Received: by 10.192.165.148 with SMTP id m20csp4609417imm; Tue, 8 May 2018 11:08:55 -0700 (PDT) X-Google-Smtp-Source: AB8JxZqXKl1zbeFrrfp7/83j+RrNwahQ1Q4zfD7SiXm+4LA/By/Ll948DZVG5kY4u3+cFkEMCY4o X-Received: by 10.98.193.3 with SMTP id i3mr3505201pfg.148.1525802935377; Tue, 08 May 2018 11:08:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525802935; cv=none; d=google.com; s=arc-20160816; b=lUTM0Hynee9gPXOByfdPLOUu2B5joz/j/erptT3rGG/5jvulXohRl44d86r8n9jiA3 bPqPn2P9jjYIFPkroVuSnuSXNAmU4TuPRtPiqqm54KidcrimjNSy1BPgP2ECsLyFkw8x dGyykRRAQJ5REu/vqb3qhFUlzcmn3sYZG74bahYKmDm59uTXN/9dR9y0wWo7WNzfz+Zd VLo8Zg888ZLNbZHx/cTHXKZy8Spl8WMgrlb4VEIOrzq1fxt4gfsCBw7A7QEbvlddOeUm PAYPhCzuIwJ7t/QLbQzJ+x/hzYQc5+ZA5fNYNS8S/6pR5z86f0K2cn8NRnq9MpwTJn42 CEXQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=jJQsHPRy64foetw7hsDq6Np1AIRLKKpSPmThYHa8P4U=; b=JEUkzoN5rfEeIeOzeL9tJEJGfda2rPlmbUliCwp14yRAuwMAV3VP6p1WY0dKKWs6zg z7h1VHHHHE+zzXNy61QAHuNZ5wYN9mc8obeqQTwcUFNrf6zx4hTN7xJI0FiNc+Y3zDhl 6hIQ9Jx4vRY/lr7SvkVDs2Rgw5ANbRlPeEz0QL1QAJ3Q5NAFerEa9dGOPEn3ZfR+veI1 WOaSIpuJtw/UKEZVC1pTRMAk1WeY7bFm2brXpY4YPwGj6uCYKJ6XFE5TnpBgmH/j4yiu nbJPcuvoxr2Zmu2sIG3cb+wVj4wKmS6BnoPz5zr5hu5Ja+NahN6Jwk5HFIv3ZpfO8fF0 Duuw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q2si18330074pfb.1.2018.05.08.11.08.40; Tue, 08 May 2018 11:08:55 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933102AbeEHSGh (ORCPT + 99 others); Tue, 8 May 2018 14:06:37 -0400 Received: from mx2.suse.de ([195.135.220.15]:54289 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933046AbeEHSGf (ORCPT ); Tue, 8 May 2018 14:06:35 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 0C391AD4A; Tue, 8 May 2018 18:06:34 +0000 (UTC) From: Mark Fasheh To: linux-fsdevel@vger.kernel.org Cc: linux-kernel@vger.kernel.org, linux-btrfs@vger.kernel.org, Mark Fasheh Subject: [PATCH 73/76] vfs: Move s_dev to to struct fs_view Date: Tue, 8 May 2018 11:04:33 -0700 Message-Id: <20180508180436.716-74-mfasheh@suse.de> X-Mailer: git-send-email 2.15.1 In-Reply-To: <20180508180436.716-1-mfasheh@suse.de> References: <20180508180436.716-1-mfasheh@suse.de> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org There are many places where a dev_t:ino_t pair are passed to userspace to uniquely describe an inode. Some file systems, like btrfs, have multiple inode namespace internally and use a separate dev_t to make the distinction between them. The kernel typically uses sb->s_dev for the inode device. Most filesystems are fine with that but btrfs needs to use the device beloning to the root which that inode resides on. By moving s_dev into the fs_view we allow btrfs and any similar filesystems to set this field on a per inode basis. This patch adds a dev_t field to struct fs_view, v_dev and removes s_dev from struct super_block. I also include a helper, inode_view() to make referencing inode->i_view fields less clunky. Signed-off-by: Mark Fasheh --- include/linux/fs.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/include/linux/fs.h b/include/linux/fs.h index 5d4bb19b2a43..c93486505084 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -1351,6 +1351,7 @@ struct sb_writers { */ struct fs_view { struct super_block *v_sb; + dev_t v_dev; /* search index; _not_ kdev_t */ }; static inline struct super_block *inode_sb(const struct inode *inode) @@ -1358,9 +1359,13 @@ static inline struct super_block *inode_sb(const struct inode *inode) return inode->i_view->v_sb; } +static inline struct fs_view *inode_view(const struct inode *inode) +{ + return inode->i_view; +} + struct super_block { struct list_head s_list; /* Keep this first */ - dev_t s_dev; /* search index; _not_ kdev_t */ unsigned char s_blocksize_bits; unsigned long s_blocksize; loff_t s_maxbytes; /* Max file size */ -- 2.15.1