diff mbox

[73/76] vfs: Move s_dev to to struct fs_view

Message ID 20180508180436.716-74-mfasheh@suse.de (mailing list archive)
State New, archived
Headers show

Commit Message

Mark Fasheh May 8, 2018, 6:04 p.m. UTC
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 <mfasheh@suse.de>
---
 include/linux/fs.h | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
diff mbox

Patch

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 */