linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC][PATCH 0/76] vfs: 'views' for filesystems with more than one root
@ 2018-05-08 18:03 Mark Fasheh
  2018-05-08 18:03 ` [PATCH 01/76] vfs: Introduce struct fs_view Mark Fasheh
                   ` (76 more replies)
  0 siblings, 77 replies; 88+ messages in thread
From: Mark Fasheh @ 2018-05-08 18:03 UTC (permalink / raw)
  To: linux-fsdevel; +Cc: linux-kernel, linux-btrfs

Hi,

The VFS's super_block covers a variety of filesystem functionality. In
particular we have a single structure representing both I/O and
namespace domains.

There are requirements to de-couple this functionality. For example,
filesystems with more than one root (such as btrfs subvolumes) can
have multiple inode namespaces. This starts to confuse userspace when
it notices multiple inodes with the same inode/device tuple on a
filesystem.

In addition, it's currently impossible for a filesystem subvolume to
have a different security context from it's parent. If we could allow
for subvolumes to optionally specify their own security context, we
could use them as containers directly instead of having to go through
an overlay.


I ran into this particular problem with respect to Btrfs some years
ago and sent out a very naive set of patches which were (rightfully)
not incorporated:

https://marc.info/?l=linux-btrfs&m=130074451403261&w=2
https://marc.info/?l=linux-btrfs&m=130532890824992&w=2

During the discussion, one question did come up - why can't
filesystems like Btrfs use a superblock per subvolume? There's a
couple of problems with that:

- It's common for a single Btrfs filesystem to have thousands of
  subvolumes. So keeping a superblock for each subvol in memory would
  get prohibively expensive - imagine having 8000 copies of struct
  super_block for a file system just because we wanted some separation
  of say, s_dev.

- Writeback would also have to walk all of these superblocks -
  again not very good for system performance.

- Anyone wanting to lock down I/O on a filesystem would have to freeze
  all the superblocks. This goes for most things related to I/O really
  - we simply can't afford to have the kernel walking thousands of
  superblocks to sync a single fs.

It's far more efficient then to pull those fields we need for a
subvolume namespace into their own structure.


The following patches attempt to fix this issue by introducing a
structure, fs_view, which can be used to represent a 'view' into a
filesystem. We can migrate super_block fields to this structure one at
a time. Struct super_block gets a default view embedded into
it. Inodes get a new field, i_view, which can be dereferenced to get
the view that an inode belgongs to. By default, we point i_view to the
view on struct super_block. That way existing filesystems don't have
to do anything different.

The patches are careful not to grow the size of struct inode.

For the first patch series, we migrate s_dev over from struct
super_block to struct fs_view. This fixes a long standing bug in how
the kernel reports inode devices to userspace.

The series follows an order:

- We first introduce the fs_view structure and embed it into struct
  super_block. As discussed, struct inode gets a pointer to the
  fs_view, i_view. The only member on fs_view at this point is a
  super_block * so that we can replace i_sb. A helper function is
  provided to get to the super_block from a struct inode.

- Convert the kernel to using our helper function to get to i_sb. This
  is done on in a per-filesystem patch. The other parts of the kernel
  referencing i_sb get their changes batched up in logical groupings.

- Move s_dev from struct super_block to struct fs_view.

- Convert the kernel from inode->i_sb->s_dev to the device from our
  fs_view. In the end, these lines will look like inode_view(inode)->v_dev.

- Add an fs_view struct to each Btrfs root, point inodes to that view
  when we initialize them.


The patches are available via git and are based off Linux
v4.16. There's two branches, with identical code.

- With the inode_sb() changeover patch broken out (as is sent here):

https://github.com/markfasheh/linux fs_view-broken-out

- With the inode_sb() changeover patch in one big change:

https://github.com/markfasheh/linux fs_view


Comments are appreciated.

Thanks,
  --Mark

^ permalink raw reply	[flat|nested] 88+ messages in thread

* [PATCH 01/76] vfs: Introduce struct fs_view
  2018-05-08 18:03 [RFC][PATCH 0/76] vfs: 'views' for filesystems with more than one root Mark Fasheh
@ 2018-05-08 18:03 ` Mark Fasheh
  2018-05-08 18:03 ` [PATCH 02/76] arch: Use inode_sb() helper instead of inode->i_sb Mark Fasheh
                   ` (75 subsequent siblings)
  76 siblings, 0 replies; 88+ messages in thread
From: Mark Fasheh @ 2018-05-08 18:03 UTC (permalink / raw)
  To: linux-fsdevel; +Cc: linux-kernel, linux-btrfs, Mark Fasheh

We want to de-couple some items from struct super_block, in particular those
that provide a 'fiew' into an fs.

Introduce a small struct, fs_view to contain these fields. This first patch
has a mostly empty fs_view. We do however, link it into the VFS:

Each super_block gets a default fs_view which is filled in via the
usual superblock intialization methods.

struct inode is updated to point to an fs_view structure via a new
'i_view' pointer, which replaces i_sb.

A filesystem can now optionally provide their own fs_view to point i_view
to.

So we don't lose our link from inode to superblock, fs_view gets
an embedded super_block pointer. A helper function, inode_sb() is
introduced to make getting the superblock from an inode less clunky.

Filesystems need no functional changes, and the only additional memory
usage here is the added pointer on struct super_block.

Signed-off-by: Mark Fasheh <mfasheh@suse.de>
---
 fs/inode.c         |  2 +-
 fs/super.c         |  1 +
 include/linux/fs.h | 21 ++++++++++++++++++++-
 3 files changed, 22 insertions(+), 2 deletions(-)

diff --git a/fs/inode.c b/fs/inode.c
index ef362364d396..4f08fdc2c60f 100644
--- a/fs/inode.c
+++ b/fs/inode.c
@@ -133,7 +133,7 @@ int inode_init_always(struct super_block *sb, struct inode *inode)
 	static const struct file_operations no_open_fops = {.open = no_open};
 	struct address_space *const mapping = &inode->i_data;
 
-	inode->i_sb = sb;
+	inode->i_view = &sb->s_view;
 	inode->i_blkbits = sb->s_blocksize_bits;
 	inode->i_flags = 0;
 	atomic_set(&inode->i_count, 1);
diff --git a/fs/super.c b/fs/super.c
index 672538ca9831..5258a57d410a 100644
--- a/fs/super.c
+++ b/fs/super.c
@@ -245,6 +245,7 @@ static struct super_block *alloc_super(struct file_system_type *type, int flags,
 	s->s_op = &default_op;
 	s->s_time_gran = 1000000000;
 	s->cleancache_poolid = CLEANCACHE_NO_POOL;
+	s->s_view.v_sb = s;
 
 	s->s_shrink.seeks = DEFAULT_SEEKS;
 	s->s_shrink.scan_objects = super_cache_scan;
diff --git a/include/linux/fs.h b/include/linux/fs.h
index c6baf767619e..4561cb9156d4 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -580,7 +580,7 @@ struct inode {
 #endif
 
 	const struct inode_operations	*i_op;
-	struct super_block	*i_sb;
+	struct fs_view		*i_view;
 	struct address_space	*i_mapping;
 
 #ifdef CONFIG_SECURITY
@@ -1340,6 +1340,24 @@ struct sb_writers {
 	struct percpu_rw_semaphore	rw_sem[SB_FREEZE_LEVELS];
 };
 
+/*
+ * "View" into a filesystem. Allows us to abstract out those
+ * superblock fields which change between the roots on a given
+ * filesystem. Most filesystems can ignore this - inodes are pointed
+ * to the default view 's_view' during initialization.
+ *
+ * A file system with multiple roots should allocate a view structure
+ * per root and point each inodes view pointer to it in iget.
+ */
+struct fs_view {
+	struct super_block	*v_sb;
+};
+
+static inline struct super_block *inode_sb(const struct inode *inode)
+{
+	return inode->i_view->v_sb;
+}
+
 struct super_block {
 	struct list_head	s_list;		/* Keep this first */
 	dev_t			s_dev;		/* search index; _not_ kdev_t */
@@ -1358,6 +1376,7 @@ struct super_block {
 	struct rw_semaphore	s_umount;
 	int			s_count;
 	atomic_t		s_active;
+	struct fs_view		s_view;		/* default view into the fs */
 #ifdef CONFIG_SECURITY
 	void                    *s_security;
 #endif
-- 
2.15.1

^ permalink raw reply related	[flat|nested] 88+ messages in thread

* [PATCH 02/76] arch: Use inode_sb() helper instead of inode->i_sb
  2018-05-08 18:03 [RFC][PATCH 0/76] vfs: 'views' for filesystems with more than one root Mark Fasheh
  2018-05-08 18:03 ` [PATCH 01/76] vfs: Introduce struct fs_view Mark Fasheh
@ 2018-05-08 18:03 ` Mark Fasheh
  2018-05-08 18:03 ` [PATCH 03/76] drivers: " Mark Fasheh
                   ` (74 subsequent siblings)
  76 siblings, 0 replies; 88+ messages in thread
From: Mark Fasheh @ 2018-05-08 18:03 UTC (permalink / raw)
  To: linux-fsdevel; +Cc: linux-kernel, linux-btrfs, Mark Fasheh

Signed-off-by: Mark Fasheh <mfasheh@suse.de>
---
 arch/arc/kernel/troubleshoot.c            | 2 +-
 arch/powerpc/platforms/cell/spufs/inode.c | 6 +++---
 arch/s390/hypfs/inode.c                   | 4 ++--
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/arch/arc/kernel/troubleshoot.c b/arch/arc/kernel/troubleshoot.c
index 6e9a0a9a6a04..18eb4984d555 100644
--- a/arch/arc/kernel/troubleshoot.c
+++ b/arch/arc/kernel/troubleshoot.c
@@ -104,7 +104,7 @@ static void show_faulting_vma(unsigned long address, char *buf)
 		if (file) {
 			nm = file_path(file, buf, PAGE_SIZE - 1);
 			inode = file_inode(vma->vm_file);
-			dev = inode->i_sb->s_dev;
+			dev = inode_sb(inode)->s_dev;
 			ino = inode->i_ino;
 		}
 		pr_info("    @off 0x%lx in [%s]\n"
diff --git a/arch/powerpc/platforms/cell/spufs/inode.c b/arch/powerpc/platforms/cell/spufs/inode.c
index db329d4bf1c3..d04460e86728 100644
--- a/arch/powerpc/platforms/cell/spufs/inode.c
+++ b/arch/powerpc/platforms/cell/spufs/inode.c
@@ -251,7 +251,7 @@ spufs_mkdir(struct inode *dir, struct dentry *dentry, unsigned int flags,
 	struct inode *inode;
 	struct spu_context *ctx;
 
-	inode = spufs_new_inode(dir->i_sb, mode | S_IFDIR);
+	inode = spufs_new_inode(inode_sb(dir), mode | S_IFDIR);
 	if (!inode)
 		return -ENOSPC;
 
@@ -284,7 +284,7 @@ spufs_mkdir(struct inode *dir, struct dentry *dentry, unsigned int flags,
 	else
 		ret = spufs_fill_dir(dentry, spufs_dir_contents, mode, ctx);
 
-	if (!ret && spufs_get_sb_info(dir->i_sb)->debug)
+	if (!ret && spufs_get_sb_info(inode_sb(dir))->debug)
 		ret = spufs_fill_dir(dentry, spufs_dir_debug_contents,
 				mode, ctx);
 
@@ -484,7 +484,7 @@ spufs_mkgang(struct inode *dir, struct dentry *dentry, umode_t mode)
 	struct spu_gang *gang;
 
 	ret = -ENOSPC;
-	inode = spufs_new_inode(dir->i_sb, mode | S_IFDIR);
+	inode = spufs_new_inode(inode_sb(dir), mode | S_IFDIR);
 	if (!inode)
 		goto out;
 
diff --git a/arch/s390/hypfs/inode.c b/arch/s390/hypfs/inode.c
index 43bbe63e2992..6a7679dcd9b7 100644
--- a/arch/s390/hypfs/inode.c
+++ b/arch/s390/hypfs/inode.c
@@ -128,7 +128,7 @@ static int hypfs_open(struct inode *inode, struct file *filp)
 			return -EACCES;
 	}
 
-	fs_info = inode->i_sb->s_fs_info;
+	fs_info = inode_sb(inode)->s_fs_info;
 	if(data) {
 		mutex_lock(&fs_info->lock);
 		filp->private_data = kstrdup(data, GFP_KERNEL);
@@ -164,7 +164,7 @@ static ssize_t hypfs_read_iter(struct kiocb *iocb, struct iov_iter *to)
 static ssize_t hypfs_write_iter(struct kiocb *iocb, struct iov_iter *from)
 {
 	int rc;
-	struct super_block *sb = file_inode(iocb->ki_filp)->i_sb;
+	struct super_block *sb = inode_sb(file_inode(iocb->ki_filp));
 	struct hypfs_sb_info *fs_info = sb->s_fs_info;
 	size_t count = iov_iter_count(from);
 
-- 
2.15.1

^ permalink raw reply related	[flat|nested] 88+ messages in thread

* [PATCH 03/76] drivers: Use inode_sb() helper instead of inode->i_sb
  2018-05-08 18:03 [RFC][PATCH 0/76] vfs: 'views' for filesystems with more than one root Mark Fasheh
  2018-05-08 18:03 ` [PATCH 01/76] vfs: Introduce struct fs_view Mark Fasheh
  2018-05-08 18:03 ` [PATCH 02/76] arch: Use inode_sb() helper instead of inode->i_sb Mark Fasheh
@ 2018-05-08 18:03 ` Mark Fasheh
  2018-05-08 18:03 ` [PATCH 04/76] fs: " Mark Fasheh
                   ` (73 subsequent siblings)
  76 siblings, 0 replies; 88+ messages in thread
From: Mark Fasheh @ 2018-05-08 18:03 UTC (permalink / raw)
  To: linux-fsdevel; +Cc: linux-kernel, linux-btrfs, Mark Fasheh

Signed-off-by: Mark Fasheh <mfasheh@suse.de>
---
 drivers/block/loop.c                               |  6 ++---
 drivers/infiniband/hw/qib/qib_fs.c                 |  2 +-
 drivers/md/md-bitmap.c                             |  2 +-
 drivers/staging/lustre/lustre/llite/dir.c          | 18 +++++++-------
 drivers/staging/lustre/lustre/llite/file.c         | 28 +++++++++++-----------
 .../staging/lustre/lustre/llite/llite_internal.h   |  6 ++---
 drivers/staging/lustre/lustre/llite/llite_lib.c    | 20 +++++++++-------
 drivers/staging/lustre/lustre/llite/llite_nfs.c    | 10 ++++----
 drivers/staging/lustre/lustre/llite/namei.c        |  8 +++----
 drivers/staging/lustre/lustre/llite/statahead.c    |  8 +++----
 drivers/staging/lustre/lustre/llite/symlink.c      |  4 ++--
 drivers/staging/lustre/lustre/llite/vvp_io.c       |  4 ++--
 drivers/staging/lustre/lustre/llite/xattr.c        |  2 +-
 drivers/staging/ncpfs/dir.c                        | 17 ++++++-------
 drivers/staging/ncpfs/file.c                       |  4 ++--
 drivers/staging/ncpfs/ioctl.c                      |  6 ++---
 drivers/staging/ncpfs/ncp_fs.h                     |  2 +-
 17 files changed, 76 insertions(+), 71 deletions(-)

diff --git a/drivers/block/loop.c b/drivers/block/loop.c
index ee62d2d517bf..1b2452b7ae09 100644
--- a/drivers/block/loop.c
+++ b/drivers/block/loop.c
@@ -173,8 +173,8 @@ static void __loop_update_dio(struct loop_device *lo, bool dio)
 	unsigned dio_align = 0;
 	bool use_dio;
 
-	if (inode->i_sb->s_bdev) {
-		sb_bsize = bdev_logical_block_size(inode->i_sb->s_bdev);
+	if (inode_sb(inode)->s_bdev) {
+		sb_bsize = bdev_logical_block_size(inode_sb(inode)->s_bdev);
 		dio_align = sb_bsize - 1;
 	}
 
@@ -821,7 +821,7 @@ static void loop_config_discard(struct loop_device *lo)
 		return;
 	}
 
-	q->limits.discard_granularity = inode->i_sb->s_blocksize;
+	q->limits.discard_granularity = inode_sb(inode)->s_blocksize;
 	q->limits.discard_alignment = 0;
 
 	blk_queue_max_discard_sectors(q, UINT_MAX >> 9);
diff --git a/drivers/infiniband/hw/qib/qib_fs.c b/drivers/infiniband/hw/qib/qib_fs.c
index 1d940a2885c9..8eab4149c7d1 100644
--- a/drivers/infiniband/hw/qib/qib_fs.c
+++ b/drivers/infiniband/hw/qib/qib_fs.c
@@ -52,7 +52,7 @@ static int qibfs_mknod(struct inode *dir, struct dentry *dentry,
 		       void *data)
 {
 	int error;
-	struct inode *inode = new_inode(dir->i_sb);
+	struct inode *inode = new_inode(inode_sb(dir));
 
 	if (!inode) {
 		error = -EPERM;
diff --git a/drivers/md/md-bitmap.c b/drivers/md/md-bitmap.c
index 239c7bb3929b..2355a7c18ecb 100644
--- a/drivers/md/md-bitmap.c
+++ b/drivers/md/md-bitmap.c
@@ -385,7 +385,7 @@ static int read_page(struct file *file, unsigned long index,
 				ret = -EINVAL;
 				goto out;
 			}
-			bh->b_bdev = inode->i_sb->s_bdev;
+			bh->b_bdev = inode_sb(inode)->s_bdev;
 			if (count < (1<<inode->i_blkbits))
 				count = 0;
 			else
diff --git a/drivers/staging/lustre/lustre/llite/dir.c b/drivers/staging/lustre/lustre/llite/dir.c
index 99b0b77c75f5..809e493b61da 100644
--- a/drivers/staging/lustre/lustre/llite/dir.c
+++ b/drivers/staging/lustre/lustre/llite/dir.c
@@ -448,7 +448,7 @@ static int ll_dir_setdirstripe(struct inode *parent, struct lmv_user_md *lump,
 			cfs_curproc_cap_pack(), 0, &request);
 	ll_finish_md_op_data(op_data);
 
-	err = ll_prep_inode(&inode, request, parent->i_sb, NULL);
+	err = ll_prep_inode(&inode, request, inode_sb(parent), NULL);
 	if (err)
 		goto err_exit;
 
@@ -470,7 +470,7 @@ int ll_dir_setstripe(struct inode *inode, struct lov_user_md *lump,
 	struct md_op_data *op_data;
 	struct ptlrpc_request *req = NULL;
 	int rc = 0;
-	struct lustre_sb_info *lsi = s2lsi(inode->i_sb);
+	struct lustre_sb_info *lsi = s2lsi(inode_sb(inode));
 	struct obd_device *mgc = lsi->lsi_mgc;
 	int lum_size;
 
@@ -544,7 +544,7 @@ int ll_dir_setstripe(struct inode *inode, struct lov_user_md *lump,
 
 		buf = param;
 		/* Get fsname and assume devname to be -MDT0000. */
-		ll_get_fsname(inode->i_sb, buf, MTI_NAME_MAXLEN);
+		ll_get_fsname(inode_sb(inode), buf, MTI_NAME_MAXLEN);
 		strcat(buf, "-MDT0000.lov");
 		buf += strlen(buf);
 
@@ -1093,7 +1093,8 @@ static long ll_dir_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
 		rc = ll_get_fid_by_name(inode, filename, namelen, NULL, NULL);
 		if (rc < 0) {
 			CERROR("%s: lookup %.*s failed: rc = %d\n",
-			       ll_get_fsname(inode->i_sb, NULL, 0), namelen,
+			       ll_get_fsname(inode_sb(inode), NULL, 0),
+			       namelen,
 			       filename, rc);
 			goto out_free;
 		}
@@ -1363,7 +1364,7 @@ static long ll_dir_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
 			struct lov_user_mds_data __user *lmdp;
 			lstat_t st = { 0 };
 
-			st.st_dev     = inode->i_sb->s_dev;
+			st.st_dev     = inode_sb(inode)->s_dev;
 			st.st_mode    = body->mbo_mode;
 			st.st_nlink   = body->mbo_nlink;
 			st.st_uid     = body->mbo_uid;
@@ -1514,7 +1515,8 @@ static long ll_dir_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
 
 			for (i = 0; i < hur->hur_request.hr_itemcount; i++) {
 				fid = &hur->hur_user_item[i].hui_fid;
-				f = search_inode_for_lustre(inode->i_sb, fid);
+				f = search_inode_for_lustre(inode_sb(inode),
+							    fid);
 				if (IS_ERR(f)) {
 					rc = PTR_ERR(f);
 					break;
@@ -1571,7 +1573,7 @@ static long ll_dir_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
 		if (IS_ERR(copy))
 			return PTR_ERR(copy);
 
-		rc = ll_ioc_copy_start(inode->i_sb, copy);
+		rc = ll_ioc_copy_start(inode_sb(inode), copy);
 		if (copy_to_user((char __user *)arg, copy, sizeof(*copy)))
 			rc = -EFAULT;
 
@@ -1586,7 +1588,7 @@ static long ll_dir_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
 		if (IS_ERR(copy))
 			return PTR_ERR(copy);
 
-		rc = ll_ioc_copy_end(inode->i_sb, copy);
+		rc = ll_ioc_copy_end(inode_sb(inode), copy);
 		if (copy_to_user((char __user *)arg, copy, sizeof(*copy)))
 			rc = -EFAULT;
 
diff --git a/drivers/staging/lustre/lustre/llite/file.c b/drivers/staging/lustre/lustre/llite/file.c
index 938b859b6650..64df47bd1118 100644
--- a/drivers/staging/lustre/lustre/llite/file.c
+++ b/drivers/staging/lustre/lustre/llite/file.c
@@ -130,7 +130,7 @@ static int ll_close_inode_openhandle(struct inode *inode,
 
 	if (!class_exp2obd(md_exp)) {
 		CERROR("%s: invalid MDC connection handle closing " DFID "\n",
-		       ll_get_fsname(inode->i_sb, NULL, 0),
+		       ll_get_fsname(inode_sb(inode), NULL, 0),
 		       PFID(&lli->lli_fid));
 		rc = 0;
 		goto out;
@@ -837,7 +837,7 @@ ll_lease_open(struct inode *inode, struct file *file, fmode_t fmode,
 	rc2 = ll_close_inode_openhandle(inode, och, 0, NULL);
 	if (rc2 < 0)
 		CERROR("%s: error closing file " DFID ": %d\n",
-		       ll_get_fsname(inode->i_sb, NULL, 0),
+		       ll_get_fsname(inode_sb(inode), NULL, 0),
 		       PFID(&ll_i2info(inode)->lli_fid), rc2);
 	och = NULL; /* och has been freed in ll_close_inode_openhandle() */
 out_release_it:
@@ -866,7 +866,7 @@ static int ll_check_swap_layouts_validity(struct inode *inode1,
 	    inode_permission(inode2, MAY_WRITE))
 		return -EPERM;
 
-	if (inode1->i_sb != inode2->i_sb)
+	if (inode_sb(inode1) != inode_sb(inode2))
 		return -EXDEV;
 
 	return 0;
@@ -880,7 +880,7 @@ static int ll_swap_layouts_close(struct obd_client_handle *och,
 	int rc;
 
 	CDEBUG(D_INODE, "%s: biased close of file " DFID "\n",
-	       ll_get_fsname(inode->i_sb, NULL, 0), PFID(fid1));
+	       ll_get_fsname(inode_sb(inode), NULL, 0), PFID(fid1));
 
 	rc = ll_check_swap_layouts_validity(inode, inode2);
 	if (rc < 0)
@@ -1016,7 +1016,7 @@ static bool file_is_noatime(const struct file *file)
 	if ((mnt->mnt_flags & MNT_NODIRATIME) && S_ISDIR(inode->i_mode))
 		return true;
 
-	if ((inode->i_sb->s_flags & SB_NODIRATIME) && S_ISDIR(inode->i_mode))
+	if ((inode_sb(inode)->s_flags & SB_NODIRATIME) && S_ISDIR(inode->i_mode))
 		return true;
 
 	return false;
@@ -1669,7 +1669,7 @@ int ll_hsm_release(struct inode *inode)
 	u16 refcheck;
 
 	CDEBUG(D_INODE, "%s: Releasing file " DFID ".\n",
-	       ll_get_fsname(inode->i_sb, NULL, 0),
+	       ll_get_fsname(inode_sb(inode), NULL, 0),
 	       PFID(&ll_i2info(inode)->lli_fid));
 
 	och = ll_lease_open(inode, NULL, FMODE_WRITE, MDS_OPEN_RELEASE);
@@ -2566,7 +2566,7 @@ int ll_get_fid_by_name(struct inode *parent, const char *name,
 		*fid = body->mbo_fid1;
 
 	if (inode)
-		rc = ll_prep_inode(inode, req, parent->i_sb, NULL);
+		rc = ll_prep_inode(inode, req, inode_sb(parent), NULL);
 out_req:
 	ptlrpc_req_finished(req);
 	return rc;
@@ -2621,7 +2621,7 @@ int ll_migrate(struct inode *parent, struct file *file, int mdtidx,
 	op_data->op_fid3 = *ll_inode2fid(child_inode);
 	if (!fid_is_sane(&op_data->op_fid3)) {
 		CERROR("%s: migrate %s, but fid " DFID " is insane\n",
-		       ll_get_fsname(parent->i_sb, NULL, 0), name,
+		       ll_get_fsname(inode_sb(parent), NULL, 0), name,
 		       PFID(&op_data->op_fid3));
 		rc = -EINVAL;
 		goto out_unlock;
@@ -2796,7 +2796,7 @@ static int ll_inode_revalidate_fini(struct inode *inode, int rc)
 	} else if (rc != 0) {
 		CDEBUG_LIMIT((rc == -EACCES || rc == -EIDRM) ? D_INFO : D_ERROR,
 			     "%s: revalidate FID " DFID " error: rc = %d\n",
-			     ll_get_fsname(inode->i_sb, NULL, 0),
+			     ll_get_fsname(inode_sb(inode), NULL, 0),
 			     PFID(ll_inode2fid(inode)), rc);
 	}
 
@@ -2967,7 +2967,7 @@ int ll_getattr(const struct path *path, struct kstat *stat,
 
 	OBD_FAIL_TIMEOUT(OBD_FAIL_GETATTR_DELAY, 30);
 
-	stat->dev = inode->i_sb->s_dev;
+	stat->dev = inode_sb(inode)->s_dev;
 	if (ll_need_32bit_api(sbi))
 		stat->ino = cl_fid_build_ino(&lli->lli_fid, 1);
 	else
@@ -3061,7 +3061,7 @@ int ll_inode_permission(struct inode *inode, int mask)
 	*/
 
 	if (is_root_inode(inode)) {
-		rc = __ll_inode_revalidate(inode->i_sb->s_root,
+		rc = __ll_inode_revalidate(inode_sb(inode)->s_root,
 					   MDS_INODELOCK_LOOKUP);
 		if (rc)
 			return rc;
@@ -3448,7 +3448,7 @@ static int ll_layout_lock_set(struct lustre_handle *lockh, enum ldlm_mode mode,
 	/* wait for IO to complete if it's still being used. */
 	if (wait_layout) {
 		CDEBUG(D_INODE, "%s: " DFID "(%p) wait for layout reconf\n",
-		       ll_get_fsname(inode->i_sb, NULL, 0),
+		       ll_get_fsname(inode_sb(inode), NULL, 0),
 		       PFID(&lli->lli_fid), inode);
 
 		memset(&conf, 0, sizeof(conf));
@@ -3460,7 +3460,7 @@ static int ll_layout_lock_set(struct lustre_handle *lockh, enum ldlm_mode mode,
 
 		CDEBUG(D_INODE,
 		       "%s: file=" DFID " waiting layout return: %d.\n",
-		       ll_get_fsname(inode->i_sb, NULL, 0),
+		       ll_get_fsname(inode_sb(inode), NULL, 0),
 		       PFID(&lli->lli_fid), rc);
 	}
 	return rc;
@@ -3506,7 +3506,7 @@ static int ll_layout_refresh_locked(struct inode *inode)
 	lockh.cookie = 0ULL;
 
 	LDLM_DEBUG_NOLOCK("%s: requeue layout lock for file " DFID "(%p)",
-			  ll_get_fsname(inode->i_sb, NULL, 0),
+			  ll_get_fsname(inode_sb(inode), NULL, 0),
 			  PFID(&lli->lli_fid), inode);
 
 	rc = md_enqueue(sbi->ll_md_exp, &einfo, NULL, &it, op_data, &lockh, 0);
diff --git a/drivers/staging/lustre/lustre/llite/llite_internal.h b/drivers/staging/lustre/lustre/llite/llite_internal.h
index f68c2e88f12b..296a546ac72d 100644
--- a/drivers/staging/lustre/lustre/llite/llite_internal.h
+++ b/drivers/staging/lustre/lustre/llite/llite_internal.h
@@ -964,17 +964,17 @@ static inline struct client_obd *sbi2mdc(struct ll_sb_info *sbi)
 /* FIXME: replace the name of this with LL_SB to conform to kernel stuff */
 static inline struct ll_sb_info *ll_i2sbi(struct inode *inode)
 {
-	return ll_s2sbi(inode->i_sb);
+	return ll_s2sbi(inode_sb(inode));
 }
 
 static inline struct obd_export *ll_i2dtexp(struct inode *inode)
 {
-	return ll_s2dtexp(inode->i_sb);
+	return ll_s2dtexp(inode_sb(inode));
 }
 
 static inline struct obd_export *ll_i2mdexp(struct inode *inode)
 {
-	return ll_s2mdexp(inode->i_sb);
+	return ll_s2mdexp(inode_sb(inode));
 }
 
 static inline struct lu_fid *ll_inode2fid(struct inode *inode)
diff --git a/drivers/staging/lustre/lustre/llite/llite_lib.c b/drivers/staging/lustre/lustre/llite/llite_lib.c
index 6735a6f006d2..6f6df27635d4 100644
--- a/drivers/staging/lustre/lustre/llite/llite_lib.c
+++ b/drivers/staging/lustre/lustre/llite/llite_lib.c
@@ -1146,7 +1146,7 @@ static int ll_init_lsm_md(struct inode *inode, struct lustre_md *md)
 			lsm->lsm_md_oinfo[i].lmo_root = inode;
 		else
 			lsm->lsm_md_oinfo[i].lmo_root =
-				ll_iget_anon_dir(inode->i_sb, fid, md);
+				ll_iget_anon_dir(inode_sb(inode), fid, md);
 		if (IS_ERR(lsm->lsm_md_oinfo[i].lmo_root)) {
 			int rc = PTR_ERR(lsm->lsm_md_oinfo[i].lmo_root);
 
@@ -1257,7 +1257,8 @@ static int ll_update_lsm_md(struct inode *inode, struct lustre_md *md)
 		int idx;
 
 		CERROR("%s: inode " DFID "(%p)'s lmv layout mismatch (%p)/(%p) magic:0x%x/0x%x stripe count: %d/%d master_mdt: %d/%d hash_type:0x%x/0x%x layout: 0x%x/0x%x pool:%s/%s\n",
-		       ll_get_fsname(inode->i_sb, NULL, 0), PFID(&lli->lli_fid),
+		       ll_get_fsname(inode_sb(inode), NULL, 0),
+		       PFID(&lli->lli_fid),
 		       inode, lsm, old_lsm,
 		       lsm->lsm_md_magic, old_lsm->lsm_md_magic,
 		       lsm->lsm_md_stripe_count,
@@ -1272,13 +1273,13 @@ static int ll_update_lsm_md(struct inode *inode, struct lustre_md *md)
 
 		for (idx = 0; idx < old_lsm->lsm_md_stripe_count; idx++) {
 			CERROR("%s: sub FIDs in old lsm idx %d, old: " DFID "\n",
-			       ll_get_fsname(inode->i_sb, NULL, 0), idx,
+			       ll_get_fsname(inode_sb(inode), NULL, 0), idx,
 			       PFID(&old_lsm->lsm_md_oinfo[idx].lmo_fid));
 		}
 
 		for (idx = 0; idx < lsm->lsm_md_stripe_count; idx++) {
 			CERROR("%s: sub FIDs in new lsm idx %d, new: " DFID "\n",
-			       ll_get_fsname(inode->i_sb, NULL, 0), idx,
+			       ll_get_fsname(inode_sb(inode), NULL, 0), idx,
 			       PFID(&lsm->lsm_md_oinfo[idx].lmo_fid));
 		}
 
@@ -1428,7 +1429,8 @@ int ll_setattr_raw(struct dentry *dentry, struct iattr *attr, bool hsm_import)
 	int rc = 0;
 
 	CDEBUG(D_VFSTRACE, "%s: setattr inode " DFID "(%p) from %llu to %llu, valid %x, hsm_import %d\n",
-	       ll_get_fsname(inode->i_sb, NULL, 0), PFID(&lli->lli_fid), inode,
+	       ll_get_fsname(inode_sb(inode), NULL, 0), PFID(&lli->lli_fid),
+	       inode,
 	       i_size_read(inode), attr->ia_size, attr->ia_valid, hsm_import);
 
 	if (attr->ia_valid & ATTR_SIZE) {
@@ -1776,7 +1778,7 @@ int ll_update_inode(struct inode *inode, struct lustre_md *md)
 		inode->i_blkbits = min(PTLRPC_MAX_BRW_BITS + 1,
 				       LL_MAX_BLKSIZE_BITS);
 	else
-		inode->i_blkbits = inode->i_sb->s_blocksize_bits;
+		inode->i_blkbits = inode_sb(inode)->s_blocksize_bits;
 	if (body->mbo_valid & OBD_MD_FLUID)
 		inode->i_uid = make_kuid(&init_user_ns, body->mbo_uid);
 	if (body->mbo_valid & OBD_MD_FLGID)
@@ -2182,7 +2184,7 @@ int ll_prep_inode(struct inode **inode, struct ptlrpc_request *req,
 	md_free_lustre_md(sbi->ll_md_exp, &md);
 cleanup:
 	if (rc != 0 && it && it->it_op & IT_OPEN)
-		ll_open_cleanup(sb ? sb : (*inode)->i_sb, req);
+		ll_open_cleanup(sb ? sb : inode_sb((*inode)), req);
 
 	return rc;
 }
@@ -2452,8 +2454,8 @@ void ll_dirty_page_discard_warn(struct page *page, int ioret)
 
 	CDEBUG(D_WARNING,
 	       "%s: dirty page discard: %s/fid: " DFID "/%s may get corrupted (rc %d)\n",
-	       ll_get_fsname(page->mapping->host->i_sb, NULL, 0),
-	       s2lsi(page->mapping->host->i_sb)->lsi_lmd->lmd_dev,
+	       ll_get_fsname(inode_sb(page->mapping->host), NULL, 0),
+	       s2lsi(inode_sb(page->mapping->host))->lsi_lmd->lmd_dev,
 	       PFID(&obj->vob_header.coh_lu.loh_fid),
 	       (path && !IS_ERR(path)) ? path : "", ioret);
 
diff --git a/drivers/staging/lustre/lustre/llite/llite_nfs.c b/drivers/staging/lustre/lustre/llite/llite_nfs.c
index a6a1d80c711a..699a5d1f3941 100644
--- a/drivers/staging/lustre/lustre/llite/llite_nfs.c
+++ b/drivers/staging/lustre/lustre/llite/llite_nfs.c
@@ -198,7 +198,7 @@ static int ll_encode_fh(struct inode *inode, __u32 *fh, int *plen,
 	struct lustre_nfs_fid *nfs_fid = (void *)fh;
 
 	CDEBUG(D_INFO, "%s: encoding for (" DFID ") maxlen=%d minlen=%d\n",
-	       ll_get_fsname(inode->i_sb, NULL, 0),
+	       ll_get_fsname(inode_sb(inode), NULL, 0),
 	       PFID(ll_inode2fid(inode)), *plen, fileid_len);
 
 	if (*plen < fileid_len) {
@@ -312,10 +312,10 @@ int ll_dir_get_parent_fid(struct inode *dir, struct lu_fid *parent_fid)
 
 	LASSERT(dir && S_ISDIR(dir->i_mode));
 
-	sbi = ll_s2sbi(dir->i_sb);
+	sbi = ll_s2sbi(inode_sb(dir));
 
 	CDEBUG(D_INFO, "%s: getting parent for (" DFID ")\n",
-	       ll_get_fsname(dir->i_sb, NULL, 0),
+	       ll_get_fsname(inode_sb(dir), NULL, 0),
 	       PFID(ll_inode2fid(dir)));
 
 	rc = ll_get_default_mdsize(sbi, &lmmsize);
@@ -332,7 +332,7 @@ int ll_dir_get_parent_fid(struct inode *dir, struct lu_fid *parent_fid)
 	ll_finish_md_op_data(op_data);
 	if (rc) {
 		CERROR("%s: failure inode " DFID " get parent: rc = %d\n",
-		       ll_get_fsname(dir->i_sb, NULL, 0),
+		       ll_get_fsname(inode_sb(dir), NULL, 0),
 		       PFID(ll_inode2fid(dir)), rc);
 		return rc;
 	}
@@ -361,7 +361,7 @@ static struct dentry *ll_get_parent(struct dentry *dchild)
 	if (rc)
 		return ERR_PTR(rc);
 
-	dentry = ll_iget_for_nfs(dchild->d_inode->i_sb, &parent_fid, NULL);
+	dentry = ll_iget_for_nfs(inode_sb(dchild->d_inode), &parent_fid, NULL);
 
 	return dentry;
 }
diff --git a/drivers/staging/lustre/lustre/llite/namei.c b/drivers/staging/lustre/lustre/llite/namei.c
index a2687f46a16d..35296a363db5 100644
--- a/drivers/staging/lustre/lustre/llite/namei.c
+++ b/drivers/staging/lustre/lustre/llite/namei.c
@@ -326,7 +326,7 @@ int ll_md_blocking_ast(struct ldlm_lock *lock, struct ldlm_lock_desc *desc,
 				 * ->ilookup5()), because master inode state is
 				 *  NEW.
 				 */
-				master_inode = ilookup5_nowait(inode->i_sb,
+				master_inode = ilookup5_nowait(inode_sb(inode),
 							       hash,
 							       ll_test_inode_by_fid,
 							       (void *)&lli->lli_pfid);
@@ -340,7 +340,7 @@ int ll_md_blocking_ast(struct ldlm_lock *lock, struct ldlm_lock_desc *desc,
 		}
 
 		if ((bits & (MDS_INODELOCK_LOOKUP | MDS_INODELOCK_PERM)) &&
-		    inode->i_sb->s_root &&
+		    inode_sb(inode)->s_root &&
 		    !is_root_inode(inode))
 			ll_invalidate_aliases(inode);
 
@@ -782,7 +782,7 @@ static struct inode *ll_create_node(struct inode *dir, struct lookup_intent *it)
 	LASSERT(it_disposition(it, DISP_ENQ_CREATE_REF));
 	request = it->it_request;
 	it_clear_disposition(it, DISP_ENQ_CREATE_REF);
-	rc = ll_prep_inode(&inode, request, dir->i_sb, it);
+	rc = ll_prep_inode(&inode, request, inode_sb(dir), it);
 	if (rc) {
 		inode = ERR_PTR(rc);
 		goto out;
@@ -925,7 +925,7 @@ static int ll_new_node(struct inode *dir, struct dentry *dentry,
 
 	ll_update_times(request, dir);
 
-	err = ll_prep_inode(&inode, request, dir->i_sb, NULL);
+	err = ll_prep_inode(&inode, request, inode_sb(dir), NULL);
 	if (err)
 		goto err_exit;
 
diff --git a/drivers/staging/lustre/lustre/llite/statahead.c b/drivers/staging/lustre/lustre/llite/statahead.c
index 90c7324575e4..8245da36cfab 100644
--- a/drivers/staging/lustre/lustre/llite/statahead.c
+++ b/drivers/staging/lustre/lustre/llite/statahead.c
@@ -586,12 +586,12 @@ static void sa_instantiate(struct ll_statahead_info *sai,
 		goto out;
 	}
 
-	rc = ll_prep_inode(&child, req, dir->i_sb, it);
+	rc = ll_prep_inode(&child, req, inode_sb(dir), it);
 	if (rc)
 		goto out;
 
 	CDEBUG(D_READA, "%s: setting %.*s" DFID " l_data to inode %p\n",
-	       ll_get_fsname(child->i_sb, NULL, 0),
+	       ll_get_fsname(inode_sb(child), NULL, 0),
 	       entry->se_qstr.len, entry->se_qstr.name,
 	       PFID(ll_inode2fid(child)), child);
 	ll_set_lock_data(ll_i2sbi(dir)->ll_md_exp, child, it, NULL);
@@ -1277,7 +1277,7 @@ static int is_first_dirent(struct inode *dir, struct dentry *dentry)
 
 			rc = PTR_ERR(page);
 			CERROR("%s: error reading dir " DFID " at %llu: opendir_pid = %u : rc = %d\n",
-			       ll_get_fsname(dir->i_sb, NULL, 0),
+			       ll_get_fsname(inode_sb(dir), NULL, 0),
 			       PFID(ll_inode2fid(dir)), pos,
 			       lli->lli_opendir_pid, rc);
 			break;
@@ -1474,7 +1474,7 @@ static int revalidate_statahead_dentry(struct inode *dir,
 				/* revalidate, but inode is recreated */
 				CDEBUG(D_READA,
 				       "%s: stale dentry %pd inode " DFID ", statahead inode " DFID "\n",
-				       ll_get_fsname((*dentryp)->d_inode->i_sb,
+				       ll_get_fsname(inode_sb((*dentryp)->d_inode),
 						     NULL, 0),
 				       *dentryp,
 				       PFID(ll_inode2fid((*dentryp)->d_inode)),
diff --git a/drivers/staging/lustre/lustre/llite/symlink.c b/drivers/staging/lustre/lustre/llite/symlink.c
index 0690fdbf49f5..caebe4f16dab 100644
--- a/drivers/staging/lustre/lustre/llite/symlink.c
+++ b/drivers/staging/lustre/lustre/llite/symlink.c
@@ -74,7 +74,7 @@ static int ll_readlink_internal(struct inode *inode,
 	if (rc) {
 		if (rc != -ENOENT)
 			CERROR("%s: inode " DFID ": rc = %d\n",
-			       ll_get_fsname(inode->i_sb, NULL, 0),
+			       ll_get_fsname(inode_sb(inode), NULL, 0),
 			       PFID(ll_inode2fid(inode)), rc);
 		goto failed;
 	}
@@ -89,7 +89,7 @@ static int ll_readlink_internal(struct inode *inode,
 	LASSERT(symlen != 0);
 	if (body->mbo_eadatasize != symlen) {
 		CERROR("%s: inode " DFID ": symlink length %d not expected %d\n",
-		       ll_get_fsname(inode->i_sb, NULL, 0),
+		       ll_get_fsname(inode_sb(inode), NULL, 0),
 		       PFID(ll_inode2fid(inode)), body->mbo_eadatasize - 1,
 		       symlen - 1);
 		rc = -EPROTO;
diff --git a/drivers/staging/lustre/lustre/llite/vvp_io.c b/drivers/staging/lustre/lustre/llite/vvp_io.c
index e7a4778e02e4..3262a297e310 100644
--- a/drivers/staging/lustre/lustre/llite/vvp_io.c
+++ b/drivers/staging/lustre/lustre/llite/vvp_io.c
@@ -951,7 +951,7 @@ static int vvp_io_write_start(const struct lu_env *env,
 	if (pos + cnt > ll_file_maxbytes(inode)) {
 		CDEBUG(D_INODE,
 		       "%s: file " DFID " offset %llu > maxbytes %llu\n",
-		       ll_get_fsname(inode->i_sb, NULL, 0),
+		       ll_get_fsname(inode_sb(inode), NULL, 0),
 		       PFID(ll_inode2fid(inode)), pos + cnt,
 		       ll_file_maxbytes(inode));
 		return -EFBIG;
@@ -1366,7 +1366,7 @@ int vvp_io_init(const struct lu_env *env, struct cl_object *obj,
 			result = 0;
 		if (result < 0)
 			CERROR("%s: refresh file layout " DFID " error %d.\n",
-			       ll_get_fsname(inode->i_sb, NULL, 0),
+			       ll_get_fsname(inode_sb(inode), NULL, 0),
 			       PFID(lu_object_fid(&obj->co_lu)), result);
 	}
 
diff --git a/drivers/staging/lustre/lustre/llite/xattr.c b/drivers/staging/lustre/lustre/llite/xattr.c
index 532384c91447..2e4becc5b3c6 100644
--- a/drivers/staging/lustre/lustre/llite/xattr.c
+++ b/drivers/staging/lustre/lustre/llite/xattr.c
@@ -352,7 +352,7 @@ ll_xattr_list(struct inode *inode, const char *name, int type, void *buffer,
 	if (rc == -EOPNOTSUPP && type == XATTR_USER_T) {
 		LCONSOLE_INFO(
 			"%s: disabling user_xattr feature because it is not supported on the server: rc = %d\n",
-			ll_get_fsname(inode->i_sb, NULL, 0), rc);
+			ll_get_fsname(inode_sb(inode), NULL, 0), rc);
 		sbi->ll_flags &= ~LL_SBI_USER_XATTR;
 	}
 out:
diff --git a/drivers/staging/ncpfs/dir.c b/drivers/staging/ncpfs/dir.c
index 0c57c5c5d40a..10be63953509 100644
--- a/drivers/staging/ncpfs/dir.c
+++ b/drivers/staging/ncpfs/dir.c
@@ -160,7 +160,8 @@ ncp_compare_dentry(const struct dentry *dentry,
 	if (ncp_case_sensitive(pinode))
 		return strncmp(str, name->name, len);
 
-	return ncp_strnicmp(NCP_IO_TABLE(pinode->i_sb), str, name->name, len);
+	return ncp_strnicmp(NCP_IO_TABLE(inode_sb(pinode)), str, name->name,
+			    len);
 }
 
 /*
@@ -616,8 +617,8 @@ ncp_fill_cache(struct file *file, struct dir_context *ctx,
 		struct inode *inode;
 
 		entry->opened = 0;
-		entry->ino = iunique(dir->i_sb, 2);
-		inode = ncp_iget(dir->i_sb, entry);
+		entry->ino = iunique(inode_sb(dir), 2);
+		inode = ncp_iget(inode_sb(dir), entry);
 		if (inode) {
 			d_instantiate(newdent, inode);
 			if (!hashed)
@@ -664,7 +665,7 @@ ncp_fill_cache(struct file *file, struct dir_context *ctx,
 		ctl.valid = 0;
 	if (!ctl.filled && (ctl.fpos == ctx->pos)) {
 		if (!ino)
-			ino = iunique(dir->i_sb, 2);
+			ino = iunique(inode_sb(dir), 2);
 		ctl.filled = !dir_emit(ctx, qname.name, qname.len,
 				     ino, DT_UNKNOWN);
 		if (!ctl.filled)
@@ -857,10 +858,10 @@ static struct dentry *ncp_lookup(struct inode *dir, struct dentry *dentry, unsig
 	 * Create an inode for the entry.
 	 */
 	finfo.opened = 0;
-	finfo.ino = iunique(dir->i_sb, 2);
+	finfo.ino = iunique(inode_sb(dir), 2);
 	finfo.volume = finfo.i.volNumber;
 	error = -EACCES;
-	inode = ncp_iget(dir->i_sb, &finfo);
+	inode = ncp_iget(inode_sb(dir), &finfo);
 
 	if (inode) {
 		ncp_new_dentry(dentry);
@@ -883,8 +884,8 @@ static int ncp_instantiate(struct inode *dir, struct dentry *dentry,
 	struct inode *inode;
 	int error = -EINVAL;
 
-	finfo->ino = iunique(dir->i_sb, 2);
-	inode = ncp_iget(dir->i_sb, finfo);
+	finfo->ino = iunique(inode_sb(dir), 2);
+	inode = ncp_iget(inode_sb(dir), finfo);
 	if (!inode)
 		goto out_close;
 	d_instantiate(dentry,inode);
diff --git a/drivers/staging/ncpfs/file.c b/drivers/staging/ncpfs/file.c
index 8f8cc0334ddd..ecb525a92656 100644
--- a/drivers/staging/ncpfs/file.c
+++ b/drivers/staging/ncpfs/file.c
@@ -114,9 +114,9 @@ ncp_file_read_iter(struct kiocb *iocb, struct iov_iter *to)
 
 	if (!iov_iter_count(to))
 		return 0;
-	if (pos > inode->i_sb->s_maxbytes)
+	if (pos > inode_sb(inode)->s_maxbytes)
 		return 0;
-	iov_iter_truncate(to, inode->i_sb->s_maxbytes - pos);
+	iov_iter_truncate(to, inode_sb(inode)->s_maxbytes - pos);
 
 	error = ncp_make_open(inode, O_RDONLY);
 	if (error) {
diff --git a/drivers/staging/ncpfs/ioctl.c b/drivers/staging/ncpfs/ioctl.c
index d378b98cd7b6..6be6eae9e0db 100644
--- a/drivers/staging/ncpfs/ioctl.c
+++ b/drivers/staging/ncpfs/ioctl.c
@@ -325,7 +325,7 @@ static long __ncp_ioctl(struct inode *inode, unsigned int cmd, unsigned long arg
 		if (server->root_setuped)
 			result = -EBUSY;
 		else {
-			result = ncp_conn_logged_in(inode->i_sb);
+			result = ncp_conn_logged_in(inode_sb(inode));
 			if (result == 0)
 				server->root_setuped = 1;
 		}
@@ -375,7 +375,7 @@ static long __ncp_ioctl(struct inode *inode, unsigned int cmd, unsigned long arg
 			result = -EACCES;
 			mutex_lock(&server->root_setup_lock);
 			if (server->m.mounted_vol[0]) {
-				struct dentry* dentry = inode->i_sb->s_root;
+				struct dentry* dentry = inode_sb(inode)->s_root;
 
 				if (dentry) {
 					struct inode* s_inode = d_inode(dentry);
@@ -431,7 +431,7 @@ static long __ncp_ioctl(struct inode *inode, unsigned int cmd, unsigned long arg
 					result = 0;
 
 				if (result == 0) {
-					dentry = inode->i_sb->s_root;
+					dentry = inode_sb(inode)->s_root;
 					if (dentry) {
 						struct inode* s_inode = d_inode(dentry);
 
diff --git a/drivers/staging/ncpfs/ncp_fs.h b/drivers/staging/ncpfs/ncp_fs.h
index bdd262b6c198..534d2cad978c 100644
--- a/drivers/staging/ncpfs/ncp_fs.h
+++ b/drivers/staging/ncpfs/ncp_fs.h
@@ -46,7 +46,7 @@ static inline struct ncp_server *NCP_SBP(const struct super_block *sb)
 	return sb->s_fs_info;
 }
 
-#define NCP_SERVER(inode)	NCP_SBP((inode)->i_sb)
+#define NCP_SERVER(inode)	NCP_SBP(inode_sb((inode)))
 static inline struct ncp_inode_info *NCP_FINFO(const struct inode *inode)
 {
 	return container_of(inode, struct ncp_inode_info, vfs_inode);
-- 
2.15.1

^ permalink raw reply related	[flat|nested] 88+ messages in thread

* [PATCH 04/76] fs: Use inode_sb() helper instead of inode->i_sb
  2018-05-08 18:03 [RFC][PATCH 0/76] vfs: 'views' for filesystems with more than one root Mark Fasheh
                   ` (2 preceding siblings ...)
  2018-05-08 18:03 ` [PATCH 03/76] drivers: " Mark Fasheh
@ 2018-05-08 18:03 ` Mark Fasheh
  2018-05-08 18:03 ` [PATCH 05/76] include: " Mark Fasheh
                   ` (72 subsequent siblings)
  76 siblings, 0 replies; 88+ messages in thread
From: Mark Fasheh @ 2018-05-08 18:03 UTC (permalink / raw)
  To: linux-fsdevel; +Cc: linux-kernel, linux-btrfs, Mark Fasheh

Signed-off-by: Mark Fasheh <mfasheh@suse.de>
---
 fs/aio.c             |  6 ++--
 fs/attr.c            | 12 +++----
 fs/binfmt_misc.c     |  6 ++--
 fs/block_dev.c       |  2 +-
 fs/cachefiles/rdwr.c |  4 +--
 fs/dcache.c          |  8 ++---
 fs/direct-io.c       |  8 ++---
 fs/eventpoll.c       |  2 +-
 fs/fs-writeback.c    | 30 ++++++++--------
 fs/inode.c           | 96 +++++++++++++++++++++++++++-------------------------
 fs/ioctl.c           |  8 ++---
 fs/iomap.c           |  7 ++--
 fs/libfs.c           |  2 +-
 fs/locks.c           | 15 ++++----
 fs/namei.c           | 14 ++++----
 fs/namespace.c       |  6 ++--
 fs/open.c            |  6 ++--
 fs/pipe.c            |  6 ++--
 fs/posix_acl.c       |  2 +-
 fs/stat.c            |  2 +-
 fs/xattr.c           |  2 +-
 21 files changed, 125 insertions(+), 119 deletions(-)

diff --git a/fs/aio.c b/fs/aio.c
index 6bcd3fb5265a..bd2a187ca6d1 100644
--- a/fs/aio.c
+++ b/fs/aio.c
@@ -1115,7 +1115,8 @@ static void aio_complete(struct kiocb *kiocb, long res, long res2)
 		 * thread.
 		 */
 		if (S_ISREG(file_inode(file)->i_mode))
-			__sb_writers_acquired(file_inode(file)->i_sb, SB_FREEZE_WRITE);
+			__sb_writers_acquired(inode_sb(file_inode(file)),
+					      SB_FREEZE_WRITE);
 		file_end_write(file);
 	}
 
@@ -1546,7 +1547,8 @@ static ssize_t aio_write(struct kiocb *req, struct iocb *iocb, bool vectored,
 		 * complain about held lock when we return to userspace.
 		 */
 		if (S_ISREG(file_inode(file)->i_mode))
-			__sb_writers_release(file_inode(file)->i_sb, SB_FREEZE_WRITE);
+			__sb_writers_release(inode_sb(file_inode(file)),
+					     SB_FREEZE_WRITE);
 	}
 	kfree(iovec);
 	return ret;
diff --git a/fs/attr.c b/fs/attr.c
index 12ffdb6fb63c..456c082fe636 100644
--- a/fs/attr.c
+++ b/fs/attr.c
@@ -119,7 +119,7 @@ int inode_newsize_ok(const struct inode *inode, loff_t offset)
 		limit = rlimit(RLIMIT_FSIZE);
 		if (limit != RLIM_INFINITY && offset > limit)
 			goto out_sig;
-		if (offset > inode->i_sb->s_maxbytes)
+		if (offset > inode_sb(inode)->s_maxbytes)
 			goto out_big;
 	} else {
 		/*
@@ -164,13 +164,13 @@ void setattr_copy(struct inode *inode, const struct iattr *attr)
 		inode->i_gid = attr->ia_gid;
 	if (ia_valid & ATTR_ATIME)
 		inode->i_atime = timespec_trunc(attr->ia_atime,
-						inode->i_sb->s_time_gran);
+						inode_sb(inode)->s_time_gran);
 	if (ia_valid & ATTR_MTIME)
 		inode->i_mtime = timespec_trunc(attr->ia_mtime,
-						inode->i_sb->s_time_gran);
+						inode_sb(inode)->s_time_gran);
 	if (ia_valid & ATTR_CTIME)
 		inode->i_ctime = timespec_trunc(attr->ia_ctime,
-						inode->i_sb->s_time_gran);
+						inode_sb(inode)->s_time_gran);
 	if (ia_valid & ATTR_MODE) {
 		umode_t mode = attr->ia_mode;
 
@@ -288,10 +288,10 @@ int notify_change(struct dentry * dentry, struct iattr * attr, struct inode **de
 	 * namespace of the superblock.
 	 */
 	if (ia_valid & ATTR_UID &&
-	    !kuid_has_mapping(inode->i_sb->s_user_ns, attr->ia_uid))
+	    !kuid_has_mapping(inode_sb(inode)->s_user_ns, attr->ia_uid))
 		return -EOVERFLOW;
 	if (ia_valid & ATTR_GID &&
-	    !kgid_has_mapping(inode->i_sb->s_user_ns, attr->ia_gid))
+	    !kgid_has_mapping(inode_sb(inode)->s_user_ns, attr->ia_gid))
 		return -EOVERFLOW;
 
 	/* Don't allow modifications of files with invalid uids or
diff --git a/fs/binfmt_misc.c b/fs/binfmt_misc.c
index a7c5a9861bef..c5f84bf4506b 100644
--- a/fs/binfmt_misc.c
+++ b/fs/binfmt_misc.c
@@ -657,7 +657,7 @@ static ssize_t bm_entry_write(struct file *file, const char __user *buffer,
 		break;
 	case 3:
 		/* Delete this handler. */
-		root = file_inode(file)->i_sb->s_root;
+		root = inode_sb(file_inode(file))->s_root;
 		inode_lock(d_inode(root));
 
 		if (!list_empty(&e->list))
@@ -685,7 +685,7 @@ static ssize_t bm_register_write(struct file *file, const char __user *buffer,
 {
 	Node *e;
 	struct inode *inode;
-	struct super_block *sb = file_inode(file)->i_sb;
+	struct super_block *sb = inode_sb(file_inode(file));
 	struct dentry *root = sb->s_root, *dentry;
 	int err = 0;
 
@@ -786,7 +786,7 @@ static ssize_t bm_status_write(struct file *file, const char __user *buffer,
 		break;
 	case 3:
 		/* Delete all handlers. */
-		root = file_inode(file)->i_sb->s_root;
+		root = inode_sb(file_inode(file))->s_root;
 		inode_lock(d_inode(root));
 
 		while (!list_empty(&entries))
diff --git a/fs/block_dev.c b/fs/block_dev.c
index fe09ef9c21f3..c9e00024b89d 100644
--- a/fs/block_dev.c
+++ b/fs/block_dev.c
@@ -973,7 +973,7 @@ void bd_forget(struct inode *inode)
 	struct block_device *bdev = NULL;
 
 	spin_lock(&bdev_lock);
-	if (!sb_is_blkdev_sb(inode->i_sb))
+	if (!sb_is_blkdev_sb(inode_sb(inode)))
 		bdev = inode->i_bdev;
 	inode->i_bdev = NULL;
 	inode->i_mapping = &inode->i_data;
diff --git a/fs/cachefiles/rdwr.c b/fs/cachefiles/rdwr.c
index 883bc7bb12c5..807fabb9310b 100644
--- a/fs/cachefiles/rdwr.c
+++ b/fs/cachefiles/rdwr.c
@@ -413,7 +413,7 @@ int cachefiles_read_or_alloc_page(struct fscache_retrieval *op,
 	ASSERT(inode->i_mapping->a_ops->readpages);
 
 	/* calculate the shift required to use bmap */
-	shift = PAGE_SHIFT - inode->i_sb->s_blocksize_bits;
+	shift = PAGE_SHIFT - inode_sb(inode)->s_blocksize_bits;
 
 	op->op.flags &= FSCACHE_OP_KEEP_FLAGS;
 	op->op.flags |= FSCACHE_OP_ASYNC;
@@ -706,7 +706,7 @@ int cachefiles_read_or_alloc_pages(struct fscache_retrieval *op,
 	ASSERT(inode->i_mapping->a_ops->readpages);
 
 	/* calculate the shift required to use bmap */
-	shift = PAGE_SHIFT - inode->i_sb->s_blocksize_bits;
+	shift = PAGE_SHIFT - inode_sb(inode)->s_blocksize_bits;
 
 	pagevec_init(&pagevec);
 
diff --git a/fs/dcache.c b/fs/dcache.c
index 8945e6cabd93..98ac784e6045 100644
--- a/fs/dcache.c
+++ b/fs/dcache.c
@@ -1897,7 +1897,7 @@ struct dentry *d_make_root(struct inode *root_inode)
 	struct dentry *res = NULL;
 
 	if (root_inode) {
-		res = d_alloc_anon(root_inode->i_sb);
+		res = d_alloc_anon(inode_sb(root_inode));
 		if (res)
 			d_instantiate(res, root_inode);
 		else
@@ -1996,7 +1996,7 @@ static struct dentry *__d_obtain_alias(struct inode *inode, bool disconnected)
 	if (res)
 		goto out_iput;
 
-	tmp = d_alloc_anon(inode->i_sb);
+	tmp = d_alloc_anon(inode_sb(inode));
 	if (!tmp) {
 		res = ERR_PTR(-ENOMEM);
 		goto out_iput;
@@ -3038,8 +3038,8 @@ struct dentry *d_splice_alias(struct inode *inode, struct dentry *dentry)
 					"VFS: Lookup of '%s' in %s %s"
 					" would have caused loop\n",
 					dentry->d_name.name,
-					inode->i_sb->s_type->name,
-					inode->i_sb->s_id);
+					inode_sb(inode)->s_type->name,
+					inode_sb(inode)->s_id);
 			} else if (!IS_ROOT(new)) {
 				int err = __d_unalias(inode, dentry, new);
 				write_sequnlock(&rename_lock);
diff --git a/fs/direct-io.c b/fs/direct-io.c
index 1357ef563893..1f3f224555d3 100644
--- a/fs/direct-io.c
+++ b/fs/direct-io.c
@@ -378,7 +378,7 @@ static void dio_bio_end_aio(struct bio *bio)
 					    dio->inode->i_mapping->nrpages);
 		if (defer_completion) {
 			INIT_WORK(&dio->complete_work, dio_aio_complete_work);
-			queue_work(dio->inode->i_sb->s_dio_done_wq,
+			queue_work(inode_sb(dio->inode)->s_dio_done_wq,
 				   &dio->complete_work);
 		} else {
 			dio_complete(dio, 0, DIO_COMPLETE_ASYNC);
@@ -638,7 +638,7 @@ int sb_init_dio_done_wq(struct super_block *sb)
 
 static int dio_set_defer_completion(struct dio *dio)
 {
-	struct super_block *sb = dio->inode->i_sb;
+	struct super_block *sb = inode_sb(dio->inode);
 
 	if (dio->defer_completion)
 		return 0;
@@ -1276,13 +1276,13 @@ do_blockdev_direct_IO(struct kiocb *iocb, struct inode *inode,
 		retval = 0;
 		if (iocb->ki_flags & IOCB_DSYNC)
 			retval = dio_set_defer_completion(dio);
-		else if (!dio->inode->i_sb->s_dio_done_wq) {
+		else if (!inode_sb(dio->inode)->s_dio_done_wq) {
 			/*
 			 * In case of AIO write racing with buffered read we
 			 * need to defer completion. We can't decide this now,
 			 * however the workqueue needs to be initialized here.
 			 */
-			retval = sb_init_dio_done_wq(dio->inode->i_sb);
+			retval = sb_init_dio_done_wq(inode_sb(dio->inode));
 		}
 		if (retval) {
 			/*
diff --git a/fs/eventpoll.c b/fs/eventpoll.c
index 0f3494ed3ed0..a7e3dbc83bbc 100644
--- a/fs/eventpoll.c
+++ b/fs/eventpoll.c
@@ -955,7 +955,7 @@ static void ep_show_fdinfo(struct seq_file *m, struct file *f)
 			   epi->ffd.fd, epi->event.events,
 			   (long long)epi->event.data,
 			   (long long)epi->ffd.file->f_pos,
-			   inode->i_ino, inode->i_sb->s_dev);
+			   inode->i_ino, inode_sb(inode)->s_dev);
 		if (seq_has_overflowed(m))
 			break;
 	}
diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c
index d4d04fee568a..f8496f3651a1 100644
--- a/fs/fs-writeback.c
+++ b/fs/fs-writeback.c
@@ -490,7 +490,7 @@ static void inode_switch_wbs(struct inode *inode, int new_wb_id)
 
 	/* while holding I_WB_SWITCH, no one else can update the association */
 	spin_lock(&inode->i_lock);
-	if (!(inode->i_sb->s_flags & SB_ACTIVE) ||
+	if (!(inode_sb(inode)->s_flags & SB_ACTIVE) ||
 	    inode->i_state & (I_WB_SWITCH | I_FREEING) ||
 	    inode_to_wb(inode) == isw->new_wb) {
 		spin_unlock(&inode->i_lock);
@@ -1002,7 +1002,7 @@ void inode_io_list_del(struct inode *inode)
  */
 void sb_mark_inode_writeback(struct inode *inode)
 {
-	struct super_block *sb = inode->i_sb;
+	struct super_block *sb = inode_sb(inode);
 	unsigned long flags;
 
 	if (list_empty(&inode->i_wb_list)) {
@@ -1020,7 +1020,7 @@ void sb_mark_inode_writeback(struct inode *inode)
  */
 void sb_clear_inode_writeback(struct inode *inode)
 {
-	struct super_block *sb = inode->i_sb;
+	struct super_block *sb = inode_sb(inode);
 	unsigned long flags;
 
 	if (!list_empty(&inode->i_wb_list)) {
@@ -1122,11 +1122,11 @@ static int move_expired_inodes(struct list_head *delaying_queue,
 		moved++;
 		if (flags & EXPIRE_DIRTY_ATIME)
 			set_bit(__I_DIRTY_TIME_EXPIRED, &inode->i_state);
-		if (sb_is_blkdev_sb(inode->i_sb))
+		if (sb_is_blkdev_sb(inode_sb(inode)))
 			continue;
-		if (sb && sb != inode->i_sb)
+		if (sb && sb != inode_sb(inode))
 			do_sb_sort = 1;
-		sb = inode->i_sb;
+		sb = inode_sb(inode);
 	}
 
 	/* just one sb in list, splice to dispatch_queue and we're done */
@@ -1137,10 +1137,10 @@ static int move_expired_inodes(struct list_head *delaying_queue,
 
 	/* Move inodes from one superblock together */
 	while (!list_empty(&tmp)) {
-		sb = wb_inode(tmp.prev)->i_sb;
+		sb = inode_sb(wb_inode(tmp.prev));
 		list_for_each_prev_safe(pos, node, &tmp) {
 			inode = wb_inode(pos);
-			if (inode->i_sb == sb)
+			if (inode_sb(inode) == sb)
 				list_move(&inode->i_io_list, dispatch_queue);
 		}
 	}
@@ -1177,9 +1177,9 @@ static int write_inode(struct inode *inode, struct writeback_control *wbc)
 {
 	int ret;
 
-	if (inode->i_sb->s_op->write_inode && !is_bad_inode(inode)) {
+	if (inode_sb(inode)->s_op->write_inode && !is_bad_inode(inode)) {
 		trace_writeback_write_inode_start(inode, wbc);
-		ret = inode->i_sb->s_op->write_inode(inode, wbc);
+		ret = inode_sb(inode)->s_op->write_inode(inode, wbc);
 		trace_writeback_write_inode(inode, wbc);
 		return ret;
 	}
@@ -1513,7 +1513,7 @@ static long writeback_sb_inodes(struct super_block *sb,
 		struct inode *inode = wb_inode(wb->b_io.prev);
 		struct bdi_writeback *tmp_wb;
 
-		if (inode->i_sb != sb) {
+		if (inode_sb(inode) != sb) {
 			if (work->sb) {
 				/*
 				 * We only want to write back data for this
@@ -1641,7 +1641,7 @@ static long __writeback_inodes_wb(struct bdi_writeback *wb,
 
 	while (!list_empty(&wb->b_io)) {
 		struct inode *inode = wb_inode(wb->b_io.prev);
-		struct super_block *sb = inode->i_sb;
+		struct super_block *sb = inode_sb(inode);
 
 		if (!trylock_super(sb)) {
 			/*
@@ -2064,7 +2064,7 @@ int dirtytime_interval_handler(struct ctl_table *table, int write,
 
 static noinline void block_dump___mark_inode_dirty(struct inode *inode)
 {
-	if (inode->i_ino || strcmp(inode->i_sb->s_id, "bdev")) {
+	if (inode->i_ino || strcmp(inode_sb(inode)->s_id, "bdev")) {
 		struct dentry *dentry;
 		const char *name = "?";
 
@@ -2076,7 +2076,7 @@ static noinline void block_dump___mark_inode_dirty(struct inode *inode)
 		printk(KERN_DEBUG
 		       "%s(%d): dirtied inode %lu (%s) on %s\n",
 		       current->comm, task_pid_nr(current), inode->i_ino,
-		       name, inode->i_sb->s_id);
+		       name, inode_sb(inode)->s_id);
 		if (dentry) {
 			spin_unlock(&dentry->d_lock);
 			dput(dentry);
@@ -2113,7 +2113,7 @@ static noinline void block_dump___mark_inode_dirty(struct inode *inode)
 void __mark_inode_dirty(struct inode *inode, int flags)
 {
 #define I_DIRTY_INODE (I_DIRTY_SYNC | I_DIRTY_DATASYNC)
-	struct super_block *sb = inode->i_sb;
+	struct super_block *sb = inode_sb(inode);
 	int dirtytime;
 
 	trace_writeback_mark_inode_dirty(inode, flags);
diff --git a/fs/inode.c b/fs/inode.c
index 4f08fdc2c60f..034b3528cd9d 100644
--- a/fs/inode.c
+++ b/fs/inode.c
@@ -28,9 +28,9 @@
  * inode->i_lock protects:
  *   inode->i_state, inode->i_hash, __iget()
  * Inode LRU list locks protect:
- *   inode->i_sb->s_inode_lru, inode->i_lru
- * inode->i_sb->s_inode_list_lock protects:
- *   inode->i_sb->s_inodes, inode->i_sb_list
+ *   inode_sb(inode)->s_inode_lru, inode->i_lru
+ * inode_sb(inode)->s_inode_list_lock protects:
+ *   inode_sb(inode)->s_inodes, inode->i_sb_list
  * bdi->wb.list_lock protects:
  *   bdi->wb.b_{dirty,io,more_io,dirty_time}, inode->i_io_list
  * inode_hash_lock protects:
@@ -38,7 +38,7 @@
  *
  * Lock ordering:
  *
- * inode->i_sb->s_inode_list_lock
+ * inode_sb(inode)->s_inode_list_lock
  *   inode->i_lock
  *     Inode LRU list locks
  *
@@ -46,7 +46,7 @@
  *   inode->i_lock
  *
  * inode_hash_lock
- *   inode->i_sb->s_inode_list_lock
+ *   inode_sb(inode)->s_inode_list_lock
  *   inode->i_lock
  *
  * iunique_lock
@@ -214,10 +214,10 @@ static struct inode *alloc_inode(struct super_block *sb)
 		return NULL;
 
 	if (unlikely(inode_init_always(sb, inode))) {
-		if (inode->i_sb->s_op->destroy_inode)
-			inode->i_sb->s_op->destroy_inode(inode);
-		else
-			kmem_cache_free(inode_cachep, inode);
+		if (inode_sb(inode)->s_op->destroy_inode)
+			inode_sb(inode)->s_op->destroy_inode(inode);
+			else
+				kmem_cache_free(inode_cachep, inode);
 		return NULL;
 	}
 
@@ -238,8 +238,8 @@ void __destroy_inode(struct inode *inode)
 	fsnotify_inode_delete(inode);
 	locks_free_lock_context(inode);
 	if (!inode->i_nlink) {
-		WARN_ON(atomic_long_read(&inode->i_sb->s_remove_count) == 0);
-		atomic_long_dec(&inode->i_sb->s_remove_count);
+		WARN_ON(atomic_long_read(&inode_sb(inode)->s_remove_count) == 0);
+		atomic_long_dec(&inode_sb(inode)->s_remove_count);
 	}
 
 #ifdef CONFIG_FS_POSIX_ACL
@@ -262,10 +262,10 @@ static void destroy_inode(struct inode *inode)
 {
 	BUG_ON(!list_empty(&inode->i_lru));
 	__destroy_inode(inode);
-	if (inode->i_sb->s_op->destroy_inode)
-		inode->i_sb->s_op->destroy_inode(inode);
-	else
-		call_rcu(&inode->i_rcu, i_callback);
+	if (inode_sb(inode)->s_op->destroy_inode)
+		inode_sb(inode)->s_op->destroy_inode(inode);
+		else
+			call_rcu(&inode->i_rcu, i_callback);
 }
 
 /**
@@ -284,7 +284,7 @@ void drop_nlink(struct inode *inode)
 	WARN_ON(inode->i_nlink == 0);
 	inode->__i_nlink--;
 	if (!inode->i_nlink)
-		atomic_long_inc(&inode->i_sb->s_remove_count);
+		atomic_long_inc(&inode_sb(inode)->s_remove_count);
 }
 EXPORT_SYMBOL(drop_nlink);
 
@@ -300,7 +300,7 @@ void clear_nlink(struct inode *inode)
 {
 	if (inode->i_nlink) {
 		inode->__i_nlink = 0;
-		atomic_long_inc(&inode->i_sb->s_remove_count);
+		atomic_long_inc(&inode_sb(inode)->s_remove_count);
 	}
 }
 EXPORT_SYMBOL(clear_nlink);
@@ -320,7 +320,7 @@ void set_nlink(struct inode *inode, unsigned int nlink)
 	} else {
 		/* Yes, some filesystems do change nlink from zero to one */
 		if (inode->i_nlink == 0)
-			atomic_long_dec(&inode->i_sb->s_remove_count);
+			atomic_long_dec(&inode_sb(inode)->s_remove_count);
 
 		inode->__i_nlink = nlink;
 	}
@@ -339,7 +339,7 @@ void inc_nlink(struct inode *inode)
 {
 	if (unlikely(inode->i_nlink == 0)) {
 		WARN_ON(!(inode->i_state & I_LINKABLE));
-		atomic_long_dec(&inode->i_sb->s_remove_count);
+		atomic_long_dec(&inode_sb(inode)->s_remove_count);
 	}
 
 	inode->__i_nlink++;
@@ -402,7 +402,7 @@ EXPORT_SYMBOL(ihold);
 
 static void inode_lru_list_add(struct inode *inode)
 {
-	if (list_lru_add(&inode->i_sb->s_inode_lru, &inode->i_lru))
+	if (list_lru_add(&inode_sb(inode)->s_inode_lru, &inode->i_lru))
 		this_cpu_inc(nr_unused);
 	else
 		inode->i_state |= I_REFERENCED;
@@ -417,7 +417,7 @@ void inode_add_lru(struct inode *inode)
 {
 	if (!(inode->i_state & (I_DIRTY_ALL | I_SYNC |
 				I_FREEING | I_WILL_FREE)) &&
-	    !atomic_read(&inode->i_count) && inode->i_sb->s_flags & SB_ACTIVE)
+	    !atomic_read(&inode->i_count) && inode_sb(inode)->s_flags & SB_ACTIVE)
 		inode_lru_list_add(inode);
 }
 
@@ -425,7 +425,7 @@ void inode_add_lru(struct inode *inode)
 static void inode_lru_list_del(struct inode *inode)
 {
 
-	if (list_lru_del(&inode->i_sb->s_inode_lru, &inode->i_lru))
+	if (list_lru_del(&inode_sb(inode)->s_inode_lru, &inode->i_lru))
 		this_cpu_dec(nr_unused);
 }
 
@@ -435,18 +435,18 @@ static void inode_lru_list_del(struct inode *inode)
  */
 void inode_sb_list_add(struct inode *inode)
 {
-	spin_lock(&inode->i_sb->s_inode_list_lock);
-	list_add(&inode->i_sb_list, &inode->i_sb->s_inodes);
-	spin_unlock(&inode->i_sb->s_inode_list_lock);
+	spin_lock(&inode_sb(inode)->s_inode_list_lock);
+	list_add(&inode->i_sb_list, &inode_sb(inode)->s_inodes);
+	spin_unlock(&inode_sb(inode)->s_inode_list_lock);
 }
 EXPORT_SYMBOL_GPL(inode_sb_list_add);
 
 static inline void inode_sb_list_del(struct inode *inode)
 {
 	if (!list_empty(&inode->i_sb_list)) {
-		spin_lock(&inode->i_sb->s_inode_list_lock);
+		spin_lock(&inode_sb(inode)->s_inode_list_lock);
 		list_del_init(&inode->i_sb_list);
-		spin_unlock(&inode->i_sb->s_inode_list_lock);
+		spin_unlock(&inode_sb(inode)->s_inode_list_lock);
 	}
 }
 
@@ -470,7 +470,8 @@ static unsigned long hash(struct super_block *sb, unsigned long hashval)
  */
 void __insert_inode_hash(struct inode *inode, unsigned long hashval)
 {
-	struct hlist_head *b = inode_hashtable + hash(inode->i_sb, hashval);
+	struct hlist_head *b = inode_hashtable + hash(inode_sb(inode),
+						      hashval);
 
 	spin_lock(&inode_hash_lock);
 	spin_lock(&inode->i_lock);
@@ -531,7 +532,7 @@ EXPORT_SYMBOL(clear_inode);
  */
 static void evict(struct inode *inode)
 {
-	const struct super_operations *op = inode->i_sb->s_op;
+	const struct super_operations *op = inode_sb(inode)->s_op;
 
 	BUG_ON(!(inode->i_state & I_FREEING));
 	BUG_ON(!list_empty(&inode->i_lru));
@@ -790,7 +791,7 @@ static struct inode *find_inode(struct super_block *sb,
 
 repeat:
 	hlist_for_each_entry(inode, head, i_hash) {
-		if (inode->i_sb != sb)
+		if (inode_sb(inode) != sb)
 			continue;
 		if (!test(inode, data))
 			continue;
@@ -819,7 +820,7 @@ static struct inode *find_inode_fast(struct super_block *sb,
 	hlist_for_each_entry(inode, head, i_hash) {
 		if (inode->i_ino != ino)
 			continue;
-		if (inode->i_sb != sb)
+		if (inode_sb(inode) != sb)
 			continue;
 		spin_lock(&inode->i_lock);
 		if (inode->i_state & (I_FREEING|I_WILL_FREE)) {
@@ -927,7 +928,7 @@ EXPORT_SYMBOL(new_inode);
 void lockdep_annotate_inode_mutex_key(struct inode *inode)
 {
 	if (S_ISDIR(inode->i_mode)) {
-		struct file_system_type *type = inode->i_sb->s_type;
+		struct file_system_type *type = inode_sb(inode)->s_type;
 
 		/* Set new key only if filesystem hasn't already changed it */
 		if (lockdep_match_class(&inode->i_rwsem, &type->i_mutex_key)) {
@@ -1169,7 +1170,7 @@ static int test_inode_iunique(struct super_block *sb, unsigned long ino)
 
 	spin_lock(&inode_hash_lock);
 	hlist_for_each_entry(inode, b, i_hash) {
-		if (inode->i_ino == ino && inode->i_sb == sb) {
+		if (inode->i_ino == ino && inode_sb(inode) == sb) {
 			spin_unlock(&inode_hash_lock);
 			return 0;
 		}
@@ -1362,7 +1363,7 @@ struct inode *find_inode_nowait(struct super_block *sb,
 
 	spin_lock(&inode_hash_lock);
 	hlist_for_each_entry(inode, head, i_hash) {
-		if (inode->i_sb != sb)
+		if (inode_sb(inode) != sb)
 			continue;
 		mval = match(inode, hashval, data);
 		if (mval == 0)
@@ -1379,7 +1380,7 @@ EXPORT_SYMBOL(find_inode_nowait);
 
 int insert_inode_locked(struct inode *inode)
 {
-	struct super_block *sb = inode->i_sb;
+	struct super_block *sb = inode_sb(inode);
 	ino_t ino = inode->i_ino;
 	struct hlist_head *head = inode_hashtable + hash(sb, ino);
 
@@ -1389,7 +1390,7 @@ int insert_inode_locked(struct inode *inode)
 		hlist_for_each_entry(old, head, i_hash) {
 			if (old->i_ino != ino)
 				continue;
-			if (old->i_sb != sb)
+			if (inode_sb(old) != sb)
 				continue;
 			spin_lock(&old->i_lock);
 			if (old->i_state & (I_FREEING|I_WILL_FREE)) {
@@ -1422,7 +1423,7 @@ EXPORT_SYMBOL(insert_inode_locked);
 int insert_inode_locked4(struct inode *inode, unsigned long hashval,
 		int (*test)(struct inode *, void *), void *data)
 {
-	struct super_block *sb = inode->i_sb;
+	struct super_block *sb = inode_sb(inode);
 	struct hlist_head *head = inode_hashtable + hash(sb, hashval);
 
 	while (1) {
@@ -1430,7 +1431,7 @@ int insert_inode_locked4(struct inode *inode, unsigned long hashval,
 
 		spin_lock(&inode_hash_lock);
 		hlist_for_each_entry(old, head, i_hash) {
-			if (old->i_sb != sb)
+			if (inode_sb(old) != sb)
 				continue;
 			if (!test(old, data))
 				continue;
@@ -1481,8 +1482,8 @@ EXPORT_SYMBOL(generic_delete_inode);
  */
 static void iput_final(struct inode *inode)
 {
-	struct super_block *sb = inode->i_sb;
-	const struct super_operations *op = inode->i_sb->s_op;
+	struct super_block *sb = inode_sb(inode);
+	const struct super_operations *op = inode_sb(inode)->s_op;
 	int drop;
 
 	WARN_ON(inode->i_state & I_NEW);
@@ -1645,7 +1646,7 @@ int generic_update_time(struct inode *inode, struct timespec *time, int flags)
 	if (flags & S_MTIME)
 		inode->i_mtime = *time;
 	if ((flags & (S_ATIME | S_CTIME | S_MTIME)) &&
-	    !(inode->i_sb->s_flags & SB_LAZYTIME))
+	    !(inode_sb(inode)->s_flags & SB_LAZYTIME))
 		dirty = true;
 
 	if (dirty)
@@ -1695,7 +1696,7 @@ bool __atime_needs_update(const struct path *path, struct inode *inode,
 
 	if (IS_NOATIME(inode))
 		return false;
-	if ((inode->i_sb->s_flags & SB_NODIRATIME) && S_ISDIR(inode->i_mode))
+	if ((inode_sb(inode)->s_flags & SB_NODIRATIME) && S_ISDIR(inode->i_mode))
 		return false;
 
 	if (mnt->mnt_flags & MNT_NOATIME)
@@ -1723,7 +1724,7 @@ void touch_atime(const struct path *path)
 	if (!__atime_needs_update(path, inode, false))
 		return;
 
-	if (!sb_start_write_trylock(inode->i_sb))
+	if (!sb_start_write_trylock(inode_sb(inode)))
 		return;
 
 	if (__mnt_want_write(mnt) != 0)
@@ -1741,7 +1742,7 @@ void touch_atime(const struct path *path)
 	update_time(inode, &now, S_ATIME);
 	__mnt_drop_write(mnt);
 skip_update:
-	sb_end_write(inode->i_sb);
+	sb_end_write(inode_sb(inode));
 }
 EXPORT_SYMBOL(touch_atime);
 
@@ -1992,7 +1993,8 @@ void init_special_inode(struct inode *inode, umode_t mode, dev_t rdev)
 		;	/* leave it no_open_fops */
 	else
 		printk(KERN_DEBUG "init_special_inode: bogus i_mode (%o) for"
-				  " inode %s:%lu\n", mode, inode->i_sb->s_id,
+				  " inode %s:%lu\n", mode,
+				  inode_sb(inode)->s_id,
 				  inode->i_ino);
 }
 EXPORT_SYMBOL(init_special_inode);
@@ -2121,11 +2123,11 @@ struct timespec current_time(struct inode *inode)
 {
 	struct timespec now = current_kernel_time();
 
-	if (unlikely(!inode->i_sb)) {
+	if (unlikely(!inode_sb(inode))) {
 		WARN(1, "current_time() called with uninitialized super_block in the inode");
 		return now;
 	}
 
-	return timespec_trunc(now, inode->i_sb->s_time_gran);
+	return timespec_trunc(now, inode_sb(inode)->s_time_gran);
 }
 EXPORT_SYMBOL(current_time);
diff --git a/fs/ioctl.c b/fs/ioctl.c
index 5ace7efb0d04..37990af8e3ad 100644
--- a/fs/ioctl.c
+++ b/fs/ioctl.c
@@ -179,7 +179,7 @@ static int ioctl_fiemap(struct file *filp, unsigned long arg)
 	struct fiemap __user *ufiemap = (struct fiemap __user *) arg;
 	struct fiemap_extent_info fieinfo = { 0, };
 	struct inode *inode = file_inode(filp);
-	struct super_block *sb = inode->i_sb;
+	struct super_block *sb = inode_sb(inode);
 	u64 len;
 	int error;
 
@@ -547,7 +547,7 @@ static int ioctl_fioasync(unsigned int fd, struct file *filp,
 
 static int ioctl_fsfreeze(struct file *filp)
 {
-	struct super_block *sb = file_inode(filp)->i_sb;
+	struct super_block *sb = inode_sb(file_inode(filp));
 
 	if (!capable(CAP_SYS_ADMIN))
 		return -EPERM;
@@ -564,7 +564,7 @@ static int ioctl_fsfreeze(struct file *filp)
 
 static int ioctl_fsthaw(struct file *filp)
 {
-	struct super_block *sb = file_inode(filp)->i_sb;
+	struct super_block *sb = inode_sb(file_inode(filp));
 
 	if (!capable(CAP_SYS_ADMIN))
 		return -EPERM;
@@ -668,7 +668,7 @@ int do_vfs_ioctl(struct file *filp, unsigned int fd, unsigned int cmd,
 		return ioctl_fiemap(filp, arg);
 
 	case FIGETBSZ:
-		return put_user(inode->i_sb->s_blocksize, argp);
+		return put_user(inode_sb(inode)->s_blocksize, argp);
 
 	case FICLONE:
 		return ioctl_file_clone(filp, arg, 0, 0, 0);
diff --git a/fs/iomap.c b/fs/iomap.c
index afd163586aa0..2c6a327f0223 100644
--- a/fs/iomap.c
+++ b/fs/iomap.c
@@ -806,7 +806,8 @@ static void iomap_dio_bio_end_io(struct bio *bio)
 			struct inode *inode = file_inode(dio->iocb->ki_filp);
 
 			INIT_WORK(&dio->aio.work, iomap_dio_complete_work);
-			queue_work(inode->i_sb->s_dio_done_wq, &dio->aio.work);
+			queue_work(inode_sb(inode)->s_dio_done_wq,
+				   &dio->aio.work);
 		} else {
 			iomap_dio_complete_work(&dio->aio.work);
 		}
@@ -1034,8 +1035,8 @@ iomap_dio_rw(struct kiocb *iocb, struct iov_iter *iter,
 	ret = 0;
 
 	if (iov_iter_rw(iter) == WRITE && !is_sync_kiocb(iocb) &&
-	    !inode->i_sb->s_dio_done_wq) {
-		ret = sb_init_dio_done_wq(inode->i_sb);
+	    !inode_sb(inode)->s_dio_done_wq) {
+		ret = sb_init_dio_done_wq(inode_sb(inode));
 		if (ret < 0)
 			goto out_free_dio;
 	}
diff --git a/fs/libfs.c b/fs/libfs.c
index 7ff3cb904acd..775eb447a68b 100644
--- a/fs/libfs.c
+++ b/fs/libfs.c
@@ -1018,7 +1018,7 @@ int generic_file_fsync(struct file *file, loff_t start, loff_t end,
 	err = __generic_file_fsync(file, start, end, datasync);
 	if (err)
 		return err;
-	return blkdev_issue_flush(inode->i_sb->s_bdev, GFP_KERNEL, NULL);
+	return blkdev_issue_flush(inode_sb(inode)->s_bdev, GFP_KERNEL, NULL);
 }
 EXPORT_SYMBOL(generic_file_fsync);
 
diff --git a/fs/locks.c b/fs/locks.c
index d6ff4beb70ce..2a86a18c0523 100644
--- a/fs/locks.c
+++ b/fs/locks.c
@@ -263,7 +263,8 @@ locks_check_ctx_lists(struct inode *inode)
 		     !list_empty(&ctx->flc_posix) ||
 		     !list_empty(&ctx->flc_lease))) {
 		pr_warn("Leaked locks on dev=0x%x:0x%x ino=0x%lx:\n",
-			MAJOR(inode->i_sb->s_dev), MINOR(inode->i_sb->s_dev),
+			MAJOR(inode_sb(inode)->s_dev),
+			MINOR(inode_sb(inode)->s_dev),
 			inode->i_ino);
 		locks_dump_ctx_list(&ctx->flc_flock, "FLOCK");
 		locks_dump_ctx_list(&ctx->flc_posix, "POSIX");
@@ -282,8 +283,8 @@ locks_check_ctx_file_list(struct file *filp, struct list_head *list,
 		if (fl->fl_file == filp)
 			pr_warn("Leaked %s lock on dev=0x%x:0x%x ino=0x%lx "
 				" fl_owner=%p fl_flags=0x%x fl_type=0x%x fl_pid=%u\n",
-				list_type, MAJOR(inode->i_sb->s_dev),
-				MINOR(inode->i_sb->s_dev), inode->i_ino,
+				list_type, MAJOR(inode_sb(inode)->s_dev),
+				MINOR(inode_sb(inode)->s_dev), inode->i_ino,
 				fl->fl_owner, fl->fl_flags, fl->fl_type, fl->fl_pid);
 }
 
@@ -2622,7 +2623,7 @@ static void lock_get_status(struct seq_file *f, struct file_lock *fl,
 {
 	struct inode *inode = NULL;
 	unsigned int fl_pid;
-	struct pid_namespace *proc_pidns = file_inode(f->file)->i_sb->s_fs_info;
+	struct pid_namespace *proc_pidns = inode_sb(file_inode(f->file))->s_fs_info;
 
 	fl_pid = locks_translate_pid(fl, proc_pidns);
 	/*
@@ -2683,8 +2684,8 @@ static void lock_get_status(struct seq_file *f, struct file_lock *fl,
 	if (inode) {
 		/* userspace relies on this representation of dev_t */
 		seq_printf(f, "%d %02x:%02x:%ld ", fl_pid,
-				MAJOR(inode->i_sb->s_dev),
-				MINOR(inode->i_sb->s_dev), inode->i_ino);
+				MAJOR(inode_sb(inode)->s_dev),
+				MINOR(inode_sb(inode)->s_dev), inode->i_ino);
 	} else {
 		seq_printf(f, "%d <none>:0 ", fl_pid);
 	}
@@ -2702,7 +2703,7 @@ static int locks_show(struct seq_file *f, void *v)
 {
 	struct locks_iterator *iter = f->private;
 	struct file_lock *fl, *bfl;
-	struct pid_namespace *proc_pidns = file_inode(f->file)->i_sb->s_fs_info;
+	struct pid_namespace *proc_pidns = inode_sb(file_inode(f->file))->s_fs_info;
 
 	fl = hlist_entry(v, struct file_lock, fl_link);
 
diff --git a/fs/namei.c b/fs/namei.c
index cafa365eeb70..03ba6b32aeb7 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -425,7 +425,7 @@ int inode_permission(struct inode *inode, int mask)
 {
 	int retval;
 
-	retval = sb_permission(inode->i_sb, inode, mask);
+	retval = sb_permission(inode_sb(inode), inode, mask);
 	if (retval)
 		return retval;
 
@@ -2805,7 +2805,7 @@ static inline int may_create(struct inode *dir, struct dentry *child)
 		return -EEXIST;
 	if (IS_DEADDIR(dir))
 		return -ENOENT;
-	s_user_ns = dir->i_sb->s_user_ns;
+	s_user_ns = inode_sb(dir)->s_user_ns;
 	if (!kuid_has_mapping(s_user_ns, current_fsuid()) ||
 	    !kgid_has_mapping(s_user_ns, current_fsgid()))
 		return -EOVERFLOW;
@@ -3781,7 +3781,7 @@ SYSCALL_DEFINE3(mknod, const char __user *, filename, umode_t, mode, unsigned, d
 int vfs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode)
 {
 	int error = may_create(dir, dentry);
-	unsigned max_links = dir->i_sb->s_max_links;
+	unsigned max_links = inode_sb(dir)->s_max_links;
 
 	if (error)
 		return error;
@@ -4167,7 +4167,7 @@ SYSCALL_DEFINE2(symlink, const char __user *, oldname, const char __user *, newn
 int vfs_link(struct dentry *old_dentry, struct inode *dir, struct dentry *new_dentry, struct inode **delegated_inode)
 {
 	struct inode *inode = old_dentry->d_inode;
-	unsigned max_links = dir->i_sb->s_max_links;
+	unsigned max_links = inode_sb(dir)->s_max_links;
 	int error;
 
 	if (!inode)
@@ -4177,7 +4177,7 @@ int vfs_link(struct dentry *old_dentry, struct inode *dir, struct dentry *new_de
 	if (error)
 		return error;
 
-	if (dir->i_sb != inode->i_sb)
+	if (inode_sb(dir) != inode_sb(inode))
 		return -EXDEV;
 
 	/*
@@ -4363,7 +4363,7 @@ int vfs_rename(struct inode *old_dir, struct dentry *old_dentry,
 	struct inode *source = old_dentry->d_inode;
 	struct inode *target = new_dentry->d_inode;
 	bool new_is_dir = false;
-	unsigned max_links = new_dir->i_sb->s_max_links;
+	unsigned max_links = inode_sb(new_dir)->s_max_links;
 	struct name_snapshot old_name;
 
 	if (source == target)
@@ -4453,7 +4453,7 @@ int vfs_rename(struct inode *old_dir, struct dentry *old_dentry,
 		dont_mount(new_dentry);
 		detach_mounts(new_dentry);
 	}
-	if (!(old_dir->i_sb->s_type->fs_flags & FS_RENAME_DOES_D_MOVE)) {
+	if (!(inode_sb(old_dir)->s_type->fs_flags & FS_RENAME_DOES_D_MOVE)) {
 		if (!(flags & RENAME_EXCHANGE))
 			d_move(old_dentry, new_dentry);
 		else
diff --git a/fs/namespace.c b/fs/namespace.c
index 9d1374ab6e06..e26da6ef673e 100644
--- a/fs/namespace.c
+++ b/fs/namespace.c
@@ -494,10 +494,10 @@ int mnt_want_write_file(struct file *file)
 
 	ret = may_write_real(file);
 	if (!ret) {
-		sb_start_write(file_inode(file)->i_sb);
+		sb_start_write(inode_sb(file_inode(file)));
 		ret = __mnt_want_write_file(file);
 		if (ret)
-			sb_end_write(file_inode(file)->i_sb);
+			sb_end_write(inode_sb(file_inode(file)));
 	}
 	return ret;
 }
@@ -546,7 +546,7 @@ void mnt_drop_write_file_path(struct file *file)
 void mnt_drop_write_file(struct file *file)
 {
 	__mnt_drop_write(file->f_path.mnt);
-	sb_end_write(file_inode(file)->i_sb);
+	sb_end_write(inode_sb(file_inode(file)));
 }
 EXPORT_SYMBOL(mnt_drop_write_file);
 
diff --git a/fs/open.c b/fs/open.c
index 7ea118471dce..a24e3564050a 100644
--- a/fs/open.c
+++ b/fs/open.c
@@ -197,13 +197,13 @@ static long do_sys_ftruncate(unsigned int fd, loff_t length, int small)
 	if (IS_APPEND(file_inode(f.file)))
 		goto out_putf;
 
-	sb_start_write(inode->i_sb);
+	sb_start_write(inode_sb(inode));
 	error = locks_verify_truncate(inode, f.file, length);
 	if (!error)
 		error = security_path_truncate(&f.file->f_path);
 	if (!error)
 		error = do_truncate(dentry, length, ATTR_MTIME|ATTR_CTIME, f.file);
-	sb_end_write(inode->i_sb);
+	sb_end_write(inode_sb(inode));
 out_putf:
 	fdput(f);
 out:
@@ -309,7 +309,7 @@ int vfs_fallocate(struct file *file, int mode, loff_t offset, loff_t len)
 		return -ENODEV;
 
 	/* Check for wrap through zero too */
-	if (((offset + len) > inode->i_sb->s_maxbytes) || ((offset + len) < 0))
+	if (((offset + len) > inode_sb(inode)->s_maxbytes) || ((offset + len) < 0))
 		return -EFBIG;
 
 	if (!file->f_op->fallocate)
diff --git a/fs/pipe.c b/fs/pipe.c
index 7b1954caf388..f8fd756cc817 100644
--- a/fs/pipe.c
+++ b/fs/pipe.c
@@ -477,11 +477,11 @@ pipe_write(struct kiocb *iocb, struct iov_iter *from)
 		wake_up_interruptible_sync_poll(&pipe->wait, EPOLLIN | EPOLLRDNORM);
 		kill_fasync(&pipe->fasync_readers, SIGIO, POLL_IN);
 	}
-	if (ret > 0 && sb_start_write_trylock(file_inode(filp)->i_sb)) {
+	if (ret > 0 && sb_start_write_trylock(inode_sb(file_inode(filp)))) {
 		int err = file_update_time(filp);
 		if (err)
 			ret = err;
-		sb_end_write(file_inode(filp)->i_sb);
+		sb_end_write(inode_sb(file_inode(filp)));
 	}
 	return ret;
 }
@@ -888,7 +888,7 @@ static void wake_up_partner(struct pipe_inode_info *pipe)
 static int fifo_open(struct inode *inode, struct file *filp)
 {
 	struct pipe_inode_info *pipe;
-	bool is_pipe = inode->i_sb->s_magic == PIPEFS_MAGIC;
+	bool is_pipe = inode_sb(inode)->s_magic == PIPEFS_MAGIC;
 	int ret;
 
 	filp->f_version = 0;
diff --git a/fs/posix_acl.c b/fs/posix_acl.c
index 2fd0fde16fe1..cf485df47d36 100644
--- a/fs/posix_acl.c
+++ b/fs/posix_acl.c
@@ -867,7 +867,7 @@ set_posix_acl(struct inode *inode, int type, struct posix_acl *acl)
 		return -EPERM;
 
 	if (acl) {
-		int ret = posix_acl_valid(inode->i_sb->s_user_ns, acl);
+		int ret = posix_acl_valid(inode_sb(inode)->s_user_ns, acl);
 		if (ret)
 			return ret;
 	}
diff --git a/fs/stat.c b/fs/stat.c
index 873785dae022..178b81d4359e 100644
--- a/fs/stat.c
+++ b/fs/stat.c
@@ -32,7 +32,7 @@
  */
 void generic_fillattr(struct inode *inode, struct kstat *stat)
 {
-	stat->dev = inode->i_sb->s_dev;
+	stat->dev = inode_sb(inode)->s_dev;
 	stat->ino = inode->i_ino;
 	stat->mode = inode->i_mode;
 	stat->nlink = inode->i_nlink;
diff --git a/fs/xattr.c b/fs/xattr.c
index 61cd28ba25f3..ac81607672ee 100644
--- a/fs/xattr.c
+++ b/fs/xattr.c
@@ -53,7 +53,7 @@ strcmp_prefix(const char *a, const char *a_prefix)
 static const struct xattr_handler *
 xattr_resolve_name(struct inode *inode, const char **name)
 {
-	const struct xattr_handler **handlers = inode->i_sb->s_xattr;
+	const struct xattr_handler **handlers = inode_sb(inode)->s_xattr;
 	const struct xattr_handler *handler;
 
 	if (!(inode->i_opflags & IOP_XATTR)) {
-- 
2.15.1

^ permalink raw reply related	[flat|nested] 88+ messages in thread

* [PATCH 05/76] include: Use inode_sb() helper instead of inode->i_sb
  2018-05-08 18:03 [RFC][PATCH 0/76] vfs: 'views' for filesystems with more than one root Mark Fasheh
                   ` (3 preceding siblings ...)
  2018-05-08 18:03 ` [PATCH 04/76] fs: " Mark Fasheh
@ 2018-05-08 18:03 ` Mark Fasheh
  2018-05-08 18:03 ` [PATCH 06/76] ipc: " Mark Fasheh
                   ` (71 subsequent siblings)
  76 siblings, 0 replies; 88+ messages in thread
From: Mark Fasheh @ 2018-05-08 18:03 UTC (permalink / raw)
  To: linux-fsdevel; +Cc: linux-kernel, linux-btrfs, Mark Fasheh

Signed-off-by: Mark Fasheh <mfasheh@suse.de>
---
 include/linux/backing-dev.h      |   4 +-
 include/linux/cleancache.h       |   2 +-
 include/linux/fs.h               |  29 +++++-----
 include/linux/fscrypt_supp.h     |   4 +-
 include/linux/hugetlb.h          |   2 +-
 include/linux/nfs_fs.h           |   2 +-
 include/trace/events/btrfs.h     |  10 ++--
 include/trace/events/ext4.h      | 118 +++++++++++++++++++--------------------
 include/trace/events/f2fs.h      |  52 ++++++++---------
 include/trace/events/filelock.h  |   8 +--
 include/trace/events/filemap.h   |  12 ++--
 include/trace/events/fs_dax.h    |  14 ++---
 include/trace/events/jbd2.h      |   2 +-
 include/trace/events/writeback.h |   2 +-
 include/uapi/linux/iso_fs.h      |   4 +-
 15 files changed, 134 insertions(+), 131 deletions(-)

diff --git a/include/linux/backing-dev.h b/include/linux/backing-dev.h
index 3e4ce54d84ab..0fb241c9324a 100644
--- a/include/linux/backing-dev.h
+++ b/include/linux/backing-dev.h
@@ -157,7 +157,7 @@ static inline struct backing_dev_info *inode_to_bdi(struct inode *inode)
 	if (!inode)
 		return &noop_backing_dev_info;
 
-	sb = inode->i_sb;
+	sb = inode_sb(inode);
 #ifdef CONFIG_BLOCK
 	if (sb_is_blkdev_sb(sb))
 		return I_BDEV(inode)->bd_bdi;
@@ -251,7 +251,7 @@ static inline bool inode_cgwb_enabled(struct inode *inode)
 		cgroup_subsys_on_dfl(io_cgrp_subsys) &&
 		bdi_cap_account_dirty(bdi) &&
 		(bdi->capabilities & BDI_CAP_CGROUP_WRITEBACK) &&
-		(inode->i_sb->s_iflags & SB_I_CGROUPWB);
+		(inode_sb(inode)->s_iflags & SB_I_CGROUPWB);
 }
 
 /**
diff --git a/include/linux/cleancache.h b/include/linux/cleancache.h
index 5f5730c1d324..74f89782f70e 100644
--- a/include/linux/cleancache.h
+++ b/include/linux/cleancache.h
@@ -51,7 +51,7 @@ extern void __cleancache_invalidate_fs(struct super_block *);
 #define cleancache_enabled (1)
 static inline bool cleancache_fs_enabled_mapping(struct address_space *mapping)
 {
-	return mapping->host->i_sb->cleancache_poolid >= 0;
+	return inode_sb(mapping->host)->cleancache_poolid >= 0;
 }
 static inline bool cleancache_fs_enabled(struct page *page)
 {
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 4561cb9156d4..5d4bb19b2a43 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -1475,22 +1475,22 @@ struct super_block {
  */
 static inline uid_t i_uid_read(const struct inode *inode)
 {
-	return from_kuid(inode->i_sb->s_user_ns, inode->i_uid);
+	return from_kuid(inode_sb(inode)->s_user_ns, inode->i_uid);
 }
 
 static inline gid_t i_gid_read(const struct inode *inode)
 {
-	return from_kgid(inode->i_sb->s_user_ns, inode->i_gid);
+	return from_kgid(inode_sb(inode)->s_user_ns, inode->i_gid);
 }
 
 static inline void i_uid_write(struct inode *inode, uid_t uid)
 {
-	inode->i_uid = make_kuid(inode->i_sb->s_user_ns, uid);
+	inode->i_uid = make_kuid(inode_sb(inode)->s_user_ns, uid);
 }
 
 static inline void i_gid_write(struct inode *inode, gid_t gid)
 {
-	inode->i_gid = make_kgid(inode->i_sb->s_user_ns, gid);
+	inode->i_gid = make_kgid(inode_sb(inode)->s_user_ns, gid);
 }
 
 extern struct timespec current_time(struct inode *inode);
@@ -1899,10 +1899,10 @@ struct super_operations {
  * i_flags updated.  Hence, i_flags no longer inherit the superblock mount
  * flags, so these have to be checked separately. -- rmk@arm.uk.linux.org
  */
-#define __IS_FLG(inode, flg)	((inode)->i_sb->s_flags & (flg))
+#define __IS_FLG(inode, flg)	(inode_sb((inode))->s_flags & (flg))
 
 static inline bool sb_rdonly(const struct super_block *sb) { return sb->s_flags & SB_RDONLY; }
-#define IS_RDONLY(inode)	sb_rdonly((inode)->i_sb)
+#define IS_RDONLY(inode)	sb_rdonly(inode_sb((inode)))
 #define IS_SYNC(inode)		(__IS_FLG(inode, SB_SYNCHRONOUS) || \
 					((inode)->i_flags & S_SYNC))
 #define IS_DIRSYNC(inode)	(__IS_FLG(inode, SB_SYNCHRONOUS|SB_DIRSYNC) || \
@@ -2725,21 +2725,22 @@ static inline void file_start_write(struct file *file)
 {
 	if (!S_ISREG(file_inode(file)->i_mode))
 		return;
-	__sb_start_write(file_inode(file)->i_sb, SB_FREEZE_WRITE, true);
+	__sb_start_write(inode_sb(file_inode(file)), SB_FREEZE_WRITE, true);
 }
 
 static inline bool file_start_write_trylock(struct file *file)
 {
 	if (!S_ISREG(file_inode(file)->i_mode))
 		return true;
-	return __sb_start_write(file_inode(file)->i_sb, SB_FREEZE_WRITE, false);
+	return __sb_start_write(inode_sb(file_inode(file)), SB_FREEZE_WRITE,
+				false);
 }
 
 static inline void file_end_write(struct file *file)
 {
 	if (!S_ISREG(file_inode(file)->i_mode))
 		return;
-	__sb_end_write(file_inode(file)->i_sb, SB_FREEZE_WRITE);
+	__sb_end_write(inode_sb(file_inode(file)), SB_FREEZE_WRITE);
 }
 
 static inline int do_clone_file_range(struct file *file_in, loff_t pos_in,
@@ -3018,8 +3019,10 @@ static inline ssize_t blockdev_direct_IO(struct kiocb *iocb,
 					 struct iov_iter *iter,
 					 get_block_t get_block)
 {
-	return __blockdev_direct_IO(iocb, inode, inode->i_sb->s_bdev, iter,
-			get_block, NULL, NULL, DIO_LOCKING | DIO_SKIP_HOLES);
+	return __blockdev_direct_IO(iocb, inode, inode_sb(inode)->s_bdev,
+				    iter,
+				    get_block, NULL, NULL,
+				    DIO_LOCKING | DIO_SKIP_HOLES);
 }
 #endif
 
@@ -3370,13 +3373,13 @@ static inline int check_sticky(struct inode *dir, struct inode *inode)
 
 static inline void inode_has_no_xattr(struct inode *inode)
 {
-	if (!is_sxid(inode->i_mode) && (inode->i_sb->s_flags & SB_NOSEC))
+	if (!is_sxid(inode->i_mode) && (inode_sb(inode)->s_flags & SB_NOSEC))
 		inode->i_flags |= S_NOSEC;
 }
 
 static inline bool is_root_inode(struct inode *inode)
 {
-	return inode == inode->i_sb->s_root->d_inode;
+	return inode == inode_sb(inode)->s_root->d_inode;
 }
 
 static inline bool dir_emit(struct dir_context *ctx,
diff --git a/include/linux/fscrypt_supp.h b/include/linux/fscrypt_supp.h
index 477a7a6504d2..01e75d7e5ec8 100644
--- a/include/linux/fscrypt_supp.h
+++ b/include/linux/fscrypt_supp.h
@@ -54,8 +54,8 @@ static inline bool fscrypt_has_encryption_key(const struct inode *inode)
 
 static inline bool fscrypt_dummy_context_enabled(struct inode *inode)
 {
-	return inode->i_sb->s_cop->dummy_context &&
-		inode->i_sb->s_cop->dummy_context(inode);
+	return inode_sb(inode)->s_cop->dummy_context &&
+			inode_sb(inode)->s_cop->dummy_context(inode);
 }
 
 /* crypto.c */
diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h
index 36fa6a2a82e3..91036dfbfe78 100644
--- a/include/linux/hugetlb.h
+++ b/include/linux/hugetlb.h
@@ -382,7 +382,7 @@ extern unsigned int default_hstate_idx;
 
 static inline struct hstate *hstate_inode(struct inode *i)
 {
-	return HUGETLBFS_SB(i->i_sb)->hstate;
+	return HUGETLBFS_SB(inode_sb(i))->hstate;
 }
 
 static inline struct hstate *hstate_file(struct file *f)
diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h
index 38187c68063d..0d3dddba4d5d 100644
--- a/include/linux/nfs_fs.h
+++ b/include/linux/nfs_fs.h
@@ -238,7 +238,7 @@ static inline struct nfs_fh *NFS_FH(const struct inode *inode)
 
 static inline struct nfs_server *NFS_SERVER(const struct inode *inode)
 {
-	return NFS_SB(inode->i_sb);
+	return NFS_SB(inode_sb(inode));
 }
 
 static inline struct rpc_clnt *NFS_CLIENT(const struct inode *inode)
diff --git a/include/trace/events/btrfs.h b/include/trace/events/btrfs.h
index c3ac5ec86519..d8d8823c635a 100644
--- a/include/trace/events/btrfs.h
+++ b/include/trace/events/btrfs.h
@@ -136,7 +136,7 @@ DECLARE_EVENT_CLASS(btrfs__inode,
 		__field(	u64,  root_objectid		)
 	),
 
-	TP_fast_assign_btrfs(btrfs_sb(inode->i_sb),
+	TP_fast_assign_btrfs(btrfs_sb(inode_sb(inode)),
 		__entry->ino	= inode->i_ino;
 		__entry->blocks	= inode->i_blocks;
 		__entry->disk_i_size  = BTRFS_I(inode)->disk_i_size;
@@ -415,7 +415,7 @@ DECLARE_EVENT_CLASS(btrfs__ordered_extent,
 		__field(	u64,  truncated_len	)
 	),
 
-	TP_fast_assign_btrfs(btrfs_sb(inode->i_sb),
+	TP_fast_assign_btrfs(btrfs_sb(inode_sb(inode)),
 		__entry->ino 		= inode->i_ino;
 		__entry->file_offset	= ordered->file_offset;
 		__entry->start		= ordered->start;
@@ -500,7 +500,7 @@ DECLARE_EVENT_CLASS(btrfs__writepage,
 		__field(	u64,    root_objectid		)
 	),
 
-	TP_fast_assign_btrfs(btrfs_sb(inode->i_sb),
+	TP_fast_assign_btrfs(btrfs_sb(inode_sb(inode)),
 		__entry->ino		= inode->i_ino;
 		__entry->index		= page->index;
 		__entry->nr_to_write	= wbc->nr_to_write;
@@ -551,7 +551,7 @@ TRACE_EVENT(btrfs_writepage_end_io_hook,
 		__field(	u64,    root_objectid	)
 	),
 
-	TP_fast_assign_btrfs(btrfs_sb(page->mapping->host->i_sb),
+	TP_fast_assign_btrfs(btrfs_sb(inode_sb(page->mapping->host)),
 		__entry->ino	= page->mapping->host->i_ino;
 		__entry->index	= page->index;
 		__entry->start	= start;
@@ -1442,7 +1442,7 @@ DECLARE_EVENT_CLASS(btrfs__qgroup_rsv_data,
 		__field(	int,		op		)
 	),
 
-	TP_fast_assign_btrfs(btrfs_sb(inode->i_sb),
+	TP_fast_assign_btrfs(btrfs_sb(inode_sb(inode)),
 		__entry->rootid		= BTRFS_I(inode)->root->objectid;
 		__entry->ino		= inode->i_ino;
 		__entry->start		= start;
diff --git a/include/trace/events/ext4.h b/include/trace/events/ext4.h
index 4d0e3af4e561..89943e59ae36 100644
--- a/include/trace/events/ext4.h
+++ b/include/trace/events/ext4.h
@@ -91,7 +91,7 @@ TRACE_EVENT(ext4_other_inode_update_time,
 
 	TP_fast_assign(
 		__entry->orig_ino = orig_ino;
-		__entry->dev	= inode->i_sb->s_dev;
+		__entry->dev	= inode_sb(inode)->s_dev;
 		__entry->ino	= inode->i_ino;
 		__entry->uid	= i_uid_read(inode);
 		__entry->gid	= i_gid_read(inode);
@@ -120,7 +120,7 @@ TRACE_EVENT(ext4_free_inode,
 	),
 
 	TP_fast_assign(
-		__entry->dev	= inode->i_sb->s_dev;
+		__entry->dev	= inode_sb(inode)->s_dev;
 		__entry->ino	= inode->i_ino;
 		__entry->uid	= i_uid_read(inode);
 		__entry->gid	= i_gid_read(inode);
@@ -146,7 +146,7 @@ TRACE_EVENT(ext4_request_inode,
 	),
 
 	TP_fast_assign(
-		__entry->dev	= dir->i_sb->s_dev;
+		__entry->dev	= inode_sb(dir)->s_dev;
 		__entry->dir	= dir->i_ino;
 		__entry->mode	= mode;
 	),
@@ -169,7 +169,7 @@ TRACE_EVENT(ext4_allocate_inode,
 	),
 
 	TP_fast_assign(
-		__entry->dev	= inode->i_sb->s_dev;
+		__entry->dev	= inode_sb(inode)->s_dev;
 		__entry->ino	= inode->i_ino;
 		__entry->dir	= dir->i_ino;
 		__entry->mode	= mode;
@@ -193,7 +193,7 @@ TRACE_EVENT(ext4_evict_inode,
 	),
 
 	TP_fast_assign(
-		__entry->dev	= inode->i_sb->s_dev;
+		__entry->dev	= inode_sb(inode)->s_dev;
 		__entry->ino	= inode->i_ino;
 		__entry->nlink	= inode->i_nlink;
 	),
@@ -215,7 +215,7 @@ TRACE_EVENT(ext4_drop_inode,
 	),
 
 	TP_fast_assign(
-		__entry->dev	= inode->i_sb->s_dev;
+		__entry->dev	= inode_sb(inode)->s_dev;
 		__entry->ino	= inode->i_ino;
 		__entry->drop	= drop;
 	),
@@ -237,7 +237,7 @@ TRACE_EVENT(ext4_mark_inode_dirty,
 	),
 
 	TP_fast_assign(
-		__entry->dev	= inode->i_sb->s_dev;
+		__entry->dev	= inode_sb(inode)->s_dev;
 		__entry->ino	= inode->i_ino;
 		__entry->ip	= IP;
 	),
@@ -259,7 +259,7 @@ TRACE_EVENT(ext4_begin_ordered_truncate,
 	),
 
 	TP_fast_assign(
-		__entry->dev		= inode->i_sb->s_dev;
+		__entry->dev		= inode_sb(inode)->s_dev;
 		__entry->ino		= inode->i_ino;
 		__entry->new_size	= new_size;
 	),
@@ -286,7 +286,7 @@ DECLARE_EVENT_CLASS(ext4__write_begin,
 	),
 
 	TP_fast_assign(
-		__entry->dev	= inode->i_sb->s_dev;
+		__entry->dev	= inode_sb(inode)->s_dev;
 		__entry->ino	= inode->i_ino;
 		__entry->pos	= pos;
 		__entry->len	= len;
@@ -330,7 +330,7 @@ DECLARE_EVENT_CLASS(ext4__write_end,
 	),
 
 	TP_fast_assign(
-		__entry->dev	= inode->i_sb->s_dev;
+		__entry->dev	= inode_sb(inode)->s_dev;
 		__entry->ino	= inode->i_ino;
 		__entry->pos	= pos;
 		__entry->len	= len;
@@ -386,7 +386,7 @@ TRACE_EVENT(ext4_writepages,
 	),
 
 	TP_fast_assign(
-		__entry->dev		= inode->i_sb->s_dev;
+		__entry->dev		= inode_sb(inode)->s_dev;
 		__entry->ino		= inode->i_ino;
 		__entry->nr_to_write	= wbc->nr_to_write;
 		__entry->pages_skipped	= wbc->pages_skipped;
@@ -424,7 +424,7 @@ TRACE_EVENT(ext4_da_write_pages,
 	),
 
 	TP_fast_assign(
-		__entry->dev		= inode->i_sb->s_dev;
+		__entry->dev		= inode_sb(inode)->s_dev;
 		__entry->ino		= inode->i_ino;
 		__entry->first_page	= first_page;
 		__entry->nr_to_write	= wbc->nr_to_write;
@@ -452,7 +452,7 @@ TRACE_EVENT(ext4_da_write_pages_extent,
 	),
 
 	TP_fast_assign(
-		__entry->dev		= inode->i_sb->s_dev;
+		__entry->dev		= inode_sb(inode)->s_dev;
 		__entry->ino		= inode->i_ino;
 		__entry->lblk		= map->m_lblk;
 		__entry->len		= map->m_len;
@@ -482,7 +482,7 @@ TRACE_EVENT(ext4_writepages_result,
 	),
 
 	TP_fast_assign(
-		__entry->dev		= inode->i_sb->s_dev;
+		__entry->dev		= inode_sb(inode)->s_dev;
 		__entry->ino		= inode->i_ino;
 		__entry->ret		= ret;
 		__entry->pages_written	= pages_written;
@@ -513,7 +513,7 @@ DECLARE_EVENT_CLASS(ext4__page_op,
 	),
 
 	TP_fast_assign(
-		__entry->dev	= page->mapping->host->i_sb->s_dev;
+		__entry->dev	= inode_sb(page->mapping->host)->s_dev;
 		__entry->ino	= page->mapping->host->i_ino;
 		__entry->index	= page->index;
 	),
@@ -559,7 +559,7 @@ DECLARE_EVENT_CLASS(ext4_invalidatepage_op,
 	),
 
 	TP_fast_assign(
-		__entry->dev	= page->mapping->host->i_sb->s_dev;
+		__entry->dev	= inode_sb(page->mapping->host)->s_dev;
 		__entry->ino	= page->mapping->host->i_ino;
 		__entry->index	= page->index;
 		__entry->offset	= offset;
@@ -669,7 +669,7 @@ TRACE_EVENT(ext4_mb_release_inode_pa,
 	),
 
 	TP_fast_assign(
-		__entry->dev		= pa->pa_inode->i_sb->s_dev;
+		__entry->dev		= inode_sb(pa->pa_inode)->s_dev;
 		__entry->ino		= pa->pa_inode->i_ino;
 		__entry->block		= block;
 		__entry->count		= count;
@@ -716,7 +716,7 @@ TRACE_EVENT(ext4_discard_preallocations,
 	),
 
 	TP_fast_assign(
-		__entry->dev	= inode->i_sb->s_dev;
+		__entry->dev	= inode_sb(inode)->s_dev;
 		__entry->ino	= inode->i_ino;
 	),
 
@@ -765,7 +765,7 @@ TRACE_EVENT(ext4_request_blocks,
 	),
 
 	TP_fast_assign(
-		__entry->dev	= ar->inode->i_sb->s_dev;
+		__entry->dev	= inode_sb(ar->inode)->s_dev;
 		__entry->ino	= ar->inode->i_ino;
 		__entry->len	= ar->len;
 		__entry->logical = ar->logical;
@@ -806,7 +806,7 @@ TRACE_EVENT(ext4_allocate_blocks,
 	),
 
 	TP_fast_assign(
-		__entry->dev	= ar->inode->i_sb->s_dev;
+		__entry->dev	= inode_sb(ar->inode)->s_dev;
 		__entry->ino	= ar->inode->i_ino;
 		__entry->block	= block;
 		__entry->len	= ar->len;
@@ -844,7 +844,7 @@ TRACE_EVENT(ext4_free_blocks,
 	),
 
 	TP_fast_assign(
-		__entry->dev		= inode->i_sb->s_dev;
+		__entry->dev		= inode_sb(inode)->s_dev;
 		__entry->ino		= inode->i_ino;
 		__entry->block		= block;
 		__entry->count		= count;
@@ -898,7 +898,7 @@ TRACE_EVENT(ext4_sync_file_exit,
 	),
 
 	TP_fast_assign(
-		__entry->dev		= inode->i_sb->s_dev;
+		__entry->dev		= inode_sb(inode)->s_dev;
 		__entry->ino		= inode->i_ino;
 		__entry->ret		= ret;
 	),
@@ -942,7 +942,7 @@ TRACE_EVENT(ext4_alloc_da_blocks,
 	),
 
 	TP_fast_assign(
-		__entry->dev	= inode->i_sb->s_dev;
+		__entry->dev	= inode_sb(inode)->s_dev;
 		__entry->ino	= inode->i_ino;
 		__entry->data_blocks = EXT4_I(inode)->i_reserved_data_blocks;
 	),
@@ -982,7 +982,7 @@ TRACE_EVENT(ext4_mballoc_alloc,
 	),
 
 	TP_fast_assign(
-		__entry->dev		= ac->ac_inode->i_sb->s_dev;
+		__entry->dev		= inode_sb(ac->ac_inode)->s_dev;
 		__entry->ino		= ac->ac_inode->i_ino;
 		__entry->orig_logical	= ac->ac_o_ex.fe_logical;
 		__entry->orig_start	= ac->ac_o_ex.fe_start;
@@ -1039,7 +1039,7 @@ TRACE_EVENT(ext4_mballoc_prealloc,
 	),
 
 	TP_fast_assign(
-		__entry->dev		= ac->ac_inode->i_sb->s_dev;
+		__entry->dev		= inode_sb(ac->ac_inode)->s_dev;
 		__entry->ino		= ac->ac_inode->i_ino;
 		__entry->orig_logical	= ac->ac_o_ex.fe_logical;
 		__entry->orig_start	= ac->ac_o_ex.fe_start;
@@ -1128,7 +1128,7 @@ TRACE_EVENT(ext4_forget,
 	),
 
 	TP_fast_assign(
-		__entry->dev	= inode->i_sb->s_dev;
+		__entry->dev	= inode_sb(inode)->s_dev;
 		__entry->ino	= inode->i_ino;
 		__entry->block	= block;
 		__entry->is_metadata = is_metadata;
@@ -1157,7 +1157,7 @@ TRACE_EVENT(ext4_da_update_reserve_space,
 	),
 
 	TP_fast_assign(
-		__entry->dev	= inode->i_sb->s_dev;
+		__entry->dev	= inode_sb(inode)->s_dev;
 		__entry->ino	= inode->i_ino;
 		__entry->i_blocks = inode->i_blocks;
 		__entry->used_blocks = used_blocks;
@@ -1190,7 +1190,7 @@ TRACE_EVENT(ext4_da_reserve_space,
 	),
 
 	TP_fast_assign(
-		__entry->dev	= inode->i_sb->s_dev;
+		__entry->dev	= inode_sb(inode)->s_dev;
 		__entry->ino	= inode->i_ino;
 		__entry->i_blocks = inode->i_blocks;
 		__entry->reserved_data_blocks = EXT4_I(inode)->i_reserved_data_blocks;
@@ -1220,7 +1220,7 @@ TRACE_EVENT(ext4_da_release_space,
 	),
 
 	TP_fast_assign(
-		__entry->dev	= inode->i_sb->s_dev;
+		__entry->dev	= inode_sb(inode)->s_dev;
 		__entry->ino	= inode->i_ino;
 		__entry->i_blocks = inode->i_blocks;
 		__entry->freed_blocks = freed_blocks;
@@ -1299,7 +1299,7 @@ TRACE_EVENT(ext4_direct_IO_enter,
 	),
 
 	TP_fast_assign(
-		__entry->dev	= inode->i_sb->s_dev;
+		__entry->dev	= inode_sb(inode)->s_dev;
 		__entry->ino	= inode->i_ino;
 		__entry->pos	= offset;
 		__entry->len	= len;
@@ -1328,7 +1328,7 @@ TRACE_EVENT(ext4_direct_IO_exit,
 	),
 
 	TP_fast_assign(
-		__entry->dev	= inode->i_sb->s_dev;
+		__entry->dev	= inode_sb(inode)->s_dev;
 		__entry->ino	= inode->i_ino;
 		__entry->pos	= offset;
 		__entry->len	= len;
@@ -1357,7 +1357,7 @@ DECLARE_EVENT_CLASS(ext4__fallocate_mode,
 	),
 
 	TP_fast_assign(
-		__entry->dev	= inode->i_sb->s_dev;
+		__entry->dev	= inode_sb(inode)->s_dev;
 		__entry->ino	= inode->i_ino;
 		__entry->offset	= offset;
 		__entry->len	= len;
@@ -1407,7 +1407,7 @@ TRACE_EVENT(ext4_fallocate_exit,
 	),
 
 	TP_fast_assign(
-		__entry->dev	= inode->i_sb->s_dev;
+		__entry->dev	= inode_sb(inode)->s_dev;
 		__entry->ino	= inode->i_ino;
 		__entry->pos	= offset;
 		__entry->blocks	= max_blocks;
@@ -1481,7 +1481,7 @@ DECLARE_EVENT_CLASS(ext4__truncate,
 	),
 
 	TP_fast_assign(
-		__entry->dev    = inode->i_sb->s_dev;
+		__entry->dev    = inode_sb(inode)->s_dev;
 		__entry->ino    = inode->i_ino;
 		__entry->blocks	= inode->i_blocks;
 	),
@@ -1523,7 +1523,7 @@ TRACE_EVENT(ext4_ext_convert_to_initialized_enter,
 	),
 
 	TP_fast_assign(
-		__entry->dev		= inode->i_sb->s_dev;
+		__entry->dev		= inode_sb(inode)->s_dev;
 		__entry->ino		= inode->i_ino;
 		__entry->m_lblk		= map->m_lblk;
 		__entry->m_len		= map->m_len;
@@ -1564,7 +1564,7 @@ TRACE_EVENT(ext4_ext_convert_to_initialized_fastpath,
 	),
 
 	TP_fast_assign(
-		__entry->dev		= inode->i_sb->s_dev;
+		__entry->dev		= inode_sb(inode)->s_dev;
 		__entry->ino		= inode->i_ino;
 		__entry->m_lblk		= map->m_lblk;
 		__entry->m_len		= map->m_len;
@@ -1601,7 +1601,7 @@ DECLARE_EVENT_CLASS(ext4__map_blocks_enter,
 	),
 
 	TP_fast_assign(
-		__entry->dev    = inode->i_sb->s_dev;
+		__entry->dev    = inode_sb(inode)->s_dev;
 		__entry->ino    = inode->i_ino;
 		__entry->lblk	= lblk;
 		__entry->len	= len;
@@ -1646,7 +1646,7 @@ DECLARE_EVENT_CLASS(ext4__map_blocks_exit,
 	),
 
 	TP_fast_assign(
-		__entry->dev    = inode->i_sb->s_dev;
+		__entry->dev    = inode_sb(inode)->s_dev;
 		__entry->ino    = inode->i_ino;
 		__entry->flags	= flags;
 		__entry->pblk	= map->m_pblk;
@@ -1691,7 +1691,7 @@ TRACE_EVENT(ext4_ext_load_extent,
 	),
 
 	TP_fast_assign(
-		__entry->dev    = inode->i_sb->s_dev;
+		__entry->dev    = inode_sb(inode)->s_dev;
 		__entry->ino    = inode->i_ino;
 		__entry->pblk	= pblk;
 		__entry->lblk	= lblk;
@@ -1714,7 +1714,7 @@ TRACE_EVENT(ext4_load_inode,
 	),
 
 	TP_fast_assign(
-		__entry->dev		= inode->i_sb->s_dev;
+		__entry->dev		= inode_sb(inode)->s_dev;
 		__entry->ino		= inode->i_ino;
 	),
 
@@ -1837,7 +1837,7 @@ TRACE_EVENT(ext4_ext_handle_unwritten_extents,
 	),
 
 	TP_fast_assign(
-		__entry->dev		= inode->i_sb->s_dev;
+		__entry->dev		= inode_sb(inode)->s_dev;
 		__entry->ino		= inode->i_ino;
 		__entry->flags		= flags;
 		__entry->lblk		= map->m_lblk;
@@ -1901,7 +1901,7 @@ TRACE_EVENT(ext4_ext_put_in_cache,
 	),
 
 	TP_fast_assign(
-		__entry->dev	= inode->i_sb->s_dev;
+		__entry->dev	= inode_sb(inode)->s_dev;
 		__entry->ino	= inode->i_ino;
 		__entry->lblk	= lblk;
 		__entry->len	= len;
@@ -1929,7 +1929,7 @@ TRACE_EVENT(ext4_ext_in_cache,
 	),
 
 	TP_fast_assign(
-		__entry->dev	= inode->i_sb->s_dev;
+		__entry->dev	= inode_sb(inode)->s_dev;
 		__entry->ino	= inode->i_ino;
 		__entry->lblk	= lblk;
 		__entry->ret	= ret;
@@ -1960,7 +1960,7 @@ TRACE_EVENT(ext4_find_delalloc_range,
 	),
 
 	TP_fast_assign(
-		__entry->dev		= inode->i_sb->s_dev;
+		__entry->dev		= inode_sb(inode)->s_dev;
 		__entry->ino		= inode->i_ino;
 		__entry->from		= from;
 		__entry->to		= to;
@@ -1991,7 +1991,7 @@ TRACE_EVENT(ext4_get_reserved_cluster_alloc,
 	),
 
 	TP_fast_assign(
-		__entry->dev	= inode->i_sb->s_dev;
+		__entry->dev	= inode_sb(inode)->s_dev;
 		__entry->ino	= inode->i_ino;
 		__entry->lblk	= lblk;
 		__entry->len	= len;
@@ -2019,7 +2019,7 @@ TRACE_EVENT(ext4_ext_show_extent,
 	),
 
 	TP_fast_assign(
-		__entry->dev	= inode->i_sb->s_dev;
+		__entry->dev	= inode_sb(inode)->s_dev;
 		__entry->ino	= inode->i_ino;
 		__entry->pblk	= pblk;
 		__entry->lblk	= lblk;
@@ -2053,7 +2053,7 @@ TRACE_EVENT(ext4_remove_blocks,
 	),
 
 	TP_fast_assign(
-		__entry->dev		= inode->i_sb->s_dev;
+		__entry->dev		= inode_sb(inode)->s_dev;
 		__entry->ino		= inode->i_ino;
 		__entry->from		= from;
 		__entry->to		= to;
@@ -2093,7 +2093,7 @@ TRACE_EVENT(ext4_ext_rm_leaf,
 	),
 
 	TP_fast_assign(
-		__entry->dev		= inode->i_sb->s_dev;
+		__entry->dev		= inode_sb(inode)->s_dev;
 		__entry->ino		= inode->i_ino;
 		__entry->partial	= partial_cluster;
 		__entry->start		= start;
@@ -2125,7 +2125,7 @@ TRACE_EVENT(ext4_ext_rm_idx,
 	),
 
 	TP_fast_assign(
-		__entry->dev	= inode->i_sb->s_dev;
+		__entry->dev	= inode_sb(inode)->s_dev;
 		__entry->ino	= inode->i_ino;
 		__entry->pblk	= pblk;
 	),
@@ -2151,7 +2151,7 @@ TRACE_EVENT(ext4_ext_remove_space,
 	),
 
 	TP_fast_assign(
-		__entry->dev	= inode->i_sb->s_dev;
+		__entry->dev	= inode_sb(inode)->s_dev;
 		__entry->ino	= inode->i_ino;
 		__entry->start	= start;
 		__entry->end	= end;
@@ -2183,7 +2183,7 @@ TRACE_EVENT(ext4_ext_remove_space_done,
 	),
 
 	TP_fast_assign(
-		__entry->dev		= inode->i_sb->s_dev;
+		__entry->dev		= inode_sb(inode)->s_dev;
 		__entry->ino		= inode->i_ino;
 		__entry->start		= start;
 		__entry->end		= end;
@@ -2218,7 +2218,7 @@ DECLARE_EVENT_CLASS(ext4__es_extent,
 	),
 
 	TP_fast_assign(
-		__entry->dev	= inode->i_sb->s_dev;
+		__entry->dev	= inode_sb(inode)->s_dev;
 		__entry->ino	= inode->i_ino;
 		__entry->lblk	= es->es_lblk;
 		__entry->len	= es->es_len;
@@ -2258,7 +2258,7 @@ TRACE_EVENT(ext4_es_remove_extent,
 	),
 
 	TP_fast_assign(
-		__entry->dev	= inode->i_sb->s_dev;
+		__entry->dev	= inode_sb(inode)->s_dev;
 		__entry->ino	= inode->i_ino;
 		__entry->lblk	= lblk;
 		__entry->len	= len;
@@ -2282,7 +2282,7 @@ TRACE_EVENT(ext4_es_find_delayed_extent_range_enter,
 	),
 
 	TP_fast_assign(
-		__entry->dev	= inode->i_sb->s_dev;
+		__entry->dev	= inode_sb(inode)->s_dev;
 		__entry->ino	= inode->i_ino;
 		__entry->lblk	= lblk;
 	),
@@ -2307,7 +2307,7 @@ TRACE_EVENT(ext4_es_find_delayed_extent_range_exit,
 	),
 
 	TP_fast_assign(
-		__entry->dev	= inode->i_sb->s_dev;
+		__entry->dev	= inode_sb(inode)->s_dev;
 		__entry->ino	= inode->i_ino;
 		__entry->lblk	= es->es_lblk;
 		__entry->len	= es->es_len;
@@ -2334,7 +2334,7 @@ TRACE_EVENT(ext4_es_lookup_extent_enter,
 	),
 
 	TP_fast_assign(
-		__entry->dev	= inode->i_sb->s_dev;
+		__entry->dev	= inode_sb(inode)->s_dev;
 		__entry->ino	= inode->i_ino;
 		__entry->lblk	= lblk;
 	),
@@ -2361,7 +2361,7 @@ TRACE_EVENT(ext4_es_lookup_extent_exit,
 	),
 
 	TP_fast_assign(
-		__entry->dev	= inode->i_sb->s_dev;
+		__entry->dev	= inode_sb(inode)->s_dev;
 		__entry->ino	= inode->i_ino;
 		__entry->lblk	= es->es_lblk;
 		__entry->len	= es->es_len;
@@ -2447,7 +2447,7 @@ TRACE_EVENT(ext4_collapse_range,
 	),
 
 	TP_fast_assign(
-		__entry->dev	= inode->i_sb->s_dev;
+		__entry->dev	= inode_sb(inode)->s_dev;
 		__entry->ino	= inode->i_ino;
 		__entry->offset	= offset;
 		__entry->len	= len;
@@ -2472,7 +2472,7 @@ TRACE_EVENT(ext4_insert_range,
 	),
 
 	TP_fast_assign(
-		__entry->dev	= inode->i_sb->s_dev;
+		__entry->dev	= inode_sb(inode)->s_dev;
 		__entry->ino	= inode->i_ino;
 		__entry->offset	= offset;
 		__entry->len	= len;
diff --git a/include/trace/events/f2fs.h b/include/trace/events/f2fs.h
index 06c87f9f720c..8e958dd92412 100644
--- a/include/trace/events/f2fs.h
+++ b/include/trace/events/f2fs.h
@@ -171,7 +171,7 @@ DECLARE_EVENT_CLASS(f2fs__inode,
 	),
 
 	TP_fast_assign(
-		__entry->dev	= inode->i_sb->s_dev;
+		__entry->dev	= inode_sb(inode)->s_dev;
 		__entry->ino	= inode->i_ino;
 		__entry->pino	= F2FS_I(inode)->i_pino;
 		__entry->mode	= inode->i_mode;
@@ -205,7 +205,7 @@ DECLARE_EVENT_CLASS(f2fs__inode_exit,
 	),
 
 	TP_fast_assign(
-		__entry->dev	= inode->i_sb->s_dev;
+		__entry->dev	= inode_sb(inode)->s_dev;
 		__entry->ino	= inode->i_ino;
 		__entry->ret	= ret;
 	),
@@ -237,7 +237,7 @@ TRACE_EVENT(f2fs_sync_file_exit,
 	),
 
 	TP_fast_assign(
-		__entry->dev		= inode->i_sb->s_dev;
+		__entry->dev		= inode_sb(inode)->s_dev;
 		__entry->ino		= inode->i_ino;
 		__entry->cp_reason	= cp_reason;
 		__entry->datasync	= datasync;
@@ -319,7 +319,7 @@ TRACE_EVENT(f2fs_unlink_enter,
 	),
 
 	TP_fast_assign(
-		__entry->dev	= dir->i_sb->s_dev;
+		__entry->dev	= inode_sb(dir)->s_dev;
 		__entry->ino	= dir->i_ino;
 		__entry->size	= dir->i_size;
 		__entry->blocks	= dir->i_blocks;
@@ -370,7 +370,7 @@ TRACE_EVENT(f2fs_truncate_data_blocks_range,
 	),
 
 	TP_fast_assign(
-		__entry->dev	= inode->i_sb->s_dev;
+		__entry->dev	= inode_sb(inode)->s_dev;
 		__entry->ino	= inode->i_ino;
 		__entry->nid	= nid;
 		__entry->ofs	= ofs;
@@ -399,7 +399,7 @@ DECLARE_EVENT_CLASS(f2fs__truncate_op,
 	),
 
 	TP_fast_assign(
-		__entry->dev	= inode->i_sb->s_dev;
+		__entry->dev	= inode_sb(inode)->s_dev;
 		__entry->ino	= inode->i_ino;
 		__entry->size	= inode->i_size;
 		__entry->blocks	= inode->i_blocks;
@@ -456,7 +456,7 @@ DECLARE_EVENT_CLASS(f2fs__truncate_node,
 	),
 
 	TP_fast_assign(
-		__entry->dev		= inode->i_sb->s_dev;
+		__entry->dev		= inode_sb(inode)->s_dev;
 		__entry->ino		= inode->i_ino;
 		__entry->nid		= nid;
 		__entry->blk_addr	= blk_addr;
@@ -504,7 +504,7 @@ TRACE_EVENT(f2fs_truncate_partial_nodes,
 	),
 
 	TP_fast_assign(
-		__entry->dev	= inode->i_sb->s_dev;
+		__entry->dev	= inode_sb(inode)->s_dev;
 		__entry->ino	= inode->i_ino;
 		__entry->nid[0]	= nid[0];
 		__entry->nid[1]	= nid[1];
@@ -538,7 +538,7 @@ TRACE_EVENT(f2fs_map_blocks,
 	),
 
 	TP_fast_assign(
-		__entry->dev		= inode->i_sb->s_dev;
+		__entry->dev		= inode_sb(inode)->s_dev;
 		__entry->ino		= inode->i_ino;
 		__entry->m_lblk		= map->m_lblk;
 		__entry->m_pblk		= map->m_pblk;
@@ -756,7 +756,7 @@ TRACE_EVENT(f2fs_lookup_start,
 	),
 
 	TP_fast_assign(
-		__entry->dev	= dir->i_sb->s_dev;
+		__entry->dev	= inode_sb(dir)->s_dev;
 		__entry->ino	= dir->i_ino;
 		__entry->name	= dentry->d_name.name;
 		__entry->flags	= flags;
@@ -784,7 +784,7 @@ TRACE_EVENT(f2fs_lookup_end,
 	),
 
 	TP_fast_assign(
-		__entry->dev	= dir->i_sb->s_dev;
+		__entry->dev	= inode_sb(dir)->s_dev;
 		__entry->ino	= dir->i_ino;
 		__entry->name	= dentry->d_name.name;
 		__entry->cino	= ino;
@@ -813,7 +813,7 @@ TRACE_EVENT(f2fs_readdir,
 	),
 
 	TP_fast_assign(
-		__entry->dev	= dir->i_sb->s_dev;
+		__entry->dev	= inode_sb(dir)->s_dev;
 		__entry->ino	= dir->i_ino;
 		__entry->start	= start_pos;
 		__entry->end	= end_pos;
@@ -846,7 +846,7 @@ TRACE_EVENT(f2fs_fallocate,
 	),
 
 	TP_fast_assign(
-		__entry->dev	= inode->i_sb->s_dev;
+		__entry->dev	= inode_sb(inode)->s_dev;
 		__entry->ino	= inode->i_ino;
 		__entry->mode	= mode;
 		__entry->offset	= offset;
@@ -882,7 +882,7 @@ TRACE_EVENT(f2fs_direct_IO_enter,
 	),
 
 	TP_fast_assign(
-		__entry->dev	= inode->i_sb->s_dev;
+		__entry->dev	= inode_sb(inode)->s_dev;
 		__entry->ino	= inode->i_ino;
 		__entry->pos	= offset;
 		__entry->len	= len;
@@ -913,7 +913,7 @@ TRACE_EVENT(f2fs_direct_IO_exit,
 	),
 
 	TP_fast_assign(
-		__entry->dev	= inode->i_sb->s_dev;
+		__entry->dev	= inode_sb(inode)->s_dev;
 		__entry->ino	= inode->i_ino;
 		__entry->pos	= offset;
 		__entry->len	= len;
@@ -945,7 +945,7 @@ TRACE_EVENT(f2fs_reserve_new_blocks,
 	),
 
 	TP_fast_assign(
-		__entry->dev	= inode->i_sb->s_dev;
+		__entry->dev	= inode_sb(inode)->s_dev;
 		__entry->nid	= nid;
 		__entry->ofs_in_node = ofs_in_node;
 		__entry->count = count;
@@ -977,7 +977,7 @@ DECLARE_EVENT_CLASS(f2fs__submit_page_bio,
 	),
 
 	TP_fast_assign(
-		__entry->dev		= page->mapping->host->i_sb->s_dev;
+		__entry->dev		= inode_sb(page->mapping->host)->s_dev;
 		__entry->ino		= page->mapping->host->i_ino;
 		__entry->index		= page->index;
 		__entry->old_blkaddr	= fio->old_blkaddr;
@@ -1104,7 +1104,7 @@ TRACE_EVENT(f2fs_write_begin,
 	),
 
 	TP_fast_assign(
-		__entry->dev	= inode->i_sb->s_dev;
+		__entry->dev	= inode_sb(inode)->s_dev;
 		__entry->ino	= inode->i_ino;
 		__entry->pos	= pos;
 		__entry->len	= len;
@@ -1134,7 +1134,7 @@ TRACE_EVENT(f2fs_write_end,
 	),
 
 	TP_fast_assign(
-		__entry->dev	= inode->i_sb->s_dev;
+		__entry->dev	= inode_sb(inode)->s_dev;
 		__entry->ino	= inode->i_ino;
 		__entry->pos	= pos;
 		__entry->len	= len;
@@ -1165,7 +1165,7 @@ DECLARE_EVENT_CLASS(f2fs__page,
 	),
 
 	TP_fast_assign(
-		__entry->dev	= page->mapping->host->i_sb->s_dev;
+		__entry->dev	= inode_sb(page->mapping->host)->s_dev;
 		__entry->ino	= page->mapping->host->i_ino;
 		__entry->type	= type;
 		__entry->dir	= S_ISDIR(page->mapping->host->i_mode);
@@ -1259,7 +1259,7 @@ TRACE_EVENT(f2fs_writepages,
 	),
 
 	TP_fast_assign(
-		__entry->dev		= inode->i_sb->s_dev;
+		__entry->dev		= inode_sb(inode)->s_dev;
 		__entry->ino		= inode->i_ino;
 		__entry->type		= type;
 		__entry->dir		= S_ISDIR(inode->i_mode);
@@ -1311,7 +1311,7 @@ TRACE_EVENT(f2fs_readpages,
 	),
 
 	TP_fast_assign(
-		__entry->dev	= inode->i_sb->s_dev;
+		__entry->dev	= inode_sb(inode)->s_dev;
 		__entry->ino	= inode->i_ino;
 		__entry->start	= page->index;
 		__entry->nrpage	= nrpage;
@@ -1454,7 +1454,7 @@ TRACE_EVENT(f2fs_lookup_extent_tree_start,
 	),
 
 	TP_fast_assign(
-		__entry->dev = inode->i_sb->s_dev;
+		__entry->dev = inode_sb(inode)->s_dev;
 		__entry->ino = inode->i_ino;
 		__entry->pgofs = pgofs;
 	),
@@ -1483,7 +1483,7 @@ TRACE_EVENT_CONDITION(f2fs_lookup_extent_tree_end,
 	),
 
 	TP_fast_assign(
-		__entry->dev = inode->i_sb->s_dev;
+		__entry->dev = inode_sb(inode)->s_dev;
 		__entry->ino = inode->i_ino;
 		__entry->pgofs = pgofs;
 		__entry->fofs = ei->fofs;
@@ -1516,7 +1516,7 @@ TRACE_EVENT(f2fs_update_extent_tree_range,
 	),
 
 	TP_fast_assign(
-		__entry->dev = inode->i_sb->s_dev;
+		__entry->dev = inode_sb(inode)->s_dev;
 		__entry->ino = inode->i_ino;
 		__entry->pgofs = pgofs;
 		__entry->blk = blkaddr;
@@ -1569,7 +1569,7 @@ TRACE_EVENT(f2fs_destroy_extent_tree,
 	),
 
 	TP_fast_assign(
-		__entry->dev = inode->i_sb->s_dev;
+		__entry->dev = inode_sb(inode)->s_dev;
 		__entry->ino = inode->i_ino;
 		__entry->node_cnt = node_cnt;
 	),
diff --git a/include/trace/events/filelock.h b/include/trace/events/filelock.h
index d1faf3597b9d..522d2740a56f 100644
--- a/include/trace/events/filelock.h
+++ b/include/trace/events/filelock.h
@@ -48,7 +48,7 @@ TRACE_EVENT(locks_get_lock_context,
 	),
 
 	TP_fast_assign(
-		__entry->s_dev = inode->i_sb->s_dev;
+		__entry->s_dev = inode_sb(inode)->s_dev;
 		__entry->i_ino = inode->i_ino;
 		__entry->type = type;
 		__entry->ctx = ctx;
@@ -80,7 +80,7 @@ DECLARE_EVENT_CLASS(filelock_lock,
 
 	TP_fast_assign(
 		__entry->fl = fl ? fl : NULL;
-		__entry->s_dev = inode->i_sb->s_dev;
+		__entry->s_dev = inode_sb(inode)->s_dev;
 		__entry->i_ino = inode->i_ino;
 		__entry->fl_next = fl ? fl->fl_next : NULL;
 		__entry->fl_owner = fl ? fl->fl_owner : NULL;
@@ -132,7 +132,7 @@ DECLARE_EVENT_CLASS(filelock_lease,
 
 	TP_fast_assign(
 		__entry->fl = fl ? fl : NULL;
-		__entry->s_dev = inode->i_sb->s_dev;
+		__entry->s_dev = inode_sb(inode)->s_dev;
 		__entry->i_ino = inode->i_ino;
 		__entry->fl_next = fl ? fl->fl_next : NULL;
 		__entry->fl_owner = fl ? fl->fl_owner : NULL;
@@ -182,7 +182,7 @@ TRACE_EVENT(generic_add_lease,
 	),
 
 	TP_fast_assign(
-		__entry->s_dev = inode->i_sb->s_dev;
+		__entry->s_dev = inode_sb(inode)->s_dev;
 		__entry->i_ino = inode->i_ino;
 		__entry->wcount = atomic_read(&inode->i_writecount);
 		__entry->dcount = d_count(fl->fl_file->f_path.dentry);
diff --git a/include/trace/events/filemap.h b/include/trace/events/filemap.h
index ee05db7ee8d2..0517759b4b8f 100644
--- a/include/trace/events/filemap.h
+++ b/include/trace/events/filemap.h
@@ -30,8 +30,8 @@ DECLARE_EVENT_CLASS(mm_filemap_op_page_cache,
 		__entry->pfn = page_to_pfn(page);
 		__entry->i_ino = page->mapping->host->i_ino;
 		__entry->index = page->index;
-		if (page->mapping->host->i_sb)
-			__entry->s_dev = page->mapping->host->i_sb->s_dev;
+		if (inode_sb(page->mapping->host))
+			__entry->s_dev = inode_sb(page->mapping->host)->s_dev;
 		else
 			__entry->s_dev = page->mapping->host->i_rdev;
 	),
@@ -68,8 +68,8 @@ TRACE_EVENT(filemap_set_wb_err,
 		TP_fast_assign(
 			__entry->i_ino = mapping->host->i_ino;
 			__entry->errseq = eseq;
-			if (mapping->host->i_sb)
-				__entry->s_dev = mapping->host->i_sb->s_dev;
+			if (inode_sb(mapping->host))
+				__entry->s_dev = inode_sb(mapping->host)->s_dev;
 			else
 				__entry->s_dev = mapping->host->i_rdev;
 		),
@@ -95,9 +95,9 @@ TRACE_EVENT(file_check_and_advance_wb_err,
 		TP_fast_assign(
 			__entry->file = file;
 			__entry->i_ino = file->f_mapping->host->i_ino;
-			if (file->f_mapping->host->i_sb)
+			if (inode_sb(file->f_mapping->host))
 				__entry->s_dev =
-					file->f_mapping->host->i_sb->s_dev;
+					inode_sb(file->f_mapping->host)->s_dev;
 			else
 				__entry->s_dev =
 					file->f_mapping->host->i_rdev;
diff --git a/include/trace/events/fs_dax.h b/include/trace/events/fs_dax.h
index 97b09fcf7e52..d3173cae131d 100644
--- a/include/trace/events/fs_dax.h
+++ b/include/trace/events/fs_dax.h
@@ -24,7 +24,7 @@ DECLARE_EVENT_CLASS(dax_pmd_fault_class,
 		__field(int, result)
 	),
 	TP_fast_assign(
-		__entry->dev = inode->i_sb->s_dev;
+		__entry->dev = inode_sb(inode)->s_dev;
 		__entry->ino = inode->i_ino;
 		__entry->vm_start = vmf->vma->vm_start;
 		__entry->vm_end = vmf->vma->vm_end;
@@ -74,7 +74,7 @@ DECLARE_EVENT_CLASS(dax_pmd_load_hole_class,
 		__field(dev_t, dev)
 	),
 	TP_fast_assign(
-		__entry->dev = inode->i_sb->s_dev;
+		__entry->dev = inode_sb(inode)->s_dev;
 		__entry->ino = inode->i_ino;
 		__entry->vm_flags = vmf->vma->vm_flags;
 		__entry->address = vmf->address;
@@ -117,7 +117,7 @@ DECLARE_EVENT_CLASS(dax_pmd_insert_mapping_class,
 		__field(int, write)
 	),
 	TP_fast_assign(
-		__entry->dev = inode->i_sb->s_dev;
+		__entry->dev = inode_sb(inode)->s_dev;
 		__entry->ino = inode->i_ino;
 		__entry->vm_flags = vmf->vma->vm_flags;
 		__entry->address = vmf->address;
@@ -163,7 +163,7 @@ DECLARE_EVENT_CLASS(dax_pte_fault_class,
 		__field(int, result)
 	),
 	TP_fast_assign(
-		__entry->dev = inode->i_sb->s_dev;
+		__entry->dev = inode_sb(inode)->s_dev;
 		__entry->ino = inode->i_ino;
 		__entry->vm_flags = vmf->vma->vm_flags;
 		__entry->address = vmf->address;
@@ -206,7 +206,7 @@ TRACE_EVENT(dax_insert_mapping,
 		__field(int, write)
 	),
 	TP_fast_assign(
-		__entry->dev = inode->i_sb->s_dev;
+		__entry->dev = inode_sb(inode)->s_dev;
 		__entry->ino = inode->i_ino;
 		__entry->vm_flags = vmf->vma->vm_flags;
 		__entry->address = vmf->address;
@@ -234,7 +234,7 @@ DECLARE_EVENT_CLASS(dax_writeback_range_class,
 		__field(dev_t, dev)
 	),
 	TP_fast_assign(
-		__entry->dev = inode->i_sb->s_dev;
+		__entry->dev = inode_sb(inode)->s_dev;
 		__entry->ino = inode->i_ino;
 		__entry->start_index = start_index;
 		__entry->end_index = end_index;
@@ -266,7 +266,7 @@ TRACE_EVENT(dax_writeback_one,
 		__field(dev_t, dev)
 	),
 	TP_fast_assign(
-		__entry->dev = inode->i_sb->s_dev;
+		__entry->dev = inode_sb(inode)->s_dev;
 		__entry->ino = inode->i_ino;
 		__entry->pgoff = pgoff;
 		__entry->pglen = pglen;
diff --git a/include/trace/events/jbd2.h b/include/trace/events/jbd2.h
index 2310b259329f..95e0cb226d30 100644
--- a/include/trace/events/jbd2.h
+++ b/include/trace/events/jbd2.h
@@ -124,7 +124,7 @@ TRACE_EVENT(jbd2_submit_inode_data,
 	),
 
 	TP_fast_assign(
-		__entry->dev	= inode->i_sb->s_dev;
+		__entry->dev	= inode_sb(inode)->s_dev;
 		__entry->ino	= inode->i_ino;
 	),
 
diff --git a/include/trace/events/writeback.h b/include/trace/events/writeback.h
index 32db72c7c055..d5ae5ea65bc4 100644
--- a/include/trace/events/writeback.h
+++ b/include/trace/events/writeback.h
@@ -710,7 +710,7 @@ DECLARE_EVENT_CLASS(writeback_inode_template,
 	),
 
 	TP_fast_assign(
-		__entry->dev	= inode->i_sb->s_dev;
+		__entry->dev	= inode_sb(inode)->s_dev;
 		__entry->ino	= inode->i_ino;
 		__entry->state	= inode->i_state;
 		__entry->mode	= inode->i_mode;
diff --git a/include/uapi/linux/iso_fs.h b/include/uapi/linux/iso_fs.h
index a2555176f6d1..36aee6068b4a 100644
--- a/include/uapi/linux/iso_fs.h
+++ b/include/uapi/linux/iso_fs.h
@@ -160,7 +160,7 @@ struct iso_directory_record {
 #define ISOFS_BLOCK_BITS 11
 #define ISOFS_BLOCK_SIZE 2048
 
-#define ISOFS_BUFFER_SIZE(INODE) ((INODE)->i_sb->s_blocksize)
-#define ISOFS_BUFFER_BITS(INODE) ((INODE)->i_sb->s_blocksize_bits)
+#define ISOFS_BUFFER_SIZE(INODE) (inode_sb((INODE))->s_blocksize)
+#define ISOFS_BUFFER_BITS(INODE) (inode_sb((INODE))->s_blocksize_bits)
 
 #endif /* _ISOFS_FS_H */
-- 
2.15.1

^ permalink raw reply related	[flat|nested] 88+ messages in thread

* [PATCH 06/76] ipc: Use inode_sb() helper instead of inode->i_sb
  2018-05-08 18:03 [RFC][PATCH 0/76] vfs: 'views' for filesystems with more than one root Mark Fasheh
                   ` (4 preceding siblings ...)
  2018-05-08 18:03 ` [PATCH 05/76] include: " Mark Fasheh
@ 2018-05-08 18:03 ` Mark Fasheh
  2018-05-08 18:03 ` [PATCH 07/76] kernel: " Mark Fasheh
                   ` (70 subsequent siblings)
  76 siblings, 0 replies; 88+ messages in thread
From: Mark Fasheh @ 2018-05-08 18:03 UTC (permalink / raw)
  To: linux-fsdevel; +Cc: linux-kernel, linux-btrfs, Mark Fasheh

Signed-off-by: Mark Fasheh <mfasheh@suse.de>
---
 ipc/mqueue.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/ipc/mqueue.c b/ipc/mqueue.c
index a808f29d4c5a..ac65b309c393 100644
--- a/ipc/mqueue.c
+++ b/ipc/mqueue.c
@@ -106,7 +106,7 @@ static inline struct mqueue_inode_info *MQUEUE_I(struct inode *inode)
  */
 static inline struct ipc_namespace *__get_ns_from_inode(struct inode *inode)
 {
-	return get_ipc_ns(inode->i_sb->s_fs_info);
+	return get_ipc_ns(inode_sb(inode)->s_fs_info);
 }
 
 static struct ipc_namespace *get_ns_from_inode(struct inode *inode)
@@ -456,7 +456,7 @@ static int mqueue_create_attr(struct dentry *dentry, umode_t mode, void *arg)
 	ipc_ns->mq_queues_count++;
 	spin_unlock(&mq_lock);
 
-	inode = mqueue_get_inode(dir->i_sb, ipc_ns, mode, attr);
+	inode = mqueue_get_inode(inode_sb(dir), ipc_ns, mode, attr);
 	if (IS_ERR(inode)) {
 		error = PTR_ERR(inode);
 		spin_lock(&mq_lock);
-- 
2.15.1

^ permalink raw reply related	[flat|nested] 88+ messages in thread

* [PATCH 07/76] kernel: Use inode_sb() helper instead of inode->i_sb
  2018-05-08 18:03 [RFC][PATCH 0/76] vfs: 'views' for filesystems with more than one root Mark Fasheh
                   ` (5 preceding siblings ...)
  2018-05-08 18:03 ` [PATCH 06/76] ipc: " Mark Fasheh
@ 2018-05-08 18:03 ` Mark Fasheh
  2018-05-08 18:03 ` [PATCH 08/76] mm: " Mark Fasheh
                   ` (69 subsequent siblings)
  76 siblings, 0 replies; 88+ messages in thread
From: Mark Fasheh @ 2018-05-08 18:03 UTC (permalink / raw)
  To: linux-fsdevel; +Cc: linux-kernel, linux-btrfs, Mark Fasheh

Signed-off-by: Mark Fasheh <mfasheh@suse.de>
---
 kernel/audit.c          | 2 +-
 kernel/audit_fsnotify.c | 2 +-
 kernel/audit_watch.c    | 5 +++--
 kernel/auditsc.c        | 8 ++++----
 kernel/bpf/inode.c      | 6 +++---
 kernel/bpf/offload.c    | 4 ++--
 kernel/events/core.c    | 4 ++--
 7 files changed, 16 insertions(+), 15 deletions(-)

diff --git a/kernel/audit.c b/kernel/audit.c
index 227db99b0f19..23159573aafd 100644
--- a/kernel/audit.c
+++ b/kernel/audit.c
@@ -2050,7 +2050,7 @@ void audit_copy_inode(struct audit_names *name, const struct dentry *dentry,
 		      struct inode *inode)
 {
 	name->ino   = inode->i_ino;
-	name->dev   = inode->i_sb->s_dev;
+	name->dev   = inode_sb(inode)->s_dev;
 	name->mode  = inode->i_mode;
 	name->uid   = inode->i_uid;
 	name->gid   = inode->i_gid;
diff --git a/kernel/audit_fsnotify.c b/kernel/audit_fsnotify.c
index 52f368b6561e..981432cef19c 100644
--- a/kernel/audit_fsnotify.c
+++ b/kernel/audit_fsnotify.c
@@ -76,7 +76,7 @@ int audit_mark_compare(struct audit_fsnotify_mark *mark, unsigned long ino, dev_
 static void audit_update_mark(struct audit_fsnotify_mark *audit_mark,
 			     const struct inode *inode)
 {
-	audit_mark->dev = inode ? inode->i_sb->s_dev : AUDIT_DEV_UNSET;
+	audit_mark->dev = inode ? inode_sb(inode)->s_dev : AUDIT_DEV_UNSET;
 	audit_mark->ino = inode ? inode->i_ino : AUDIT_INO_UNSET;
 }
 
diff --git a/kernel/audit_watch.c b/kernel/audit_watch.c
index 9eb8b3511636..3e785d4cf8aa 100644
--- a/kernel/audit_watch.c
+++ b/kernel/audit_watch.c
@@ -499,7 +499,8 @@ static int audit_watch_handle_event(struct fsnotify_group *group,
 	}
 
 	if (mask & (FS_CREATE|FS_MOVED_TO) && inode)
-		audit_update_watch(parent, dname, inode->i_sb->s_dev, inode->i_ino, 0);
+		audit_update_watch(parent, dname, inode_sb(inode)->s_dev,
+				   inode->i_ino, 0);
 	else if (mask & (FS_DELETE|FS_MOVED_FROM))
 		audit_update_watch(parent, dname, AUDIT_DEV_UNSET, AUDIT_INO_UNSET, 1);
 	else if (mask & (FS_DELETE_SELF|FS_UNMOUNT|FS_MOVE_SELF))
@@ -553,7 +554,7 @@ int audit_exe_compare(struct task_struct *tsk, struct audit_fsnotify_mark *mark)
 	if (!exe_file)
 		return 0;
 	ino = file_inode(exe_file)->i_ino;
-	dev = file_inode(exe_file)->i_sb->s_dev;
+	dev = inode_sb(file_inode(exe_file))->s_dev;
 	fput(exe_file);
 	return audit_mark_compare(mark, ino, dev);
 }
diff --git a/kernel/auditsc.c b/kernel/auditsc.c
index e80459f7e132..9cb16a1ebedd 100644
--- a/kernel/auditsc.c
+++ b/kernel/auditsc.c
@@ -1797,7 +1797,7 @@ void __audit_inode(struct filename *name, const struct dentry *dentry,
 		if (n->ino) {
 			/* valid inode number, use that for the comparison */
 			if (n->ino != inode->i_ino ||
-			    n->dev != inode->i_sb->s_dev)
+			    n->dev != inode_sb(inode)->s_dev)
 				continue;
 		} else if (n->name) {
 			/* inode number has not been set, check the name */
@@ -1883,8 +1883,8 @@ void __audit_inode_child(struct inode *parent,
 				struct audit_field *f = &e->rule.fields[i];
 
 				if (f->type == AUDIT_FSTYPE) {
-					if (audit_comparator(parent->i_sb->s_magic,
-					    f->op, f->val)) {
+					if (audit_comparator(inode_sb(parent)->s_magic,
+						             f->op, f->val)) {
 						if (e->rule.action == AUDIT_NEVER) {
 							rcu_read_unlock();
 							return;
@@ -1906,7 +1906,7 @@ void __audit_inode_child(struct inode *parent,
 		     n->type != AUDIT_TYPE_UNKNOWN))
 			continue;
 
-		if (n->ino == parent->i_ino && n->dev == parent->i_sb->s_dev &&
+		if (n->ino == parent->i_ino && n->dev == inode_sb(parent)->s_dev &&
 		    !audit_compare_dname_path(dname,
 					      n->name->name, n->name_len)) {
 			if (n->type == AUDIT_TYPE_UNKNOWN)
diff --git a/kernel/bpf/inode.c b/kernel/bpf/inode.c
index 81e2f6995adb..130d9edc11eb 100644
--- a/kernel/bpf/inode.c
+++ b/kernel/bpf/inode.c
@@ -136,7 +136,7 @@ static int bpf_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode)
 {
 	struct inode *inode;
 
-	inode = bpf_get_inode(dir->i_sb, dir, mode | S_IFDIR);
+	inode = bpf_get_inode(inode_sb(dir), dir, mode | S_IFDIR);
 	if (IS_ERR(inode))
 		return PTR_ERR(inode);
 
@@ -154,7 +154,7 @@ static int bpf_mkobj_ops(struct dentry *dentry, umode_t mode, void *raw,
 			 const struct inode_operations *iops)
 {
 	struct inode *dir = dentry->d_parent->d_inode;
-	struct inode *inode = bpf_get_inode(dir->i_sb, dir, mode);
+	struct inode *inode = bpf_get_inode(inode_sb(dir), dir, mode);
 	if (IS_ERR(inode))
 		return PTR_ERR(inode);
 
@@ -193,7 +193,7 @@ static int bpf_symlink(struct inode *dir, struct dentry *dentry,
 	if (!link)
 		return -ENOMEM;
 
-	inode = bpf_get_inode(dir->i_sb, dir, S_IRWXUGO | S_IFLNK);
+	inode = bpf_get_inode(inode_sb(dir), dir, S_IRWXUGO | S_IFLNK);
 	if (IS_ERR(inode)) {
 		kfree(link);
 		return PTR_ERR(inode);
diff --git a/kernel/bpf/offload.c b/kernel/bpf/offload.c
index c9401075b58c..6ff86b395175 100644
--- a/kernel/bpf/offload.c
+++ b/kernel/bpf/offload.c
@@ -265,7 +265,7 @@ int bpf_prog_offload_info_fill(struct bpf_prog_info *info,
 	up_read(&bpf_devs_lock);
 
 	ns_inode = ns_path.dentry->d_inode;
-	info->netns_dev = new_encode_dev(ns_inode->i_sb->s_dev);
+	info->netns_dev = new_encode_dev(inode_sb(ns_inode)->s_dev);
 	info->netns_ino = ns_inode->i_ino;
 	path_put(&ns_path);
 
@@ -461,7 +461,7 @@ int bpf_map_offload_info_fill(struct bpf_map_info *info, struct bpf_map *map)
 	}
 
 	ns_inode = ns_path.dentry->d_inode;
-	info->netns_dev = new_encode_dev(ns_inode->i_sb->s_dev);
+	info->netns_dev = new_encode_dev(inode_sb(ns_inode)->s_dev);
 	info->netns_ino = ns_inode->i_ino;
 	path_put(&ns_path);
 
diff --git a/kernel/events/core.c b/kernel/events/core.c
index 709a55b9ad97..58c02221e066 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -6713,7 +6713,7 @@ static void perf_fill_ns_link_info(struct perf_ns_link_info *ns_link_info,
 	error = ns_get_path(&ns_path, task, ns_ops);
 	if (!error) {
 		ns_inode = ns_path.dentry->d_inode;
-		ns_link_info->dev = new_encode_dev(ns_inode->i_sb->s_dev);
+		ns_link_info->dev = new_encode_dev(inode_sb(ns_inode)->s_dev);
 		ns_link_info->ino = ns_inode->i_ino;
 		path_put(&ns_path);
 	}
@@ -6918,7 +6918,7 @@ static void perf_event_mmap_event(struct perf_mmap_event *mmap_event)
 			goto cpy_name;
 		}
 		inode = file_inode(vma->vm_file);
-		dev = inode->i_sb->s_dev;
+		dev = inode_sb(inode)->s_dev;
 		ino = inode->i_ino;
 		gen = inode->i_generation;
 		maj = MAJOR(dev);
-- 
2.15.1

^ permalink raw reply related	[flat|nested] 88+ messages in thread

* [PATCH 08/76] mm: Use inode_sb() helper instead of inode->i_sb
  2018-05-08 18:03 [RFC][PATCH 0/76] vfs: 'views' for filesystems with more than one root Mark Fasheh
                   ` (6 preceding siblings ...)
  2018-05-08 18:03 ` [PATCH 07/76] kernel: " Mark Fasheh
@ 2018-05-08 18:03 ` Mark Fasheh
  2018-05-08 18:03 ` [PATCH 09/76] net: " Mark Fasheh
                   ` (68 subsequent siblings)
  76 siblings, 0 replies; 88+ messages in thread
From: Mark Fasheh @ 2018-05-08 18:03 UTC (permalink / raw)
  To: linux-fsdevel; +Cc: linux-kernel, linux-btrfs, Mark Fasheh

Signed-off-by: Mark Fasheh <mfasheh@suse.de>
---
 mm/cleancache.c     | 10 +++++-----
 mm/filemap.c        | 12 ++++++------
 mm/hugetlb.c        |  2 +-
 mm/memory-failure.c |  2 +-
 mm/shmem.c          | 29 +++++++++++++++--------------
 mm/swapfile.c       |  4 ++--
 6 files changed, 30 insertions(+), 29 deletions(-)

diff --git a/mm/cleancache.c b/mm/cleancache.c
index f7b9fdc79d97..b4cabc316aea 100644
--- a/mm/cleancache.c
+++ b/mm/cleancache.c
@@ -147,7 +147,7 @@ static int cleancache_get_key(struct inode *inode,
 {
 	int (*fhfn)(struct inode *, __u32 *fh, int *, struct inode *);
 	int len = 0, maxlen = CLEANCACHE_KEY_MAX;
-	struct super_block *sb = inode->i_sb;
+	struct super_block *sb = inode_sb(inode);
 
 	key->u.ino = inode->i_ino;
 	if (sb->s_export_op != NULL) {
@@ -186,7 +186,7 @@ int __cleancache_get_page(struct page *page)
 	}
 
 	VM_BUG_ON_PAGE(!PageLocked(page), page);
-	pool_id = page->mapping->host->i_sb->cleancache_poolid;
+	pool_id = inode_sb(page->mapping->host)->cleancache_poolid;
 	if (pool_id < 0)
 		goto out;
 
@@ -224,7 +224,7 @@ void __cleancache_put_page(struct page *page)
 	}
 
 	VM_BUG_ON_PAGE(!PageLocked(page), page);
-	pool_id = page->mapping->host->i_sb->cleancache_poolid;
+	pool_id = inode_sb(page->mapping->host)->cleancache_poolid;
 	if (pool_id >= 0 &&
 		cleancache_get_key(page->mapping->host, &key) >= 0) {
 		cleancache_ops->put_page(pool_id, key, page->index, page);
@@ -245,7 +245,7 @@ void __cleancache_invalidate_page(struct address_space *mapping,
 					struct page *page)
 {
 	/* careful... page->mapping is NULL sometimes when this is called */
-	int pool_id = mapping->host->i_sb->cleancache_poolid;
+	int pool_id = inode_sb(mapping->host)->cleancache_poolid;
 	struct cleancache_filekey key = { .u.key = { 0 } };
 
 	if (!cleancache_ops)
@@ -273,7 +273,7 @@ EXPORT_SYMBOL(__cleancache_invalidate_page);
  */
 void __cleancache_invalidate_inode(struct address_space *mapping)
 {
-	int pool_id = mapping->host->i_sb->cleancache_poolid;
+	int pool_id = inode_sb(mapping->host)->cleancache_poolid;
 	struct cleancache_filekey key = { .u.key = { 0 } };
 
 	if (!cleancache_ops)
diff --git a/mm/filemap.c b/mm/filemap.c
index 693f62212a59..c81943b5ab3d 100644
--- a/mm/filemap.c
+++ b/mm/filemap.c
@@ -2064,9 +2064,9 @@ static ssize_t generic_file_buffered_read(struct kiocb *iocb,
 	unsigned int prev_offset;
 	int error = 0;
 
-	if (unlikely(*ppos >= inode->i_sb->s_maxbytes))
+	if (unlikely(*ppos >= inode_sb(inode)->s_maxbytes))
 		return 0;
-	iov_iter_truncate(iter, inode->i_sb->s_maxbytes);
+	iov_iter_truncate(iter, inode_sb(inode)->s_maxbytes);
 
 	index = *ppos >> PAGE_SHIFT;
 	prev_index = ra->prev_pos >> PAGE_SHIFT;
@@ -2702,7 +2702,7 @@ int filemap_page_mkwrite(struct vm_fault *vmf)
 	struct inode *inode = file_inode(vmf->vma->vm_file);
 	int ret = VM_FAULT_LOCKED;
 
-	sb_start_pagefault(inode->i_sb);
+	sb_start_pagefault(inode_sb(inode));
 	file_update_time(vmf->vma->vm_file);
 	lock_page(page);
 	if (page->mapping != inode->i_mapping) {
@@ -2718,7 +2718,7 @@ int filemap_page_mkwrite(struct vm_fault *vmf)
 	set_page_dirty(page);
 	wait_for_stable_page(page);
 out:
-	sb_end_pagefault(inode->i_sb);
+	sb_end_pagefault(inode_sb(inode));
 	return ret;
 }
 EXPORT_SYMBOL(filemap_page_mkwrite);
@@ -2965,10 +2965,10 @@ inline ssize_t generic_write_checks(struct kiocb *iocb, struct iov_iter *from)
 	 * exceeded without writing data we send a signal and return EFBIG.
 	 * Linus frestrict idea will clean these up nicely..
 	 */
-	if (unlikely(pos >= inode->i_sb->s_maxbytes))
+	if (unlikely(pos >= inode_sb(inode)->s_maxbytes))
 		return -EFBIG;
 
-	iov_iter_truncate(from, inode->i_sb->s_maxbytes - pos);
+	iov_iter_truncate(from, inode_sb(inode)->s_maxbytes - pos);
 	return iov_iter_count(from);
 }
 EXPORT_SYMBOL(generic_write_checks);
diff --git a/mm/hugetlb.c b/mm/hugetlb.c
index 976bbc5646fe..350ca2f2a05e 100644
--- a/mm/hugetlb.c
+++ b/mm/hugetlb.c
@@ -209,7 +209,7 @@ static long hugepage_subpool_put_pages(struct hugepage_subpool *spool,
 
 static inline struct hugepage_subpool *subpool_inode(struct inode *inode)
 {
-	return HUGETLBFS_SB(inode->i_sb)->spool;
+	return HUGETLBFS_SB(inode_sb(inode))->spool;
 }
 
 static inline struct hugepage_subpool *subpool_vma(struct vm_area_struct *vma)
diff --git a/mm/memory-failure.c b/mm/memory-failure.c
index 8291b75f42c8..08e2367985f8 100644
--- a/mm/memory-failure.c
+++ b/mm/memory-failure.c
@@ -98,7 +98,7 @@ static int hwpoison_filter_dev(struct page *p)
 	if (mapping == NULL || mapping->host == NULL)
 		return -EINVAL;
 
-	dev = mapping->host->i_sb->s_dev;
+	dev = inode_sb(mapping->host)->s_dev;
 	if (hwpoison_filter_dev_major != ~0U &&
 	    hwpoison_filter_dev_major != MAJOR(dev))
 		return -EINVAL;
diff --git a/mm/shmem.c b/mm/shmem.c
index b85919243399..29ad457b4774 100644
--- a/mm/shmem.c
+++ b/mm/shmem.c
@@ -192,7 +192,7 @@ static inline void shmem_unacct_blocks(unsigned long flags, long pages)
 static inline bool shmem_inode_acct_block(struct inode *inode, long pages)
 {
 	struct shmem_inode_info *info = SHMEM_I(inode);
-	struct shmem_sb_info *sbinfo = SHMEM_SB(inode->i_sb);
+	struct shmem_sb_info *sbinfo = SHMEM_SB(inode_sb(inode));
 
 	if (shmem_acct_block(info->flags, pages))
 		return false;
@@ -214,7 +214,7 @@ static inline bool shmem_inode_acct_block(struct inode *inode, long pages)
 static inline void shmem_inode_unacct_blocks(struct inode *inode, long pages)
 {
 	struct shmem_inode_info *info = SHMEM_I(inode);
-	struct shmem_sb_info *sbinfo = SHMEM_SB(inode->i_sb);
+	struct shmem_sb_info *sbinfo = SHMEM_SB(inode_sb(inode));
 
 	if (sbinfo->max_blocks)
 		percpu_counter_sub(&sbinfo->used_blocks, pages);
@@ -1002,7 +1002,7 @@ static int shmem_setattr(struct dentry *dentry, struct iattr *attr)
 {
 	struct inode *inode = d_inode(dentry);
 	struct shmem_inode_info *info = SHMEM_I(inode);
-	struct shmem_sb_info *sbinfo = SHMEM_SB(inode->i_sb);
+	struct shmem_sb_info *sbinfo = SHMEM_SB(inode_sb(inode));
 	int error;
 
 	error = setattr_prepare(dentry, attr);
@@ -1068,7 +1068,7 @@ static int shmem_setattr(struct dentry *dentry, struct iattr *attr)
 static void shmem_evict_inode(struct inode *inode)
 {
 	struct shmem_inode_info *info = SHMEM_I(inode);
-	struct shmem_sb_info *sbinfo = SHMEM_SB(inode->i_sb);
+	struct shmem_sb_info *sbinfo = SHMEM_SB(inode_sb(inode));
 
 	if (inode->i_mapping->a_ops == &shmem_aops) {
 		shmem_unacct_size(info->flags, inode->i_size);
@@ -1091,7 +1091,7 @@ static void shmem_evict_inode(struct inode *inode)
 
 	simple_xattrs_free(&info->xattrs);
 	WARN_ON(inode->i_blocks);
-	shmem_free_inode(inode->i_sb);
+	shmem_free_inode(inode_sb(inode));
 	clear_inode(inode);
 }
 
@@ -1654,7 +1654,7 @@ static int shmem_getpage_gfp(struct inode *inode, pgoff_t index,
 	 * Fast cache lookup did not find it:
 	 * bring it back from swap or allocate.
 	 */
-	sbinfo = SHMEM_SB(inode->i_sb);
+	sbinfo = SHMEM_SB(inode_sb(inode));
 	charge_mm = vma ? vma->vm_mm : current->mm;
 
 	if (swap.val) {
@@ -2056,7 +2056,7 @@ unsigned long shmem_get_unmapped_area(struct file *file,
 
 		if (file) {
 			VM_BUG_ON(file->f_op != &shmem_file_operations);
-			sb = file_inode(file)->i_sb;
+			sb = inode_sb(file_inode(file));
 		} else {
 			/*
 			 * Called directly from mm/mmap.c, or drivers/char/mem.c
@@ -2852,7 +2852,7 @@ static long shmem_fallocate(struct file *file, int mode, loff_t offset,
 							 loff_t len)
 {
 	struct inode *inode = file_inode(file);
-	struct shmem_sb_info *sbinfo = SHMEM_SB(inode->i_sb);
+	struct shmem_sb_info *sbinfo = SHMEM_SB(inode_sb(inode));
 	struct shmem_inode_info *info = SHMEM_I(inode);
 	struct shmem_falloc shmem_falloc;
 	pgoff_t start, index, end;
@@ -3010,7 +3010,7 @@ shmem_mknod(struct inode *dir, struct dentry *dentry, umode_t mode, dev_t dev)
 	struct inode *inode;
 	int error = -ENOSPC;
 
-	inode = shmem_get_inode(dir->i_sb, dir, mode, dev, VM_NORESERVE);
+	inode = shmem_get_inode(inode_sb(dir), dir, mode, dev, VM_NORESERVE);
 	if (inode) {
 		error = simple_acl_create(dir, inode);
 		if (error)
@@ -3039,7 +3039,7 @@ shmem_tmpfile(struct inode *dir, struct dentry *dentry, umode_t mode)
 	struct inode *inode;
 	int error = -ENOSPC;
 
-	inode = shmem_get_inode(dir->i_sb, dir, mode, 0, VM_NORESERVE);
+	inode = shmem_get_inode(inode_sb(dir), dir, mode, 0, VM_NORESERVE);
 	if (inode) {
 		error = security_inode_init_security(inode, dir,
 						     NULL,
@@ -3086,7 +3086,7 @@ static int shmem_link(struct dentry *old_dentry, struct inode *dir, struct dentr
 	 * but each new link needs a new dentry, pinning lowmem, and
 	 * tmpfs dentries cannot be pruned until they are unlinked.
 	 */
-	ret = shmem_reserve_inode(inode->i_sb);
+	ret = shmem_reserve_inode(inode_sb(inode));
 	if (ret)
 		goto out;
 
@@ -3105,7 +3105,7 @@ static int shmem_unlink(struct inode *dir, struct dentry *dentry)
 	struct inode *inode = d_inode(dentry);
 
 	if (inode->i_nlink > 1 && !S_ISDIR(inode->i_mode))
-		shmem_free_inode(inode->i_sb);
+		shmem_free_inode(inode_sb(inode));
 
 	dir->i_size -= BOGO_DIRENT_SIZE;
 	inode->i_ctime = dir->i_ctime = dir->i_mtime = current_time(inode);
@@ -3230,7 +3230,8 @@ static int shmem_symlink(struct inode *dir, struct dentry *dentry, const char *s
 	if (len > PAGE_SIZE)
 		return -ENAMETOOLONG;
 
-	inode = shmem_get_inode(dir->i_sb, dir, S_IFLNK|S_IRWXUGO, 0, VM_NORESERVE);
+	inode = shmem_get_inode(inode_sb(dir), dir, S_IFLNK|S_IRWXUGO, 0,
+				VM_NORESERVE);
 	if (!inode)
 		return -ENOSPC;
 
@@ -4093,7 +4094,7 @@ struct kobj_attribute shmem_enabled_attr =
 bool shmem_huge_enabled(struct vm_area_struct *vma)
 {
 	struct inode *inode = file_inode(vma->vm_file);
-	struct shmem_sb_info *sbinfo = SHMEM_SB(inode->i_sb);
+	struct shmem_sb_info *sbinfo = SHMEM_SB(inode_sb(inode));
 	loff_t i_size;
 	pgoff_t off;
 
diff --git a/mm/swapfile.c b/mm/swapfile.c
index c7a33717d079..e2316b4ad91e 100644
--- a/mm/swapfile.c
+++ b/mm/swapfile.c
@@ -2446,7 +2446,7 @@ static int swap_node(struct swap_info_struct *p)
 	if (p->bdev)
 		bdev = p->bdev;
 	else
-		bdev = p->swap_file->f_inode->i_sb->s_bdev;
+		bdev = inode_sb(p->swap_file->f_inode)->s_bdev;
 
 	return bdev ? bdev->bd_disk->node_id : NUMA_NO_NODE;
 }
@@ -2899,7 +2899,7 @@ static int claim_swapfile(struct swap_info_struct *p, struct inode *inode)
 			return error;
 		p->flags |= SWP_BLKDEV;
 	} else if (S_ISREG(inode->i_mode)) {
-		p->bdev = inode->i_sb->s_bdev;
+		p->bdev = inode_sb(inode)->s_bdev;
 		inode_lock(inode);
 		if (IS_SWAPFILE(inode))
 			return -EBUSY;
-- 
2.15.1

^ permalink raw reply related	[flat|nested] 88+ messages in thread

* [PATCH 09/76] net: Use inode_sb() helper instead of inode->i_sb
  2018-05-08 18:03 [RFC][PATCH 0/76] vfs: 'views' for filesystems with more than one root Mark Fasheh
                   ` (7 preceding siblings ...)
  2018-05-08 18:03 ` [PATCH 08/76] mm: " Mark Fasheh
@ 2018-05-08 18:03 ` Mark Fasheh
  2018-05-08 18:03 ` [PATCH 10/76] security: " Mark Fasheh
                   ` (67 subsequent siblings)
  76 siblings, 0 replies; 88+ messages in thread
From: Mark Fasheh @ 2018-05-08 18:03 UTC (permalink / raw)
  To: linux-fsdevel; +Cc: linux-kernel, linux-btrfs, Mark Fasheh

Signed-off-by: Mark Fasheh <mfasheh@suse.de>
---
 net/sunrpc/auth_gss/auth_gss.c | 4 ++--
 net/sunrpc/rpc_pipe.c          | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/net/sunrpc/auth_gss/auth_gss.c b/net/sunrpc/auth_gss/auth_gss.c
index 9463af4b32e8..3560956424fe 100644
--- a/net/sunrpc/auth_gss/auth_gss.c
+++ b/net/sunrpc/auth_gss/auth_gss.c
@@ -769,7 +769,7 @@ gss_pipe_downcall(struct file *filp, const char __user *src, size_t mlen)
 
 static int gss_pipe_open(struct inode *inode, int new_version)
 {
-	struct net *net = inode->i_sb->s_fs_info;
+	struct net *net = inode_sb(inode)->s_fs_info;
 	struct sunrpc_net *sn = net_generic(net, sunrpc_net_id);
 	int ret = 0;
 
@@ -804,7 +804,7 @@ static int gss_pipe_open_v1(struct inode *inode)
 static void
 gss_pipe_release(struct inode *inode)
 {
-	struct net *net = inode->i_sb->s_fs_info;
+	struct net *net = inode_sb(inode)->s_fs_info;
 	struct rpc_pipe *pipe = RPC_I(inode)->pipe;
 	struct gss_upcall_msg *gss_msg;
 
diff --git a/net/sunrpc/rpc_pipe.c b/net/sunrpc/rpc_pipe.c
index fc97fc3ed637..c2851a1ee91c 100644
--- a/net/sunrpc/rpc_pipe.c
+++ b/net/sunrpc/rpc_pipe.c
@@ -497,10 +497,10 @@ static int __rpc_create_common(struct inode *dir, struct dentry *dentry,
 	struct inode *inode;
 
 	d_drop(dentry);
-	inode = rpc_get_inode(dir->i_sb, mode);
+	inode = rpc_get_inode(inode_sb(dir), mode);
 	if (!inode)
 		goto out_err;
-	inode->i_ino = iunique(dir->i_sb, 100);
+	inode->i_ino = iunique(inode_sb(dir), 100);
 	if (i_fop)
 		inode->i_fop = i_fop;
 	if (private)
-- 
2.15.1

^ permalink raw reply related	[flat|nested] 88+ messages in thread

* [PATCH 10/76] security: Use inode_sb() helper instead of inode->i_sb
  2018-05-08 18:03 [RFC][PATCH 0/76] vfs: 'views' for filesystems with more than one root Mark Fasheh
                   ` (8 preceding siblings ...)
  2018-05-08 18:03 ` [PATCH 09/76] net: " Mark Fasheh
@ 2018-05-08 18:03 ` Mark Fasheh
  2018-05-08 18:03 ` [PATCH 11/76] fs/9p: " Mark Fasheh
                   ` (66 subsequent siblings)
  76 siblings, 0 replies; 88+ messages in thread
From: Mark Fasheh @ 2018-05-08 18:03 UTC (permalink / raw)
  To: linux-fsdevel; +Cc: linux-kernel, linux-btrfs, Mark Fasheh

Signed-off-by: Mark Fasheh <mfasheh@suse.de>
---
 security/apparmor/apparmorfs.c       |  4 ++--
 security/commoncap.c                 |  8 ++++----
 security/inode.c                     |  2 +-
 security/integrity/evm/evm_crypto.c  |  4 ++--
 security/integrity/ima/ima_policy.c  |  4 ++--
 security/integrity/integrity_audit.c |  2 +-
 security/lsm_audit.c                 | 10 +++++-----
 security/selinux/hooks.c             | 23 ++++++++++++-----------
 security/smack/smack_lsm.c           | 26 +++++++++++++-------------
 security/tomoyo/condition.c          |  2 +-
 10 files changed, 43 insertions(+), 42 deletions(-)

diff --git a/security/apparmor/apparmorfs.c b/security/apparmor/apparmorfs.c
index a9428daa69f3..862a4bd89597 100644
--- a/security/apparmor/apparmorfs.c
+++ b/security/apparmor/apparmorfs.c
@@ -181,7 +181,7 @@ static int __aafs_setup_d_inode(struct inode *dir, struct dentry *dentry,
 			       const struct file_operations *fops,
 			       const struct inode_operations *iops)
 {
-	struct inode *inode = new_inode(dir->i_sb);
+	struct inode *inode = new_inode(inode_sb(dir));
 
 	AA_BUG(!dir);
 	AA_BUG(!dentry);
@@ -2349,7 +2349,7 @@ static int aa_mk_null_file(struct dentry *parent)
 		error = PTR_ERR(dentry);
 		goto out;
 	}
-	inode = new_inode(parent->d_inode->i_sb);
+	inode = new_inode(inode_sb(parent->d_inode));
 	if (!inode) {
 		error = -ENOMEM;
 		goto out1;
diff --git a/security/commoncap.c b/security/commoncap.c
index 48620c93d697..f85a10da2ba2 100644
--- a/security/commoncap.c
+++ b/security/commoncap.c
@@ -400,7 +400,7 @@ int cap_inode_getsecurity(struct inode *inode, const char *name, void **buffer,
 	if (ret < 0)
 		return ret;
 
-	fs_ns = inode->i_sb->s_user_ns;
+	fs_ns = inode_sb(inode)->s_user_ns;
 	cap = (struct vfs_cap_data *) tmpbuf;
 	if (is_v2header((size_t) ret, cap)) {
 		/* If this is sizeof(vfs_cap_data) then we're ok with the
@@ -486,7 +486,7 @@ int cap_convert_nscap(struct dentry *dentry, void **ivalue, size_t size)
 	__u32 magic, nsmagic;
 	struct inode *inode = d_backing_inode(dentry);
 	struct user_namespace *task_ns = current_user_ns(),
-		*fs_ns = inode->i_sb->s_user_ns;
+		*fs_ns = inode_sb(inode)->s_user_ns;
 	kuid_t rootid;
 	size_t newsize;
 
@@ -497,7 +497,7 @@ int cap_convert_nscap(struct dentry *dentry, void **ivalue, size_t size)
 	if (!capable_wrt_inode_uidgid(inode, CAP_SETFCAP))
 		return -EPERM;
 	if (size == XATTR_CAPS_SZ_2)
-		if (ns_capable(inode->i_sb->s_user_ns, CAP_SETFCAP))
+		if (ns_capable(inode_sb(inode)->s_user_ns, CAP_SETFCAP))
 			/* user is privileged, just write the v2 */
 			return size;
 
@@ -589,7 +589,7 @@ int get_vfs_caps_from_disk(const struct dentry *dentry, struct cpu_vfs_cap_data
 	if (!inode)
 		return -ENODATA;
 
-	fs_ns = inode->i_sb->s_user_ns;
+	fs_ns = inode_sb(inode)->s_user_ns;
 	size = __vfs_getxattr((struct dentry *)dentry, inode,
 			      XATTR_NAME_CAPS, &data, XATTR_CAPS_SZ);
 	if (size == -ENODATA || size == -EOPNOTSUPP)
diff --git a/security/inode.c b/security/inode.c
index 8dd9ca8848e4..6a3d08901054 100644
--- a/security/inode.c
+++ b/security/inode.c
@@ -131,7 +131,7 @@ static struct dentry *securityfs_create_dentry(const char *name, umode_t mode,
 		goto out1;
 	}
 
-	inode = new_inode(dir->i_sb);
+	inode = new_inode(inode_sb(dir));
 	if (!inode) {
 		error = -ENOMEM;
 		goto out1;
diff --git a/security/integrity/evm/evm_crypto.c b/security/integrity/evm/evm_crypto.c
index 691f3e09154c..979bf5068d46 100644
--- a/security/integrity/evm/evm_crypto.c
+++ b/security/integrity/evm/evm_crypto.c
@@ -170,8 +170,8 @@ static void hmac_add_misc(struct shash_desc *desc, struct inode *inode,
 	crypto_shash_update(desc, (const u8 *)&hmac_misc, sizeof(hmac_misc));
 	if ((evm_hmac_attrs & EVM_ATTR_FSUUID) &&
 	    type != EVM_XATTR_PORTABLE_DIGSIG)
-		crypto_shash_update(desc, &inode->i_sb->s_uuid.b[0],
-				    sizeof(inode->i_sb->s_uuid));
+		crypto_shash_update(desc, &inode_sb(inode)->s_uuid.b[0],
+				    sizeof(inode_sb(inode)->s_uuid));
 	crypto_shash_final(desc, digest);
 }
 
diff --git a/security/integrity/ima/ima_policy.c b/security/integrity/ima/ima_policy.c
index 915f5572c6ff..61ded57e0427 100644
--- a/security/integrity/ima/ima_policy.c
+++ b/security/integrity/ima/ima_policy.c
@@ -265,10 +265,10 @@ static bool ima_match_rules(struct ima_rule_entry *rule, struct inode *inode,
 	    (!(rule->mask & mask) && func != POST_SETATTR))
 		return false;
 	if ((rule->flags & IMA_FSMAGIC)
-	    && rule->fsmagic != inode->i_sb->s_magic)
+	    && rule->fsmagic != inode_sb(inode)->s_magic)
 		return false;
 	if ((rule->flags & IMA_FSUUID) &&
-	    !uuid_equal(&rule->fsuuid, &inode->i_sb->s_uuid))
+	    !uuid_equal(&rule->fsuuid, &inode_sb(inode)->s_uuid))
 		return false;
 	if ((rule->flags & IMA_UID) && !rule->uid_op(cred->uid, rule->uid))
 		return false;
diff --git a/security/integrity/integrity_audit.c b/security/integrity/integrity_audit.c
index 90987d15b6fe..62e569589dc8 100644
--- a/security/integrity/integrity_audit.c
+++ b/security/integrity/integrity_audit.c
@@ -57,7 +57,7 @@ void integrity_audit_msg(int audit_msgno, struct inode *inode,
 	}
 	if (inode) {
 		audit_log_format(ab, " dev=");
-		audit_log_untrustedstring(ab, inode->i_sb->s_id);
+		audit_log_untrustedstring(ab, inode_sb(inode)->s_id);
 		audit_log_format(ab, " ino=%lu", inode->i_ino);
 	}
 	audit_log_format(ab, " res=%d", !result);
diff --git a/security/lsm_audit.c b/security/lsm_audit.c
index 67703dbe29ea..90d557cf7819 100644
--- a/security/lsm_audit.c
+++ b/security/lsm_audit.c
@@ -240,7 +240,7 @@ static void dump_common_audit_data(struct audit_buffer *ab,
 		inode = d_backing_inode(a->u.path.dentry);
 		if (inode) {
 			audit_log_format(ab, " dev=");
-			audit_log_untrustedstring(ab, inode->i_sb->s_id);
+			audit_log_untrustedstring(ab, inode_sb(inode)->s_id);
 			audit_log_format(ab, " ino=%lu", inode->i_ino);
 		}
 		break;
@@ -253,7 +253,7 @@ static void dump_common_audit_data(struct audit_buffer *ab,
 		inode = file_inode(a->u.file);
 		if (inode) {
 			audit_log_format(ab, " dev=");
-			audit_log_untrustedstring(ab, inode->i_sb->s_id);
+			audit_log_untrustedstring(ab, inode_sb(inode)->s_id);
 			audit_log_format(ab, " ino=%lu", inode->i_ino);
 		}
 		break;
@@ -266,7 +266,7 @@ static void dump_common_audit_data(struct audit_buffer *ab,
 		inode = a->u.op->path.dentry->d_inode;
 		if (inode) {
 			audit_log_format(ab, " dev=");
-			audit_log_untrustedstring(ab, inode->i_sb->s_id);
+			audit_log_untrustedstring(ab, inode_sb(inode)->s_id);
 			audit_log_format(ab, " ino=%lu", inode->i_ino);
 		}
 
@@ -282,7 +282,7 @@ static void dump_common_audit_data(struct audit_buffer *ab,
 		inode = d_backing_inode(a->u.dentry);
 		if (inode) {
 			audit_log_format(ab, " dev=");
-			audit_log_untrustedstring(ab, inode->i_sb->s_id);
+			audit_log_untrustedstring(ab, inode_sb(inode)->s_id);
 			audit_log_format(ab, " ino=%lu", inode->i_ino);
 		}
 		break;
@@ -300,7 +300,7 @@ static void dump_common_audit_data(struct audit_buffer *ab,
 			dput(dentry);
 		}
 		audit_log_format(ab, " dev=");
-		audit_log_untrustedstring(ab, inode->i_sb->s_id);
+		audit_log_untrustedstring(ab, inode_sb(inode)->s_id);
 		audit_log_format(ab, " ino=%lu", inode->i_ino);
 		break;
 	}
diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c
index 8644d864e3c1..55bb29dd6726 100644
--- a/security/selinux/hooks.c
+++ b/security/selinux/hooks.c
@@ -331,7 +331,7 @@ static void inode_free_rcu(struct rcu_head *head)
 static void inode_free_security(struct inode *inode)
 {
 	struct inode_security_struct *isec = inode->i_security;
-	struct superblock_security_struct *sbsec = inode->i_sb->s_security;
+	struct superblock_security_struct *sbsec = inode_sb(inode)->s_security;
 
 	/*
 	 * As not all inode security structures are in a list, we check for
@@ -1500,7 +1500,7 @@ static int inode_doinit_with_dentry(struct inode *inode, struct dentry *opt_dent
 	if (isec->sclass == SECCLASS_FILE)
 		isec->sclass = inode_mode_to_security_class(inode->i_mode);
 
-	sbsec = inode->i_sb->s_security;
+	sbsec = inode_sb(inode)->s_security;
 	if (!(sbsec->flags & SE_SBINITIALIZED)) {
 		/* Defer initialization until selinux_complete_init,
 		   after the initial policy is loaded and the security
@@ -1581,7 +1581,8 @@ static int inode_doinit_with_dentry(struct inode *inode, struct dentry *opt_dent
 			if (rc != -ENODATA) {
 				printk(KERN_WARNING "SELinux: %s:  getxattr returned "
 				       "%d for dev=%s ino=%ld\n", __func__,
-				       -rc, inode->i_sb->s_id, inode->i_ino);
+				       -rc, inode_sb(inode)->s_id,
+				       inode->i_ino);
 				kfree(context);
 				goto out;
 			}
@@ -1593,7 +1594,7 @@ static int inode_doinit_with_dentry(struct inode *inode, struct dentry *opt_dent
 							     sbsec->def_sid,
 							     GFP_NOFS);
 			if (rc) {
-				char *dev = inode->i_sb->s_id;
+				char *dev = inode_sb(inode)->s_id;
 				unsigned long ino = inode->i_ino;
 
 				if (rc == -EINVAL) {
@@ -1873,7 +1874,7 @@ selinux_determine_inode_label(const struct task_security_struct *tsec,
 				 const struct qstr *name, u16 tclass,
 				 u32 *_new_isid)
 {
-	const struct superblock_security_struct *sbsec = dir->i_sb->s_security;
+	const struct superblock_security_struct *sbsec = inode_sb(dir)->s_security;
 
 	if ((sbsec->flags & SE_SBINITIALIZED) &&
 	    (sbsec->behavior == SECURITY_FS_USE_MNTPOINT)) {
@@ -1903,7 +1904,7 @@ static int may_create(struct inode *dir,
 	int rc;
 
 	dsec = inode_security(dir);
-	sbsec = dir->i_sb->s_security;
+	sbsec = inode_sb(dir)->s_security;
 
 	sid = tsec->sid;
 
@@ -2106,7 +2107,7 @@ static inline u32 open_file_to_av(struct file *file)
 	u32 av = file_to_av(file);
 	struct inode *inode = file_inode(file);
 
-	if (selinux_policycap_openperm && inode->i_sb->s_magic != SOCKFS_MAGIC)
+	if (selinux_policycap_openperm && inode_sb(inode)->s_magic != SOCKFS_MAGIC)
 		av |= FILE__OPEN;
 
 	return av;
@@ -2939,7 +2940,7 @@ static int selinux_inode_init_security(struct inode *inode, struct inode *dir,
 	int rc;
 	char *context;
 
-	sbsec = dir->i_sb->s_security;
+	sbsec = inode_sb(dir)->s_security;
 
 	newsid = tsec->create_sid;
 
@@ -3127,7 +3128,7 @@ static int selinux_inode_setattr(struct dentry *dentry, struct iattr *iattr)
 		return dentry_has_perm(cred, dentry, FILE__SETATTR);
 
 	if (selinux_policycap_openperm &&
-	    inode->i_sb->s_magic != SOCKFS_MAGIC &&
+	    inode_sb(inode)->s_magic != SOCKFS_MAGIC &&
 	    (ia_valid & ATTR_SIZE) &&
 	    !(ia_valid & ATTR_FILE))
 		av |= FILE__OPEN;
@@ -3172,7 +3173,7 @@ static int selinux_inode_setxattr(struct dentry *dentry, const char *name,
 		return dentry_has_perm(current_cred(), dentry, FILE__SETATTR);
 	}
 
-	sbsec = inode->i_sb->s_security;
+	sbsec = inode_sb(inode)->s_security;
 	if (!(sbsec->flags & SBLABEL_MNT))
 		return -EOPNOTSUPP;
 
@@ -3253,7 +3254,7 @@ static void selinux_inode_post_setxattr(struct dentry *dentry, const char *name,
 	if (rc) {
 		printk(KERN_ERR "SELinux:  unable to map context to SID"
 		       "for (%s, %lu), rc=%d\n",
-		       inode->i_sb->s_id, inode->i_ino, -rc);
+		       inode_sb(inode)->s_id, inode->i_ino, -rc);
 		return;
 	}
 
diff --git a/security/smack/smack_lsm.c b/security/smack/smack_lsm.c
index 03fdecba93bb..cf1dacb55d48 100644
--- a/security/smack/smack_lsm.c
+++ b/security/smack/smack_lsm.c
@@ -170,7 +170,7 @@ static int smk_bu_inode(struct inode *inode, int mode, int rc)
 
 	if (isp->smk_flags & SMK_INODE_IMPURE)
 		pr_info("Smack Unconfined Corruption: inode=(%s %ld) %s\n",
-			inode->i_sb->s_id, inode->i_ino, current->comm);
+			inode_sb(inode)->s_id, inode->i_ino, current->comm);
 
 	if (rc <= 0)
 		return rc;
@@ -184,7 +184,7 @@ static int smk_bu_inode(struct inode *inode, int mode, int rc)
 
 	pr_info("Smack %s: (%s %s %s) inode=(%s %ld) %s\n", smk_bu_mess[rc],
 		tsp->smk_task->smk_known, isp->smk_inode->smk_known, acc,
-		inode->i_sb->s_id, inode->i_ino, current->comm);
+		inode_sb(inode)->s_id, inode->i_ino, current->comm);
 	return 0;
 }
 #else
@@ -202,7 +202,7 @@ static int smk_bu_file(struct file *file, int mode, int rc)
 
 	if (isp->smk_flags & SMK_INODE_IMPURE)
 		pr_info("Smack Unconfined Corruption: inode=(%s %ld) %s\n",
-			inode->i_sb->s_id, inode->i_ino, current->comm);
+			inode_sb(inode)->s_id, inode->i_ino, current->comm);
 
 	if (rc <= 0)
 		return rc;
@@ -212,7 +212,7 @@ static int smk_bu_file(struct file *file, int mode, int rc)
 	smk_bu_mode(mode, acc);
 	pr_info("Smack %s: (%s %s %s) file=(%s %ld %pD) %s\n", smk_bu_mess[rc],
 		sskp->smk_known, smk_of_inode(inode)->smk_known, acc,
-		inode->i_sb->s_id, inode->i_ino, file,
+		inode_sb(inode)->s_id, inode->i_ino, file,
 		current->comm);
 	return 0;
 }
@@ -232,7 +232,7 @@ static int smk_bu_credfile(const struct cred *cred, struct file *file,
 
 	if (isp->smk_flags & SMK_INODE_IMPURE)
 		pr_info("Smack Unconfined Corruption: inode=(%s %ld) %s\n",
-			inode->i_sb->s_id, inode->i_ino, current->comm);
+			inode_sb(inode)->s_id, inode->i_ino, current->comm);
 
 	if (rc <= 0)
 		return rc;
@@ -242,7 +242,7 @@ static int smk_bu_credfile(const struct cred *cred, struct file *file,
 	smk_bu_mode(mode, acc);
 	pr_info("Smack %s: (%s %s %s) file=(%s %ld %pD) %s\n", smk_bu_mess[rc],
 		sskp->smk_known, smk_of_inode(inode)->smk_known, acc,
-		inode->i_sb->s_id, inode->i_ino, file,
+		inode_sb(inode)->s_id, inode->i_ino, file,
 		current->comm);
 	return 0;
 }
@@ -924,7 +924,7 @@ static int smack_bprm_set_creds(struct linux_binprm *bprm)
 	if (isp->smk_task == NULL || isp->smk_task == bsp->smk_task)
 		return 0;
 
-	sbsp = inode->i_sb->s_security;
+	sbsp = inode_sb(inode)->s_security;
 	if ((sbsp->smk_flags & SMK_SB_UNTRUSTED) &&
 	    isp->smk_task != sbsp->smk_root)
 		return 0;
@@ -1213,7 +1213,7 @@ static int smack_inode_rename(struct inode *old_inode,
  */
 static int smack_inode_permission(struct inode *inode, int mask)
 {
-	struct superblock_smack *sbsp = inode->i_sb->s_security;
+	struct superblock_smack *sbsp = inode_sb(inode)->s_security;
 	struct smk_audit_info ad;
 	int no_block = mask & MAY_NOT_BLOCK;
 	int rc;
@@ -1493,7 +1493,7 @@ static int smack_inode_getsecurity(struct inode *inode,
 		/*
 		 * The rest of the Smack xattrs are only on sockets.
 		 */
-		sbp = ip->i_sb;
+		sbp = inode_sb(ip);
 		if (sbp->s_magic != SOCKFS_MAGIC)
 			return -EOPNOTSUPP;
 
@@ -1737,7 +1737,7 @@ static int smack_mmap_file(struct file *file,
 	isp = file_inode(file)->i_security;
 	if (isp->smk_mmap == NULL)
 		return 0;
-	sbsp = file_inode(file)->i_sb->s_security;
+	sbsp = inode_sb(file_inode(file))->s_security;
 	if (sbsp->smk_flags & SMK_SB_UNTRUSTED &&
 	    isp->smk_mmap != sbsp->smk_root)
 		return -EACCES;
@@ -1884,7 +1884,7 @@ static int smack_file_receive(struct file *file)
 	smk_ad_init(&ad, __func__, LSM_AUDIT_DATA_PATH);
 	smk_ad_setfield_u_fs_path(&ad, file->f_path);
 
-	if (inode->i_sb->s_magic == SOCKFS_MAGIC) {
+	if (inode_sb(inode)->s_magic == SOCKFS_MAGIC) {
 		sock = SOCKET_I(inode);
 		ssp = sock->sk->sk_security;
 		tsp = current_security();
@@ -2759,7 +2759,7 @@ static int smack_inode_setsecurity(struct inode *inode, const char *name,
 	/*
 	 * The rest of the Smack xattrs are only on sockets.
 	 */
-	if (inode->i_sb->s_magic != SOCKFS_MAGIC)
+	if (inode_sb(inode)->s_magic != SOCKFS_MAGIC)
 		return -EOPNOTSUPP;
 
 	sock = SOCKET_I(inode);
@@ -3414,7 +3414,7 @@ static void smack_d_instantiate(struct dentry *opt_dentry, struct inode *inode)
 	if (isp->smk_flags & SMK_INODE_INSTANT)
 		goto unlockandout;
 
-	sbp = inode->i_sb;
+	sbp = inode_sb(inode);
 	sbsp = sbp->s_security;
 	/*
 	 * We're going to use the superblock default label
diff --git a/security/tomoyo/condition.c b/security/tomoyo/condition.c
index 8d0e1b9c9c57..3422f5f57e43 100644
--- a/security/tomoyo/condition.c
+++ b/security/tomoyo/condition.c
@@ -722,7 +722,7 @@ void tomoyo_get_attributes(struct tomoyo_obj_info *obj)
 			stat->gid  = inode->i_gid;
 			stat->ino  = inode->i_ino;
 			stat->mode = inode->i_mode;
-			stat->dev  = inode->i_sb->s_dev;
+			stat->dev  = inode_sb(inode)->s_dev;
 			stat->rdev = inode->i_rdev;
 			obj->stat_valid[i] = true;
 		}
-- 
2.15.1

^ permalink raw reply related	[flat|nested] 88+ messages in thread

* [PATCH 11/76] fs/9p: Use inode_sb() helper instead of inode->i_sb
  2018-05-08 18:03 [RFC][PATCH 0/76] vfs: 'views' for filesystems with more than one root Mark Fasheh
                   ` (9 preceding siblings ...)
  2018-05-08 18:03 ` [PATCH 10/76] security: " Mark Fasheh
@ 2018-05-08 18:03 ` Mark Fasheh
  2018-05-08 18:03 ` [PATCH 12/76] fs/adfs: " Mark Fasheh
                   ` (65 subsequent siblings)
  76 siblings, 0 replies; 88+ messages in thread
From: Mark Fasheh @ 2018-05-08 18:03 UTC (permalink / raw)
  To: linux-fsdevel; +Cc: linux-kernel, linux-btrfs, Mark Fasheh

Signed-off-by: Mark Fasheh <mfasheh@suse.de>
---
 fs/9p/acl.c            |  3 ++-
 fs/9p/v9fs.h           |  2 +-
 fs/9p/vfs_inode.c      |  8 ++++----
 fs/9p/vfs_inode_dotl.c | 14 +++++++-------
 4 files changed, 14 insertions(+), 13 deletions(-)

diff --git a/fs/9p/acl.c b/fs/9p/acl.c
index 082d227fa56b..ccd91eb83725 100644
--- a/fs/9p/acl.c
+++ b/fs/9p/acl.c
@@ -266,7 +266,8 @@ static int v9fs_xattr_set_acl(const struct xattr_handler *handler,
 		if (IS_ERR(acl))
 			return PTR_ERR(acl);
 		else if (acl) {
-			retval = posix_acl_valid(inode->i_sb->s_user_ns, acl);
+			retval = posix_acl_valid(inode_sb(inode)->s_user_ns,
+						 acl);
 			if (retval)
 				goto err_out;
 		}
diff --git a/fs/9p/v9fs.h b/fs/9p/v9fs.h
index 982e017acadb..9e27ef7ebeaa 100644
--- a/fs/9p/v9fs.h
+++ b/fs/9p/v9fs.h
@@ -171,7 +171,7 @@ extern struct inode *v9fs_inode_from_fid_dotl(struct v9fs_session_info *v9ses,
 
 static inline struct v9fs_session_info *v9fs_inode2v9ses(struct inode *inode)
 {
-	return (inode->i_sb->s_fs_info);
+	return (inode_sb(inode)->s_fs_info);
 }
 
 static inline struct v9fs_session_info *v9fs_dentry2v9ses(struct dentry *dentry)
diff --git a/fs/9p/vfs_inode.c b/fs/9p/vfs_inode.c
index bdabb2765d1b..fb6220552fc6 100644
--- a/fs/9p/vfs_inode.c
+++ b/fs/9p/vfs_inode.c
@@ -690,7 +690,7 @@ v9fs_create(struct v9fs_session_info *v9ses, struct inode *dir,
 		/*
 		 * instantiate inode and assign the unopened fid to the dentry
 		 */
-		inode = v9fs_get_new_inode_from_fid(v9ses, fid, dir->i_sb);
+		inode = v9fs_get_new_inode_from_fid(v9ses, fid, inode_sb(dir));
 		if (IS_ERR(inode)) {
 			err = PTR_ERR(inode);
 			p9_debug(P9_DEBUG_VFS,
@@ -820,9 +820,9 @@ struct dentry *v9fs_vfs_lookup(struct inode *dir, struct dentry *dentry,
 	 * inode. But with cache disabled, lookup should do this.
 	 */
 	if (v9ses->cache == CACHE_LOOSE || v9ses->cache == CACHE_FSCACHE)
-		inode = v9fs_get_inode_from_fid(v9ses, fid, dir->i_sb);
+		inode = v9fs_get_inode_from_fid(v9ses, fid, inode_sb(dir));
 	else
-		inode = v9fs_get_new_inode_from_fid(v9ses, fid, dir->i_sb);
+		inode = v9fs_get_new_inode_from_fid(v9ses, fid, inode_sb(dir));
 	if (IS_ERR(inode)) {
 		p9_client_clunk(fid);
 		return ERR_CAST(inode);
@@ -1425,7 +1425,7 @@ int v9fs_refresh_inode(struct p9_fid *fid, struct inode *inode)
 	 * because we may have cached data
 	 */
 	i_size = inode->i_size;
-	v9fs_stat2inode(st, inode, inode->i_sb);
+	v9fs_stat2inode(st, inode, inode_sb(inode));
 	if (v9ses->cache == CACHE_LOOSE || v9ses->cache == CACHE_FSCACHE)
 		inode->i_size = i_size;
 	spin_unlock(&inode->i_lock);
diff --git a/fs/9p/vfs_inode_dotl.c b/fs/9p/vfs_inode_dotl.c
index 7f6ae21a27b3..ed462264239c 100644
--- a/fs/9p/vfs_inode_dotl.c
+++ b/fs/9p/vfs_inode_dotl.c
@@ -318,7 +318,7 @@ v9fs_vfs_atomic_open_dotl(struct inode *dir, struct dentry *dentry,
 		fid = NULL;
 		goto error;
 	}
-	inode = v9fs_get_new_inode_from_fid(v9ses, fid, dir->i_sb);
+	inode = v9fs_get_new_inode_from_fid(v9ses, fid, inode_sb(dir));
 	if (IS_ERR(inode)) {
 		err = PTR_ERR(inode);
 		p9_debug(P9_DEBUG_VFS, "inode creation failed %d\n", err);
@@ -435,7 +435,7 @@ static int v9fs_vfs_mkdir_dotl(struct inode *dir,
 
 	/* instantiate inode and assign the unopened fid to the dentry */
 	if (v9ses->cache == CACHE_LOOSE || v9ses->cache == CACHE_FSCACHE) {
-		inode = v9fs_get_new_inode_from_fid(v9ses, fid, dir->i_sb);
+		inode = v9fs_get_new_inode_from_fid(v9ses, fid, inode_sb(dir));
 		if (IS_ERR(inode)) {
 			err = PTR_ERR(inode);
 			p9_debug(P9_DEBUG_VFS, "inode creation failed %d\n",
@@ -453,7 +453,7 @@ static int v9fs_vfs_mkdir_dotl(struct inode *dir,
 		 * inode with stat. We need to get an inode
 		 * so that we can set the acl with dentry
 		 */
-		inode = v9fs_get_inode(dir->i_sb, mode, 0);
+		inode = v9fs_get_inode(inode_sb(dir), mode, 0);
 		if (IS_ERR(inode)) {
 			err = PTR_ERR(inode);
 			goto error;
@@ -723,7 +723,7 @@ v9fs_vfs_symlink_dotl(struct inode *dir, struct dentry *dentry,
 		}
 
 		/* instantiate inode and assign the unopened fid to dentry */
-		inode = v9fs_get_new_inode_from_fid(v9ses, fid, dir->i_sb);
+		inode = v9fs_get_new_inode_from_fid(v9ses, fid, inode_sb(dir));
 		if (IS_ERR(inode)) {
 			err = PTR_ERR(inode);
 			p9_debug(P9_DEBUG_VFS, "inode creation failed %d\n",
@@ -736,7 +736,7 @@ v9fs_vfs_symlink_dotl(struct inode *dir, struct dentry *dentry,
 		err = 0;
 	} else {
 		/* Not in cached mode. No need to populate inode with stat */
-		inode = v9fs_get_inode(dir->i_sb, S_IFLNK, 0);
+		inode = v9fs_get_inode(inode_sb(dir), S_IFLNK, 0);
 		if (IS_ERR(inode)) {
 			err = PTR_ERR(inode);
 			goto error;
@@ -864,7 +864,7 @@ v9fs_vfs_mknod_dotl(struct inode *dir, struct dentry *dentry, umode_t omode,
 
 	/* instantiate inode and assign the unopened fid to the dentry */
 	if (v9ses->cache == CACHE_LOOSE || v9ses->cache == CACHE_FSCACHE) {
-		inode = v9fs_get_new_inode_from_fid(v9ses, fid, dir->i_sb);
+		inode = v9fs_get_new_inode_from_fid(v9ses, fid, inode_sb(dir));
 		if (IS_ERR(inode)) {
 			err = PTR_ERR(inode);
 			p9_debug(P9_DEBUG_VFS, "inode creation failed %d\n",
@@ -881,7 +881,7 @@ v9fs_vfs_mknod_dotl(struct inode *dir, struct dentry *dentry, umode_t omode,
 		 * Not in cached mode. No need to populate inode with stat.
 		 * socket syscall returns a fd, so we need instantiate
 		 */
-		inode = v9fs_get_inode(dir->i_sb, mode, rdev);
+		inode = v9fs_get_inode(inode_sb(dir), mode, rdev);
 		if (IS_ERR(inode)) {
 			err = PTR_ERR(inode);
 			goto error;
-- 
2.15.1

^ permalink raw reply related	[flat|nested] 88+ messages in thread

* [PATCH 12/76] fs/adfs: Use inode_sb() helper instead of inode->i_sb
  2018-05-08 18:03 [RFC][PATCH 0/76] vfs: 'views' for filesystems with more than one root Mark Fasheh
                   ` (10 preceding siblings ...)
  2018-05-08 18:03 ` [PATCH 11/76] fs/9p: " Mark Fasheh
@ 2018-05-08 18:03 ` Mark Fasheh
  2018-05-08 18:03 ` [PATCH 13/76] fs/affs: " Mark Fasheh
                   ` (64 subsequent siblings)
  76 siblings, 0 replies; 88+ messages in thread
From: Mark Fasheh @ 2018-05-08 18:03 UTC (permalink / raw)
  To: linux-fsdevel; +Cc: linux-kernel, linux-btrfs, Mark Fasheh

Signed-off-by: Mark Fasheh <mfasheh@suse.de>
---
 fs/adfs/dir.c   | 6 +++---
 fs/adfs/inode.c | 8 ++++----
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/fs/adfs/dir.c b/fs/adfs/dir.c
index 29444c83da48..e28357fcb2d4 100644
--- a/fs/adfs/dir.c
+++ b/fs/adfs/dir.c
@@ -20,7 +20,7 @@ static int
 adfs_readdir(struct file *file, struct dir_context *ctx)
 {
 	struct inode *inode = file_inode(file);
-	struct super_block *sb = inode->i_sb;
+	struct super_block *sb = inode_sb(inode);
 	const struct adfs_dir_ops *ops = ADFS_SB(sb)->s_dir;
 	struct object_info obj;
 	struct adfs_dir dir;
@@ -128,7 +128,7 @@ adfs_match(const struct qstr *name, struct object_info *obj)
 static int
 adfs_dir_lookup_byname(struct inode *inode, const struct qstr *name, struct object_info *obj)
 {
-	struct super_block *sb = inode->i_sb;
+	struct super_block *sb = inode_sb(inode);
 	const struct adfs_dir_ops *ops = ADFS_SB(sb)->s_dir;
 	struct adfs_dir dir;
 	int ret;
@@ -271,7 +271,7 @@ adfs_lookup(struct inode *dir, struct dentry *dentry, unsigned int flags)
 		 * This only returns NULL if get_empty_inode
 		 * fails.
 		 */
-		inode = adfs_iget(dir->i_sb, &obj);
+		inode = adfs_iget(inode_sb(dir), &obj);
 		if (inode)
 			error = 0;
 	}
diff --git a/fs/adfs/inode.c b/fs/adfs/inode.c
index 8dbd36f5e581..c946b072ef7f 100644
--- a/fs/adfs/inode.c
+++ b/fs/adfs/inode.c
@@ -23,9 +23,9 @@ adfs_get_block(struct inode *inode, sector_t block, struct buffer_head *bh,
 		if (block >= inode->i_blocks)
 			goto abort_toobig;
 
-		block = __adfs_block_map(inode->i_sb, inode->i_ino, block);
+		block = __adfs_block_map(inode_sb(inode), inode->i_ino, block);
 		if (block)
-			map_bh(bh, inode->i_sb, block);
+			map_bh(bh, inode_sb(inode), block);
 		return 0;
 	}
 	/* don't support allocation of blocks yet */
@@ -299,7 +299,7 @@ int
 adfs_notify_change(struct dentry *dentry, struct iattr *attr)
 {
 	struct inode *inode = d_inode(dentry);
-	struct super_block *sb = inode->i_sb;
+	struct super_block *sb = inode_sb(inode);
 	unsigned int ia_valid = attr->ia_valid;
 	int error;
 	
@@ -354,7 +354,7 @@ adfs_notify_change(struct dentry *dentry, struct iattr *attr)
  */
 int adfs_write_inode(struct inode *inode, struct writeback_control *wbc)
 {
-	struct super_block *sb = inode->i_sb;
+	struct super_block *sb = inode_sb(inode);
 	struct object_info obj;
 	int ret;
 
-- 
2.15.1

^ permalink raw reply related	[flat|nested] 88+ messages in thread

* [PATCH 13/76] fs/affs: Use inode_sb() helper instead of inode->i_sb
  2018-05-08 18:03 [RFC][PATCH 0/76] vfs: 'views' for filesystems with more than one root Mark Fasheh
                   ` (11 preceding siblings ...)
  2018-05-08 18:03 ` [PATCH 12/76] fs/adfs: " Mark Fasheh
@ 2018-05-08 18:03 ` Mark Fasheh
  2018-05-08 18:03 ` [PATCH 14/76] fs/afs: " Mark Fasheh
                   ` (63 subsequent siblings)
  76 siblings, 0 replies; 88+ messages in thread
From: Mark Fasheh @ 2018-05-08 18:03 UTC (permalink / raw)
  To: linux-fsdevel; +Cc: linux-kernel, linux-btrfs, Mark Fasheh

Signed-off-by: Mark Fasheh <mfasheh@suse.de>
---
 fs/affs/amigaffs.c | 10 +++++-----
 fs/affs/bitmap.c   |  2 +-
 fs/affs/dir.c      |  2 +-
 fs/affs/file.c     | 28 ++++++++++++++--------------
 fs/affs/inode.c    | 16 ++++++++--------
 fs/affs/namei.c    | 12 ++++++------
 fs/affs/symlink.c  |  4 ++--
 7 files changed, 37 insertions(+), 37 deletions(-)

diff --git a/fs/affs/amigaffs.c b/fs/affs/amigaffs.c
index 14a6c1b90c9f..42dacf56dd0e 100644
--- a/fs/affs/amigaffs.c
+++ b/fs/affs/amigaffs.c
@@ -25,7 +25,7 @@
 int
 affs_insert_hash(struct inode *dir, struct buffer_head *bh)
 {
-	struct super_block *sb = dir->i_sb;
+	struct super_block *sb = inode_sb(dir);
 	struct buffer_head *dir_bh;
 	u32 ino, hash_ino;
 	int offset;
@@ -80,7 +80,7 @@ affs_remove_hash(struct inode *dir, struct buffer_head *rem_bh)
 	__be32 ino;
 	int offset, retval;
 
-	sb = dir->i_sb;
+	sb = inode_sb(dir);
 	rem_ino = rem_bh->b_blocknr;
 	offset = affs_hash_name(sb, AFFS_TAIL(sb, rem_bh)->name+1, AFFS_TAIL(sb, rem_bh)->name[0]);
 	pr_debug("%s(dir=%lu, ino=%d, hashval=%d)\n", __func__, dir->i_ino,
@@ -142,7 +142,7 @@ static int
 affs_remove_link(struct dentry *dentry)
 {
 	struct inode *dir, *inode = d_inode(dentry);
-	struct super_block *sb = inode->i_sb;
+	struct super_block *sb = inode_sb(inode);
 	struct buffer_head *bh, *link_bh = NULL;
 	u32 link_ino, ino;
 	int retval;
@@ -233,7 +233,7 @@ affs_remove_link(struct dentry *dentry)
 static int
 affs_empty_dir(struct inode *inode)
 {
-	struct super_block *sb = inode->i_sb;
+	struct super_block *sb = inode_sb(inode);
 	struct buffer_head *bh;
 	int retval, size;
 
@@ -272,7 +272,7 @@ affs_remove_header(struct dentry *dentry)
 	int retval;
 
 	dir = d_inode(dentry->d_parent);
-	sb = dir->i_sb;
+	sb = inode_sb(dir);
 
 	retval = -ENOENT;
 	inode = d_inode(dentry);
diff --git a/fs/affs/bitmap.c b/fs/affs/bitmap.c
index 5ba9ef2742f6..b6f7955680c4 100644
--- a/fs/affs/bitmap.c
+++ b/fs/affs/bitmap.c
@@ -122,7 +122,7 @@ affs_alloc_block(struct inode *inode, u32 goal)
 	u32 blk, bmap, bit, mask, mask2, tmp;
 	int i;
 
-	sb = inode->i_sb;
+	sb = inode_sb(inode);
 	sbi = AFFS_SB(sb);
 
 	pr_debug("balloc(inode=%lu,goal=%u): ", inode->i_ino, goal);
diff --git a/fs/affs/dir.c b/fs/affs/dir.c
index b2bf7016e1b3..098b52a09634 100644
--- a/fs/affs/dir.c
+++ b/fs/affs/dir.c
@@ -45,7 +45,7 @@ static int
 affs_readdir(struct file *file, struct dir_context *ctx)
 {
 	struct inode		*inode = file_inode(file);
-	struct super_block	*sb = inode->i_sb;
+	struct super_block	*sb = inode_sb(inode);
 	struct buffer_head	*dir_bh = NULL;
 	struct buffer_head	*fh_bh = NULL;
 	unsigned char		*name;
diff --git a/fs/affs/file.c b/fs/affs/file.c
index a85817f54483..e253f1137921 100644
--- a/fs/affs/file.c
+++ b/fs/affs/file.c
@@ -47,7 +47,7 @@ affs_file_release(struct inode *inode, struct file *filp)
 static int
 affs_grow_extcache(struct inode *inode, u32 lc_idx)
 {
-	struct super_block	*sb = inode->i_sb;
+	struct super_block	*sb = inode_sb(inode);
 	struct buffer_head	*bh;
 	u32 lc_max;
 	int i, j, key;
@@ -117,7 +117,7 @@ affs_grow_extcache(struct inode *inode, u32 lc_idx)
 static struct buffer_head *
 affs_alloc_extblock(struct inode *inode, struct buffer_head *bh, u32 ext)
 {
-	struct super_block *sb = inode->i_sb;
+	struct super_block *sb = inode_sb(inode);
 	struct buffer_head *new_bh;
 	u32 blocknr, tmp;
 
@@ -169,7 +169,7 @@ affs_get_extblock(struct inode *inode, u32 ext)
 static struct buffer_head *
 affs_get_extblock_slow(struct inode *inode, u32 ext)
 {
-	struct super_block *sb = inode->i_sb;
+	struct super_block *sb = inode_sb(inode);
 	struct buffer_head *bh;
 	u32 ext_key;
 	u32 lc_idx, lc_off, ac_idx;
@@ -294,7 +294,7 @@ affs_get_extblock_slow(struct inode *inode, u32 ext)
 static int
 affs_get_block(struct inode *inode, sector_t block, struct buffer_head *bh_result, int create)
 {
-	struct super_block	*sb = inode->i_sb;
+	struct super_block	*sb = inode_sb(inode);
 	struct buffer_head	*ext_bh;
 	u32			 ext;
 
@@ -353,7 +353,7 @@ affs_get_block(struct inode *inode, sector_t block, struct buffer_head *bh_resul
 	return 0;
 
 err_big:
-	affs_error(inode->i_sb, "get_block", "strange block request %llu",
+	affs_error(inode_sb(inode), "get_block", "strange block request %llu",
 		   (unsigned long long)block);
 	return -EIO;
 err_ext:
@@ -451,7 +451,7 @@ affs_bread_ino(struct inode *inode, int block, int create)
 	tmp_bh.b_state = 0;
 	err = affs_get_block(inode, block, &tmp_bh, create);
 	if (!err) {
-		bh = affs_bread(inode->i_sb, tmp_bh.b_blocknr);
+		bh = affs_bread(inode_sb(inode), tmp_bh.b_blocknr);
 		if (bh) {
 			bh->b_state |= tmp_bh.b_state;
 			return bh;
@@ -470,7 +470,7 @@ affs_getzeroblk_ino(struct inode *inode, int block)
 	tmp_bh.b_state = 0;
 	err = affs_get_block(inode, block, &tmp_bh, 1);
 	if (!err) {
-		bh = affs_getzeroblk(inode->i_sb, tmp_bh.b_blocknr);
+		bh = affs_getzeroblk(inode_sb(inode), tmp_bh.b_blocknr);
 		if (bh) {
 			bh->b_state |= tmp_bh.b_state;
 			return bh;
@@ -489,7 +489,7 @@ affs_getemptyblk_ino(struct inode *inode, int block)
 	tmp_bh.b_state = 0;
 	err = affs_get_block(inode, block, &tmp_bh, 1);
 	if (!err) {
-		bh = affs_getemptyblk(inode->i_sb, tmp_bh.b_blocknr);
+		bh = affs_getemptyblk(inode_sb(inode), tmp_bh.b_blocknr);
 		if (bh) {
 			bh->b_state |= tmp_bh.b_state;
 			return bh;
@@ -503,7 +503,7 @@ static int
 affs_do_readpage_ofs(struct page *page, unsigned to, int create)
 {
 	struct inode *inode = page->mapping->host;
-	struct super_block *sb = inode->i_sb;
+	struct super_block *sb = inode_sb(inode);
 	struct buffer_head *bh;
 	char *data;
 	unsigned pos = 0;
@@ -539,7 +539,7 @@ affs_do_readpage_ofs(struct page *page, unsigned to, int create)
 static int
 affs_extent_file_ofs(struct inode *inode, u32 newsize)
 {
-	struct super_block *sb = inode->i_sb;
+	struct super_block *sb = inode_sb(inode);
 	struct buffer_head *bh, *prev_bh;
 	u32 bidx, boff;
 	u32 size, bsize;
@@ -671,7 +671,7 @@ static int affs_write_end_ofs(struct file *file, struct address_space *mapping,
 				struct page *page, void *fsdata)
 {
 	struct inode *inode = mapping->host;
-	struct super_block *sb = inode->i_sb;
+	struct super_block *sb = inode_sb(inode);
 	struct buffer_head *bh, *prev_bh;
 	char *data;
 	u32 bidx, boff, bsize;
@@ -819,7 +819,7 @@ const struct address_space_operations affs_aops_ofs = {
 void
 affs_free_prealloc(struct inode *inode)
 {
-	struct super_block *sb = inode->i_sb;
+	struct super_block *sb = inode_sb(inode);
 
 	pr_debug("free_prealloc(ino=%lu)\n", inode->i_ino);
 
@@ -834,7 +834,7 @@ affs_free_prealloc(struct inode *inode)
 void
 affs_truncate(struct inode *inode)
 {
-	struct super_block *sb = inode->i_sb;
+	struct super_block *sb = inode_sb(inode);
 	u32 ext, ext_key;
 	u32 last_blk, blkcnt, blk;
 	u32 size;
@@ -961,7 +961,7 @@ int affs_file_fsync(struct file *filp, loff_t start, loff_t end, int datasync)
 
 	inode_lock(inode);
 	ret = write_inode_now(inode, 0);
-	err = sync_blockdev(inode->i_sb->s_bdev);
+	err = sync_blockdev(inode_sb(inode)->s_bdev);
 	if (!ret)
 		ret = err;
 	inode_unlock(inode);
diff --git a/fs/affs/inode.c b/fs/affs/inode.c
index 73598bff8506..f64d01e33a29 100644
--- a/fs/affs/inode.c
+++ b/fs/affs/inode.c
@@ -169,7 +169,7 @@ struct inode *affs_iget(struct super_block *sb, unsigned long ino)
 int
 affs_write_inode(struct inode *inode, struct writeback_control *wbc)
 {
-	struct super_block	*sb = inode->i_sb;
+	struct super_block	*sb = inode_sb(inode);
 	struct buffer_head	*bh;
 	struct affs_tail	*tail;
 	uid_t			 uid;
@@ -228,13 +228,13 @@ affs_notify_change(struct dentry *dentry, struct iattr *attr)
 		goto out;
 
 	if (((attr->ia_valid & ATTR_UID) &&
-	      affs_test_opt(AFFS_SB(inode->i_sb)->s_flags, SF_SETUID)) ||
+	      affs_test_opt(AFFS_SB(inode_sb(inode))->s_flags, SF_SETUID)) ||
 	    ((attr->ia_valid & ATTR_GID) &&
-	      affs_test_opt(AFFS_SB(inode->i_sb)->s_flags, SF_SETGID)) ||
+	      affs_test_opt(AFFS_SB(inode_sb(inode))->s_flags, SF_SETGID)) ||
 	    ((attr->ia_valid & ATTR_MODE) &&
-	     (AFFS_SB(inode->i_sb)->s_flags &
+	     (AFFS_SB(inode_sb(inode))->s_flags &
 	      (AFFS_MOUNT_SF_SETMODE | AFFS_MOUNT_SF_IMMUTABLE)))) {
-		if (!affs_test_opt(AFFS_SB(inode->i_sb)->s_flags, SF_QUIET))
+		if (!affs_test_opt(AFFS_SB(inode_sb(inode))->s_flags, SF_QUIET))
 			error = -EPERM;
 		goto out;
 	}
@@ -286,13 +286,13 @@ affs_evict_inode(struct inode *inode)
 	AFFS_I(inode)->i_ext_bh = NULL;
 
 	if (!inode->i_nlink)
-		affs_free_block(inode->i_sb, inode->i_ino);
+		affs_free_block(inode_sb(inode), inode->i_ino);
 }
 
 struct inode *
 affs_new_inode(struct inode *dir)
 {
-	struct super_block	*sb = dir->i_sb;
+	struct super_block	*sb = inode_sb(dir);
 	struct inode		*inode;
 	u32			 block;
 	struct buffer_head	*bh;
@@ -349,7 +349,7 @@ affs_new_inode(struct inode *dir)
 int
 affs_add_entry(struct inode *dir, struct inode *inode, struct dentry *dentry, s32 type)
 {
-	struct super_block *sb = dir->i_sb;
+	struct super_block *sb = inode_sb(dir);
 	struct buffer_head *inode_bh = NULL;
 	struct buffer_head *bh;
 	u32 block = 0;
diff --git a/fs/affs/namei.c b/fs/affs/namei.c
index d8aa0ae3d037..3fb3c33618f6 100644
--- a/fs/affs/namei.c
+++ b/fs/affs/namei.c
@@ -169,7 +169,7 @@ affs_hash_name(struct super_block *sb, const u8 *name, unsigned int len)
 static struct buffer_head *
 affs_find_entry(struct inode *dir, struct dentry *dentry)
 {
-	struct super_block *sb = dir->i_sb;
+	struct super_block *sb = inode_sb(dir);
 	struct buffer_head *bh;
 	toupper_t toupper = affs_get_toupper(sb);
 	u32 key;
@@ -198,7 +198,7 @@ affs_find_entry(struct inode *dir, struct dentry *dentry)
 struct dentry *
 affs_lookup(struct inode *dir, struct dentry *dentry, unsigned int flags)
 {
-	struct super_block *sb = dir->i_sb;
+	struct super_block *sb = inode_sb(dir);
 	struct buffer_head *bh;
 	struct inode *inode = NULL;
 
@@ -241,7 +241,7 @@ affs_unlink(struct inode *dir, struct dentry *dentry)
 int
 affs_create(struct inode *dir, struct dentry *dentry, umode_t mode, bool excl)
 {
-	struct super_block *sb = dir->i_sb;
+	struct super_block *sb = inode_sb(dir);
 	struct inode	*inode;
 	int		 error;
 
@@ -310,7 +310,7 @@ affs_rmdir(struct inode *dir, struct dentry *dentry)
 int
 affs_symlink(struct inode *dir, struct dentry *dentry, const char *symname)
 {
-	struct super_block	*sb = dir->i_sb;
+	struct super_block	*sb = inode_sb(dir);
 	struct buffer_head	*bh;
 	struct inode		*inode;
 	char			*p;
@@ -399,7 +399,7 @@ static int
 affs_rename(struct inode *old_dir, struct dentry *old_dentry,
 	    struct inode *new_dir, struct dentry *new_dentry)
 {
-	struct super_block *sb = old_dir->i_sb;
+	struct super_block *sb = inode_sb(old_dir);
 	struct buffer_head *bh = NULL;
 	int retval;
 
@@ -447,7 +447,7 @@ affs_xrename(struct inode *old_dir, struct dentry *old_dentry,
 	     struct inode *new_dir, struct dentry *new_dentry)
 {
 
-	struct super_block *sb = old_dir->i_sb;
+	struct super_block *sb = inode_sb(old_dir);
 	struct buffer_head *bh_old = NULL;
 	struct buffer_head *bh_new = NULL;
 	int retval;
diff --git a/fs/affs/symlink.c b/fs/affs/symlink.c
index a7531b26e8f0..c82618c32843 100644
--- a/fs/affs/symlink.c
+++ b/fs/affs/symlink.c
@@ -23,7 +23,7 @@ static int affs_symlink_readpage(struct file *file, struct page *page)
 
 	pr_debug("get_link(ino=%lu)\n", inode->i_ino);
 
-	bh = affs_bread(inode->i_sb, inode->i_ino);
+	bh = affs_bread(inode_sb(inode), inode->i_ino);
 	if (!bh)
 		goto fail;
 	i  = 0;
@@ -32,7 +32,7 @@ static int affs_symlink_readpage(struct file *file, struct page *page)
 	lc = 0;
 
 	if (strchr(lf->symname,':')) {	/* Handle assign or volume name */
-		struct affs_sb_info *sbi = AFFS_SB(inode->i_sb);
+		struct affs_sb_info *sbi = AFFS_SB(inode_sb(inode));
 		char *pf;
 		spin_lock(&sbi->symlink_lock);
 		pf = sbi->s_prefix ? sbi->s_prefix : "/";
-- 
2.15.1

^ permalink raw reply related	[flat|nested] 88+ messages in thread

* [PATCH 14/76] fs/afs: Use inode_sb() helper instead of inode->i_sb
  2018-05-08 18:03 [RFC][PATCH 0/76] vfs: 'views' for filesystems with more than one root Mark Fasheh
                   ` (12 preceding siblings ...)
  2018-05-08 18:03 ` [PATCH 13/76] fs/affs: " Mark Fasheh
@ 2018-05-08 18:03 ` Mark Fasheh
  2018-05-08 18:03 ` [PATCH 15/76] fs/autofs4: " Mark Fasheh
                   ` (62 subsequent siblings)
  76 siblings, 0 replies; 88+ messages in thread
From: Mark Fasheh @ 2018-05-08 18:03 UTC (permalink / raw)
  To: linux-fsdevel; +Cc: linux-kernel, linux-btrfs, Mark Fasheh

Signed-off-by: Mark Fasheh <mfasheh@suse.de>
---
 fs/afs/callback.c | 2 +-
 fs/afs/dir.c      | 8 ++++----
 fs/afs/file.c     | 2 +-
 fs/afs/write.c    | 4 ++--
 4 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/fs/afs/callback.c b/fs/afs/callback.c
index f4291b576054..73371c83b646 100644
--- a/fs/afs/callback.c
+++ b/fs/afs/callback.c
@@ -63,7 +63,7 @@ int afs_register_server_cb_interest(struct afs_vnode *vnode,
 			return -ENOMEM;
 
 		refcount_set(&new->usage, 1);
-		new->sb = vnode->vfs_inode.i_sb;
+		new->sb = vnode->vfs_inode.i_view->v_sb;
 		new->vid = vnode->volume->vid;
 		new->server = afs_get_server(server);
 		INIT_LIST_HEAD(&new->cb_link);
diff --git a/fs/afs/dir.c b/fs/afs/dir.c
index ba2b458b36d1..1a828b1da90f 100644
--- a/fs/afs/dir.c
+++ b/fs/afs/dir.c
@@ -453,7 +453,7 @@ static int afs_lookup_filldir(struct dir_context *ctx, const char *name,
 static int afs_do_lookup(struct inode *dir, struct dentry *dentry,
 			 struct afs_fid *fid, struct key *key)
 {
-	struct afs_super_info *as = dir->i_sb->s_fs_info;
+	struct afs_super_info *as = inode_sb(dir)->s_fs_info;
 	struct afs_lookup_cookie cookie = {
 		.ctx.actor = afs_lookup_filldir,
 		.name = dentry->d_name,
@@ -533,7 +533,7 @@ static struct inode *afs_try_auto_mntpt(struct dentry *dentry,
 	if (ret < 0)
 		goto out;
 
-	inode = afs_iget_pseudo_dir(dir->i_sb, false);
+	inode = afs_iget_pseudo_dir(inode_sb(dir), false);
 	if (IS_ERR(inode)) {
 		ret = PTR_ERR(inode);
 		goto out;
@@ -614,7 +614,7 @@ static struct dentry *afs_lookup(struct inode *dir, struct dentry *dentry,
 	dentry->d_fsdata = (void *)(unsigned long) vnode->status.data_version;
 
 	/* instantiate the dentry */
-	inode = afs_iget(dir->i_sb, key, &fid, NULL, NULL, NULL);
+	inode = afs_iget(inode_sb(dir), key, &fid, NULL, NULL, NULL);
 	key_put(key);
 	if (IS_ERR(inode)) {
 		_leave(" = %ld", PTR_ERR(inode));
@@ -861,7 +861,7 @@ static void afs_vnode_new_inode(struct afs_fs_cursor *fc,
 
 	d_drop(new_dentry);
 
-	inode = afs_iget(fc->vnode->vfs_inode.i_sb, fc->key,
+	inode = afs_iget(fc->vnode->vfs_inode.i_view->v_sb, fc->key,
 			 newfid, newstatus, newcb, fc->cbi);
 	if (IS_ERR(inode)) {
 		/* ENOMEM or EINTR at a really inconvenient time - just abandon
diff --git a/fs/afs/file.c b/fs/afs/file.c
index a39192ced99e..1abbe9f37163 100644
--- a/fs/afs/file.c
+++ b/fs/afs/file.c
@@ -376,7 +376,7 @@ static int afs_readpage(struct file *file, struct page *page)
 		ret = afs_page_filler(key, page);
 	} else {
 		struct inode *inode = page->mapping->host;
-		key = afs_request_key(AFS_FS_S(inode->i_sb)->cell);
+		key = afs_request_key(AFS_FS_S(inode_sb(inode))->cell);
 		if (IS_ERR(key)) {
 			ret = PTR_ERR(key);
 		} else {
diff --git a/fs/afs/write.c b/fs/afs/write.c
index 9370e2feb999..df5a30e0d46e 100644
--- a/fs/afs/write.c
+++ b/fs/afs/write.c
@@ -761,7 +761,7 @@ int afs_page_mkwrite(struct vm_fault *vmf)
 	_enter("{{%x:%u}},{%lx}",
 	       vnode->fid.vid, vnode->fid.vnode, vmf->page->index);
 
-	sb_start_pagefault(inode->i_sb);
+	sb_start_pagefault(inode_sb(inode));
 
 	/* Wait for the page to be written to the cache before we allow it to
 	 * be modified.  We then assume the entire page will need writing back.
@@ -790,7 +790,7 @@ int afs_page_mkwrite(struct vm_fault *vmf)
 	SetPagePrivate(vmf->page);
 	set_page_private(vmf->page, priv);
 
-	sb_end_pagefault(inode->i_sb);
+	sb_end_pagefault(inode_sb(inode));
 	return VM_FAULT_LOCKED;
 }
 
-- 
2.15.1

^ permalink raw reply related	[flat|nested] 88+ messages in thread

* [PATCH 15/76] fs/autofs4: Use inode_sb() helper instead of inode->i_sb
  2018-05-08 18:03 [RFC][PATCH 0/76] vfs: 'views' for filesystems with more than one root Mark Fasheh
                   ` (13 preceding siblings ...)
  2018-05-08 18:03 ` [PATCH 14/76] fs/afs: " Mark Fasheh
@ 2018-05-08 18:03 ` Mark Fasheh
  2018-05-08 18:03 ` [PATCH 16/76] fs/befs: " Mark Fasheh
                   ` (61 subsequent siblings)
  76 siblings, 0 replies; 88+ messages in thread
From: Mark Fasheh @ 2018-05-08 18:03 UTC (permalink / raw)
  To: linux-fsdevel; +Cc: linux-kernel, linux-btrfs, Mark Fasheh

Signed-off-by: Mark Fasheh <mfasheh@suse.de>
---
 fs/autofs4/dev-ioctl.c |  2 +-
 fs/autofs4/root.c      | 20 ++++++++++----------
 2 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/fs/autofs4/dev-ioctl.c b/fs/autofs4/dev-ioctl.c
index b7c816f39404..6b28b01e5022 100644
--- a/fs/autofs4/dev-ioctl.c
+++ b/fs/autofs4/dev-ioctl.c
@@ -166,7 +166,7 @@ static struct autofs_sb_info *autofs_dev_ioctl_sbi(struct file *f)
 
 	if (f) {
 		inode = file_inode(f);
-		sbi = autofs4_sbi(inode->i_sb);
+		sbi = autofs4_sbi(inode_sb(inode));
 	}
 	return sbi;
 }
diff --git a/fs/autofs4/root.c b/fs/autofs4/root.c
index 82e8f6edfb48..41b0a0b73bce 100644
--- a/fs/autofs4/root.c
+++ b/fs/autofs4/root.c
@@ -513,7 +513,7 @@ static struct dentry *autofs4_lookup(struct inode *dir,
 	if (dentry->d_name.len > NAME_MAX)
 		return ERR_PTR(-ENAMETOOLONG);
 
-	sbi = autofs4_sbi(dir->i_sb);
+	sbi = autofs4_sbi(inode_sb(dir));
 
 	pr_debug("pid = %u, pgrp = %u, catatonic = %d, oz_mode = %d\n",
 		 current->pid, task_pgrp_nr(current), sbi->catatonic,
@@ -553,7 +553,7 @@ static int autofs4_dir_symlink(struct inode *dir,
 			       struct dentry *dentry,
 			       const char *symname)
 {
-	struct autofs_sb_info *sbi = autofs4_sbi(dir->i_sb);
+	struct autofs_sb_info *sbi = autofs4_sbi(inode_sb(dir));
 	struct autofs_info *ino = autofs4_dentry_ino(dentry);
 	struct autofs_info *p_ino;
 	struct inode *inode;
@@ -577,7 +577,7 @@ static int autofs4_dir_symlink(struct inode *dir,
 
 	strcpy(cp, symname);
 
-	inode = autofs4_get_inode(dir->i_sb, S_IFLNK | 0555);
+	inode = autofs4_get_inode(inode_sb(dir), S_IFLNK | 0555);
 	if (!inode) {
 		kfree(cp);
 		return -ENOMEM;
@@ -614,7 +614,7 @@ static int autofs4_dir_symlink(struct inode *dir,
  */
 static int autofs4_dir_unlink(struct inode *dir, struct dentry *dentry)
 {
-	struct autofs_sb_info *sbi = autofs4_sbi(dir->i_sb);
+	struct autofs_sb_info *sbi = autofs4_sbi(inode_sb(dir));
 	struct autofs_info *ino = autofs4_dentry_ino(dentry);
 	struct autofs_info *p_ino;
 
@@ -694,7 +694,7 @@ static void autofs_clear_leaf_automount_flags(struct dentry *dentry)
 
 static int autofs4_dir_rmdir(struct inode *dir, struct dentry *dentry)
 {
-	struct autofs_sb_info *sbi = autofs4_sbi(dir->i_sb);
+	struct autofs_sb_info *sbi = autofs4_sbi(inode_sb(dir));
 	struct autofs_info *ino = autofs4_dentry_ino(dentry);
 	struct autofs_info *p_ino;
 
@@ -733,7 +733,7 @@ static int autofs4_dir_rmdir(struct inode *dir, struct dentry *dentry)
 static int autofs4_dir_mkdir(struct inode *dir,
 			     struct dentry *dentry, umode_t mode)
 {
-	struct autofs_sb_info *sbi = autofs4_sbi(dir->i_sb);
+	struct autofs_sb_info *sbi = autofs4_sbi(inode_sb(dir));
 	struct autofs_info *ino = autofs4_dentry_ino(dentry);
 	struct autofs_info *p_ino;
 	struct inode *inode;
@@ -749,7 +749,7 @@ static int autofs4_dir_mkdir(struct inode *dir,
 
 	autofs4_del_active(dentry);
 
-	inode = autofs4_get_inode(dir->i_sb, S_IFDIR | 0555);
+	inode = autofs4_get_inode(inode_sb(dir), S_IFDIR | 0555);
 	if (!inode)
 		return -ENOMEM;
 	d_add(dentry, inode);
@@ -868,7 +868,7 @@ int is_autofs4_dentry(struct dentry *dentry)
 static int autofs4_root_ioctl_unlocked(struct inode *inode, struct file *filp,
 				       unsigned int cmd, unsigned long arg)
 {
-	struct autofs_sb_info *sbi = autofs4_sbi(inode->i_sb);
+	struct autofs_sb_info *sbi = autofs4_sbi(inode_sb(inode));
 	void __user *p = (void __user *)arg;
 
 	pr_debug("cmd = 0x%08x, arg = 0x%08lx, sbi = %p, pgrp = %u\n",
@@ -905,11 +905,11 @@ static int autofs4_root_ioctl_unlocked(struct inode *inode, struct file *filp,
 
 	/* return a single thing to expire */
 	case AUTOFS_IOC_EXPIRE:
-		return autofs4_expire_run(inode->i_sb,
+		return autofs4_expire_run(inode_sb(inode),
 					  filp->f_path.mnt, sbi, p);
 	/* same as above, but can send multiple expires through pipe */
 	case AUTOFS_IOC_EXPIRE_MULTI:
-		return autofs4_expire_multi(inode->i_sb,
+		return autofs4_expire_multi(inode_sb(inode),
 					    filp->f_path.mnt, sbi, p);
 
 	default:
-- 
2.15.1

^ permalink raw reply related	[flat|nested] 88+ messages in thread

* [PATCH 16/76] fs/befs: Use inode_sb() helper instead of inode->i_sb
  2018-05-08 18:03 [RFC][PATCH 0/76] vfs: 'views' for filesystems with more than one root Mark Fasheh
                   ` (14 preceding siblings ...)
  2018-05-08 18:03 ` [PATCH 15/76] fs/autofs4: " Mark Fasheh
@ 2018-05-08 18:03 ` Mark Fasheh
  2018-05-08 18:03 ` [PATCH 17/76] fs/bfs: " Mark Fasheh
                   ` (60 subsequent siblings)
  76 siblings, 0 replies; 88+ messages in thread
From: Mark Fasheh @ 2018-05-08 18:03 UTC (permalink / raw)
  To: linux-fsdevel; +Cc: linux-kernel, linux-btrfs, Mark Fasheh

Signed-off-by: Mark Fasheh <mfasheh@suse.de>
---
 fs/befs/linuxvfs.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/fs/befs/linuxvfs.c b/fs/befs/linuxvfs.c
index af2832aaeec5..fc997025b9a0 100644
--- a/fs/befs/linuxvfs.c
+++ b/fs/befs/linuxvfs.c
@@ -131,7 +131,7 @@ static int
 befs_get_block(struct inode *inode, sector_t block,
 	       struct buffer_head *bh_result, int create)
 {
-	struct super_block *sb = inode->i_sb;
+	struct super_block *sb = inode_sb(inode);
 	befs_data_stream *ds = &BEFS_I(inode)->i_data.ds;
 	befs_block_run run = BAD_IADDR;
 	int res;
@@ -157,7 +157,7 @@ befs_get_block(struct inode *inode, sector_t block,
 
 	disk_off = (ulong) iaddr2blockno(sb, &run);
 
-	map_bh(bh_result, inode->i_sb, disk_off);
+	map_bh(bh_result, inode_sb(inode), disk_off);
 
 	befs_debug(sb, "<--- %s for inode %lu, block %ld, disk address %lu",
 		  __func__, (unsigned long)inode->i_ino, (long)block,
@@ -170,7 +170,7 @@ static struct dentry *
 befs_lookup(struct inode *dir, struct dentry *dentry, unsigned int flags)
 {
 	struct inode *inode;
-	struct super_block *sb = dir->i_sb;
+	struct super_block *sb = inode_sb(dir);
 	const befs_data_stream *ds = &BEFS_I(dir)->i_data.ds;
 	befs_off_t offset;
 	int ret;
@@ -206,7 +206,7 @@ befs_lookup(struct inode *dir, struct dentry *dentry, unsigned int flags)
 		return ERR_PTR(-ENODATA);
 	}
 
-	inode = befs_iget(dir->i_sb, (ino_t) offset);
+	inode = befs_iget(inode_sb(dir), (ino_t) offset);
 	if (IS_ERR(inode))
 		return ERR_CAST(inode);
 
@@ -221,7 +221,7 @@ static int
 befs_readdir(struct file *file, struct dir_context *ctx)
 {
 	struct inode *inode = file_inode(file);
-	struct super_block *sb = inode->i_sb;
+	struct super_block *sb = inode_sb(inode);
 	const befs_data_stream *ds = &BEFS_I(inode)->i_data.ds;
 	befs_off_t value;
 	int result;
@@ -482,7 +482,7 @@ befs_destroy_inodecache(void)
 static int befs_symlink_readpage(struct file *unused, struct page *page)
 {
 	struct inode *inode = page->mapping->host;
-	struct super_block *sb = inode->i_sb;
+	struct super_block *sb = inode_sb(inode);
 	struct befs_inode_info *befs_ino = BEFS_I(inode);
 	befs_data_stream *data = &befs_ino->i_data.ds;
 	befs_off_t len = data->size;
-- 
2.15.1

^ permalink raw reply related	[flat|nested] 88+ messages in thread

* [PATCH 17/76] fs/bfs: Use inode_sb() helper instead of inode->i_sb
  2018-05-08 18:03 [RFC][PATCH 0/76] vfs: 'views' for filesystems with more than one root Mark Fasheh
                   ` (15 preceding siblings ...)
  2018-05-08 18:03 ` [PATCH 16/76] fs/befs: " Mark Fasheh
@ 2018-05-08 18:03 ` Mark Fasheh
  2018-05-08 18:03 ` [PATCH 18/76] fs/btrfs: " Mark Fasheh
                   ` (59 subsequent siblings)
  76 siblings, 0 replies; 88+ messages in thread
From: Mark Fasheh @ 2018-05-08 18:03 UTC (permalink / raw)
  To: linux-fsdevel; +Cc: linux-kernel, linux-btrfs, Mark Fasheh

Signed-off-by: Mark Fasheh <mfasheh@suse.de>
---
 fs/bfs/dir.c   | 23 ++++++++++++-----------
 fs/bfs/file.c  |  4 ++--
 fs/bfs/inode.c | 16 +++++++++-------
 3 files changed, 23 insertions(+), 20 deletions(-)

diff --git a/fs/bfs/dir.c b/fs/bfs/dir.c
index ee832ca5f734..124c1eedb53c 100644
--- a/fs/bfs/dir.c
+++ b/fs/bfs/dir.c
@@ -38,14 +38,14 @@ static int bfs_readdir(struct file *f, struct dir_context *ctx)
 	if (ctx->pos & (BFS_DIRENT_SIZE - 1)) {
 		printf("Bad f_pos=%08lx for %s:%08lx\n",
 					(unsigned long)ctx->pos,
-					dir->i_sb->s_id, dir->i_ino);
+					inode_sb(dir)->s_id, dir->i_ino);
 		return -EINVAL;
 	}
 
 	while (ctx->pos < dir->i_size) {
 		offset = ctx->pos & (BFS_BSIZE - 1);
 		block = BFS_I(dir)->i_sblock + (ctx->pos >> BFS_BSIZE_BITS);
-		bh = sb_bread(dir->i_sb, block);
+		bh = sb_bread(inode_sb(dir), block);
 		if (!bh) {
 			ctx->pos += BFS_BSIZE - offset;
 			continue;
@@ -81,7 +81,7 @@ static int bfs_create(struct inode *dir, struct dentry *dentry, umode_t mode,
 {
 	int err;
 	struct inode *inode;
-	struct super_block *s = dir->i_sb;
+	struct super_block *s = inode_sb(dir);
 	struct bfs_sb_info *info = BFS_SB(s);
 	unsigned long ino;
 
@@ -130,7 +130,7 @@ static struct dentry *bfs_lookup(struct inode *dir, struct dentry *dentry,
 	struct inode *inode = NULL;
 	struct buffer_head *bh;
 	struct bfs_dirent *de;
-	struct bfs_sb_info *info = BFS_SB(dir->i_sb);
+	struct bfs_sb_info *info = BFS_SB(inode_sb(dir));
 
 	if (dentry->d_name.len > BFS_NAMELEN)
 		return ERR_PTR(-ENAMETOOLONG);
@@ -140,7 +140,7 @@ static struct dentry *bfs_lookup(struct inode *dir, struct dentry *dentry,
 	if (bh) {
 		unsigned long ino = (unsigned long)le16_to_cpu(de->ino);
 		brelse(bh);
-		inode = bfs_iget(dir->i_sb, ino);
+		inode = bfs_iget(inode_sb(dir), ino);
 		if (IS_ERR(inode)) {
 			mutex_unlock(&info->bfs_lock);
 			return ERR_CAST(inode);
@@ -155,7 +155,7 @@ static int bfs_link(struct dentry *old, struct inode *dir,
 						struct dentry *new)
 {
 	struct inode *inode = d_inode(old);
-	struct bfs_sb_info *info = BFS_SB(inode->i_sb);
+	struct bfs_sb_info *info = BFS_SB(inode_sb(inode));
 	int err;
 
 	mutex_lock(&info->bfs_lock);
@@ -180,7 +180,7 @@ static int bfs_unlink(struct inode *dir, struct dentry *dentry)
 	struct inode *inode = d_inode(dentry);
 	struct buffer_head *bh;
 	struct bfs_dirent *de;
-	struct bfs_sb_info *info = BFS_SB(inode->i_sb);
+	struct bfs_sb_info *info = BFS_SB(inode_sb(inode));
 
 	mutex_lock(&info->bfs_lock);
 	bh = bfs_find_entry(dir, dentry->d_name.name, dentry->d_name.len, &de);
@@ -189,7 +189,7 @@ static int bfs_unlink(struct inode *dir, struct dentry *dentry)
 
 	if (!inode->i_nlink) {
 		printf("unlinking non-existent file %s:%lu (nlink=%d)\n",
-					inode->i_sb->s_id, inode->i_ino,
+					inode_sb(inode)->s_id, inode->i_ino,
 					inode->i_nlink);
 		set_nlink(inode, 1);
 	}
@@ -225,7 +225,7 @@ static int bfs_rename(struct inode *old_dir, struct dentry *old_dentry,
 	if (S_ISDIR(old_inode->i_mode))
 		return -EINVAL;
 
-	info = BFS_SB(old_inode->i_sb);
+	info = BFS_SB(inode_sb(old_inode));
 
 	mutex_lock(&info->bfs_lock);
 	old_bh = bfs_find_entry(old_dir, 
@@ -296,7 +296,7 @@ static int bfs_add_entry(struct inode *dir, const unsigned char *name,
 	sblock = BFS_I(dir)->i_sblock;
 	eblock = BFS_I(dir)->i_eblock;
 	for (block = sblock; block <= eblock; block++) {
-		bh = sb_bread(dir->i_sb, block);
+		bh = sb_bread(inode_sb(dir), block);
 		if (!bh)
 			return -EIO;
 		for (off = 0; off < BFS_BSIZE; off += BFS_DIRENT_SIZE) {
@@ -345,7 +345,8 @@ static struct buffer_head *bfs_find_entry(struct inode *dir,
 
 	while (block * BFS_BSIZE + offset < dir->i_size) {
 		if (!bh) {
-			bh = sb_bread(dir->i_sb, BFS_I(dir)->i_sblock + block);
+			bh = sb_bread(inode_sb(dir),
+				      BFS_I(dir)->i_sblock + block);
 			if (!bh) {
 				block++;
 				continue;
diff --git a/fs/bfs/file.c b/fs/bfs/file.c
index 1476cdd90cfb..159ef9ebca2d 100644
--- a/fs/bfs/file.c
+++ b/fs/bfs/file.c
@@ -66,7 +66,7 @@ static int bfs_get_block(struct inode *inode, sector_t block,
 {
 	unsigned long phys;
 	int err;
-	struct super_block *sb = inode->i_sb;
+	struct super_block *sb = inode_sb(inode);
 	struct bfs_sb_info *info = BFS_SB(sb);
 	struct bfs_inode_info *bi = BFS_I(inode);
 
@@ -122,7 +122,7 @@ static int bfs_get_block(struct inode *inode, sector_t block,
 	}
 
 	if (bi->i_sblock) {
-		err = bfs_move_blocks(inode->i_sb, bi->i_sblock, 
+		err = bfs_move_blocks(inode_sb(inode), bi->i_sblock, 
 						bi->i_eblock, phys);
 		if (err) {
 			dprintf("failed to move ino=%08lx -> fs corruption\n",
diff --git a/fs/bfs/inode.c b/fs/bfs/inode.c
index 9a69392f1fb3..8216f6b03fda 100644
--- a/fs/bfs/inode.c
+++ b/fs/bfs/inode.c
@@ -44,15 +44,17 @@ struct inode *bfs_iget(struct super_block *sb, unsigned long ino)
 	if (!(inode->i_state & I_NEW))
 		return inode;
 
-	if ((ino < BFS_ROOT_INO) || (ino > BFS_SB(inode->i_sb)->si_lasti)) {
-		printf("Bad inode number %s:%08lx\n", inode->i_sb->s_id, ino);
+	if ((ino < BFS_ROOT_INO) || (ino > BFS_SB(inode_sb(inode))->si_lasti)) {
+		printf("Bad inode number %s:%08lx\n", inode_sb(inode)->s_id,
+		       ino);
 		goto error;
 	}
 
 	block = (ino - BFS_ROOT_INO) / BFS_INODES_PER_BLOCK + 1;
-	bh = sb_bread(inode->i_sb, block);
+	bh = sb_bread(inode_sb(inode), block);
 	if (!bh) {
-		printf("Unable to read inode %s:%08lx\n", inode->i_sb->s_id,
+		printf("Unable to read inode %s:%08lx\n",
+									inode_sb(inode)->s_id,
 									ino);
 		goto error;
 	}
@@ -116,7 +118,7 @@ static struct bfs_inode *find_inode(struct super_block *sb, u16 ino, struct buff
 
 static int bfs_write_inode(struct inode *inode, struct writeback_control *wbc)
 {
-	struct bfs_sb_info *info = BFS_SB(inode->i_sb);
+	struct bfs_sb_info *info = BFS_SB(inode_sb(inode));
 	unsigned int ino = (u16)inode->i_ino;
         unsigned long i_sblock;
 	struct bfs_inode *di;
@@ -125,7 +127,7 @@ static int bfs_write_inode(struct inode *inode, struct writeback_control *wbc)
 
         dprintf("ino=%08x\n", ino);
 
-	di = find_inode(inode->i_sb, ino, &bh);
+	di = find_inode(inode_sb(inode), ino, &bh);
 	if (IS_ERR(di))
 		return PTR_ERR(di);
 
@@ -165,7 +167,7 @@ static void bfs_evict_inode(struct inode *inode)
 	unsigned long ino = inode->i_ino;
 	struct bfs_inode *di;
 	struct buffer_head *bh;
-	struct super_block *s = inode->i_sb;
+	struct super_block *s = inode_sb(inode);
 	struct bfs_sb_info *info = BFS_SB(s);
 	struct bfs_inode_info *bi = BFS_I(inode);
 
-- 
2.15.1

^ permalink raw reply related	[flat|nested] 88+ messages in thread

* [PATCH 18/76] fs/btrfs: Use inode_sb() helper instead of inode->i_sb
  2018-05-08 18:03 [RFC][PATCH 0/76] vfs: 'views' for filesystems with more than one root Mark Fasheh
                   ` (16 preceding siblings ...)
  2018-05-08 18:03 ` [PATCH 17/76] fs/bfs: " Mark Fasheh
@ 2018-05-08 18:03 ` Mark Fasheh
  2018-05-08 18:03 ` [PATCH 19/76] fs/ceph: " Mark Fasheh
                   ` (58 subsequent siblings)
  76 siblings, 0 replies; 88+ messages in thread
From: Mark Fasheh @ 2018-05-08 18:03 UTC (permalink / raw)
  To: linux-fsdevel; +Cc: linux-kernel, linux-btrfs, Mark Fasheh

Signed-off-by: Mark Fasheh <mfasheh@suse.de>
---
 fs/btrfs/compression.c      |   4 +-
 fs/btrfs/ctree.h            |   2 +-
 fs/btrfs/delayed-inode.c    |   4 +-
 fs/btrfs/disk-io.c          |   8 +--
 fs/btrfs/export.c           |   4 +-
 fs/btrfs/extent-tree.c      |  14 ++---
 fs/btrfs/extent_io.c        |  24 ++++----
 fs/btrfs/file-item.c        |  10 ++--
 fs/btrfs/file.c             |  30 +++++-----
 fs/btrfs/free-space-cache.c |   6 +-
 fs/btrfs/inode.c            | 133 ++++++++++++++++++++++----------------------
 fs/btrfs/ioctl.c            |  72 ++++++++++++------------
 fs/btrfs/ordered-data.c     |  12 ++--
 fs/btrfs/relocation.c       |   6 +-
 fs/btrfs/tree-log.c         |   8 +--
 15 files changed, 169 insertions(+), 168 deletions(-)

diff --git a/fs/btrfs/compression.c b/fs/btrfs/compression.c
index 07d049c0c20f..63ac953b18c3 100644
--- a/fs/btrfs/compression.c
+++ b/fs/btrfs/compression.c
@@ -312,7 +312,7 @@ blk_status_t btrfs_submit_compressed_write(struct inode *inode, u64 start,
 				 unsigned long nr_pages,
 				 unsigned int write_flags)
 {
-	struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb);
+	struct btrfs_fs_info *fs_info = btrfs_sb(inode_sb(inode));
 	struct bio *bio = NULL;
 	struct compressed_bio *cb;
 	unsigned long bytes_left;
@@ -547,7 +547,7 @@ static noinline int add_ra_bio_pages(struct inode *inode,
 blk_status_t btrfs_submit_compressed_read(struct inode *inode, struct bio *bio,
 				 int mirror_num, unsigned long bio_flags)
 {
-	struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb);
+	struct btrfs_fs_info *fs_info = btrfs_sb(inode_sb(inode));
 	struct extent_io_tree *tree;
 	struct extent_map_tree *em_tree;
 	struct compressed_bio *cb;
diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h
index da308774b8a4..a3cca35642e2 100644
--- a/fs/btrfs/ctree.h
+++ b/fs/btrfs/ctree.h
@@ -1271,7 +1271,7 @@ struct btrfs_file_private {
 
 static inline u32 btrfs_inode_sectorsize(const struct inode *inode)
 {
-	return btrfs_sb(inode->i_sb)->sectorsize;
+	return btrfs_sb(inode_sb(inode))->sectorsize;
 }
 
 static inline u32 BTRFS_LEAF_DATA_SIZE(const struct btrfs_fs_info *info)
diff --git a/fs/btrfs/delayed-inode.c b/fs/btrfs/delayed-inode.c
index 0530f6f2e4ba..adc07604156e 100644
--- a/fs/btrfs/delayed-inode.c
+++ b/fs/btrfs/delayed-inode.c
@@ -1214,7 +1214,7 @@ int btrfs_commit_inode_delayed_items(struct btrfs_trans_handle *trans,
 
 int btrfs_commit_inode_delayed_inode(struct btrfs_inode *inode)
 {
-	struct btrfs_fs_info *fs_info = btrfs_sb(inode->vfs_inode.i_sb);
+	struct btrfs_fs_info *fs_info = btrfs_sb(inode_sb(&inode->vfs_inode));
 	struct btrfs_trans_handle *trans;
 	struct btrfs_delayed_node *delayed_node = btrfs_get_delayed_node(inode);
 	struct btrfs_path *path;
@@ -1829,7 +1829,7 @@ int btrfs_delayed_update_inode(struct btrfs_trans_handle *trans,
 
 int btrfs_delayed_delete_inode_ref(struct btrfs_inode *inode)
 {
-	struct btrfs_fs_info *fs_info = btrfs_sb(inode->vfs_inode.i_sb);
+	struct btrfs_fs_info *fs_info = btrfs_sb(inode_sb(&inode->vfs_inode));
 	struct btrfs_delayed_node *delayed_node;
 
 	/*
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
index 21f34ad0d411..334234da997c 100644
--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -226,7 +226,7 @@ struct extent_map *btree_get_extent(struct btrfs_inode *inode,
 		struct page *page, size_t pg_offset, u64 start, u64 len,
 		int create)
 {
-	struct btrfs_fs_info *fs_info = btrfs_sb(inode->vfs_inode.i_sb);
+	struct btrfs_fs_info *fs_info = btrfs_sb(inode_sb(&inode->vfs_inode));
 	struct extent_map_tree *em_tree = &inode->extent_tree;
 	struct extent_map *em;
 	int ret;
@@ -829,7 +829,7 @@ static blk_status_t __btree_submit_bio_done(void *private_data, struct bio *bio,
 	 * when we're called for a write, we're already in the async
 	 * submission context.  Just jump into btrfs_map_bio
 	 */
-	ret = btrfs_map_bio(btrfs_sb(inode->i_sb), bio, mirror_num, 1);
+	ret = btrfs_map_bio(btrfs_sb(inode_sb(inode)), bio, mirror_num, 1);
 	if (ret) {
 		bio->bi_status = ret;
 		bio_endio(bio);
@@ -853,7 +853,7 @@ static blk_status_t btree_submit_bio_hook(void *private_data, struct bio *bio,
 					  u64 bio_offset)
 {
 	struct inode *inode = private_data;
-	struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb);
+	struct btrfs_fs_info *fs_info = btrfs_sb(inode_sb(inode));
 	int async = check_async_write(BTRFS_I(inode));
 	blk_status_t ret;
 
@@ -4438,7 +4438,7 @@ static int btrfs_cleanup_transaction(struct btrfs_fs_info *fs_info)
 static struct btrfs_fs_info *btree_fs_info(void *private_data)
 {
 	struct inode *inode = private_data;
-	return btrfs_sb(inode->i_sb);
+	return btrfs_sb(inode_sb(inode));
 }
 
 static const struct extent_io_ops btree_extent_io_ops = {
diff --git a/fs/btrfs/export.c b/fs/btrfs/export.c
index ddaccad469f8..2ea5b2368999 100644
--- a/fs/btrfs/export.c
+++ b/fs/btrfs/export.c
@@ -154,7 +154,7 @@ static struct dentry *btrfs_fh_to_dentry(struct super_block *sb, struct fid *fh,
 static struct dentry *btrfs_get_parent(struct dentry *child)
 {
 	struct inode *dir = d_inode(child);
-	struct btrfs_fs_info *fs_info = btrfs_sb(dir->i_sb);
+	struct btrfs_fs_info *fs_info = btrfs_sb(inode_sb(dir));
 	struct btrfs_root *root = BTRFS_I(dir)->root;
 	struct btrfs_path *path;
 	struct extent_buffer *leaf;
@@ -224,7 +224,7 @@ static int btrfs_get_name(struct dentry *parent, char *name,
 {
 	struct inode *inode = d_inode(child);
 	struct inode *dir = d_inode(parent);
-	struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb);
+	struct btrfs_fs_info *fs_info = btrfs_sb(inode_sb(inode));
 	struct btrfs_path *path;
 	struct btrfs_root *root = BTRFS_I(dir)->root;
 	struct btrfs_inode_ref *iref;
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
index c1618ab9fecf..1d86511aec42 100644
--- a/fs/btrfs/extent-tree.c
+++ b/fs/btrfs/extent-tree.c
@@ -4382,7 +4382,7 @@ int btrfs_alloc_data_chunk_ondemand(struct btrfs_inode *inode, u64 bytes)
 int btrfs_check_data_free_space(struct inode *inode,
 			struct extent_changeset **reserved, u64 start, u64 len)
 {
-	struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb);
+	struct btrfs_fs_info *fs_info = btrfs_sb(inode_sb(inode));
 	int ret;
 
 	/* align the range */
@@ -4414,7 +4414,7 @@ int btrfs_check_data_free_space(struct inode *inode,
 void btrfs_free_reserved_data_space_noquota(struct inode *inode, u64 start,
 					    u64 len)
 {
-	struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb);
+	struct btrfs_fs_info *fs_info = btrfs_sb(inode_sb(inode));
 	struct btrfs_space_info *data_sinfo;
 
 	/* Make sure the range is aligned to sectorsize */
@@ -5934,7 +5934,7 @@ void btrfs_trans_release_chunk_metadata(struct btrfs_trans_handle *trans)
 int btrfs_orphan_reserve_metadata(struct btrfs_trans_handle *trans,
 				  struct btrfs_inode *inode)
 {
-	struct btrfs_fs_info *fs_info = btrfs_sb(inode->vfs_inode.i_sb);
+	struct btrfs_fs_info *fs_info = btrfs_sb(inode_sb(&inode->vfs_inode));
 	struct btrfs_root *root = inode->root;
 	/*
 	 * We always use trans->block_rsv here as we will have reserved space
@@ -5959,7 +5959,7 @@ int btrfs_orphan_reserve_metadata(struct btrfs_trans_handle *trans,
 
 void btrfs_orphan_release_metadata(struct btrfs_inode *inode)
 {
-	struct btrfs_fs_info *fs_info = btrfs_sb(inode->vfs_inode.i_sb);
+	struct btrfs_fs_info *fs_info = btrfs_sb(inode_sb(&inode->vfs_inode));
 	struct btrfs_root *root = inode->root;
 	u64 num_bytes = btrfs_calc_trans_metadata_size(fs_info, 1);
 
@@ -6051,7 +6051,7 @@ static void btrfs_calculate_inode_block_rsv_size(struct btrfs_fs_info *fs_info,
 
 int btrfs_delalloc_reserve_metadata(struct btrfs_inode *inode, u64 num_bytes)
 {
-	struct btrfs_fs_info *fs_info = btrfs_sb(inode->vfs_inode.i_sb);
+	struct btrfs_fs_info *fs_info = btrfs_sb(inode_sb(&inode->vfs_inode));
 	struct btrfs_root *root = inode->root;
 	unsigned nr_extents;
 	enum btrfs_reserve_flush_enum flush = BTRFS_RESERVE_FLUSH_ALL;
@@ -6133,7 +6133,7 @@ int btrfs_delalloc_reserve_metadata(struct btrfs_inode *inode, u64 num_bytes)
  */
 void btrfs_delalloc_release_metadata(struct btrfs_inode *inode, u64 num_bytes)
 {
-	struct btrfs_fs_info *fs_info = btrfs_sb(inode->vfs_inode.i_sb);
+	struct btrfs_fs_info *fs_info = btrfs_sb(inode_sb(&inode->vfs_inode));
 
 	num_bytes = ALIGN(num_bytes, fs_info->sectorsize);
 	spin_lock(&inode->lock);
@@ -6160,7 +6160,7 @@ void btrfs_delalloc_release_metadata(struct btrfs_inode *inode, u64 num_bytes)
  */
 void btrfs_delalloc_release_extents(struct btrfs_inode *inode, u64 num_bytes)
 {
-	struct btrfs_fs_info *fs_info = btrfs_sb(inode->vfs_inode.i_sb);
+	struct btrfs_fs_info *fs_info = btrfs_sb(inode_sb(&inode->vfs_inode));
 	unsigned num_extents;
 
 	spin_lock(&inode->lock);
diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c
index dfeb74a0be77..8db8041cf041 100644
--- a/fs/btrfs/extent_io.c
+++ b/fs/btrfs/extent_io.c
@@ -2174,7 +2174,7 @@ void btrfs_free_io_failure_record(struct btrfs_inode *inode, u64 start, u64 end)
 int btrfs_get_io_failure_record(struct inode *inode, u64 start, u64 end,
 		struct io_failure_record **failrec_ret)
 {
-	struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb);
+	struct btrfs_fs_info *fs_info = btrfs_sb(inode_sb(inode));
 	struct io_failure_record *failrec;
 	struct extent_map *em;
 	struct extent_io_tree *failure_tree = &BTRFS_I(inode)->io_failure_tree;
@@ -2261,7 +2261,7 @@ int btrfs_get_io_failure_record(struct inode *inode, u64 start, u64 end,
 bool btrfs_check_repairable(struct inode *inode, unsigned failed_bio_pages,
 			   struct io_failure_record *failrec, int failed_mirror)
 {
-	struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb);
+	struct btrfs_fs_info *fs_info = btrfs_sb(inode_sb(inode));
 	int num_copies;
 
 	num_copies = btrfs_num_copies(fs_info, failrec->logical, failrec->len);
@@ -2327,7 +2327,7 @@ struct bio *btrfs_create_repair_bio(struct inode *inode, struct bio *failed_bio,
 				    struct page *page, int pg_offset, int icsum,
 				    bio_end_io_t *endio_func, void *data)
 {
-	struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb);
+	struct btrfs_fs_info *fs_info = btrfs_sb(inode_sb(inode));
 	struct bio *bio;
 	struct btrfs_io_bio *btrfs_failed_bio;
 	struct btrfs_io_bio *btrfs_bio;
@@ -2392,16 +2392,16 @@ static int bio_readpage_error(struct bio *failed_bio, u64 phy_offset,
 	if (failed_bio_pages > 1)
 		read_mode |= REQ_FAILFAST_DEV;
 
-	phy_offset >>= inode->i_sb->s_blocksize_bits;
+	phy_offset >>= inode_sb(inode)->s_blocksize_bits;
 	bio = btrfs_create_repair_bio(inode, failed_bio, failrec, page,
 				      start - page_offset(page),
 				      (int)phy_offset, failed_bio->bi_end_io,
 				      NULL);
 	bio_set_op_attrs(bio, REQ_OP_READ, read_mode);
 
-	btrfs_debug(btrfs_sb(inode->i_sb),
-		"Repair Read Error: submitting new read[%#x] to this_mirror=%d, in_validation=%d",
-		read_mode, failrec->this_mirror, failrec->in_validation);
+	btrfs_debug(btrfs_sb(inode_sb(inode)),
+		    "Repair Read Error: submitting new read[%#x] to this_mirror=%d, in_validation=%d",
+		    read_mode, failrec->this_mirror, failrec->in_validation);
 
 	status = tree->ops->submit_bio_hook(tree->private_data, bio, failrec->this_mirror,
 					 failrec->bio_flags, 0);
@@ -2457,7 +2457,7 @@ static void end_bio_extent_writepage(struct bio *bio)
 	bio_for_each_segment_all(bvec, bio, i) {
 		struct page *page = bvec->bv_page;
 		struct inode *inode = page->mapping->host;
-		struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb);
+		struct btrfs_fs_info *fs_info = btrfs_sb(inode_sb(inode));
 
 		/* We always issue full-page reads, but if some block
 		 * in a page fails to read, blk_update_request() will
@@ -2528,7 +2528,7 @@ static void end_bio_extent_readpage(struct bio *bio)
 	bio_for_each_segment_all(bvec, bio, i) {
 		struct page *page = bvec->bv_page;
 		struct inode *inode = page->mapping->host;
-		struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb);
+		struct btrfs_fs_info *fs_info = btrfs_sb(inode_sb(inode));
 
 		btrfs_debug(fs_info,
 			"end_bio_extent_readpage: bi_sector=%llu, err=%d, mirror=%u",
@@ -2900,7 +2900,7 @@ static int __do_readpage(struct extent_io_tree *tree,
 	size_t pg_offset = 0;
 	size_t iosize;
 	size_t disk_io_size;
-	size_t blocksize = inode->i_sb->s_blocksize;
+	size_t blocksize = inode_sb(inode)->s_blocksize;
 	unsigned long this_bio_flag = 0;
 
 	set_page_extent_mapped(page);
@@ -3358,7 +3358,7 @@ static noinline_for_stack int __extent_writepage_io(struct inode *inode,
 		goto done;
 	}
 
-	blocksize = inode->i_sb->s_blocksize;
+	blocksize = inode_sb(inode)->s_blocksize;
 
 	while (cur <= end) {
 		u64 em_end;
@@ -4176,7 +4176,7 @@ int extent_invalidatepage(struct extent_io_tree *tree,
 	struct extent_state *cached_state = NULL;
 	u64 start = page_offset(page);
 	u64 end = start + PAGE_SIZE - 1;
-	size_t blocksize = page->mapping->host->i_sb->s_blocksize;
+	size_t blocksize = inode_sb(page->mapping->host)->s_blocksize;
 
 	start += ALIGN(offset, blocksize);
 	if (start > end)
diff --git a/fs/btrfs/file-item.c b/fs/btrfs/file-item.c
index fdcb41002623..75f025a2bf4d 100644
--- a/fs/btrfs/file-item.c
+++ b/fs/btrfs/file-item.c
@@ -163,7 +163,7 @@ static void btrfs_io_bio_endio_readpage(struct btrfs_io_bio *bio, int err)
 static blk_status_t __btrfs_lookup_bio_sums(struct inode *inode, struct bio *bio,
 				   u64 logical_offset, u32 *dst, int dio)
 {
-	struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb);
+	struct btrfs_fs_info *fs_info = btrfs_sb(inode_sb(inode));
 	struct bio_vec bvec;
 	struct bvec_iter iter;
 	struct btrfs_io_bio *btrfs_bio = btrfs_io_bio(bio);
@@ -185,7 +185,7 @@ static blk_status_t __btrfs_lookup_bio_sums(struct inode *inode, struct bio *bio
 	if (!path)
 		return BLK_STS_RESOURCE;
 
-	nblocks = bio->bi_iter.bi_size >> inode->i_sb->s_blocksize_bits;
+	nblocks = bio->bi_iter.bi_size >> inode_sb(inode)->s_blocksize_bits;
 	if (!dst) {
 		if (nblocks * csum_size > BTRFS_BIO_INLINE_CSUM_SIZE) {
 			btrfs_bio->csum_allocated = kmalloc_array(nblocks,
@@ -280,7 +280,7 @@ static blk_status_t __btrfs_lookup_bio_sums(struct inode *inode, struct bio *bio
 		diff = diff / fs_info->sectorsize;
 		diff = diff * csum_size;
 		count = min_t(int, nblocks, (item_last_offset - disk_bytenr) >>
-					    inode->i_sb->s_blocksize_bits);
+					    inode_sb(inode)->s_blocksize_bits);
 		read_extent_buffer(path->nodes[0], csum,
 				   ((unsigned long)item) + diff,
 				   csum_size * count);
@@ -435,7 +435,7 @@ int btrfs_lookup_csums_range(struct btrfs_root *root, u64 start, u64 end,
 blk_status_t btrfs_csum_one_bio(struct inode *inode, struct bio *bio,
 		       u64 file_start, int contig)
 {
-	struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb);
+	struct btrfs_fs_info *fs_info = btrfs_sb(inode_sb(inode));
 	struct btrfs_ordered_sum *sums;
 	struct btrfs_ordered_extent *ordered = NULL;
 	char *data;
@@ -935,7 +935,7 @@ void btrfs_extent_item_to_extent_map(struct btrfs_inode *inode,
 				     const bool new_inline,
 				     struct extent_map *em)
 {
-	struct btrfs_fs_info *fs_info = btrfs_sb(inode->vfs_inode.i_sb);
+	struct btrfs_fs_info *fs_info = btrfs_sb(inode_sb(&inode->vfs_inode));
 	struct btrfs_root *root = inode->root;
 	struct extent_buffer *leaf = path->nodes[0];
 	const int slot = path->slots[0];
diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c
index 41ab9073d1d4..4a7348aed20e 100644
--- a/fs/btrfs/file.c
+++ b/fs/btrfs/file.c
@@ -96,7 +96,7 @@ static int __compare_inode_defrag(struct inode_defrag *defrag1,
 static int __btrfs_add_inode_defrag(struct btrfs_inode *inode,
 				    struct inode_defrag *defrag)
 {
-	struct btrfs_fs_info *fs_info = btrfs_sb(inode->vfs_inode.i_sb);
+	struct btrfs_fs_info *fs_info = btrfs_sb(inode_sb(&inode->vfs_inode));
 	struct inode_defrag *entry;
 	struct rb_node **p;
 	struct rb_node *parent = NULL;
@@ -148,7 +148,7 @@ static inline int __need_auto_defrag(struct btrfs_fs_info *fs_info)
 int btrfs_add_inode_defrag(struct btrfs_trans_handle *trans,
 			   struct btrfs_inode *inode)
 {
-	struct btrfs_fs_info *fs_info = btrfs_sb(inode->vfs_inode.i_sb);
+	struct btrfs_fs_info *fs_info = btrfs_sb(inode_sb(&inode->vfs_inode));
 	struct btrfs_root *root = inode->root;
 	struct inode_defrag *defrag;
 	u64 transid;
@@ -198,7 +198,7 @@ int btrfs_add_inode_defrag(struct btrfs_trans_handle *trans,
 static void btrfs_requeue_inode_defrag(struct btrfs_inode *inode,
 				       struct inode_defrag *defrag)
 {
-	struct btrfs_fs_info *fs_info = btrfs_sb(inode->vfs_inode.i_sb);
+	struct btrfs_fs_info *fs_info = btrfs_sb(inode_sb(&inode->vfs_inode));
 	int ret;
 
 	if (!__need_auto_defrag(fs_info))
@@ -531,7 +531,7 @@ int btrfs_dirty_pages(struct inode *inode, struct page **pages,
 		      size_t num_pages, loff_t pos, size_t write_bytes,
 		      struct extent_state **cached)
 {
-	struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb);
+	struct btrfs_fs_info *fs_info = btrfs_sb(inode_sb(inode));
 	int err = 0;
 	int i;
 	u64 num_bytes;
@@ -1146,7 +1146,7 @@ static int extent_mergeable(struct extent_buffer *leaf, int slot,
 int btrfs_mark_extent_written(struct btrfs_trans_handle *trans,
 			      struct btrfs_inode *inode, u64 start, u64 end)
 {
-	struct btrfs_fs_info *fs_info = btrfs_sb(inode->vfs_inode.i_sb);
+	struct btrfs_fs_info *fs_info = btrfs_sb(inode_sb(&inode->vfs_inode));
 	struct btrfs_root *root = inode->root;
 	struct extent_buffer *leaf;
 	struct btrfs_path *path;
@@ -1483,7 +1483,7 @@ lock_and_cleanup_extent_if_need(struct btrfs_inode *inode, struct page **pages,
 				u64 *lockstart, u64 *lockend,
 				struct extent_state **cached_state)
 {
-	struct btrfs_fs_info *fs_info = btrfs_sb(inode->vfs_inode.i_sb);
+	struct btrfs_fs_info *fs_info = btrfs_sb(inode_sb(&inode->vfs_inode));
 	u64 start_pos;
 	u64 last_pos;
 	int i;
@@ -1539,7 +1539,7 @@ lock_and_cleanup_extent_if_need(struct btrfs_inode *inode, struct page **pages,
 static noinline int check_can_nocow(struct btrfs_inode *inode, loff_t pos,
 				    size_t *write_bytes)
 {
-	struct btrfs_fs_info *fs_info = btrfs_sb(inode->vfs_inode.i_sb);
+	struct btrfs_fs_info *fs_info = btrfs_sb(inode_sb(&inode->vfs_inode));
 	struct btrfs_root *root = inode->root;
 	struct btrfs_ordered_extent *ordered;
 	u64 lockstart, lockend;
@@ -1587,7 +1587,7 @@ static noinline ssize_t __btrfs_buffered_write(struct file *file,
 					       loff_t pos)
 {
 	struct inode *inode = file_inode(file);
-	struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb);
+	struct btrfs_fs_info *fs_info = btrfs_sb(inode_sb(inode));
 	struct btrfs_root *root = BTRFS_I(inode)->root;
 	struct page **pages = NULL;
 	struct extent_state *cached_state = NULL;
@@ -1875,7 +1875,7 @@ static ssize_t btrfs_file_write_iter(struct kiocb *iocb,
 {
 	struct file *file = iocb->ki_filp;
 	struct inode *inode = file_inode(file);
-	struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb);
+	struct btrfs_fs_info *fs_info = btrfs_sb(inode_sb(inode));
 	struct btrfs_root *root = BTRFS_I(inode)->root;
 	u64 start_pos;
 	u64 end_pos;
@@ -2051,7 +2051,7 @@ int btrfs_sync_file(struct file *file, loff_t start, loff_t end, int datasync)
 {
 	struct dentry *dentry = file_dentry(file);
 	struct inode *inode = d_inode(dentry);
-	struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb);
+	struct btrfs_fs_info *fs_info = btrfs_sb(inode_sb(inode));
 	struct btrfs_root *root = BTRFS_I(inode)->root;
 	struct btrfs_trans_handle *trans;
 	struct btrfs_log_ctx ctx;
@@ -2330,7 +2330,7 @@ static int fill_holes(struct btrfs_trans_handle *trans,
 		struct btrfs_inode *inode,
 		struct btrfs_path *path, u64 offset, u64 end)
 {
-	struct btrfs_fs_info *fs_info = btrfs_sb(inode->vfs_inode.i_sb);
+	struct btrfs_fs_info *fs_info = btrfs_sb(inode_sb(&inode->vfs_inode));
 	struct btrfs_root *root = inode->root;
 	struct extent_buffer *leaf;
 	struct btrfs_file_extent_item *fi;
@@ -2438,7 +2438,7 @@ static int fill_holes(struct btrfs_trans_handle *trans,
  */
 static int find_first_non_hole(struct inode *inode, u64 *start, u64 *len)
 {
-	struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb);
+	struct btrfs_fs_info *fs_info = btrfs_sb(inode_sb(inode));
 	struct extent_map *em;
 	int ret = 0;
 
@@ -2501,7 +2501,7 @@ static int btrfs_punch_hole_lock_range(struct inode *inode,
 
 static int btrfs_punch_hole(struct inode *inode, loff_t offset, loff_t len)
 {
-	struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb);
+	struct btrfs_fs_info *fs_info = btrfs_sb(inode_sb(inode));
 	struct btrfs_root *root = BTRFS_I(inode)->root;
 	struct extent_state *cached_state = NULL;
 	struct btrfs_path *path;
@@ -3259,7 +3259,7 @@ static long btrfs_fallocate(struct file *file, int mode,
 
 static int find_desired_extent(struct inode *inode, loff_t *offset, int whence)
 {
-	struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb);
+	struct btrfs_fs_info *fs_info = btrfs_sb(inode_sb(inode));
 	struct extent_map *em = NULL;
 	struct extent_state *cached_state = NULL;
 	u64 lockstart;
@@ -3348,7 +3348,7 @@ static loff_t btrfs_file_llseek(struct file *file, loff_t offset, int whence)
 		}
 	}
 
-	offset = vfs_setpos(file, offset, inode->i_sb->s_maxbytes);
+	offset = vfs_setpos(file, offset, inode_sb(inode)->s_maxbytes);
 out:
 	inode_unlock(inode);
 	return offset;
diff --git a/fs/btrfs/free-space-cache.c b/fs/btrfs/free-space-cache.c
index a9f22ac50d6a..a2fd0ea7caa0 100644
--- a/fs/btrfs/free-space-cache.c
+++ b/fs/btrfs/free-space-cache.c
@@ -327,7 +327,7 @@ static int io_ctl_init(struct btrfs_io_ctl *io_ctl, struct inode *inode,
 		return -ENOMEM;
 
 	io_ctl->num_pages = num_pages;
-	io_ctl->fs_info = btrfs_sb(inode->i_sb);
+	io_ctl->fs_info = btrfs_sb(inode_sb(inode));
 	io_ctl->check_crcs = check_crcs;
 	io_ctl->inode = inode;
 
@@ -670,7 +670,7 @@ static int __load_free_space_cache(struct btrfs_root *root, struct inode *inode,
 				   struct btrfs_free_space_ctl *ctl,
 				   struct btrfs_path *path, u64 offset)
 {
-	struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb);
+	struct btrfs_fs_info *fs_info = btrfs_sb(inode_sb(inode));
 	struct btrfs_free_space_header *header;
 	struct extent_buffer *leaf;
 	struct btrfs_io_ctl io_ctl;
@@ -1143,7 +1143,7 @@ static int __btrfs_wait_cache_io(struct btrfs_root *root,
 	if (!inode)
 		return 0;
 
-	fs_info = btrfs_sb(inode->i_sb);
+	fs_info = btrfs_sb(inode_sb(inode));
 
 	/* Flush the dirty pages in the cache file. */
 	ret = flush_dirty_cache(inode);
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index f53470112670..1d4a28a4763a 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -407,7 +407,7 @@ static noinline int add_async_extent(struct async_cow *cow,
 
 static inline int inode_need_compress(struct inode *inode, u64 start, u64 end)
 {
-	struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb);
+	struct btrfs_fs_info *fs_info = btrfs_sb(inode_sb(inode));
 
 	/* force compress */
 	if (btrfs_test_opt(fs_info, FORCE_COMPRESS))
@@ -457,7 +457,7 @@ static noinline void compress_file_range(struct inode *inode,
 					struct async_cow *async_cow,
 					int *num_added)
 {
-	struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb);
+	struct btrfs_fs_info *fs_info = btrfs_sb(inode_sb(inode));
 	struct btrfs_root *root = BTRFS_I(inode)->root;
 	u64 blocksize = fs_info->sectorsize;
 	u64 actual_end;
@@ -725,7 +725,7 @@ static void free_async_extent_pages(struct async_extent *async_extent)
 static noinline void submit_compressed_extents(struct inode *inode,
 					      struct async_cow *async_cow)
 {
-	struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb);
+	struct btrfs_fs_info *fs_info = btrfs_sb(inode_sb(inode));
 	struct async_extent *async_extent;
 	u64 alloc_hint = 0;
 	struct btrfs_key ins;
@@ -956,7 +956,7 @@ static noinline int cow_file_range(struct inode *inode,
 				   int *page_started, unsigned long *nr_written,
 				   int unlock, struct btrfs_dedupe_hash *hash)
 {
-	struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb);
+	struct btrfs_fs_info *fs_info = btrfs_sb(inode_sb(inode));
 	struct btrfs_root *root = BTRFS_I(inode)->root;
 	u64 alloc_hint = 0;
 	u64 num_bytes;
@@ -1201,7 +1201,7 @@ static int cow_file_range_async(struct inode *inode, struct page *locked_page,
 				unsigned long *nr_written,
 				unsigned int write_flags)
 {
-	struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb);
+	struct btrfs_fs_info *fs_info = btrfs_sb(inode_sb(inode));
 	struct async_cow *async_cow;
 	struct btrfs_root *root = BTRFS_I(inode)->root;
 	unsigned long nr_pages;
@@ -1277,7 +1277,7 @@ static noinline int run_delalloc_nocow(struct inode *inode,
 			      u64 start, u64 end, int *page_started, int force,
 			      unsigned long *nr_written)
 {
-	struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb);
+	struct btrfs_fs_info *fs_info = btrfs_sb(inode_sb(inode));
 	struct btrfs_root *root = BTRFS_I(inode)->root;
 	struct extent_buffer *leaf;
 	struct btrfs_path *path;
@@ -1714,7 +1714,7 @@ static void btrfs_merge_extent_hook(void *private_data,
 static void btrfs_add_delalloc_inodes(struct btrfs_root *root,
 				      struct inode *inode)
 {
-	struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb);
+	struct btrfs_fs_info *fs_info = btrfs_sb(inode_sb(inode));
 
 	spin_lock(&root->delalloc_lock);
 	if (list_empty(&BTRFS_I(inode)->delalloc_inodes)) {
@@ -1737,7 +1737,7 @@ static void btrfs_add_delalloc_inodes(struct btrfs_root *root,
 static void btrfs_del_delalloc_inode(struct btrfs_root *root,
 				     struct btrfs_inode *inode)
 {
-	struct btrfs_fs_info *fs_info = btrfs_sb(inode->vfs_inode.i_sb);
+	struct btrfs_fs_info *fs_info = btrfs_sb(inode_sb(&inode->vfs_inode));
 
 	spin_lock(&root->delalloc_lock);
 	if (!list_empty(&inode->delalloc_inodes)) {
@@ -1765,7 +1765,7 @@ static void btrfs_set_bit_hook(void *private_data,
 {
 	struct inode *inode = private_data;
 
-	struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb);
+	struct btrfs_fs_info *fs_info = btrfs_sb(inode_sb(inode));
 
 	if ((*bits & EXTENT_DEFRAG) && !(*bits & EXTENT_DELALLOC))
 		WARN_ON(1);
@@ -1817,7 +1817,7 @@ static void btrfs_clear_bit_hook(void *private_data,
 				 unsigned *bits)
 {
 	struct btrfs_inode *inode = BTRFS_I((struct inode *)private_data);
-	struct btrfs_fs_info *fs_info = btrfs_sb(inode->vfs_inode.i_sb);
+	struct btrfs_fs_info *fs_info = btrfs_sb(inode_sb(&inode->vfs_inode));
 	u64 len = state->end + 1 - state->start;
 	u32 num_extents = count_max_extents(len);
 
@@ -1893,7 +1893,7 @@ int btrfs_merge_bio_hook(struct page *page, unsigned long offset,
 			 unsigned long bio_flags)
 {
 	struct inode *inode = page->mapping->host;
-	struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb);
+	struct btrfs_fs_info *fs_info = btrfs_sb(inode_sb(inode));
 	u64 logical = (u64)bio->bi_iter.bi_sector << 9;
 	u64 length = 0;
 	u64 map_length;
@@ -1946,7 +1946,7 @@ static blk_status_t __btrfs_submit_bio_done(void *private_data, struct bio *bio,
 			  u64 bio_offset)
 {
 	struct inode *inode = private_data;
-	struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb);
+	struct btrfs_fs_info *fs_info = btrfs_sb(inode_sb(inode));
 	blk_status_t ret;
 
 	ret = btrfs_map_bio(fs_info, bio, mirror_num, 1);
@@ -1980,7 +1980,7 @@ static blk_status_t btrfs_submit_bio_hook(void *private_data, struct bio *bio,
 				 u64 bio_offset)
 {
 	struct inode *inode = private_data;
-	struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb);
+	struct btrfs_fs_info *fs_info = btrfs_sb(inode_sb(inode));
 	struct btrfs_root *root = BTRFS_I(inode)->root;
 	enum btrfs_wq_endio_type metadata = BTRFS_WQ_ENDIO_DATA;
 	blk_status_t ret = 0;
@@ -2159,7 +2159,7 @@ static void btrfs_writepage_fixup_worker(struct btrfs_work *work)
 static int btrfs_writepage_start_hook(struct page *page, u64 start, u64 end)
 {
 	struct inode *inode = page->mapping->host;
-	struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb);
+	struct btrfs_fs_info *fs_info = btrfs_sb(inode_sb(inode));
 	struct btrfs_writepage_fixup *fixup;
 
 	/* this page is properly in the ordered list */
@@ -2374,7 +2374,7 @@ static noinline int record_one_backref(u64 inum, u64 offset, u64 root_id,
 	struct sa_defrag_extent_backref *backref;
 	struct extent_buffer *leaf;
 	struct inode *inode = new->inode;
-	struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb);
+	struct btrfs_fs_info *fs_info = btrfs_sb(inode_sb(inode));
 	int slot;
 	int ret;
 	u64 extent_offset;
@@ -2485,7 +2485,7 @@ static noinline int record_one_backref(u64 inum, u64 offset, u64 root_id,
 static noinline bool record_extent_backrefs(struct btrfs_path *path,
 				   struct new_sa_defrag_extent *new)
 {
-	struct btrfs_fs_info *fs_info = btrfs_sb(new->inode->i_sb);
+	struct btrfs_fs_info *fs_info = btrfs_sb(inode_sb(new->inode));
 	struct old_sa_defrag_extent *old, *tmp;
 	int ret;
 
@@ -2548,7 +2548,7 @@ static noinline int relink_extent_backref(struct btrfs_path *path,
 	struct extent_buffer *leaf;
 	struct old_sa_defrag_extent *old = backref->old;
 	struct new_sa_defrag_extent *new = old->new;
-	struct btrfs_fs_info *fs_info = btrfs_sb(new->inode->i_sb);
+	struct btrfs_fs_info *fs_info = btrfs_sb(inode_sb(new->inode));
 	struct inode *inode;
 	struct extent_state *cached = NULL;
 	int ret = 0;
@@ -2749,7 +2749,7 @@ static void free_sa_defrag_extent(struct new_sa_defrag_extent *new)
 
 static void relink_file_extents(struct new_sa_defrag_extent *new)
 {
-	struct btrfs_fs_info *fs_info = btrfs_sb(new->inode->i_sb);
+	struct btrfs_fs_info *fs_info = btrfs_sb(inode_sb(new->inode));
 	struct btrfs_path *path;
 	struct sa_defrag_extent_backref *backref;
 	struct sa_defrag_extent_backref *prev = NULL;
@@ -2804,7 +2804,7 @@ static struct new_sa_defrag_extent *
 record_old_file_extents(struct inode *inode,
 			struct btrfs_ordered_extent *ordered)
 {
-	struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb);
+	struct btrfs_fs_info *fs_info = btrfs_sb(inode_sb(inode));
 	struct btrfs_root *root = BTRFS_I(inode)->root;
 	struct btrfs_path *path;
 	struct btrfs_key key;
@@ -2936,7 +2936,7 @@ static void btrfs_release_delalloc_bytes(struct btrfs_fs_info *fs_info,
 static int btrfs_finish_ordered_io(struct btrfs_ordered_extent *ordered_extent)
 {
 	struct inode *inode = ordered_extent->inode;
-	struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb);
+	struct btrfs_fs_info *fs_info = btrfs_sb(inode_sb(inode));
 	struct btrfs_root *root = BTRFS_I(inode)->root;
 	struct btrfs_trans_handle *trans = NULL;
 	struct extent_io_tree *io_tree = &BTRFS_I(inode)->io_tree;
@@ -3161,7 +3161,7 @@ static void btrfs_writepage_end_io_hook(struct page *page, u64 start, u64 end,
 				struct extent_state *state, int uptodate)
 {
 	struct inode *inode = page->mapping->host;
-	struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb);
+	struct btrfs_fs_info *fs_info = btrfs_sb(inode_sb(inode));
 	struct btrfs_ordered_extent *ordered_extent = NULL;
 	struct btrfs_workqueue *wq;
 	btrfs_work_func_t func;
@@ -3242,14 +3242,14 @@ static int btrfs_readpage_end_io_hook(struct btrfs_io_bio *io_bio,
 		return 0;
 	}
 
-	phy_offset >>= inode->i_sb->s_blocksize_bits;
+	phy_offset >>= inode_sb(inode)->s_blocksize_bits;
 	return __readpage_endio_check(inode, io_bio, phy_offset, page, offset,
 				      start, (size_t)(end - start + 1));
 }
 
 void btrfs_add_delayed_iput(struct inode *inode)
 {
-	struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb);
+	struct btrfs_fs_info *fs_info = btrfs_sb(inode_sb(inode));
 	struct btrfs_inode *binode = BTRFS_I(inode);
 
 	if (atomic_add_unless(&inode->i_count, -1, 1))
@@ -3346,7 +3346,7 @@ void btrfs_orphan_commit_root(struct btrfs_trans_handle *trans,
 int btrfs_orphan_add(struct btrfs_trans_handle *trans,
 		struct btrfs_inode *inode)
 {
-	struct btrfs_fs_info *fs_info = btrfs_sb(inode->vfs_inode.i_sb);
+	struct btrfs_fs_info *fs_info = btrfs_sb(inode_sb(&inode->vfs_inode));
 	struct btrfs_root *root = inode->root;
 	struct btrfs_block_rsv *block_rsv = NULL;
 	int reserve = 0;
@@ -3758,7 +3758,7 @@ static noinline int acls_after_inode_item(struct extent_buffer *leaf,
  */
 static int btrfs_read_locked_inode(struct inode *inode)
 {
-	struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb);
+	struct btrfs_fs_info *fs_info = btrfs_sb(inode_sb(inode));
 	struct btrfs_path *path;
 	struct extent_buffer *leaf;
 	struct btrfs_inode_item *inode_item;
@@ -4774,7 +4774,7 @@ int btrfs_truncate_inode_items(struct btrfs_trans_handle *trans,
 int btrfs_truncate_block(struct inode *inode, loff_t from, loff_t len,
 			int front)
 {
-	struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb);
+	struct btrfs_fs_info *fs_info = btrfs_sb(inode_sb(inode));
 	struct address_space *mapping = inode->i_mapping;
 	struct extent_io_tree *io_tree = &BTRFS_I(inode)->io_tree;
 	struct btrfs_ordered_extent *ordered;
@@ -4886,7 +4886,7 @@ int btrfs_truncate_block(struct inode *inode, loff_t from, loff_t len,
 static int maybe_insert_hole(struct btrfs_root *root, struct inode *inode,
 			     u64 offset, u64 len)
 {
-	struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb);
+	struct btrfs_fs_info *fs_info = btrfs_sb(inode_sb(inode));
 	struct btrfs_trans_handle *trans;
 	int ret;
 
@@ -4935,7 +4935,7 @@ static int maybe_insert_hole(struct btrfs_root *root, struct inode *inode,
  */
 int btrfs_cont_expand(struct inode *inode, loff_t oldsize, loff_t size)
 {
-	struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb);
+	struct btrfs_fs_info *fs_info = btrfs_sb(inode_sb(inode));
 	struct btrfs_root *root = BTRFS_I(inode)->root;
 	struct extent_io_tree *io_tree = &BTRFS_I(inode)->io_tree;
 	struct extent_map *em = NULL;
@@ -5288,7 +5288,7 @@ static void evict_inode_truncate_pages(struct inode *inode)
 
 void btrfs_evict_inode(struct inode *inode)
 {
-	struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb);
+	struct btrfs_fs_info *fs_info = btrfs_sb(inode_sb(inode));
 	struct btrfs_trans_handle *trans;
 	struct btrfs_root *root = BTRFS_I(inode)->root;
 	struct btrfs_block_rsv *rsv, *global_rsv;
@@ -5612,7 +5612,7 @@ static void inode_tree_add(struct inode *inode)
 
 static void inode_tree_del(struct inode *inode)
 {
-	struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb);
+	struct btrfs_fs_info *fs_info = btrfs_sb(inode_sb(inode));
 	struct btrfs_root *root = BTRFS_I(inode)->root;
 	int empty = 0;
 
@@ -5792,7 +5792,7 @@ static struct inode *new_simple_dir(struct super_block *s,
 
 struct inode *btrfs_lookup_dentry(struct inode *dir, struct dentry *dentry)
 {
-	struct btrfs_fs_info *fs_info = btrfs_sb(dir->i_sb);
+	struct btrfs_fs_info *fs_info = btrfs_sb(inode_sb(dir));
 	struct inode *inode;
 	struct btrfs_root *root = BTRFS_I(dir)->root;
 	struct btrfs_root *sub_root = root;
@@ -5811,7 +5811,7 @@ struct inode *btrfs_lookup_dentry(struct inode *dir, struct dentry *dentry)
 		return ERR_PTR(-ENOENT);
 
 	if (location.type == BTRFS_INODE_ITEM_KEY) {
-		inode = btrfs_iget(dir->i_sb, &location, root, NULL);
+		inode = btrfs_iget(inode_sb(dir), &location, root, NULL);
 		return inode;
 	}
 
@@ -5822,15 +5822,16 @@ struct inode *btrfs_lookup_dentry(struct inode *dir, struct dentry *dentry)
 		if (ret != -ENOENT)
 			inode = ERR_PTR(ret);
 		else
-			inode = new_simple_dir(dir->i_sb, &location, sub_root);
+			inode = new_simple_dir(inode_sb(dir), &location,
+					       sub_root);
 	} else {
-		inode = btrfs_iget(dir->i_sb, &location, sub_root, NULL);
+		inode = btrfs_iget(inode_sb(dir), &location, sub_root, NULL);
 	}
 	srcu_read_unlock(&fs_info->subvol_srcu, index);
 
 	if (!IS_ERR(inode) && root != sub_root) {
 		down_read(&fs_info->cleanup_work_sem);
-		if (!sb_rdonly(inode->i_sb))
+		if (!sb_rdonly(inode_sb(inode)))
 			ret = btrfs_orphan_cleanup(sub_root);
 		up_read(&fs_info->cleanup_work_sem);
 		if (ret) {
@@ -6106,7 +6107,7 @@ int btrfs_write_inode(struct inode *inode, struct writeback_control *wbc)
  */
 static int btrfs_dirty_inode(struct inode *inode)
 {
-	struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb);
+	struct btrfs_fs_info *fs_info = btrfs_sb(inode_sb(inode));
 	struct btrfs_root *root = BTRFS_I(inode)->root;
 	struct btrfs_trans_handle *trans;
 	int ret;
@@ -6464,7 +6465,7 @@ int btrfs_add_link(struct btrfs_trans_handle *trans,
 		   struct btrfs_inode *parent_inode, struct btrfs_inode *inode,
 		   const char *name, int name_len, int add_backref, u64 index)
 {
-	struct btrfs_fs_info *fs_info = btrfs_sb(inode->vfs_inode.i_sb);
+	struct btrfs_fs_info *fs_info = btrfs_sb(inode_sb(&inode->vfs_inode));
 	int ret = 0;
 	struct btrfs_key key;
 	struct btrfs_root *root = parent_inode->root;
@@ -6545,7 +6546,7 @@ static int btrfs_add_nondir(struct btrfs_trans_handle *trans,
 static int btrfs_mknod(struct inode *dir, struct dentry *dentry,
 			umode_t mode, dev_t rdev)
 {
-	struct btrfs_fs_info *fs_info = btrfs_sb(dir->i_sb);
+	struct btrfs_fs_info *fs_info = btrfs_sb(inode_sb(dir));
 	struct btrfs_trans_handle *trans;
 	struct btrfs_root *root = BTRFS_I(dir)->root;
 	struct inode *inode = NULL;
@@ -6617,7 +6618,7 @@ static int btrfs_mknod(struct inode *dir, struct dentry *dentry,
 static int btrfs_create(struct inode *dir, struct dentry *dentry,
 			umode_t mode, bool excl)
 {
-	struct btrfs_fs_info *fs_info = btrfs_sb(dir->i_sb);
+	struct btrfs_fs_info *fs_info = btrfs_sb(inode_sb(dir));
 	struct btrfs_trans_handle *trans;
 	struct btrfs_root *root = BTRFS_I(dir)->root;
 	struct inode *inode = NULL;
@@ -6695,7 +6696,7 @@ static int btrfs_link(struct dentry *old_dentry, struct inode *dir,
 	struct btrfs_trans_handle *trans = NULL;
 	struct btrfs_root *root = BTRFS_I(dir)->root;
 	struct inode *inode = d_inode(old_dentry);
-	struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb);
+	struct btrfs_fs_info *fs_info = btrfs_sb(inode_sb(inode));
 	u64 index;
 	int err;
 	int drop_inode = 0;
@@ -6767,7 +6768,7 @@ static int btrfs_link(struct dentry *old_dentry, struct inode *dir,
 
 static int btrfs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode)
 {
-	struct btrfs_fs_info *fs_info = btrfs_sb(dir->i_sb);
+	struct btrfs_fs_info *fs_info = btrfs_sb(inode_sb(dir));
 	struct inode *inode = NULL;
 	struct btrfs_trans_handle *trans;
 	struct btrfs_root *root = BTRFS_I(dir)->root;
@@ -6898,7 +6899,7 @@ struct extent_map *btrfs_get_extent(struct btrfs_inode *inode,
 	    size_t pg_offset, u64 start, u64 len,
 		int create)
 {
-	struct btrfs_fs_info *fs_info = btrfs_sb(inode->vfs_inode.i_sb);
+	struct btrfs_fs_info *fs_info = btrfs_sb(inode_sb(&inode->vfs_inode));
 	int ret;
 	int err = 0;
 	u64 extent_start = 0;
@@ -7279,7 +7280,7 @@ static struct extent_map *btrfs_create_dio_extent(struct inode *inode,
 static struct extent_map *btrfs_new_extent_direct(struct inode *inode,
 						  u64 start, u64 len)
 {
-	struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb);
+	struct btrfs_fs_info *fs_info = btrfs_sb(inode_sb(inode));
 	struct btrfs_root *root = BTRFS_I(inode)->root;
 	struct extent_map *em;
 	struct btrfs_key ins;
@@ -7311,7 +7312,7 @@ noinline int can_nocow_extent(struct inode *inode, u64 offset, u64 *len,
 			      u64 *orig_start, u64 *orig_block_len,
 			      u64 *ram_bytes)
 {
-	struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb);
+	struct btrfs_fs_info *fs_info = btrfs_sb(inode_sb(inode));
 	struct btrfs_path *path;
 	int ret;
 	struct extent_buffer *leaf;
@@ -7656,7 +7657,7 @@ static struct extent_map *create_io_em(struct inode *inode, u64 start, u64 len,
 static int btrfs_get_blocks_direct(struct inode *inode, sector_t iblock,
 				   struct buffer_head *bh_result, int create)
 {
-	struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb);
+	struct btrfs_fs_info *fs_info = btrfs_sb(inode_sb(inode));
 	struct extent_map *em;
 	struct extent_state *cached_state = NULL;
 	struct btrfs_dio_data *dio_data = NULL;
@@ -7850,7 +7851,7 @@ static inline blk_status_t submit_dio_repair_bio(struct inode *inode,
 						 struct bio *bio,
 						 int mirror_num)
 {
-	struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb);
+	struct btrfs_fs_info *fs_info = btrfs_sb(inode_sb(inode));
 	blk_status_t ret;
 
 	BUG_ON(bio_op(bio) == REQ_OP_WRITE);
@@ -7869,7 +7870,7 @@ static int btrfs_check_dio_repairable(struct inode *inode,
 				      struct io_failure_record *failrec,
 				      int failed_mirror)
 {
-	struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb);
+	struct btrfs_fs_info *fs_info = btrfs_sb(inode_sb(inode));
 	int num_copies;
 
 	num_copies = btrfs_num_copies(fs_info, failrec->logical, failrec->len);
@@ -7936,7 +7937,7 @@ static blk_status_t dio_read_error(struct inode *inode, struct bio *failed_bio,
 		read_mode |= REQ_FAILFAST_DEV;
 
 	isector = start - btrfs_io_bio(failed_bio)->logical;
-	isector >>= inode->i_sb->s_blocksize_bits;
+	isector >>= inode_sb(inode)->s_blocksize_bits;
 	bio = btrfs_create_repair_bio(inode, failed_bio, failrec, page,
 				pgoff, isector, repair_endio, repair_arg);
 	bio_set_op_attrs(bio, REQ_OP_READ, read_mode);
@@ -8209,7 +8210,7 @@ static void __endio_write_update_ordered(struct inode *inode,
 					 const u64 offset, const u64 bytes,
 					 const bool uptodate)
 {
-	struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb);
+	struct btrfs_fs_info *fs_info = btrfs_sb(inode_sb(inode));
 	struct btrfs_ordered_extent *ordered = NULL;
 	struct btrfs_workqueue *wq;
 	btrfs_work_func_t func;
@@ -8346,7 +8347,7 @@ static inline blk_status_t btrfs_lookup_and_bind_dio_csum(struct inode *inode,
 		return 0;
 
 	file_offset -= dip->logical_offset;
-	file_offset >>= inode->i_sb->s_blocksize_bits;
+	file_offset >>= inode_sb(inode)->s_blocksize_bits;
 	io_bio->csum = (u8 *)(((u32 *)orig_io_bio->csum) + file_offset);
 
 	return 0;
@@ -8356,7 +8357,7 @@ static inline blk_status_t
 __btrfs_submit_dio_bio(struct bio *bio, struct inode *inode, u64 file_offset,
 		       int async_submit)
 {
-	struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb);
+	struct btrfs_fs_info *fs_info = btrfs_sb(inode_sb(inode));
 	struct btrfs_dio_private *dip = bio->bi_private;
 	bool write = bio_op(bio) == REQ_OP_WRITE;
 	blk_status_t ret;
@@ -8403,7 +8404,7 @@ __btrfs_submit_dio_bio(struct bio *bio, struct inode *inode, u64 file_offset,
 static int btrfs_submit_direct_hook(struct btrfs_dio_private *dip)
 {
 	struct inode *inode = dip->inode;
-	struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb);
+	struct btrfs_fs_info *fs_info = btrfs_sb(inode_sb(inode));
 	struct bio *bio;
 	struct bio *orig_bio = dip->orig_bio;
 	u64 start_sector = orig_bio->bi_iter.bi_sector;
@@ -8639,7 +8640,7 @@ static ssize_t btrfs_direct_IO(struct kiocb *iocb, struct iov_iter *iter)
 {
 	struct file *file = iocb->ki_filp;
 	struct inode *inode = file->f_mapping->host;
-	struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb);
+	struct btrfs_fs_info *fs_info = btrfs_sb(inode_sb(inode));
 	struct btrfs_dio_data dio_data = { 0 };
 	struct extent_changeset *data_reserved = NULL;
 	loff_t offset = iocb->ki_pos;
@@ -8963,7 +8964,7 @@ int btrfs_page_mkwrite(struct vm_fault *vmf)
 {
 	struct page *page = vmf->page;
 	struct inode *inode = file_inode(vmf->vma->vm_file);
-	struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb);
+	struct btrfs_fs_info *fs_info = btrfs_sb(inode_sb(inode));
 	struct extent_io_tree *io_tree = &BTRFS_I(inode)->io_tree;
 	struct btrfs_ordered_extent *ordered;
 	struct extent_state *cached_state = NULL;
@@ -8980,7 +8981,7 @@ int btrfs_page_mkwrite(struct vm_fault *vmf)
 
 	reserved_space = PAGE_SIZE;
 
-	sb_start_pagefault(inode->i_sb);
+	sb_start_pagefault(inode_sb(inode));
 	page_start = page_offset(page);
 	page_end = page_start + PAGE_SIZE - 1;
 	end = page_end;
@@ -9096,7 +9097,7 @@ int btrfs_page_mkwrite(struct vm_fault *vmf)
 out_unlock:
 	if (!ret) {
 		btrfs_delalloc_release_extents(BTRFS_I(inode), PAGE_SIZE);
-		sb_end_pagefault(inode->i_sb);
+		sb_end_pagefault(inode_sb(inode));
 		extent_changeset_free(data_reserved);
 		return VM_FAULT_LOCKED;
 	}
@@ -9106,14 +9107,14 @@ int btrfs_page_mkwrite(struct vm_fault *vmf)
 	btrfs_delalloc_release_space(inode, data_reserved, page_start,
 				     reserved_space);
 out_noreserve:
-	sb_end_pagefault(inode->i_sb);
+	sb_end_pagefault(inode_sb(inode));
 	extent_changeset_free(data_reserved);
 	return ret;
 }
 
 static int btrfs_truncate(struct inode *inode)
 {
-	struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb);
+	struct btrfs_fs_info *fs_info = btrfs_sb(inode_sb(inode));
 	struct btrfs_root *root = BTRFS_I(inode)->root;
 	struct btrfs_block_rsv *rsv;
 	int ret = 0;
@@ -9385,7 +9386,7 @@ static void btrfs_i_callback(struct rcu_head *head)
 
 void btrfs_destroy_inode(struct inode *inode)
 {
-	struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb);
+	struct btrfs_fs_info *fs_info = btrfs_sb(inode_sb(inode));
 	struct btrfs_ordered_extent *ordered;
 	struct btrfs_root *root = BTRFS_I(inode)->root;
 
@@ -9506,7 +9507,7 @@ static int btrfs_getattr(const struct path *path, struct kstat *stat,
 {
 	u64 delalloc_bytes;
 	struct inode *inode = d_inode(path->dentry);
-	u32 blocksize = inode->i_sb->s_blocksize;
+	u32 blocksize = inode_sb(inode)->s_blocksize;
 	u32 bi_flags = BTRFS_I(inode)->flags;
 
 	stat->result_mask |= STATX_BTIME;
@@ -9542,7 +9543,7 @@ static int btrfs_rename_exchange(struct inode *old_dir,
 			      struct inode *new_dir,
 			      struct dentry *new_dentry)
 {
-	struct btrfs_fs_info *fs_info = btrfs_sb(old_dir->i_sb);
+	struct btrfs_fs_info *fs_info = btrfs_sb(inode_sb(old_dir));
 	struct btrfs_trans_handle *trans;
 	struct btrfs_root *root = BTRFS_I(old_dir)->root;
 	struct btrfs_root *dest = BTRFS_I(new_dir)->root;
@@ -9817,7 +9818,7 @@ static int btrfs_rename(struct inode *old_dir, struct dentry *old_dentry,
 			   struct inode *new_dir, struct dentry *new_dentry,
 			   unsigned int flags)
 {
-	struct btrfs_fs_info *fs_info = btrfs_sb(old_dir->i_sb);
+	struct btrfs_fs_info *fs_info = btrfs_sb(inode_sb(old_dir));
 	struct btrfs_trans_handle *trans;
 	unsigned int trans_num_items;
 	struct btrfs_root *root = BTRFS_I(old_dir)->root;
@@ -10226,7 +10227,7 @@ int btrfs_start_delalloc_roots(struct btrfs_fs_info *fs_info, int delay_iput,
 static int btrfs_symlink(struct inode *dir, struct dentry *dentry,
 			 const char *symname)
 {
-	struct btrfs_fs_info *fs_info = btrfs_sb(dir->i_sb);
+	struct btrfs_fs_info *fs_info = btrfs_sb(inode_sb(dir));
 	struct btrfs_trans_handle *trans;
 	struct btrfs_root *root = BTRFS_I(dir)->root;
 	struct btrfs_path *path;
@@ -10357,7 +10358,7 @@ static int __btrfs_prealloc_file_range(struct inode *inode, int mode,
 				       loff_t actual_len, u64 *alloc_hint,
 				       struct btrfs_trans_handle *trans)
 {
-	struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb);
+	struct btrfs_fs_info *fs_info = btrfs_sb(inode_sb(inode));
 	struct extent_map_tree *em_tree = &BTRFS_I(inode)->extent_tree;
 	struct extent_map *em;
 	struct btrfs_root *root = BTRFS_I(inode)->root;
@@ -10523,7 +10524,7 @@ static int btrfs_permission(struct inode *inode, int mask)
 
 static int btrfs_tmpfile(struct inode *dir, struct dentry *dentry, umode_t mode)
 {
-	struct btrfs_fs_info *fs_info = btrfs_sb(dir->i_sb);
+	struct btrfs_fs_info *fs_info = btrfs_sb(inode_sb(dir));
 	struct btrfs_trans_handle *trans;
 	struct btrfs_root *root = BTRFS_I(dir)->root;
 	struct inode *inode = NULL;
@@ -10601,7 +10602,7 @@ static int btrfs_readpage_io_failed_hook(struct page *page, int failed_mirror)
 static struct btrfs_fs_info *iotree_fs_info(void *private_data)
 {
 	struct inode *inode = private_data;
-	return btrfs_sb(inode->i_sb);
+	return btrfs_sb(inode_sb(inode));
 }
 
 static void btrfs_check_extent_io_range(void *private_data, const char *caller,
diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
index 111ee282b777..a8bc097b23a3 100644
--- a/fs/btrfs/ioctl.c
+++ b/fs/btrfs/ioctl.c
@@ -198,7 +198,7 @@ static int check_flags(unsigned int flags)
 static int btrfs_ioctl_setflags(struct file *file, void __user *arg)
 {
 	struct inode *inode = file_inode(file);
-	struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb);
+	struct btrfs_fs_info *fs_info = btrfs_sb(inode_sb(inode));
 	struct btrfs_inode *ip = BTRFS_I(inode);
 	struct btrfs_root *root = ip->root;
 	struct btrfs_trans_handle *trans;
@@ -358,7 +358,7 @@ static int btrfs_ioctl_getversion(struct file *file, int __user *arg)
 static noinline int btrfs_ioctl_fitrim(struct file *file, void __user *arg)
 {
 	struct inode *inode = file_inode(file);
-	struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb);
+	struct btrfs_fs_info *fs_info = btrfs_sb(inode_sb(inode));
 	struct btrfs_device *device;
 	struct request_queue *q;
 	struct fstrim_range range;
@@ -421,7 +421,7 @@ static noinline int create_subvol(struct inode *dir,
 				  u64 *async_transid,
 				  struct btrfs_qgroup_inherit *inherit)
 {
-	struct btrfs_fs_info *fs_info = btrfs_sb(dir->i_sb);
+	struct btrfs_fs_info *fs_info = btrfs_sb(inode_sb(dir));
 	struct btrfs_trans_handle *trans;
 	struct btrfs_key key;
 	struct btrfs_root_item *root_item;
@@ -626,7 +626,7 @@ static int create_snapshot(struct btrfs_root *root, struct inode *dir,
 			   u64 *async_transid, bool readonly,
 			   struct btrfs_qgroup_inherit *inherit)
 {
-	struct btrfs_fs_info *fs_info = btrfs_sb(dir->i_sb);
+	struct btrfs_fs_info *fs_info = btrfs_sb(inode_sb(dir));
 	struct inode *inode;
 	struct btrfs_pending_snapshot *pending_snapshot;
 	struct btrfs_trans_handle *trans;
@@ -806,7 +806,7 @@ static noinline int btrfs_mksubvol(const struct path *parent,
 				   struct btrfs_qgroup_inherit *inherit)
 {
 	struct inode *dir = d_inode(parent->dentry);
-	struct btrfs_fs_info *fs_info = btrfs_sb(dir->i_sb);
+	struct btrfs_fs_info *fs_info = btrfs_sb(inode_sb(dir));
 	struct dentry *dentry;
 	int error;
 
@@ -1171,7 +1171,7 @@ static int cluster_pages_for_defrag(struct inode *inode,
 	if (!i_done || ret)
 		goto out;
 
-	if (!(inode->i_sb->s_flags & SB_ACTIVE))
+	if (!(inode_sb(inode)->s_flags & SB_ACTIVE))
 		goto out;
 
 	/*
@@ -1236,7 +1236,7 @@ int btrfs_defrag_file(struct inode *inode, struct file *file,
 		      struct btrfs_ioctl_defrag_range_args *range,
 		      u64 newer_than, unsigned long max_to_defrag)
 {
-	struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb);
+	struct btrfs_fs_info *fs_info = btrfs_sb(inode_sb(inode));
 	struct btrfs_root *root = BTRFS_I(inode)->root;
 	struct file_ra_state *ra = NULL;
 	unsigned long last_index;
@@ -1331,7 +1331,7 @@ int btrfs_defrag_file(struct inode *inode, struct file *file,
 		 * make sure we stop running if someone unmounts
 		 * the FS
 		 */
-		if (!(inode->i_sb->s_flags & SB_ACTIVE))
+		if (!(inode_sb(inode)->s_flags & SB_ACTIVE))
 			break;
 
 		if (btrfs_defrag_cancelled(fs_info)) {
@@ -1442,7 +1442,7 @@ static noinline int btrfs_ioctl_resize(struct file *file,
 					void __user *arg)
 {
 	struct inode *inode = file_inode(file);
-	struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb);
+	struct btrfs_fs_info *fs_info = btrfs_sb(inode_sb(inode));
 	u64 new_size;
 	u64 old_size;
 	u64 devid = 1;
@@ -1621,7 +1621,7 @@ static noinline int btrfs_ioctl_snap_create_transid(struct file *file,
 		}
 
 		src_inode = file_inode(src.file);
-		if (src_inode->i_sb != file_inode(file)->i_sb) {
+		if (inode_sb(src_inode) != inode_sb(file_inode(file))) {
 			btrfs_info(BTRFS_I(file_inode(file))->root->fs_info,
 				   "Snapshot src from another FS");
 			ret = -EXDEV;
@@ -1730,7 +1730,7 @@ static noinline int btrfs_ioctl_subvol_getflags(struct file *file,
 						void __user *arg)
 {
 	struct inode *inode = file_inode(file);
-	struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb);
+	struct btrfs_fs_info *fs_info = btrfs_sb(inode_sb(inode));
 	struct btrfs_root *root = BTRFS_I(inode)->root;
 	int ret = 0;
 	u64 flags = 0;
@@ -1753,7 +1753,7 @@ static noinline int btrfs_ioctl_subvol_setflags(struct file *file,
 					      void __user *arg)
 {
 	struct inode *inode = file_inode(file);
-	struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb);
+	struct btrfs_fs_info *fs_info = btrfs_sb(inode_sb(inode));
 	struct btrfs_root *root = BTRFS_I(inode)->root;
 	struct btrfs_trans_handle *trans;
 	u64 root_flags;
@@ -2050,7 +2050,7 @@ static noinline int search_ioctl(struct inode *inode,
 				 size_t *buf_size,
 				 char __user *ubuf)
 {
-	struct btrfs_fs_info *info = btrfs_sb(inode->i_sb);
+	struct btrfs_fs_info *info = btrfs_sb(inode_sb(inode));
 	struct btrfs_root *root;
 	struct btrfs_key key;
 	struct btrfs_path *path;
@@ -2647,7 +2647,7 @@ static long btrfs_ioctl_add_dev(struct btrfs_fs_info *fs_info, void __user *arg)
 static long btrfs_ioctl_rm_dev_v2(struct file *file, void __user *arg)
 {
 	struct inode *inode = file_inode(file);
-	struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb);
+	struct btrfs_fs_info *fs_info = btrfs_sb(inode_sb(inode));
 	struct btrfs_ioctl_vol_args_v2 *vol_args;
 	int ret;
 
@@ -2699,7 +2699,7 @@ static long btrfs_ioctl_rm_dev_v2(struct file *file, void __user *arg)
 static long btrfs_ioctl_rm_dev(struct file *file, void __user *arg)
 {
 	struct inode *inode = file_inode(file);
-	struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb);
+	struct btrfs_fs_info *fs_info = btrfs_sb(inode_sb(inode));
 	struct btrfs_ioctl_vol_args *vol_args;
 	int ret;
 
@@ -3354,7 +3354,7 @@ static int clone_copy_inline_extent(struct inode *dst,
 				    const u64 size,
 				    char *inline_data)
 {
-	struct btrfs_fs_info *fs_info = btrfs_sb(dst->i_sb);
+	struct btrfs_fs_info *fs_info = btrfs_sb(inode_sb(dst));
 	struct btrfs_root *root = BTRFS_I(dst)->root;
 	const u64 aligned_end = ALIGN(new_key->offset + datal,
 				      fs_info->sectorsize);
@@ -3478,7 +3478,7 @@ static int btrfs_clone(struct inode *src, struct inode *inode,
 		       const u64 off, const u64 olen, const u64 olen_aligned,
 		       const u64 destoff, int no_time_update)
 {
-	struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb);
+	struct btrfs_fs_info *fs_info = btrfs_sb(inode_sb(inode));
 	struct btrfs_root *root = BTRFS_I(inode)->root;
 	struct btrfs_path *path = NULL;
 	struct extent_buffer *leaf;
@@ -3812,7 +3812,7 @@ static noinline int btrfs_clone_files(struct file *file, struct file *file_src,
 {
 	struct inode *inode = file_inode(file);
 	struct inode *src = file_inode(file_src);
-	struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb);
+	struct btrfs_fs_info *fs_info = btrfs_sb(inode_sb(inode));
 	struct btrfs_root *root = BTRFS_I(inode)->root;
 	int ret;
 	u64 len = olen;
@@ -3834,7 +3834,7 @@ static noinline int btrfs_clone_files(struct file *file, struct file *file_src,
 		return -EROFS;
 
 	if (file_src->f_path.mnt != file->f_path.mnt ||
-	    src->i_sb != inode->i_sb)
+	    inode_sb(src) != inode_sb(inode))
 		return -EXDEV;
 
 	/* don't make the dst file partly checksummed */
@@ -3945,7 +3945,7 @@ int btrfs_clone_file_range(struct file *src_file, loff_t off,
 static long btrfs_ioctl_trans_start(struct file *file)
 {
 	struct inode *inode = file_inode(file);
-	struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb);
+	struct btrfs_fs_info *fs_info = btrfs_sb(inode_sb(inode));
 	struct btrfs_root *root = BTRFS_I(inode)->root;
 	struct btrfs_trans_handle *trans;
 	struct btrfs_file_private *private;
@@ -4006,7 +4006,7 @@ static long btrfs_ioctl_trans_start(struct file *file)
 static long btrfs_ioctl_default_subvol(struct file *file, void __user *argp)
 {
 	struct inode *inode = file_inode(file);
-	struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb);
+	struct btrfs_fs_info *fs_info = btrfs_sb(inode_sb(inode));
 	struct btrfs_root *root = BTRFS_I(inode)->root;
 	struct btrfs_root *new_root;
 	struct btrfs_dir_item *di;
@@ -4313,7 +4313,7 @@ static noinline long btrfs_ioctl_wait_sync(struct btrfs_fs_info *fs_info,
 
 static long btrfs_ioctl_scrub(struct file *file, void __user *arg)
 {
-	struct btrfs_fs_info *fs_info = btrfs_sb(file_inode(file)->i_sb);
+	struct btrfs_fs_info *fs_info = btrfs_sb(inode_sb(file_inode(file)));
 	struct btrfs_ioctl_scrub_args *sa;
 	int ret;
 
@@ -4816,7 +4816,7 @@ static long btrfs_ioctl_balance_progress(struct btrfs_fs_info *fs_info,
 static long btrfs_ioctl_quota_ctl(struct file *file, void __user *arg)
 {
 	struct inode *inode = file_inode(file);
-	struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb);
+	struct btrfs_fs_info *fs_info = btrfs_sb(inode_sb(inode));
 	struct btrfs_ioctl_quota_ctl_args *sa;
 	struct btrfs_trans_handle *trans = NULL;
 	int ret;
@@ -4868,7 +4868,7 @@ static long btrfs_ioctl_quota_ctl(struct file *file, void __user *arg)
 static long btrfs_ioctl_qgroup_assign(struct file *file, void __user *arg)
 {
 	struct inode *inode = file_inode(file);
-	struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb);
+	struct btrfs_fs_info *fs_info = btrfs_sb(inode_sb(inode));
 	struct btrfs_root *root = BTRFS_I(inode)->root;
 	struct btrfs_ioctl_qgroup_assign_args *sa;
 	struct btrfs_trans_handle *trans;
@@ -4921,7 +4921,7 @@ static long btrfs_ioctl_qgroup_assign(struct file *file, void __user *arg)
 static long btrfs_ioctl_qgroup_create(struct file *file, void __user *arg)
 {
 	struct inode *inode = file_inode(file);
-	struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb);
+	struct btrfs_fs_info *fs_info = btrfs_sb(inode_sb(inode));
 	struct btrfs_root *root = BTRFS_I(inode)->root;
 	struct btrfs_ioctl_qgroup_create_args *sa;
 	struct btrfs_trans_handle *trans;
@@ -4972,7 +4972,7 @@ static long btrfs_ioctl_qgroup_create(struct file *file, void __user *arg)
 static long btrfs_ioctl_qgroup_limit(struct file *file, void __user *arg)
 {
 	struct inode *inode = file_inode(file);
-	struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb);
+	struct btrfs_fs_info *fs_info = btrfs_sb(inode_sb(inode));
 	struct btrfs_root *root = BTRFS_I(inode)->root;
 	struct btrfs_ioctl_qgroup_limit_args *sa;
 	struct btrfs_trans_handle *trans;
@@ -5021,7 +5021,7 @@ static long btrfs_ioctl_qgroup_limit(struct file *file, void __user *arg)
 static long btrfs_ioctl_quota_rescan(struct file *file, void __user *arg)
 {
 	struct inode *inode = file_inode(file);
-	struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb);
+	struct btrfs_fs_info *fs_info = btrfs_sb(inode_sb(inode));
 	struct btrfs_ioctl_quota_rescan_args *qsa;
 	int ret;
 
@@ -5055,7 +5055,7 @@ static long btrfs_ioctl_quota_rescan(struct file *file, void __user *arg)
 static long btrfs_ioctl_quota_rescan_status(struct file *file, void __user *arg)
 {
 	struct inode *inode = file_inode(file);
-	struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb);
+	struct btrfs_fs_info *fs_info = btrfs_sb(inode_sb(inode));
 	struct btrfs_ioctl_quota_rescan_args *qsa;
 	int ret = 0;
 
@@ -5081,7 +5081,7 @@ static long btrfs_ioctl_quota_rescan_status(struct file *file, void __user *arg)
 static long btrfs_ioctl_quota_rescan_wait(struct file *file, void __user *arg)
 {
 	struct inode *inode = file_inode(file);
-	struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb);
+	struct btrfs_fs_info *fs_info = btrfs_sb(inode_sb(inode));
 
 	if (!capable(CAP_SYS_ADMIN))
 		return -EPERM;
@@ -5093,7 +5093,7 @@ static long _btrfs_ioctl_set_received_subvol(struct file *file,
 					    struct btrfs_ioctl_received_subvol_args *sa)
 {
 	struct inode *inode = file_inode(file);
-	struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb);
+	struct btrfs_fs_info *fs_info = btrfs_sb(inode_sb(inode));
 	struct btrfs_root *root = BTRFS_I(inode)->root;
 	struct btrfs_root_item *root_item = &root->root_item;
 	struct btrfs_trans_handle *trans;
@@ -5251,7 +5251,7 @@ static long btrfs_ioctl_set_received_subvol(struct file *file,
 static int btrfs_ioctl_get_fslabel(struct file *file, void __user *arg)
 {
 	struct inode *inode = file_inode(file);
-	struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb);
+	struct btrfs_fs_info *fs_info = btrfs_sb(inode_sb(inode));
 	size_t len;
 	int ret;
 	char label[BTRFS_LABEL_SIZE];
@@ -5276,7 +5276,7 @@ static int btrfs_ioctl_get_fslabel(struct file *file, void __user *arg)
 static int btrfs_ioctl_set_fslabel(struct file *file, void __user *arg)
 {
 	struct inode *inode = file_inode(file);
-	struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb);
+	struct btrfs_fs_info *fs_info = btrfs_sb(inode_sb(inode));
 	struct btrfs_root *root = BTRFS_I(inode)->root;
 	struct btrfs_super_block *super_block = fs_info->super_copy;
 	struct btrfs_trans_handle *trans;
@@ -5338,7 +5338,7 @@ int btrfs_ioctl_get_supported_features(void __user *arg)
 static int btrfs_ioctl_get_features(struct file *file, void __user *arg)
 {
 	struct inode *inode = file_inode(file);
-	struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb);
+	struct btrfs_fs_info *fs_info = btrfs_sb(inode_sb(inode));
 	struct btrfs_super_block *super_block = fs_info->super_copy;
 	struct btrfs_ioctl_feature_flags features;
 
@@ -5420,7 +5420,7 @@ check_feature_bits(fs_info, FEAT_##mask_base, change_mask, flags,	\
 static int btrfs_ioctl_set_features(struct file *file, void __user *arg)
 {
 	struct inode *inode = file_inode(file);
-	struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb);
+	struct btrfs_fs_info *fs_info = btrfs_sb(inode_sb(inode));
 	struct btrfs_root *root = BTRFS_I(inode)->root;
 	struct btrfs_super_block *super_block = fs_info->super_copy;
 	struct btrfs_ioctl_feature_flags flags[2];
@@ -5527,7 +5527,7 @@ long btrfs_ioctl(struct file *file, unsigned int
 		cmd, unsigned long arg)
 {
 	struct inode *inode = file_inode(file);
-	struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb);
+	struct btrfs_fs_info *fs_info = btrfs_sb(inode_sb(inode));
 	struct btrfs_root *root = BTRFS_I(inode)->root;
 	void __user *argp = (void __user *)arg;
 
@@ -5598,7 +5598,7 @@ long btrfs_ioctl(struct file *file, unsigned int
 		ret = btrfs_start_delalloc_roots(fs_info, 0, -1);
 		if (ret)
 			return ret;
-		ret = btrfs_sync_fs(inode->i_sb, 1);
+		ret = btrfs_sync_fs(inode_sb(inode), 1);
 		/*
 		 * The transaction thread may want to do more work,
 		 * namely it pokes the cleaner kthread that will start
diff --git a/fs/btrfs/ordered-data.c b/fs/btrfs/ordered-data.c
index 5b311aeddcc8..cfe166246ac1 100644
--- a/fs/btrfs/ordered-data.c
+++ b/fs/btrfs/ordered-data.c
@@ -66,7 +66,7 @@ static struct rb_node *tree_insert(struct rb_root *root, u64 file_offset,
 static void ordered_data_tree_panic(struct inode *inode, int errno,
 					       u64 offset)
 {
-	struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb);
+	struct btrfs_fs_info *fs_info = btrfs_sb(inode_sb(inode));
 	btrfs_panic(fs_info, errno,
 		    "Inconsistency in ordered tree at offset %llu", offset);
 }
@@ -186,7 +186,7 @@ static int __btrfs_add_ordered_extent(struct inode *inode, u64 file_offset,
 				      u64 start, u64 len, u64 disk_len,
 				      int type, int dio, int compress_type)
 {
-	struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb);
+	struct btrfs_fs_info *fs_info = btrfs_sb(inode_sb(inode));
 	struct btrfs_root *root = BTRFS_I(inode)->root;
 	struct btrfs_ordered_inode_tree *tree;
 	struct rb_node *node;
@@ -312,7 +312,7 @@ int btrfs_dec_test_first_ordered_pending(struct inode *inode,
 				   struct btrfs_ordered_extent **cached,
 				   u64 *file_offset, u64 io_size, int uptodate)
 {
-	struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb);
+	struct btrfs_fs_info *fs_info = btrfs_sb(inode_sb(inode));
 	struct btrfs_ordered_inode_tree *tree;
 	struct rb_node *node;
 	struct btrfs_ordered_extent *entry = NULL;
@@ -598,7 +598,7 @@ void btrfs_put_ordered_extent(struct btrfs_ordered_extent *entry)
 void btrfs_remove_ordered_extent(struct inode *inode,
 				 struct btrfs_ordered_extent *entry)
 {
-	struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb);
+	struct btrfs_fs_info *fs_info = btrfs_sb(inode_sb(inode));
 	struct btrfs_ordered_inode_tree *tree;
 	struct btrfs_inode *btrfs_inode = BTRFS_I(inode);
 	struct btrfs_root *root = btrfs_inode->root;
@@ -1123,9 +1123,9 @@ int btrfs_find_ordered_sum(struct inode *inode, u64 offset, u64 disk_bytenr,
 		if (disk_bytenr >= ordered_sum->bytenr &&
 		    disk_bytenr < ordered_sum->bytenr + ordered_sum->len) {
 			i = (disk_bytenr - ordered_sum->bytenr) >>
-			    inode->i_sb->s_blocksize_bits;
+			    inode_sb(inode)->s_blocksize_bits;
 			num_sectors = ordered_sum->len >>
-				      inode->i_sb->s_blocksize_bits;
+				      inode_sb(inode)->s_blocksize_bits;
 			num_sectors = min_t(int, len - index, num_sectors - i);
 			memcpy(sum + index, ordered_sum->sums + i,
 			       num_sectors);
diff --git a/fs/btrfs/relocation.c b/fs/btrfs/relocation.c
index cd2298d185dd..40e3ae49a746 100644
--- a/fs/btrfs/relocation.c
+++ b/fs/btrfs/relocation.c
@@ -3145,7 +3145,7 @@ static noinline_for_stack
 int setup_extent_mapping(struct inode *inode, u64 start, u64 end,
 			 u64 block_start)
 {
-	struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb);
+	struct btrfs_fs_info *fs_info = btrfs_sb(inode_sb(inode));
 	struct extent_map_tree *em_tree = &BTRFS_I(inode)->extent_tree;
 	struct extent_map *em;
 	int ret = 0;
@@ -3179,7 +3179,7 @@ int setup_extent_mapping(struct inode *inode, u64 start, u64 end,
 static int relocate_file_extent_cluster(struct inode *inode,
 					struct file_extent_cluster *cluster)
 {
-	struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb);
+	struct btrfs_fs_info *fs_info = btrfs_sb(inode_sb(inode));
 	u64 page_start;
 	u64 page_end;
 	u64 offset = BTRFS_I(inode)->index_cnt;
@@ -4643,7 +4643,7 @@ int btrfs_recover_relocation(struct btrfs_root *root)
  */
 int btrfs_reloc_clone_csums(struct inode *inode, u64 file_pos, u64 len)
 {
-	struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb);
+	struct btrfs_fs_info *fs_info = btrfs_sb(inode_sb(inode));
 	struct btrfs_ordered_sum *sums;
 	struct btrfs_ordered_extent *ordered;
 	int ret;
diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c
index 434457794c27..a07ca88b6cc6 100644
--- a/fs/btrfs/tree-log.c
+++ b/fs/btrfs/tree-log.c
@@ -3738,7 +3738,7 @@ static noinline int copy_items(struct btrfs_trans_handle *trans,
 			       int start_slot, int nr, int inode_only,
 			       u64 logged_isize)
 {
-	struct btrfs_fs_info *fs_info = btrfs_sb(inode->vfs_inode.i_sb);
+	struct btrfs_fs_info *fs_info = btrfs_sb(inode_sb(&inode->vfs_inode));
 	unsigned long src_offset;
 	unsigned long dst_offset;
 	struct btrfs_root *log = inode->root->log_root;
@@ -5417,7 +5417,7 @@ static int btrfs_log_all_parents(struct btrfs_trans_handle *trans,
 				 struct btrfs_inode *inode,
 				 struct btrfs_log_ctx *ctx)
 {
-	struct btrfs_fs_info *fs_info = btrfs_sb(inode->vfs_inode.i_sb);
+	struct btrfs_fs_info *fs_info = btrfs_sb(inode_sb(&inode->vfs_inode));
 	int ret;
 	struct btrfs_path *path;
 	struct btrfs_key key;
@@ -5533,7 +5533,7 @@ static int btrfs_log_inode_parent(struct btrfs_trans_handle *trans,
 	bool log_dentries = false;
 	struct btrfs_inode *orig_inode = inode;
 
-	sb = inode->vfs_inode.i_sb;
+	sb = inode_sb(&inode->vfs_inode);
 
 	if (btrfs_test_opt(fs_info, NOTREELOG)) {
 		ret = 1;
@@ -5952,7 +5952,7 @@ int btrfs_log_new_name(struct btrfs_trans_handle *trans,
 			struct btrfs_inode *inode, struct btrfs_inode *old_dir,
 			struct dentry *parent)
 {
-	struct btrfs_fs_info *fs_info = btrfs_sb(inode->vfs_inode.i_sb);
+	struct btrfs_fs_info *fs_info = btrfs_sb(inode_sb(&inode->vfs_inode));
 	struct btrfs_root *root = inode->root;
 
 	/*
-- 
2.15.1

^ permalink raw reply related	[flat|nested] 88+ messages in thread

* [PATCH 19/76] fs/ceph: Use inode_sb() helper instead of inode->i_sb
  2018-05-08 18:03 [RFC][PATCH 0/76] vfs: 'views' for filesystems with more than one root Mark Fasheh
                   ` (17 preceding siblings ...)
  2018-05-08 18:03 ` [PATCH 18/76] fs/btrfs: " Mark Fasheh
@ 2018-05-08 18:03 ` Mark Fasheh
  2018-05-08 18:03 ` [PATCH 20/76] fs/cifs: " Mark Fasheh
                   ` (57 subsequent siblings)
  76 siblings, 0 replies; 88+ messages in thread
From: Mark Fasheh @ 2018-05-08 18:03 UTC (permalink / raw)
  To: linux-fsdevel; +Cc: linux-kernel, linux-btrfs, Mark Fasheh

Signed-off-by: Mark Fasheh <mfasheh@suse.de>
---
 fs/ceph/addr.c       |  2 +-
 fs/ceph/caps.c       | 16 ++++++++--------
 fs/ceph/dir.c        | 24 ++++++++++++------------
 fs/ceph/file.c       | 16 ++++++++--------
 fs/ceph/inode.c      | 16 ++++++++--------
 fs/ceph/ioctl.c      |  6 +++---
 fs/ceph/locks.c      |  2 +-
 fs/ceph/mds_client.c |  2 +-
 fs/ceph/snap.c       |  2 +-
 fs/ceph/super.h      |  2 +-
 fs/ceph/xattr.c      |  8 ++++----
 11 files changed, 48 insertions(+), 48 deletions(-)

diff --git a/fs/ceph/addr.c b/fs/ceph/addr.c
index b4336b42ce3b..8741e928fca0 100644
--- a/fs/ceph/addr.c
+++ b/fs/ceph/addr.c
@@ -776,7 +776,7 @@ static void writepages_finish(struct ceph_osd_request *req)
 	osd_data = osd_req_op_extent_osd_data(req, 0);
 	if (osd_data->pages_from_pool)
 		mempool_free(osd_data->pages,
-			     ceph_sb_to_client(inode->i_sb)->wb_pagevec_pool);
+			     ceph_sb_to_client(inode_sb(inode))->wb_pagevec_pool);
 	else
 		kfree(osd_data->pages);
 	ceph_osdc_put_request(req);
diff --git a/fs/ceph/caps.c b/fs/ceph/caps.c
index 0e5bd3e3344e..d92e6e9ff6e2 100644
--- a/fs/ceph/caps.c
+++ b/fs/ceph/caps.c
@@ -977,7 +977,7 @@ static void drop_inode_snap_realm(struct ceph_inode_info *ci)
 	ci->i_snap_realm_counter++;
 	ci->i_snap_realm = NULL;
 	spin_unlock(&realm->inodes_with_caps_lock);
-	ceph_put_snap_realm(ceph_sb_to_client(ci->vfs_inode.i_sb)->mdsc,
+	ceph_put_snap_realm(ceph_sb_to_client(inode_sb(&ci->vfs_inode))->mdsc,
 			    realm);
 }
 
@@ -992,7 +992,7 @@ void __ceph_remove_cap(struct ceph_cap *cap, bool queue_release)
 	struct ceph_mds_session *session = cap->session;
 	struct ceph_inode_info *ci = cap->ci;
 	struct ceph_mds_client *mdsc =
-		ceph_sb_to_client(ci->vfs_inode.i_sb)->mdsc;
+		ceph_sb_to_client(inode_sb(&ci->vfs_inode))->mdsc;
 	int removed = 0;
 
 	dout("__ceph_remove_cap %p from %p\n", cap, &ci->vfs_inode);
@@ -1551,7 +1551,7 @@ int __ceph_mark_dirty_caps(struct ceph_inode_info *ci, int mask,
 			   struct ceph_cap_flush **pcf)
 {
 	struct ceph_mds_client *mdsc =
-		ceph_sb_to_client(ci->vfs_inode.i_sb)->mdsc;
+		ceph_sb_to_client(inode_sb(&ci->vfs_inode))->mdsc;
 	struct inode *inode = &ci->vfs_inode;
 	int was = ci->i_dirty_caps;
 	int dirty = 0;
@@ -1660,7 +1660,7 @@ static int __mark_caps_flushing(struct inode *inode,
 				struct ceph_mds_session *session, bool wake,
 				u64 *flush_tid, u64 *oldest_flush_tid)
 {
-	struct ceph_mds_client *mdsc = ceph_sb_to_client(inode->i_sb)->mdsc;
+	struct ceph_mds_client *mdsc = ceph_sb_to_client(inode_sb(inode))->mdsc;
 	struct ceph_inode_info *ci = ceph_inode(inode);
 	struct ceph_cap_flush *cf = NULL;
 	int flushing;
@@ -2029,7 +2029,7 @@ void ceph_check_caps(struct ceph_inode_info *ci, int flags,
  */
 static int try_flush_caps(struct inode *inode, u64 *ptid)
 {
-	struct ceph_mds_client *mdsc = ceph_sb_to_client(inode->i_sb)->mdsc;
+	struct ceph_mds_client *mdsc = ceph_sb_to_client(inode_sb(inode))->mdsc;
 	struct ceph_inode_info *ci = ceph_inode(inode);
 	struct ceph_mds_session *session = NULL;
 	int flushing = 0;
@@ -2217,7 +2217,7 @@ int ceph_write_inode(struct inode *inode, struct writeback_control *wbc)
 				       caps_are_flushed(inode, flush_tid));
 	} else {
 		struct ceph_mds_client *mdsc =
-			ceph_sb_to_client(inode->i_sb)->mdsc;
+			ceph_sb_to_client(inode_sb(inode))->mdsc;
 
 		spin_lock(&ci->i_ceph_lock);
 		if (__ceph_caps_dirty(ci))
@@ -3228,7 +3228,7 @@ static void handle_cap_flush_ack(struct inode *inode, u64 flush_tid,
 	__releases(ci->i_ceph_lock)
 {
 	struct ceph_inode_info *ci = ceph_inode(inode);
-	struct ceph_mds_client *mdsc = ceph_sb_to_client(inode->i_sb)->mdsc;
+	struct ceph_mds_client *mdsc = ceph_sb_to_client(inode_sb(inode))->mdsc;
 	struct ceph_cap_flush *cf, *tmp_cf;
 	LIST_HEAD(to_remove);
 	unsigned seq = le32_to_cpu(m->seq);
@@ -3331,7 +3331,7 @@ static void handle_cap_flushsnap_ack(struct inode *inode, u64 flush_tid,
 				     struct ceph_mds_session *session)
 {
 	struct ceph_inode_info *ci = ceph_inode(inode);
-	struct ceph_mds_client *mdsc = ceph_sb_to_client(inode->i_sb)->mdsc;
+	struct ceph_mds_client *mdsc = ceph_sb_to_client(inode_sb(inode))->mdsc;
 	u64 follows = le64_to_cpu(m->snap_follows);
 	struct ceph_cap_snap *capsnap;
 	bool flushed = false;
diff --git a/fs/ceph/dir.c b/fs/ceph/dir.c
index f1d9c6cc0491..f41c584cdae7 100644
--- a/fs/ceph/dir.c
+++ b/fs/ceph/dir.c
@@ -317,7 +317,7 @@ static int ceph_readdir(struct file *file, struct dir_context *ctx)
 	if (ctx->pos == 0) {
 		dout("readdir off 0 -> '.'\n");
 		if (!dir_emit(ctx, ".", 1, 
-			    ceph_translate_ino(inode->i_sb, inode->i_ino),
+			    ceph_translate_ino(inode_sb(inode), inode->i_ino),
 			    inode->i_mode >> 12))
 			return 0;
 		ctx->pos = 1;
@@ -326,7 +326,7 @@ static int ceph_readdir(struct file *file, struct dir_context *ctx)
 		ino_t ino = parent_ino(file->f_path.dentry);
 		dout("readdir off 1 -> '..'\n");
 		if (!dir_emit(ctx, "..", 2,
-			    ceph_translate_ino(inode->i_sb, ino),
+			    ceph_translate_ino(inode_sb(inode), ino),
 			    inode->i_mode >> 12))
 			return 0;
 		ctx->pos = 2;
@@ -513,7 +513,7 @@ static int ceph_readdir(struct file *file, struct dir_context *ctx)
 		ino = ceph_vino_to_ino(vino);
 
 		if (!dir_emit(ctx, rde->name, rde->name_len,
-			      ceph_translate_ino(inode->i_sb, ino), ftype)) {
+			      ceph_translate_ino(inode_sb(inode), ino), ftype)) {
 			dout("filldir stopping us...\n");
 			return 0;
 		}
@@ -727,7 +727,7 @@ static bool is_root_ceph_dentry(struct inode *inode, struct dentry *dentry)
 static struct dentry *ceph_lookup(struct inode *dir, struct dentry *dentry,
 				  unsigned int flags)
 {
-	struct ceph_fs_client *fsc = ceph_sb_to_client(dir->i_sb);
+	struct ceph_fs_client *fsc = ceph_sb_to_client(inode_sb(dir));
 	struct ceph_mds_client *mdsc = fsc->mdsc;
 	struct ceph_mds_request *req;
 	int op;
@@ -816,7 +816,7 @@ int ceph_handle_notrace_create(struct inode *dir, struct dentry *dentry)
 static int ceph_mknod(struct inode *dir, struct dentry *dentry,
 		      umode_t mode, dev_t rdev)
 {
-	struct ceph_fs_client *fsc = ceph_sb_to_client(dir->i_sb);
+	struct ceph_fs_client *fsc = ceph_sb_to_client(inode_sb(dir));
 	struct ceph_mds_client *mdsc = fsc->mdsc;
 	struct ceph_mds_request *req;
 	struct ceph_acls_info acls = {};
@@ -870,7 +870,7 @@ static int ceph_create(struct inode *dir, struct dentry *dentry, umode_t mode,
 static int ceph_symlink(struct inode *dir, struct dentry *dentry,
 			    const char *dest)
 {
-	struct ceph_fs_client *fsc = ceph_sb_to_client(dir->i_sb);
+	struct ceph_fs_client *fsc = ceph_sb_to_client(inode_sb(dir));
 	struct ceph_mds_client *mdsc = fsc->mdsc;
 	struct ceph_mds_request *req;
 	int err;
@@ -908,7 +908,7 @@ static int ceph_symlink(struct inode *dir, struct dentry *dentry,
 
 static int ceph_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode)
 {
-	struct ceph_fs_client *fsc = ceph_sb_to_client(dir->i_sb);
+	struct ceph_fs_client *fsc = ceph_sb_to_client(inode_sb(dir));
 	struct ceph_mds_client *mdsc = fsc->mdsc;
 	struct ceph_mds_request *req;
 	struct ceph_acls_info acls = {};
@@ -967,7 +967,7 @@ static int ceph_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode)
 static int ceph_link(struct dentry *old_dentry, struct inode *dir,
 		     struct dentry *dentry)
 {
-	struct ceph_fs_client *fsc = ceph_sb_to_client(dir->i_sb);
+	struct ceph_fs_client *fsc = ceph_sb_to_client(inode_sb(dir));
 	struct ceph_mds_client *mdsc = fsc->mdsc;
 	struct ceph_mds_request *req;
 	int err;
@@ -1007,7 +1007,7 @@ static int ceph_link(struct dentry *old_dentry, struct inode *dir,
  */
 static int ceph_unlink(struct inode *dir, struct dentry *dentry)
 {
-	struct ceph_fs_client *fsc = ceph_sb_to_client(dir->i_sb);
+	struct ceph_fs_client *fsc = ceph_sb_to_client(inode_sb(dir));
 	struct ceph_mds_client *mdsc = fsc->mdsc;
 	struct inode *inode = d_inode(dentry);
 	struct ceph_mds_request *req;
@@ -1049,7 +1049,7 @@ static int ceph_rename(struct inode *old_dir, struct dentry *old_dentry,
 		       struct inode *new_dir, struct dentry *new_dentry,
 		       unsigned int flags)
 {
-	struct ceph_fs_client *fsc = ceph_sb_to_client(old_dir->i_sb);
+	struct ceph_fs_client *fsc = ceph_sb_to_client(inode_sb(old_dir));
 	struct ceph_mds_client *mdsc = fsc->mdsc;
 	struct ceph_mds_request *req;
 	int op = CEPH_MDS_OP_RENAME;
@@ -1232,7 +1232,7 @@ static int ceph_d_revalidate(struct dentry *dentry, unsigned int flags)
 
 	if (!valid) {
 		struct ceph_mds_client *mdsc =
-			ceph_sb_to_client(dir->i_sb)->mdsc;
+			ceph_sb_to_client(inode_sb(dir))->mdsc;
 		struct ceph_mds_request *req;
 		int op, err;
 		u32 mask;
@@ -1358,7 +1358,7 @@ static ssize_t ceph_read_dir(struct file *file, char __user *buf, size_t size,
 	int left;
 	const int bufsize = 1024;
 
-	if (!ceph_test_mount_opt(ceph_sb_to_client(inode->i_sb), DIRSTAT))
+	if (!ceph_test_mount_opt(ceph_sb_to_client(inode_sb(inode)), DIRSTAT))
 		return -EISDIR;
 
 	if (!cf->dir_info) {
diff --git a/fs/ceph/file.c b/fs/ceph/file.c
index b67eec3532a1..7d0984676292 100644
--- a/fs/ceph/file.c
+++ b/fs/ceph/file.c
@@ -218,7 +218,7 @@ static int ceph_init_file(struct inode *inode, struct file *file, int fmode)
  */
 int ceph_renew_caps(struct inode *inode)
 {
-	struct ceph_mds_client *mdsc = ceph_sb_to_client(inode->i_sb)->mdsc;
+	struct ceph_mds_client *mdsc = ceph_sb_to_client(inode_sb(inode))->mdsc;
 	struct ceph_inode_info *ci = ceph_inode(inode);
 	struct ceph_mds_request *req;
 	int err, flags, wanted;
@@ -248,7 +248,7 @@ int ceph_renew_caps(struct inode *inode)
 		flags |= O_LAZY;
 #endif
 
-	req = prepare_open_request(inode->i_sb, flags, 0);
+	req = prepare_open_request(inode_sb(inode), flags, 0);
 	if (IS_ERR(req)) {
 		err = PTR_ERR(req);
 		goto out;
@@ -275,7 +275,7 @@ int ceph_renew_caps(struct inode *inode)
 int ceph_open(struct inode *inode, struct file *file)
 {
 	struct ceph_inode_info *ci = ceph_inode(inode);
-	struct ceph_fs_client *fsc = ceph_sb_to_client(inode->i_sb);
+	struct ceph_fs_client *fsc = ceph_sb_to_client(inode_sb(inode));
 	struct ceph_mds_client *mdsc = fsc->mdsc;
 	struct ceph_mds_request *req;
 	struct ceph_file_info *cf = file->private_data;
@@ -343,7 +343,7 @@ int ceph_open(struct inode *inode, struct file *file)
 	spin_unlock(&ci->i_ceph_lock);
 
 	dout("open fmode %d wants %s\n", fmode, ceph_cap_string(wanted));
-	req = prepare_open_request(inode->i_sb, flags, 0);
+	req = prepare_open_request(inode_sb(inode), flags, 0);
 	if (IS_ERR(req)) {
 		err = PTR_ERR(req);
 		goto out;
@@ -370,7 +370,7 @@ int ceph_atomic_open(struct inode *dir, struct dentry *dentry,
 		     struct file *file, unsigned flags, umode_t mode,
 		     int *opened)
 {
-	struct ceph_fs_client *fsc = ceph_sb_to_client(dir->i_sb);
+	struct ceph_fs_client *fsc = ceph_sb_to_client(inode_sb(dir));
 	struct ceph_mds_client *mdsc = fsc->mdsc;
 	struct ceph_mds_request *req;
 	struct dentry *dn;
@@ -392,7 +392,7 @@ int ceph_atomic_open(struct inode *dir, struct dentry *dentry,
 	}
 
 	/* do the open */
-	req = prepare_open_request(dir->i_sb, flags, mode);
+	req = prepare_open_request(inode_sb(dir), flags, mode);
 	if (IS_ERR(req)) {
 		err = PTR_ERR(req);
 		goto out_acl;
@@ -1307,7 +1307,7 @@ static ssize_t ceph_write_iter(struct kiocb *iocb, struct iov_iter *from)
 	struct inode *inode = file_inode(file);
 	struct ceph_inode_info *ci = ceph_inode(inode);
 	struct ceph_osd_client *osdc =
-		&ceph_sb_to_client(inode->i_sb)->client->osdc;
+		&ceph_sb_to_client(inode_sb(inode))->client->osdc;
 	struct ceph_cap_flush *prealloc_cf;
 	ssize_t count, written = 0;
 	int err, want, got;
@@ -1505,7 +1505,7 @@ static loff_t ceph_llseek(struct file *file, loff_t offset, int whence)
 		break;
 	}
 
-	ret = vfs_setpos(file, offset, inode->i_sb->s_maxbytes);
+	ret = vfs_setpos(file, offset, inode_sb(inode)->s_maxbytes);
 
 out:
 	inode_unlock(inode);
diff --git a/fs/ceph/inode.c b/fs/ceph/inode.c
index c6ec5aa46100..95ef61d0954a 100644
--- a/fs/ceph/inode.c
+++ b/fs/ceph/inode.c
@@ -75,7 +75,7 @@ struct inode *ceph_get_snapdir(struct inode *parent)
 		.ino = ceph_ino(parent),
 		.snap = CEPH_SNAPDIR,
 	};
-	struct inode *inode = ceph_get_inode(parent->i_sb, vino);
+	struct inode *inode = ceph_get_inode(inode_sb(parent), vino);
 	struct ceph_inode_info *ci = ceph_inode(inode);
 
 	BUG_ON(!S_ISDIR(parent->i_mode));
@@ -542,7 +542,7 @@ void ceph_destroy_inode(struct inode *inode)
 	 */
 	if (ci->i_snap_realm) {
 		struct ceph_mds_client *mdsc =
-			ceph_sb_to_client(ci->vfs_inode.i_sb)->mdsc;
+			ceph_sb_to_client(inode_sb(&ci->vfs_inode))->mdsc;
 		struct ceph_snap_realm *realm = ci->i_snap_realm;
 
 		dout(" dropping residual ref to snap realm %p\n", realm);
@@ -1832,7 +1832,7 @@ void ceph_queue_vmtruncate(struct inode *inode)
 
 	ihold(inode);
 
-	if (queue_work(ceph_sb_to_client(inode->i_sb)->trunc_wq,
+	if (queue_work(ceph_sb_to_client(inode_sb(inode))->trunc_wq,
 		       &ci->i_vmtruncate_work)) {
 		dout("ceph_queue_vmtruncate %p\n", inode);
 	} else {
@@ -1882,7 +1882,7 @@ void __ceph_do_pending_vmtruncate(struct inode *inode)
 		truncate_pagecache(inode, to);
 
 		filemap_write_and_wait_range(&inode->i_data, 0,
-					     inode->i_sb->s_maxbytes);
+					     inode_sb(inode)->s_maxbytes);
 		goto retry;
 	}
 
@@ -1929,7 +1929,7 @@ int __ceph_setattr(struct inode *inode, struct iattr *attr)
 	struct ceph_inode_info *ci = ceph_inode(inode);
 	const unsigned int ia_valid = attr->ia_valid;
 	struct ceph_mds_request *req;
-	struct ceph_mds_client *mdsc = ceph_sb_to_client(inode->i_sb)->mdsc;
+	struct ceph_mds_client *mdsc = ceph_sb_to_client(inode_sb(inode))->mdsc;
 	struct ceph_cap_flush *prealloc_cf;
 	int issued;
 	int release = 0, dirtied = 0;
@@ -2167,7 +2167,7 @@ int ceph_setattr(struct dentry *dentry, struct iattr *attr)
 int __ceph_do_getattr(struct inode *inode, struct page *locked_page,
 		      int mask, bool force)
 {
-	struct ceph_fs_client *fsc = ceph_sb_to_client(inode->i_sb);
+	struct ceph_fs_client *fsc = ceph_sb_to_client(inode_sb(inode));
 	struct ceph_mds_client *mdsc = fsc->mdsc;
 	struct ceph_mds_request *req;
 	int err;
@@ -2240,13 +2240,13 @@ int ceph_getattr(const struct path *path, struct kstat *stat,
 	err = ceph_do_getattr(inode, CEPH_STAT_CAP_INODE_ALL, false);
 	if (!err) {
 		generic_fillattr(inode, stat);
-		stat->ino = ceph_translate_ino(inode->i_sb, inode->i_ino);
+		stat->ino = ceph_translate_ino(inode_sb(inode), inode->i_ino);
 		if (ceph_snap(inode) != CEPH_NOSNAP)
 			stat->dev = ceph_snap(inode);
 		else
 			stat->dev = 0;
 		if (S_ISDIR(inode->i_mode)) {
-			if (ceph_test_mount_opt(ceph_sb_to_client(inode->i_sb),
+			if (ceph_test_mount_opt(ceph_sb_to_client(inode_sb(inode)),
 						RBYTES))
 				stat->size = ci->i_rbytes;
 			else
diff --git a/fs/ceph/ioctl.c b/fs/ceph/ioctl.c
index 851aa69ec8f0..ed3401b8bf0a 100644
--- a/fs/ceph/ioctl.c
+++ b/fs/ceph/ioctl.c
@@ -64,7 +64,7 @@ static long __validate_layout(struct ceph_mds_client *mdsc,
 static long ceph_ioctl_set_layout(struct file *file, void __user *arg)
 {
 	struct inode *inode = file_inode(file);
-	struct ceph_mds_client *mdsc = ceph_sb_to_client(inode->i_sb)->mdsc;
+	struct ceph_mds_client *mdsc = ceph_sb_to_client(inode_sb(inode))->mdsc;
 	struct ceph_mds_request *req;
 	struct ceph_ioctl_layout l;
 	struct ceph_inode_info *ci = ceph_inode(file_inode(file));
@@ -139,7 +139,7 @@ static long ceph_ioctl_set_layout_policy (struct file *file, void __user *arg)
 	struct ceph_mds_request *req;
 	struct ceph_ioctl_layout l;
 	int err;
-	struct ceph_mds_client *mdsc = ceph_sb_to_client(inode->i_sb)->mdsc;
+	struct ceph_mds_client *mdsc = ceph_sb_to_client(inode_sb(inode))->mdsc;
 
 	/* copy and validate */
 	if (copy_from_user(&l, arg, sizeof(l)))
@@ -182,7 +182,7 @@ static long ceph_ioctl_get_dataloc(struct file *file, void __user *arg)
 	struct inode *inode = file_inode(file);
 	struct ceph_inode_info *ci = ceph_inode(inode);
 	struct ceph_osd_client *osdc =
-		&ceph_sb_to_client(inode->i_sb)->client->osdc;
+		&ceph_sb_to_client(inode_sb(inode))->client->osdc;
 	struct ceph_object_locator oloc;
 	CEPH_DEFINE_OID_ONSTACK(oid);
 	u64 len = 1, olen;
diff --git a/fs/ceph/locks.c b/fs/ceph/locks.c
index 9e66f69ee8a5..0690fec1b678 100644
--- a/fs/ceph/locks.c
+++ b/fs/ceph/locks.c
@@ -59,7 +59,7 @@ static const struct file_lock_operations ceph_fl_lock_ops = {
 static int ceph_lock_message(u8 lock_type, u16 operation, struct inode *inode,
 			     int cmd, u8 wait, struct file_lock *fl)
 {
-	struct ceph_mds_client *mdsc = ceph_sb_to_client(inode->i_sb)->mdsc;
+	struct ceph_mds_client *mdsc = ceph_sb_to_client(inode_sb(inode))->mdsc;
 	struct ceph_mds_request *req;
 	int err;
 	u64 length = 0;
diff --git a/fs/ceph/mds_client.c b/fs/ceph/mds_client.c
index 2e8f90f96540..b46d25e5586f 100644
--- a/fs/ceph/mds_client.c
+++ b/fs/ceph/mds_client.c
@@ -760,7 +760,7 @@ static int __choose_mds(struct ceph_mds_client *mdsc,
 		parent = req->r_dentry->d_parent;
 		dir = req->r_parent ? : d_inode_rcu(parent);
 
-		if (!dir || dir->i_sb != mdsc->fsc->sb) {
+		if (!dir || inode_sb(dir) != mdsc->fsc->sb) {
 			/*  not this fs or parent went negative */
 			inode = d_inode(req->r_dentry);
 			if (inode)
diff --git a/fs/ceph/snap.c b/fs/ceph/snap.c
index 07cf95e6413d..b370cf0f7218 100644
--- a/fs/ceph/snap.c
+++ b/fs/ceph/snap.c
@@ -590,7 +590,7 @@ int __ceph_finish_cap_snap(struct ceph_inode_info *ci,
 			    struct ceph_cap_snap *capsnap)
 {
 	struct inode *inode = &ci->vfs_inode;
-	struct ceph_mds_client *mdsc = ceph_sb_to_client(inode->i_sb)->mdsc;
+	struct ceph_mds_client *mdsc = ceph_sb_to_client(inode_sb(inode))->mdsc;
 
 	BUG_ON(capsnap->writing);
 	capsnap->size = inode->i_size;
diff --git a/fs/ceph/super.h b/fs/ceph/super.h
index 1c2086e0fec2..49c013180595 100644
--- a/fs/ceph/super.h
+++ b/fs/ceph/super.h
@@ -386,7 +386,7 @@ static inline struct ceph_inode_info *ceph_inode(struct inode *inode)
 
 static inline struct ceph_fs_client *ceph_inode_to_client(struct inode *inode)
 {
-	return (struct ceph_fs_client *)inode->i_sb->s_fs_info;
+	return (struct ceph_fs_client *) inode_sb(inode)->s_fs_info;
 }
 
 static inline struct ceph_fs_client *ceph_sb_to_client(struct super_block *sb)
diff --git a/fs/ceph/xattr.c b/fs/ceph/xattr.c
index e1c4e0b12b4c..a6d4f85d0583 100644
--- a/fs/ceph/xattr.c
+++ b/fs/ceph/xattr.c
@@ -67,7 +67,7 @@ static bool ceph_vxattrcb_layout_exists(struct ceph_inode_info *ci)
 static size_t ceph_vxattrcb_layout(struct ceph_inode_info *ci, char *val,
 				   size_t size)
 {
-	struct ceph_fs_client *fsc = ceph_sb_to_client(ci->vfs_inode.i_sb);
+	struct ceph_fs_client *fsc = ceph_sb_to_client(inode_sb(&ci->vfs_inode));
 	struct ceph_osd_client *osdc = &fsc->client->osdc;
 	struct ceph_string *pool_ns;
 	s64 pool = ci->i_layout.pool_id;
@@ -146,7 +146,7 @@ static size_t ceph_vxattrcb_layout_pool(struct ceph_inode_info *ci,
 					char *val, size_t size)
 {
 	int ret;
-	struct ceph_fs_client *fsc = ceph_sb_to_client(ci->vfs_inode.i_sb);
+	struct ceph_fs_client *fsc = ceph_sb_to_client(inode_sb(&ci->vfs_inode));
 	struct ceph_osd_client *osdc = &fsc->client->osdc;
 	s64 pool = ci->i_layout.pool_id;
 	const char *pool_name;
@@ -885,7 +885,7 @@ ssize_t ceph_listxattr(struct dentry *dentry, char *names, size_t size)
 static int ceph_sync_setxattr(struct inode *inode, const char *name,
 			      const char *value, size_t size, int flags)
 {
-	struct ceph_fs_client *fsc = ceph_sb_to_client(inode->i_sb);
+	struct ceph_fs_client *fsc = ceph_sb_to_client(inode_sb(inode));
 	struct ceph_inode_info *ci = ceph_inode(inode);
 	struct ceph_mds_request *req;
 	struct ceph_mds_client *mdsc = fsc->mdsc;
@@ -953,7 +953,7 @@ int __ceph_setxattr(struct inode *inode, const char *name,
 {
 	struct ceph_vxattr *vxattr;
 	struct ceph_inode_info *ci = ceph_inode(inode);
-	struct ceph_mds_client *mdsc = ceph_sb_to_client(inode->i_sb)->mdsc;
+	struct ceph_mds_client *mdsc = ceph_sb_to_client(inode_sb(inode))->mdsc;
 	struct ceph_cap_flush *prealloc_cf = NULL;
 	int issued;
 	int err;
-- 
2.15.1

^ permalink raw reply related	[flat|nested] 88+ messages in thread

* [PATCH 20/76] fs/cifs: Use inode_sb() helper instead of inode->i_sb
  2018-05-08 18:03 [RFC][PATCH 0/76] vfs: 'views' for filesystems with more than one root Mark Fasheh
                   ` (18 preceding siblings ...)
  2018-05-08 18:03 ` [PATCH 19/76] fs/ceph: " Mark Fasheh
@ 2018-05-08 18:03 ` Mark Fasheh
  2018-05-08 18:03 ` [PATCH 21/76] fs/coda: " Mark Fasheh
                   ` (56 subsequent siblings)
  76 siblings, 0 replies; 88+ messages in thread
From: Mark Fasheh @ 2018-05-08 18:03 UTC (permalink / raw)
  To: linux-fsdevel; +Cc: linux-kernel, linux-btrfs, Mark Fasheh

Signed-off-by: Mark Fasheh <mfasheh@suse.de>
---
 fs/cifs/cifsacl.c   |  4 ++--
 fs/cifs/cifsfs.c    |  4 ++--
 fs/cifs/cifsglob.h  |  2 +-
 fs/cifs/dir.c       | 29 ++++++++++++++++-------------
 fs/cifs/file.c      | 42 ++++++++++++++++++++++--------------------
 fs/cifs/fscache.c   |  4 ++--
 fs/cifs/inode.c     | 43 +++++++++++++++++++++++--------------------
 fs/cifs/ioctl.c     |  2 +-
 fs/cifs/link.c      | 10 +++++-----
 fs/cifs/readdir.c   |  2 +-
 fs/cifs/smb1ops.c   |  4 ++--
 fs/cifs/smb2inode.c |  2 +-
 fs/cifs/smb2ops.c   |  4 ++--
 13 files changed, 80 insertions(+), 72 deletions(-)

diff --git a/fs/cifs/cifsacl.c b/fs/cifs/cifsacl.c
index 13a8a77322c9..d7b37ff7d57f 100644
--- a/fs/cifs/cifsacl.c
+++ b/fs/cifs/cifsacl.c
@@ -1081,7 +1081,7 @@ int set_cifs_acl(struct cifs_ntsd *pnntsd, __u32 acllen,
 	unsigned int xid;
 	int rc, access_flags, create_options = 0;
 	struct cifs_tcon *tcon;
-	struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb);
+	struct cifs_sb_info *cifs_sb = CIFS_SB(inode_sb(inode));
 	struct tcon_link *tlink = cifs_sb_tlink(cifs_sb);
 	struct cifs_fid fid;
 	struct cifs_open_parms oparms;
@@ -1178,7 +1178,7 @@ id_mode_to_cifs_acl(struct inode *inode, const char *path, __u64 nmode,
 	__u32 secdesclen = 0;
 	struct cifs_ntsd *pntsd = NULL; /* acl obtained from server */
 	struct cifs_ntsd *pnntsd = NULL; /* modified acl to be sent to server */
-	struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb);
+	struct cifs_sb_info *cifs_sb = CIFS_SB(inode_sb(inode));
 	struct tcon_link *tlink = cifs_sb_tlink(cifs_sb);
 	struct smb_version_operations *ops;
 
diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c
index 32cdea67bbfd..54741739c5e6 100644
--- a/fs/cifs/cifsfs.c
+++ b/fs/cifs/cifsfs.c
@@ -231,7 +231,7 @@ static int cifs_permission(struct inode *inode, int mask)
 {
 	struct cifs_sb_info *cifs_sb;
 
-	cifs_sb = CIFS_SB(inode->i_sb);
+	cifs_sb = CIFS_SB(inode_sb(inode));
 
 	if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_PERM) {
 		if ((mask & MAY_EXEC) && !execute_ok(inode))
@@ -581,7 +581,7 @@ static int cifs_remount(struct super_block *sb, int *flags, char *data)
 
 static int cifs_drop_inode(struct inode *inode)
 {
-	struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb);
+	struct cifs_sb_info *cifs_sb = CIFS_SB(inode_sb(inode));
 
 	/* no serverino => unconditional eviction */
 	return !(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SERVER_INUM) ||
diff --git a/fs/cifs/cifsglob.h b/fs/cifs/cifsglob.h
index 48f7c197cd2d..35910ece3526 100644
--- a/fs/cifs/cifsglob.h
+++ b/fs/cifs/cifsglob.h
@@ -1265,7 +1265,7 @@ CIFS_SB(struct super_block *sb)
 static inline struct cifs_sb_info *
 CIFS_FILE_SB(struct file *file)
 {
-	return CIFS_SB(file_inode(file)->i_sb);
+	return CIFS_SB(inode_sb(file_inode(file)));
 }
 
 static inline char CIFS_DIR_SEP(const struct cifs_sb_info *cifs_sb)
diff --git a/fs/cifs/dir.c b/fs/cifs/dir.c
index 81ba6e0d88d8..201ec5c3d4fe 100644
--- a/fs/cifs/dir.c
+++ b/fs/cifs/dir.c
@@ -231,7 +231,7 @@ cifs_do_create(struct inode *inode, struct dentry *direntry, unsigned int xid,
 	int rc = -ENOENT;
 	int create_options = CREATE_NOT_DIR;
 	int desired_access;
-	struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb);
+	struct cifs_sb_info *cifs_sb = CIFS_SB(inode_sb(inode));
 	struct cifs_tcon *tcon = tlink_tcon(tlink);
 	char *full_path = NULL;
 	FILE_ALL_INFO *buf = NULL;
@@ -253,7 +253,8 @@ cifs_do_create(struct inode *inode, struct dentry *direntry, unsigned int xid,
 	if (tcon->unix_ext && cap_unix(tcon->ses) && !tcon->broken_posix_open &&
 	    (CIFS_UNIX_POSIX_PATH_OPS_CAP &
 			le64_to_cpu(tcon->fsUnixInfo.Capability))) {
-		rc = cifs_posix_open(full_path, &newinode, inode->i_sb, mode,
+		rc = cifs_posix_open(full_path, &newinode, inode_sb(inode),
+				     mode,
 				     oflags, oplock, &fid->netfid, xid);
 		switch (rc) {
 		case 0:
@@ -414,10 +415,12 @@ cifs_do_create(struct inode *inode, struct dentry *direntry, unsigned int xid,
 cifs_create_get_file_info:
 	/* server might mask mode so we have to query for it */
 	if (tcon->unix_ext)
-		rc = cifs_get_inode_info_unix(&newinode, full_path, inode->i_sb,
+		rc = cifs_get_inode_info_unix(&newinode, full_path,
+					      inode_sb(inode),
 					      xid);
 	else {
-		rc = cifs_get_inode_info(&newinode, full_path, buf, inode->i_sb,
+		rc = cifs_get_inode_info(&newinode, full_path, buf,
+					 inode_sb(inode),
 					 xid, fid);
 		if (newinode) {
 			if (server->ops->set_lease_key)
@@ -511,7 +514,7 @@ cifs_atomic_open(struct inode *inode, struct dentry *direntry,
 	cifs_dbg(FYI, "parent inode = 0x%p name is: %pd and dentry = 0x%p\n",
 		 inode, direntry, direntry);
 
-	tlink = cifs_sb_tlink(CIFS_SB(inode->i_sb));
+	tlink = cifs_sb_tlink(CIFS_SB(inode_sb(inode)));
 	if (IS_ERR(tlink)) {
 		rc = PTR_ERR(tlink);
 		goto out_free_xid;
@@ -550,8 +553,8 @@ cifs_atomic_open(struct inode *inode, struct dentry *direntry,
 	}
 
 	if (file->f_flags & O_DIRECT &&
-	    CIFS_SB(inode->i_sb)->mnt_cifs_flags & CIFS_MOUNT_STRICT_IO) {
-		if (CIFS_SB(inode->i_sb)->mnt_cifs_flags & CIFS_MOUNT_NO_BRL)
+	    CIFS_SB(inode_sb(inode))->mnt_cifs_flags & CIFS_MOUNT_STRICT_IO) {
+		if (CIFS_SB(inode_sb(inode))->mnt_cifs_flags & CIFS_MOUNT_NO_BRL)
 			file->f_op = &cifs_file_direct_nobrl_ops;
 		else
 			file->f_op = &cifs_file_direct_ops;
@@ -595,7 +598,7 @@ int cifs_create(struct inode *inode, struct dentry *direntry, umode_t mode,
 	cifs_dbg(FYI, "cifs_create parent inode = 0x%p name is: %pd and dentry = 0x%p\n",
 		 inode, direntry, direntry);
 
-	tlink = cifs_sb_tlink(CIFS_SB(inode->i_sb));
+	tlink = cifs_sb_tlink(CIFS_SB(inode_sb(inode)));
 	rc = PTR_ERR(tlink);
 	if (IS_ERR(tlink))
 		goto out_free_xid;
@@ -640,7 +643,7 @@ int cifs_mknod(struct inode *inode, struct dentry *direntry, umode_t mode,
 	if (!old_valid_dev(device_number))
 		return -EINVAL;
 
-	cifs_sb = CIFS_SB(inode->i_sb);
+	cifs_sb = CIFS_SB(inode_sb(inode));
 	tlink = cifs_sb_tlink(cifs_sb);
 	if (IS_ERR(tlink))
 		return PTR_ERR(tlink);
@@ -677,7 +680,7 @@ int cifs_mknod(struct inode *inode, struct dentry *direntry, umode_t mode,
 			goto mknod_out;
 
 		rc = cifs_get_inode_info_unix(&newinode, full_path,
-						inode->i_sb, xid);
+						inode_sb(inode), xid);
 
 		if (rc == 0)
 			d_instantiate(direntry, newinode);
@@ -775,7 +778,7 @@ cifs_lookup(struct inode *parent_dir_inode, struct dentry *direntry,
 
 	/* check whether path exists */
 
-	cifs_sb = CIFS_SB(parent_dir_inode->i_sb);
+	cifs_sb = CIFS_SB(inode_sb(parent_dir_inode));
 	tlink = cifs_sb_tlink(cifs_sb);
 	if (IS_ERR(tlink)) {
 		free_xid(xid);
@@ -806,10 +809,10 @@ cifs_lookup(struct inode *parent_dir_inode, struct dentry *direntry,
 
 	if (pTcon->unix_ext) {
 		rc = cifs_get_inode_info_unix(&newInode, full_path,
-					      parent_dir_inode->i_sb, xid);
+					      inode_sb(parent_dir_inode), xid);
 	} else {
 		rc = cifs_get_inode_info(&newInode, full_path, NULL,
-				parent_dir_inode->i_sb, xid, NULL);
+				inode_sb(parent_dir_inode), xid, NULL);
 	}
 
 	if ((rc == 0) && (newInode != NULL)) {
diff --git a/fs/cifs/file.c b/fs/cifs/file.c
index 7cee97b93a61..ecb3bf22bfa0 100644
--- a/fs/cifs/file.c
+++ b/fs/cifs/file.c
@@ -246,10 +246,12 @@ cifs_nt_open(char *full_path, struct inode *inode, struct cifs_sb_info *cifs_sb,
 		goto out;
 
 	if (tcon->unix_ext)
-		rc = cifs_get_inode_info_unix(&inode, full_path, inode->i_sb,
+		rc = cifs_get_inode_info_unix(&inode, full_path,
+					      inode_sb(inode),
 					      xid);
 	else
-		rc = cifs_get_inode_info(&inode, full_path, buf, inode->i_sb,
+		rc = cifs_get_inode_info(&inode, full_path, buf,
+					 inode_sb(inode),
 					 xid, fid);
 
 out:
@@ -314,7 +316,7 @@ cifs_new_fileinfo(struct cifs_fid *fid, struct file *file,
 	mutex_init(&cfile->fh_mutex);
 	spin_lock_init(&cfile->file_info_lock);
 
-	cifs_sb_active(inode->i_sb);
+	cifs_sb_active(inode_sb(inode));
 
 	/*
 	 * If the server returned a read oplock and we have mandatory brlocks,
@@ -369,7 +371,7 @@ void cifsFileInfo_put(struct cifsFileInfo *cifs_file)
 	struct cifs_tcon *tcon = tlink_tcon(cifs_file->tlink);
 	struct TCP_Server_Info *server = tcon->ses->server;
 	struct cifsInodeInfo *cifsi = CIFS_I(inode);
-	struct super_block *sb = inode->i_sb;
+	struct super_block *sb = inode_sb(inode);
 	struct cifs_sb_info *cifs_sb = CIFS_SB(sb);
 	struct cifsLockInfo *li, *tmp;
 	struct cifs_fid fid;
@@ -466,7 +468,7 @@ int cifs_open(struct inode *inode, struct file *file)
 
 	xid = get_xid();
 
-	cifs_sb = CIFS_SB(inode->i_sb);
+	cifs_sb = CIFS_SB(inode_sb(inode));
 	tlink = cifs_sb_tlink(cifs_sb);
 	if (IS_ERR(tlink)) {
 		free_xid(xid);
@@ -501,9 +503,9 @@ int cifs_open(struct inode *inode, struct file *file)
 	    cap_unix(tcon->ses) && (CIFS_UNIX_POSIX_PATH_OPS_CAP &
 				le64_to_cpu(tcon->fsUnixInfo.Capability))) {
 		/* can not refresh inode info since size could be stale */
-		rc = cifs_posix_open(full_path, &inode, inode->i_sb,
-				cifs_sb->mnt_file_mode /* ignored */,
-				file->f_flags, &oplock, &fid.netfid, xid);
+		rc = cifs_posix_open(full_path, &inode, inode_sb(inode),
+				     cifs_sb->mnt_file_mode /* ignored */,
+				     file->f_flags, &oplock, &fid.netfid, xid);
 		if (rc == 0) {
 			cifs_dbg(FYI, "posix open succeeded\n");
 			posix_open_ok = true;
@@ -634,7 +636,7 @@ cifs_reopen_file(struct cifsFileInfo *cfile, bool can_flush)
 	}
 
 	inode = d_inode(cfile->dentry);
-	cifs_sb = CIFS_SB(inode->i_sb);
+	cifs_sb = CIFS_SB(inode_sb(inode));
 	tcon = tlink_tcon(cfile->tlink);
 	server = tcon->ses->server;
 
@@ -670,7 +672,7 @@ cifs_reopen_file(struct cifsFileInfo *cfile, bool can_flush)
 		unsigned int oflags = cfile->f_flags &
 						~(O_CREAT | O_EXCL | O_TRUNC);
 
-		rc = cifs_posix_open(full_path, NULL, inode->i_sb,
+		rc = cifs_posix_open(full_path, NULL, inode_sb(inode),
 				     cifs_sb->mnt_file_mode /* ignored */,
 				     oflags, &oplock, &cfile->fid.netfid, xid);
 		if (rc == 0) {
@@ -734,10 +736,10 @@ cifs_reopen_file(struct cifsFileInfo *cfile, bool can_flush)
 
 		if (tcon->unix_ext)
 			rc = cifs_get_inode_info_unix(&inode, full_path,
-						      inode->i_sb, xid);
+						      inode_sb(inode), xid);
 		else
 			rc = cifs_get_inode_info(&inode, full_path, NULL,
-						 inode->i_sb, xid, NULL);
+						 inode_sb(inode), xid, NULL);
 	}
 	/*
 	 * Else we are writing out data to server already and could deadlock if
@@ -1790,7 +1792,7 @@ struct cifsFileInfo *find_readable_file(struct cifsInodeInfo *cifs_inode,
 					bool fsuid_only)
 {
 	struct cifsFileInfo *open_file = NULL;
-	struct cifs_sb_info *cifs_sb = CIFS_SB(cifs_inode->vfs_inode.i_sb);
+	struct cifs_sb_info *cifs_sb = CIFS_SB(inode_sb(&cifs_inode->vfs_inode));
 	struct cifs_tcon *tcon = cifs_sb_master_tcon(cifs_sb);
 
 	/* only filter by fsuid on multiuser mounts */
@@ -1841,7 +1843,7 @@ struct cifsFileInfo *find_writable_file(struct cifsInodeInfo *cifs_inode,
 		return NULL;
 	}
 
-	cifs_sb = CIFS_SB(cifs_inode->vfs_inode.i_sb);
+	cifs_sb = CIFS_SB(inode_sb(&cifs_inode->vfs_inode));
 	tcon = cifs_sb_master_tcon(cifs_sb);
 
 	/* only filter by fsuid on multiuser mounts */
@@ -2093,7 +2095,7 @@ wdata_send_pages(struct cifs_writedata *wdata, unsigned int nr_pages,
 static int cifs_writepages(struct address_space *mapping,
 			   struct writeback_control *wbc)
 {
-	struct cifs_sb_info *cifs_sb = CIFS_SB(mapping->host->i_sb);
+	struct cifs_sb_info *cifs_sb = CIFS_SB(inode_sb(mapping->host));
 	struct TCP_Server_Info *server;
 	bool done = false, scanned = false, range_whole = false;
 	pgoff_t end, index;
@@ -2321,7 +2323,7 @@ int cifs_strict_fsync(struct file *file, loff_t start, loff_t end,
 	struct TCP_Server_Info *server;
 	struct cifsFileInfo *smbfile = file->private_data;
 	struct inode *inode = file_inode(file);
-	struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb);
+	struct cifs_sb_info *cifs_sb = CIFS_SB(inode_sb(inode));
 
 	rc = file_write_and_wait_range(file, start, end);
 	if (rc)
@@ -2837,7 +2839,7 @@ cifs_strict_writev(struct kiocb *iocb, struct iov_iter *from)
 {
 	struct inode *inode = file_inode(iocb->ki_filp);
 	struct cifsInodeInfo *cinode = CIFS_I(inode);
-	struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb);
+	struct cifs_sb_info *cifs_sb = CIFS_SB(inode_sb(inode));
 	struct cifsFileInfo *cfile = (struct cifsFileInfo *)
 						iocb->ki_filp->private_data;
 	struct cifs_tcon *tcon = tlink_tcon(cfile->tlink);
@@ -3333,7 +3335,7 @@ cifs_strict_readv(struct kiocb *iocb, struct iov_iter *to)
 {
 	struct inode *inode = file_inode(iocb->ki_filp);
 	struct cifsInodeInfo *cinode = CIFS_I(inode);
-	struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb);
+	struct cifs_sb_info *cifs_sb = CIFS_SB(inode_sb(inode));
 	struct cifsFileInfo *cfile = (struct cifsFileInfo *)
 						iocb->ki_filp->private_data;
 	struct cifs_tcon *tcon = tlink_tcon(cfile->tlink);
@@ -3900,7 +3902,7 @@ static int is_inode_writable(struct cifsInodeInfo *cifs_inode)
 {
 	struct cifsFileInfo *open_file;
 	struct cifs_tcon *tcon =
-		cifs_sb_master_tcon(CIFS_SB(cifs_inode->vfs_inode.i_sb));
+		cifs_sb_master_tcon(CIFS_SB(inode_sb(&cifs_inode->vfs_inode)));
 
 	spin_lock(&tcon->open_file_lock);
 	list_for_each_entry(open_file, &cifs_inode->openFileList, flist) {
@@ -3928,7 +3930,7 @@ bool is_size_safe_to_change(struct cifsInodeInfo *cifsInode, __u64 end_of_file)
 		/* This inode is open for write at least once */
 		struct cifs_sb_info *cifs_sb;
 
-		cifs_sb = CIFS_SB(cifsInode->vfs_inode.i_sb);
+		cifs_sb = CIFS_SB(inode_sb(&cifsInode->vfs_inode));
 		if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_DIRECT_IO) {
 			/* since no page cache to corrupt on directio
 			we can change size safely */
diff --git a/fs/cifs/fscache.c b/fs/cifs/fscache.c
index 8d4b7bc8ae91..bb24a08d7edd 100644
--- a/fs/cifs/fscache.c
+++ b/fs/cifs/fscache.c
@@ -61,7 +61,7 @@ void cifs_fscache_release_super_cookie(struct cifs_tcon *tcon)
 static void cifs_fscache_enable_inode_cookie(struct inode *inode)
 {
 	struct cifsInodeInfo *cifsi = CIFS_I(inode);
-	struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb);
+	struct cifs_sb_info *cifs_sb = CIFS_SB(inode_sb(inode));
 	struct cifs_tcon *tcon = cifs_sb_master_tcon(cifs_sb);
 
 	if (cifsi->fscache)
@@ -109,7 +109,7 @@ void cifs_fscache_set_inode_cookie(struct inode *inode, struct file *filp)
 void cifs_fscache_reset_inode_cookie(struct inode *inode)
 {
 	struct cifsInodeInfo *cifsi = CIFS_I(inode);
-	struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb);
+	struct cifs_sb_info *cifs_sb = CIFS_SB(inode_sb(inode));
 	struct fscache_cookie *old = cifsi->fscache;
 
 	if (cifsi->fscache) {
diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c
index 8f9a8cc7cc62..b29d09642214 100644
--- a/fs/cifs/inode.c
+++ b/fs/cifs/inode.c
@@ -39,7 +39,7 @@
 
 static void cifs_set_ops(struct inode *inode)
 {
-	struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb);
+	struct cifs_sb_info *cifs_sb = CIFS_SB(inode_sb(inode));
 
 	switch (inode->i_mode & S_IFMT) {
 	case S_IFREG:
@@ -157,7 +157,7 @@ void
 cifs_fattr_to_inode(struct inode *inode, struct cifs_fattr *fattr)
 {
 	struct cifsInodeInfo *cifs_i = CIFS_I(inode);
-	struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb);
+	struct cifs_sb_info *cifs_sb = CIFS_SB(inode_sb(inode));
 
 	cifs_revalidate_cache(inode, fattr);
 
@@ -340,7 +340,7 @@ cifs_get_file_info_unix(struct file *filp)
 	FILE_UNIX_BASIC_INFO find_data;
 	struct cifs_fattr fattr;
 	struct inode *inode = file_inode(filp);
-	struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb);
+	struct cifs_sb_info *cifs_sb = CIFS_SB(inode_sb(inode));
 	struct cifsFileInfo *cfile = filp->private_data;
 	struct cifs_tcon *tcon = tlink_tcon(cfile->tlink);
 
@@ -349,7 +349,7 @@ cifs_get_file_info_unix(struct file *filp)
 	if (!rc) {
 		cifs_unix_basic_to_fattr(&fattr, &find_data, cifs_sb);
 	} else if (rc == -EREMOTE) {
-		cifs_create_dfs_fattr(&fattr, inode->i_sb);
+		cifs_create_dfs_fattr(&fattr, inode_sb(inode));
 		rc = 0;
 	}
 
@@ -675,11 +675,12 @@ cifs_get_file_info(struct file *filp)
 	rc = server->ops->query_file_info(xid, tcon, &cfile->fid, &find_data);
 	switch (rc) {
 	case 0:
-		cifs_all_info_to_fattr(&fattr, &find_data, inode->i_sb, false,
+		cifs_all_info_to_fattr(&fattr, &find_data, inode_sb(inode),
+				       false,
 				       false);
 		break;
 	case -EREMOTE:
-		cifs_create_dfs_fattr(&fattr, inode->i_sb);
+		cifs_create_dfs_fattr(&fattr, inode_sb(inode));
 		rc = 0;
 		break;
 	case -EOPNOTSUPP:
@@ -1078,7 +1079,7 @@ cifs_set_file_info(struct inode *inode, struct iattr *attrs, unsigned int xid,
 		   char *full_path, __u32 dosattr)
 {
 	bool set_time = false;
-	struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb);
+	struct cifs_sb_info *cifs_sb = CIFS_SB(inode_sb(inode));
 	struct TCP_Server_Info *server;
 	FILE_BASIC_INFO	info_buf;
 
@@ -1137,7 +1138,7 @@ cifs_rename_pending_delete(const char *full_path, struct dentry *dentry,
 	struct cifs_open_parms oparms;
 	struct inode *inode = d_inode(dentry);
 	struct cifsInodeInfo *cifsInode = CIFS_I(inode);
-	struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb);
+	struct cifs_sb_info *cifs_sb = CIFS_SB(inode_sb(inode));
 	struct tcon_link *tlink;
 	struct cifs_tcon *tcon;
 	__u32 dosattr, origattr;
@@ -1277,7 +1278,7 @@ int cifs_unlink(struct inode *dir, struct dentry *dentry)
 	char *full_path = NULL;
 	struct inode *inode = d_inode(dentry);
 	struct cifsInodeInfo *cifs_inode;
-	struct super_block *sb = dir->i_sb;
+	struct super_block *sb = inode_sb(dir);
 	struct cifs_sb_info *cifs_sb = CIFS_SB(sb);
 	struct tcon_link *tlink;
 	struct cifs_tcon *tcon;
@@ -1389,10 +1390,12 @@ cifs_mkdir_qinfo(struct inode *parent, struct dentry *dentry, umode_t mode,
 	struct inode *inode = NULL;
 
 	if (tcon->unix_ext)
-		rc = cifs_get_inode_info_unix(&inode, full_path, parent->i_sb,
+		rc = cifs_get_inode_info_unix(&inode, full_path,
+					      inode_sb(parent),
 					      xid);
 	else
-		rc = cifs_get_inode_info(&inode, full_path, NULL, parent->i_sb,
+		rc = cifs_get_inode_info(&inode, full_path, NULL,
+					 inode_sb(parent),
 					 xid, NULL);
 
 	if (rc)
@@ -1490,8 +1493,8 @@ cifs_posix_mkdir(struct inode *inode, struct dentry *dentry, umode_t mode,
 	 */
 
 	cifs_unix_basic_to_fattr(&fattr, info, cifs_sb);
-	cifs_fill_uniqueid(inode->i_sb, &fattr);
-	newinode = cifs_iget(inode->i_sb, &fattr);
+	cifs_fill_uniqueid(inode_sb(inode), &fattr);
+	newinode = cifs_iget(inode_sb(inode), &fattr);
 	if (!newinode)
 		goto posix_mkdir_get_info;
 
@@ -1528,7 +1531,7 @@ int cifs_mkdir(struct inode *inode, struct dentry *direntry, umode_t mode)
 	cifs_dbg(FYI, "In cifs_mkdir, mode = 0x%hx inode = 0x%p\n",
 		 mode, inode);
 
-	cifs_sb = CIFS_SB(inode->i_sb);
+	cifs_sb = CIFS_SB(inode_sb(inode));
 	tlink = cifs_sb_tlink(cifs_sb);
 	if (IS_ERR(tlink))
 		return PTR_ERR(tlink);
@@ -1600,7 +1603,7 @@ int cifs_rmdir(struct inode *inode, struct dentry *direntry)
 		goto rmdir_exit;
 	}
 
-	cifs_sb = CIFS_SB(inode->i_sb);
+	cifs_sb = CIFS_SB(inode_sb(inode));
 	tlink = cifs_sb_tlink(cifs_sb);
 	if (IS_ERR(tlink)) {
 		rc = PTR_ERR(tlink);
@@ -1722,7 +1725,7 @@ cifs_rename2(struct inode *source_dir, struct dentry *source_dentry,
 	if (flags & ~RENAME_NOREPLACE)
 		return -EINVAL;
 
-	cifs_sb = CIFS_SB(source_dir->i_sb);
+	cifs_sb = CIFS_SB(inode_sb(source_dir));
 	tlink = cifs_sb_tlink(cifs_sb);
 	if (IS_ERR(tlink))
 		return PTR_ERR(tlink);
@@ -1825,7 +1828,7 @@ static bool
 cifs_inode_needs_reval(struct inode *inode)
 {
 	struct cifsInodeInfo *cifs_i = CIFS_I(inode);
-	struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb);
+	struct cifs_sb_info *cifs_sb = CIFS_SB(inode_sb(inode));
 
 	if (CIFS_CACHE_READ(cifs_i))
 		return false;
@@ -2088,7 +2091,7 @@ cifs_set_file_size(struct inode *inode, struct iattr *attrs,
 	int rc;
 	struct cifsFileInfo *open_file;
 	struct cifsInodeInfo *cifsInode = CIFS_I(inode);
-	struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb);
+	struct cifs_sb_info *cifs_sb = CIFS_SB(inode_sb(inode));
 	struct tcon_link *tlink = NULL;
 	struct cifs_tcon *tcon = NULL;
 	struct TCP_Server_Info *server;
@@ -2160,7 +2163,7 @@ cifs_setattr_unix(struct dentry *direntry, struct iattr *attrs)
 	char *full_path = NULL;
 	struct inode *inode = d_inode(direntry);
 	struct cifsInodeInfo *cifsInode = CIFS_I(inode);
-	struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb);
+	struct cifs_sb_info *cifs_sb = CIFS_SB(inode_sb(inode));
 	struct tcon_link *tlink;
 	struct cifs_tcon *pTcon;
 	struct cifs_unix_set_info_args *args = NULL;
@@ -2299,7 +2302,7 @@ cifs_setattr_nounix(struct dentry *direntry, struct iattr *attrs)
 	kuid_t uid = INVALID_UID;
 	kgid_t gid = INVALID_GID;
 	struct inode *inode = d_inode(direntry);
-	struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb);
+	struct cifs_sb_info *cifs_sb = CIFS_SB(inode_sb(inode));
 	struct cifsInodeInfo *cifsInode = CIFS_I(inode);
 	char *full_path = NULL;
 	int rc = -EACCES;
diff --git a/fs/cifs/ioctl.c b/fs/cifs/ioctl.c
index 54f32f9143a9..abb71d967084 100644
--- a/fs/cifs/ioctl.c
+++ b/fs/cifs/ioctl.c
@@ -131,7 +131,7 @@ long cifs_ioctl(struct file *filep, unsigned int command, unsigned long arg)
 
 	xid = get_xid();
 
-	cifs_sb = CIFS_SB(inode->i_sb);
+	cifs_sb = CIFS_SB(inode_sb(inode));
 	cifs_dbg(FYI, "cifs ioctl 0x%x\n", command);
 	switch (command) {
 		case FS_IOC_GETFLAGS:
diff --git a/fs/cifs/link.c b/fs/cifs/link.c
index 60b5a11ee11b..bd4d4ddc40a1 100644
--- a/fs/cifs/link.c
+++ b/fs/cifs/link.c
@@ -535,7 +535,7 @@ cifs_hardlink(struct dentry *old_file, struct inode *inode,
 	unsigned int xid;
 	char *from_name = NULL;
 	char *to_name = NULL;
-	struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb);
+	struct cifs_sb_info *cifs_sb = CIFS_SB(inode_sb(inode));
 	struct tcon_link *tlink;
 	struct cifs_tcon *tcon;
 	struct TCP_Server_Info *server;
@@ -625,7 +625,7 @@ cifs_get_link(struct dentry *direntry, struct inode *inode,
 	unsigned int xid;
 	char *full_path = NULL;
 	char *target_path = NULL;
-	struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb);
+	struct cifs_sb_info *cifs_sb = CIFS_SB(inode_sb(inode));
 	struct tcon_link *tlink = NULL;
 	struct cifs_tcon *tcon;
 	struct TCP_Server_Info *server;
@@ -681,7 +681,7 @@ cifs_symlink(struct inode *inode, struct dentry *direntry, const char *symname)
 {
 	int rc = -EOPNOTSUPP;
 	unsigned int xid;
-	struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb);
+	struct cifs_sb_info *cifs_sb = CIFS_SB(inode_sb(inode));
 	struct tcon_link *tlink;
 	struct cifs_tcon *pTcon;
 	char *full_path = NULL;
@@ -719,10 +719,10 @@ cifs_symlink(struct inode *inode, struct dentry *direntry, const char *symname)
 	if (rc == 0) {
 		if (pTcon->unix_ext)
 			rc = cifs_get_inode_info_unix(&newinode, full_path,
-						      inode->i_sb, xid);
+						      inode_sb(inode), xid);
 		else
 			rc = cifs_get_inode_info(&newinode, full_path, NULL,
-						 inode->i_sb, xid, NULL);
+						 inode_sb(inode), xid, NULL);
 
 		if (rc != 0) {
 			cifs_dbg(FYI, "Create symlink ok, getinodeinfo fail rc = %d\n",
diff --git a/fs/cifs/readdir.c b/fs/cifs/readdir.c
index a27fc8791551..19e3a9f6f89c 100644
--- a/fs/cifs/readdir.c
+++ b/fs/cifs/readdir.c
@@ -689,7 +689,7 @@ static int cifs_filldir(char *find_entry, struct file *file,
 		char *scratch_buf, unsigned int max_len)
 {
 	struct cifsFileInfo *file_info = file->private_data;
-	struct super_block *sb = file_inode(file)->i_sb;
+	struct super_block *sb = inode_sb(file_inode(file));
 	struct cifs_sb_info *cifs_sb = CIFS_SB(sb);
 	struct cifs_dirent de = { NULL, };
 	struct cifs_fattr fattr;
diff --git a/fs/cifs/smb1ops.c b/fs/cifs/smb1ops.c
index 3d495e440c87..a0385106b711 100644
--- a/fs/cifs/smb1ops.c
+++ b/fs/cifs/smb1ops.c
@@ -774,7 +774,7 @@ smb_set_file_info(struct inode *inode, const char *full_path,
 	struct cifs_open_parms oparms;
 	struct cifsFileInfo *open_file;
 	struct cifsInodeInfo *cinode = CIFS_I(inode);
-	struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb);
+	struct cifs_sb_info *cifs_sb = CIFS_SB(inode_sb(inode));
 	struct tcon_link *tlink = NULL;
 	struct cifs_tcon *tcon;
 
@@ -1013,7 +1013,7 @@ cifs_is_read_op(__u32 oplock)
 static unsigned int
 cifs_wp_retry_size(struct inode *inode)
 {
-	return CIFS_SB(inode->i_sb)->wsize;
+	return CIFS_SB(inode_sb(inode))->wsize;
 }
 
 static bool
diff --git a/fs/cifs/smb2inode.c b/fs/cifs/smb2inode.c
index 1238cd3552f9..74ac53fc470b 100644
--- a/fs/cifs/smb2inode.c
+++ b/fs/cifs/smb2inode.c
@@ -262,7 +262,7 @@ int
 smb2_set_file_info(struct inode *inode, const char *full_path,
 		   FILE_BASIC_INFO *buf, const unsigned int xid)
 {
-	struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb);
+	struct cifs_sb_info *cifs_sb = CIFS_SB(inode_sb(inode));
 	struct tcon_link *tlink;
 	int rc;
 
diff --git a/fs/cifs/smb2ops.c b/fs/cifs/smb2ops.c
index eb68e2fcc500..932e8661c2a6 100644
--- a/fs/cifs/smb2ops.c
+++ b/fs/cifs/smb2ops.c
@@ -1608,7 +1608,7 @@ set_smb2_acl(struct cifs_ntsd *pnntsd, __u32 acllen,
 	unsigned int xid;
 	int rc, access_flags = 0;
 	struct cifs_tcon *tcon;
-	struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb);
+	struct cifs_sb_info *cifs_sb = CIFS_SB(inode_sb(inode));
 	struct tcon_link *tlink = cifs_sb_tlink(cifs_sb);
 	struct cifs_fid fid;
 	struct cifs_open_parms oparms;
@@ -2039,7 +2039,7 @@ smb3_parse_lease_buf(void *buf, unsigned int *epoch)
 static unsigned int
 smb2_wp_retry_size(struct inode *inode)
 {
-	return min_t(unsigned int, CIFS_SB(inode->i_sb)->wsize,
+	return min_t(unsigned int, CIFS_SB(inode_sb(inode))->wsize,
 		     SMB2_MAX_BUFFER_SIZE);
 }
 
-- 
2.15.1

^ permalink raw reply related	[flat|nested] 88+ messages in thread

* [PATCH 21/76] fs/coda: Use inode_sb() helper instead of inode->i_sb
  2018-05-08 18:03 [RFC][PATCH 0/76] vfs: 'views' for filesystems with more than one root Mark Fasheh
                   ` (19 preceding siblings ...)
  2018-05-08 18:03 ` [PATCH 20/76] fs/cifs: " Mark Fasheh
@ 2018-05-08 18:03 ` Mark Fasheh
  2018-05-08 18:03 ` [PATCH 22/76] fs/configfs: " Mark Fasheh
                   ` (55 subsequent siblings)
  76 siblings, 0 replies; 88+ messages in thread
From: Mark Fasheh @ 2018-05-08 18:03 UTC (permalink / raw)
  To: linux-fsdevel; +Cc: linux-kernel, linux-btrfs, Mark Fasheh

Signed-off-by: Mark Fasheh <mfasheh@suse.de>
---
 fs/coda/dir.c     | 25 +++++++++++++------------
 fs/coda/file.c    |  7 ++++---
 fs/coda/inode.c   |  4 ++--
 fs/coda/pioctl.c  |  4 ++--
 fs/coda/symlink.c |  2 +-
 5 files changed, 22 insertions(+), 20 deletions(-)

diff --git a/fs/coda/dir.c b/fs/coda/dir.c
index 00876ddadb43..89deb3532f5e 100644
--- a/fs/coda/dir.c
+++ b/fs/coda/dir.c
@@ -40,7 +40,7 @@ static int coda_return_EIO(void)
 /* access routines: lookup, readlink, permission */
 static struct dentry *coda_lookup(struct inode *dir, struct dentry *entry, unsigned int flags)
 {
-	struct super_block *sb = dir->i_sb;
+	struct super_block *sb = inode_sb(dir);
 	const char *name = entry->d_name.name;
 	size_t length = entry->d_name.len;
 	struct inode *inode;
@@ -91,7 +91,7 @@ int coda_permission(struct inode *inode, int mask)
 	if (coda_cache_check(inode, mask))
 		return 0;
 
-	error = venus_access(inode->i_sb, coda_i2f(inode), mask);
+	error = venus_access(inode_sb(inode), coda_i2f(inode), mask);
     
 	if (!error)
 		coda_cache_enter(inode, mask);
@@ -144,12 +144,12 @@ static int coda_create(struct inode *dir, struct dentry *de, umode_t mode, bool
 	if (is_root_inode(dir) && coda_iscontrol(name, length))
 		return -EPERM;
 
-	error = venus_create(dir->i_sb, coda_i2f(dir), name, length, 
+	error = venus_create(inode_sb(dir), coda_i2f(dir), name, length, 
 				0, mode, &newfid, &attrs);
 	if (error)
 		goto err_out;
 
-	inode = coda_iget(dir->i_sb, &newfid, &attrs);
+	inode = coda_iget(inode_sb(dir), &newfid, &attrs);
 	if (IS_ERR(inode)) {
 		error = PTR_ERR(inode);
 		goto err_out;
@@ -177,12 +177,12 @@ static int coda_mkdir(struct inode *dir, struct dentry *de, umode_t mode)
 		return -EPERM;
 
 	attrs.va_mode = mode;
-	error = venus_mkdir(dir->i_sb, coda_i2f(dir), 
+	error = venus_mkdir(inode_sb(dir), coda_i2f(dir), 
 			       name, len, &newfid, &attrs);
 	if (error)
 		goto err_out;
          
-	inode = coda_iget(dir->i_sb, &newfid, &attrs);
+	inode = coda_iget(inode_sb(dir), &newfid, &attrs);
 	if (IS_ERR(inode)) {
 		error = PTR_ERR(inode);
 		goto err_out;
@@ -210,7 +210,7 @@ static int coda_link(struct dentry *source_de, struct inode *dir_inode,
 	if (is_root_inode(dir_inode) && coda_iscontrol(name, len))
 		return -EPERM;
 
-	error = venus_link(dir_inode->i_sb, coda_i2f(inode),
+	error = venus_link(inode_sb(dir_inode), coda_i2f(inode),
 			   coda_i2f(dir_inode), (const char *)name, len);
 	if (error) {
 		d_drop(de);
@@ -245,7 +245,8 @@ static int coda_symlink(struct inode *dir_inode, struct dentry *de,
 	 * an inode for the entry we have to drop it.
 	 */
 	d_drop(de);
-	error = venus_symlink(dir_inode->i_sb, coda_i2f(dir_inode), name, len,
+	error = venus_symlink(inode_sb(dir_inode), coda_i2f(dir_inode), name,
+			      len,
 			      symname, symlen);
 
 	/* mtime is no good anymore */
@@ -262,7 +263,7 @@ static int coda_unlink(struct inode *dir, struct dentry *de)
 	const char *name = de->d_name.name;
 	int len = de->d_name.len;
 
-	error = venus_remove(dir->i_sb, coda_i2f(dir), name, len);
+	error = venus_remove(inode_sb(dir), coda_i2f(dir), name, len);
 	if (error)
 		return error;
 
@@ -277,7 +278,7 @@ static int coda_rmdir(struct inode *dir, struct dentry *de)
 	int len = de->d_name.len;
 	int error;
 
-	error = venus_rmdir(dir->i_sb, coda_i2f(dir), name, len);
+	error = venus_rmdir(inode_sb(dir), coda_i2f(dir), name, len);
 	if (!error) {
 		/* VFS may delete the child */
 		if (d_really_is_positive(de))
@@ -304,7 +305,7 @@ static int coda_rename(struct inode *old_dir, struct dentry *old_dentry,
 	if (flags)
 		return -EINVAL;
 
-	error = venus_rename(old_dir->i_sb, coda_i2f(old_dir),
+	error = venus_rename(inode_sb(old_dir), coda_i2f(old_dir),
 			     coda_i2f(new_dir), old_length, new_length,
 			     (const char *) old_name, (const char *)new_name);
 	if (!error) {
@@ -529,7 +530,7 @@ int coda_revalidate_inode(struct inode *inode)
 		return 0;
 
 	if (cii->c_flags & (C_VATTR | C_PURGE | C_FLUSH)) {
-		error = venus_getattr(inode->i_sb, &(cii->c_fid), &attr);
+		error = venus_getattr(inode_sb(inode), &(cii->c_fid), &attr);
 		if (error)
 			return -EIO;
 
diff --git a/fs/coda/file.c b/fs/coda/file.c
index 1cbc1f2298ee..6f84de9d1197 100644
--- a/fs/coda/file.c
+++ b/fs/coda/file.c
@@ -112,7 +112,8 @@ int coda_open(struct inode *coda_inode, struct file *coda_file)
 	if (!cfi)
 		return -ENOMEM;
 
-	error = venus_open(coda_inode->i_sb, coda_i2f(coda_inode), coda_flags,
+	error = venus_open(inode_sb(coda_inode), coda_i2f(coda_inode),
+			   coda_flags,
 			   &host_file);
 	if (!host_file)
 		error = -EIO;
@@ -145,7 +146,7 @@ int coda_release(struct inode *coda_inode, struct file *coda_file)
 	cfi = CODA_FTOC(coda_file);
 	BUG_ON(!cfi || cfi->cfi_magic != CODA_MAGIC);
 
-	err = venus_close(coda_inode->i_sb, coda_i2f(coda_inode),
+	err = venus_close(inode_sb(coda_inode), coda_i2f(coda_inode),
 			  coda_flags, coda_file->f_cred->fsuid);
 
 	host_inode = file_inode(cfi->cfi_container);
@@ -191,7 +192,7 @@ int coda_fsync(struct file *coda_file, loff_t start, loff_t end, int datasync)
 
 	err = vfs_fsync(host_file, datasync);
 	if (!err && !datasync)
-		err = venus_fsync(coda_inode->i_sb, coda_i2f(coda_inode));
+		err = venus_fsync(inode_sb(coda_inode), coda_i2f(coda_inode));
 	inode_unlock(coda_inode);
 
 	return err;
diff --git a/fs/coda/inode.c b/fs/coda/inode.c
index 97424cf206c0..b4f3f9ace9fc 100644
--- a/fs/coda/inode.c
+++ b/fs/coda/inode.c
@@ -218,7 +218,7 @@ static int coda_fill_super(struct super_block *sb, void *data, int silent)
 	} 
 
 	pr_info("%s: rootinode is %ld dev %s\n",
-		__func__, root->i_ino, root->i_sb->s_id);
+		__func__, root->i_ino, inode_sb(root)->s_id);
 	sb->s_root = d_make_root(root);
 	if (!sb->s_root) {
 		error = -EINVAL;
@@ -275,7 +275,7 @@ int coda_setattr(struct dentry *de, struct iattr *iattr)
 	vattr.va_type = C_VNON; /* cannot set type */
 
 	/* Venus is responsible for truncating the container-file!!! */
-	error = venus_setattr(inode->i_sb, coda_i2f(inode), &vattr);
+	error = venus_setattr(inode_sb(inode), coda_i2f(inode), &vattr);
 
 	if (!error) {
 	        coda_vattr_to_iattr(inode, &vattr); 
diff --git a/fs/coda/pioctl.c b/fs/coda/pioctl.c
index e0c17b7dccce..c7158c04aba7 100644
--- a/fs/coda/pioctl.c
+++ b/fs/coda/pioctl.c
@@ -75,7 +75,7 @@ static long coda_pioctl(struct file *filp, unsigned int cmd,
 	target_inode = d_inode(path.dentry);
 
 	/* return if it is not a Coda inode */
-	if (target_inode->i_sb != inode->i_sb) {
+	if (inode_sb(target_inode) != inode_sb(inode)) {
 		error = -EINVAL;
 		goto out;
 	}
@@ -83,7 +83,7 @@ static long coda_pioctl(struct file *filp, unsigned int cmd,
 	/* now proceed to make the upcall */
 	cnp = ITOC(target_inode);
 
-	error = venus_pioctl(inode->i_sb, &(cnp->c_fid), cmd, &data);
+	error = venus_pioctl(inode_sb(inode), &(cnp->c_fid), cmd, &data);
 out:
 	path_put(&path);
 	return error;
diff --git a/fs/coda/symlink.c b/fs/coda/symlink.c
index 202297d156df..68dff2c5df74 100644
--- a/fs/coda/symlink.c
+++ b/fs/coda/symlink.c
@@ -31,7 +31,7 @@ static int coda_symlink_filler(struct file *file, struct page *page)
 
 	cii = ITOC(inode);
 
-	error = venus_readlink(inode->i_sb, &cii->c_fid, p, &len);
+	error = venus_readlink(inode_sb(inode), &cii->c_fid, p, &len);
 	if (error)
 		goto fail;
 	SetPageUptodate(page);
-- 
2.15.1

^ permalink raw reply related	[flat|nested] 88+ messages in thread

* [PATCH 22/76] fs/configfs: Use inode_sb() helper instead of inode->i_sb
  2018-05-08 18:03 [RFC][PATCH 0/76] vfs: 'views' for filesystems with more than one root Mark Fasheh
                   ` (20 preceding siblings ...)
  2018-05-08 18:03 ` [PATCH 21/76] fs/coda: " Mark Fasheh
@ 2018-05-08 18:03 ` Mark Fasheh
  2018-05-08 18:03 ` [PATCH 23/76] fs/cramfs: " Mark Fasheh
                   ` (54 subsequent siblings)
  76 siblings, 0 replies; 88+ messages in thread
From: Mark Fasheh @ 2018-05-08 18:03 UTC (permalink / raw)
  To: linux-fsdevel; +Cc: linux-kernel, linux-btrfs, Mark Fasheh

Signed-off-by: Mark Fasheh <mfasheh@suse.de>
---
 fs/configfs/inode.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/fs/configfs/inode.c b/fs/configfs/inode.c
index ad718e5e37bb..4f28a7445336 100644
--- a/fs/configfs/inode.c
+++ b/fs/configfs/inode.c
@@ -91,13 +91,13 @@ int configfs_setattr(struct dentry * dentry, struct iattr * iattr)
 		sd_iattr->ia_gid = iattr->ia_gid;
 	if (ia_valid & ATTR_ATIME)
 		sd_iattr->ia_atime = timespec_trunc(iattr->ia_atime,
-						inode->i_sb->s_time_gran);
+						inode_sb(inode)->s_time_gran);
 	if (ia_valid & ATTR_MTIME)
 		sd_iattr->ia_mtime = timespec_trunc(iattr->ia_mtime,
-						inode->i_sb->s_time_gran);
+						inode_sb(inode)->s_time_gran);
 	if (ia_valid & ATTR_CTIME)
 		sd_iattr->ia_ctime = timespec_trunc(iattr->ia_ctime,
-						inode->i_sb->s_time_gran);
+						inode_sb(inode)->s_time_gran);
 	if (ia_valid & ATTR_MODE) {
 		umode_t mode = iattr->ia_mode;
 
-- 
2.15.1

^ permalink raw reply related	[flat|nested] 88+ messages in thread

* [PATCH 23/76] fs/cramfs: Use inode_sb() helper instead of inode->i_sb
  2018-05-08 18:03 [RFC][PATCH 0/76] vfs: 'views' for filesystems with more than one root Mark Fasheh
                   ` (21 preceding siblings ...)
  2018-05-08 18:03 ` [PATCH 22/76] fs/configfs: " Mark Fasheh
@ 2018-05-08 18:03 ` Mark Fasheh
  2018-05-08 18:03 ` [PATCH 24/76] fs/crypto: " Mark Fasheh
                   ` (53 subsequent siblings)
  76 siblings, 0 replies; 88+ messages in thread
From: Mark Fasheh @ 2018-05-08 18:03 UTC (permalink / raw)
  To: linux-fsdevel; +Cc: linux-kernel, linux-btrfs, Mark Fasheh

Signed-off-by: Mark Fasheh <mfasheh@suse.de>
---
 fs/cramfs/inode.c | 19 ++++++++++---------
 1 file changed, 10 insertions(+), 9 deletions(-)

diff --git a/fs/cramfs/inode.c b/fs/cramfs/inode.c
index 017b0ab19bc4..eb633de7ccbe 100644
--- a/fs/cramfs/inode.c
+++ b/fs/cramfs/inode.c
@@ -294,7 +294,7 @@ static void *cramfs_read(struct super_block *sb, unsigned int offset,
  */
 static u32 cramfs_get_block_range(struct inode *inode, u32 pgoff, u32 *pages)
 {
-	struct cramfs_sb_info *sbi = CRAMFS_SB(inode->i_sb);
+	struct cramfs_sb_info *sbi = CRAMFS_SB(inode_sb(inode));
 	int i;
 	u32 *blockptrs, first_block_addr;
 
@@ -335,7 +335,7 @@ static u32 cramfs_get_block_range(struct inode *inode, u32 pgoff, u32 *pages)
  */
 static bool cramfs_last_page_is_shared(struct inode *inode)
 {
-	struct cramfs_sb_info *sbi = CRAMFS_SB(inode->i_sb);
+	struct cramfs_sb_info *sbi = CRAMFS_SB(inode_sb(inode));
 	u32 partial, last_page, blockaddr, *blockptrs;
 	char *tail_data;
 
@@ -353,7 +353,7 @@ static bool cramfs_last_page_is_shared(struct inode *inode)
 static int cramfs_physmem_mmap(struct file *file, struct vm_area_struct *vma)
 {
 	struct inode *inode = file_inode(file);
-	struct cramfs_sb_info *sbi = CRAMFS_SB(inode->i_sb);
+	struct cramfs_sb_info *sbi = CRAMFS_SB(inode_sb(inode));
 	unsigned int pages, max_pages, offset;
 	unsigned long address, pgoff = vma->vm_pgoff;
 	char *bailout_reason;
@@ -451,7 +451,7 @@ static unsigned long cramfs_physmem_get_unmapped_area(struct file *file,
 			unsigned long pgoff, unsigned long flags)
 {
 	struct inode *inode = file_inode(file);
-	struct super_block *sb = inode->i_sb;
+	struct super_block *sb = inode_sb(inode);
 	struct cramfs_sb_info *sbi = CRAMFS_SB(sb);
 	unsigned int pages, block_pages, max_pages, offset;
 
@@ -696,7 +696,7 @@ static int cramfs_statfs(struct dentry *dentry, struct kstatfs *buf)
 static int cramfs_readdir(struct file *file, struct dir_context *ctx)
 {
 	struct inode *inode = file_inode(file);
-	struct super_block *sb = inode->i_sb;
+	struct super_block *sb = inode_sb(inode);
 	char *buf;
 	unsigned int offset;
 
@@ -763,14 +763,15 @@ static struct dentry *cramfs_lookup(struct inode *dir, struct dentry *dentry, un
 	int sorted;
 
 	mutex_lock(&read_mutex);
-	sorted = CRAMFS_SB(dir->i_sb)->flags & CRAMFS_FLAG_SORTED_DIRS;
+	sorted = CRAMFS_SB(inode_sb(dir))->flags & CRAMFS_FLAG_SORTED_DIRS;
 	while (offset < dir->i_size) {
 		struct cramfs_inode *de;
 		char *name;
 		int namelen, retval;
 		int dir_off = OFFSET(dir) + offset;
 
-		de = cramfs_read(dir->i_sb, dir_off, sizeof(*de)+CRAMFS_MAXPATHLEN);
+		de = cramfs_read(inode_sb(dir), dir_off,
+				 sizeof(*de)+CRAMFS_MAXPATHLEN);
 		name = (char *)(de+1);
 
 		/* Try to take advantage of sorted directories */
@@ -799,7 +800,7 @@ static struct dentry *cramfs_lookup(struct inode *dir, struct dentry *dentry, un
 		if (retval > 0)
 			continue;
 		if (!retval) {
-			inode = get_cramfs_inode(dir->i_sb, de, dir_off);
+			inode = get_cramfs_inode(inode_sb(dir), de, dir_off);
 			break;
 		}
 		/* else (retval < 0) */
@@ -826,7 +827,7 @@ static int cramfs_readpage(struct file *file, struct page *page)
 	pgdata = kmap(page);
 
 	if (page->index < maxblock) {
-		struct super_block *sb = inode->i_sb;
+		struct super_block *sb = inode_sb(inode);
 		u32 blkptr_offset = OFFSET(inode) + page->index * 4;
 		u32 block_ptr, block_start, block_len;
 		bool uncompressed, direct;
-- 
2.15.1

^ permalink raw reply related	[flat|nested] 88+ messages in thread

* [PATCH 24/76] fs/crypto: Use inode_sb() helper instead of inode->i_sb
  2018-05-08 18:03 [RFC][PATCH 0/76] vfs: 'views' for filesystems with more than one root Mark Fasheh
                   ` (22 preceding siblings ...)
  2018-05-08 18:03 ` [PATCH 23/76] fs/cramfs: " Mark Fasheh
@ 2018-05-08 18:03 ` Mark Fasheh
  2018-05-08 18:03 ` [PATCH 25/76] fs/ecryptfs: " Mark Fasheh
                   ` (52 subsequent siblings)
  76 siblings, 0 replies; 88+ messages in thread
From: Mark Fasheh @ 2018-05-08 18:03 UTC (permalink / raw)
  To: linux-fsdevel; +Cc: linux-kernel, linux-btrfs, Mark Fasheh

Signed-off-by: Mark Fasheh <mfasheh@suse.de>
---
 fs/crypto/bio.c     | 10 +++++-----
 fs/crypto/crypto.c  |  4 ++--
 fs/crypto/fname.c   |  4 ++--
 fs/crypto/keyinfo.c |  8 ++++----
 fs/crypto/policy.c  | 12 ++++++------
 5 files changed, 19 insertions(+), 19 deletions(-)

diff --git a/fs/crypto/bio.c b/fs/crypto/bio.c
index 0d5e6a569d58..0f7daacfa3de 100644
--- a/fs/crypto/bio.c
+++ b/fs/crypto/bio.c
@@ -92,7 +92,7 @@ int fscrypt_zeroout_range(const struct inode *inode, pgoff_t lblk,
 	struct bio *bio;
 	int ret, err = 0;
 
-	BUG_ON(inode->i_sb->s_blocksize != PAGE_SIZE);
+	BUG_ON(inode_sb(inode)->s_blocksize != PAGE_SIZE);
 
 	ctx = fscrypt_get_ctx(inode, GFP_NOFS);
 	if (IS_ERR(ctx))
@@ -116,13 +116,13 @@ int fscrypt_zeroout_range(const struct inode *inode, pgoff_t lblk,
 			err = -ENOMEM;
 			goto errout;
 		}
-		bio_set_dev(bio, inode->i_sb->s_bdev);
+		bio_set_dev(bio, inode_sb(inode)->s_bdev);
 		bio->bi_iter.bi_sector =
-			pblk << (inode->i_sb->s_blocksize_bits - 9);
+			pblk << (inode_sb(inode)->s_blocksize_bits - 9);
 		bio_set_op_attrs(bio, REQ_OP_WRITE, 0);
 		ret = bio_add_page(bio, ciphertext_page,
-					inode->i_sb->s_blocksize, 0);
-		if (ret != inode->i_sb->s_blocksize) {
+					inode_sb(inode)->s_blocksize, 0);
+		if (ret != inode_sb(inode)->s_blocksize) {
 			/* should never happen! */
 			WARN_ON(1);
 			bio_put(bio);
diff --git a/fs/crypto/crypto.c b/fs/crypto/crypto.c
index ce654526c0fb..94b88687fe3f 100644
--- a/fs/crypto/crypto.c
+++ b/fs/crypto/crypto.c
@@ -240,7 +240,7 @@ struct page *fscrypt_encrypt_page(const struct inode *inode,
 
 	BUG_ON(len % FS_CRYPTO_BLOCK_SIZE != 0);
 
-	if (inode->i_sb->s_cop->flags & FS_CFLG_OWN_PAGES) {
+	if (inode_sb(inode)->s_cop->flags & FS_CFLG_OWN_PAGES) {
 		/* with inplace-encryption we just encrypt the page */
 		err = fscrypt_do_page_crypto(inode, FS_ENCRYPT, lblk_num, page,
 					     ciphertext_page, len, offs,
@@ -299,7 +299,7 @@ EXPORT_SYMBOL(fscrypt_encrypt_page);
 int fscrypt_decrypt_page(const struct inode *inode, struct page *page,
 			unsigned int len, unsigned int offs, u64 lblk_num)
 {
-	if (!(inode->i_sb->s_cop->flags & FS_CFLG_OWN_PAGES))
+	if (!(inode_sb(inode)->s_cop->flags & FS_CFLG_OWN_PAGES))
 		BUG_ON(!PageLocked(page));
 
 	return fscrypt_do_page_crypto(inode, FS_DECRYPT, lblk_num, page, page,
diff --git a/fs/crypto/fname.c b/fs/crypto/fname.c
index e33f3d3c5ade..cc0e7632e2d6 100644
--- a/fs/crypto/fname.c
+++ b/fs/crypto/fname.c
@@ -102,7 +102,7 @@ static int fname_decrypt(struct inode *inode,
 	char iv[FS_CRYPTO_BLOCK_SIZE];
 	unsigned lim;
 
-	lim = inode->i_sb->s_cop->max_namelen(inode);
+	lim = inode_sb(inode)->s_cop->max_namelen(inode);
 	if (iname->len <= 0 || iname->len > lim)
 		return -EIO;
 
@@ -346,7 +346,7 @@ int fscrypt_setup_filename(struct inode *dir, const struct qstr *iname,
 
 	if (dir->i_crypt_info) {
 		if (!fscrypt_fname_encrypted_size(dir, iname->len,
-						  dir->i_sb->s_cop->max_namelen(dir),
+						  inode_sb(dir)->s_cop->max_namelen(dir),
 						  &fname->crypto_buf.len))
 			return -ENAMETOOLONG;
 		fname->crypto_buf.name = kmalloc(fname->crypto_buf.len,
diff --git a/fs/crypto/keyinfo.c b/fs/crypto/keyinfo.c
index 05f5ee1f0705..13beafec4355 100644
--- a/fs/crypto/keyinfo.c
+++ b/fs/crypto/keyinfo.c
@@ -253,11 +253,11 @@ int fscrypt_get_encryption_info(struct inode *inode)
 	if (inode->i_crypt_info)
 		return 0;
 
-	res = fscrypt_initialize(inode->i_sb->s_cop->flags);
+	res = fscrypt_initialize(inode_sb(inode)->s_cop->flags);
 	if (res)
 		return res;
 
-	res = inode->i_sb->s_cop->get_context(inode, &ctx, sizeof(ctx));
+	res = inode_sb(inode)->s_cop->get_context(inode, &ctx, sizeof(ctx));
 	if (res < 0) {
 		if (!fscrypt_dummy_context_enabled(inode) ||
 		    IS_ENCRYPTED(inode))
@@ -305,9 +305,9 @@ int fscrypt_get_encryption_info(struct inode *inode)
 
 	res = validate_user_key(crypt_info, &ctx, raw_key, FS_KEY_DESC_PREFIX,
 				keysize);
-	if (res && inode->i_sb->s_cop->key_prefix) {
+	if (res && inode_sb(inode)->s_cop->key_prefix) {
 		int res2 = validate_user_key(crypt_info, &ctx, raw_key,
-					     inode->i_sb->s_cop->key_prefix,
+					     inode_sb(inode)->s_cop->key_prefix,
 					     keysize);
 		if (res2) {
 			if (res2 == -ENOKEY)
diff --git a/fs/crypto/policy.c b/fs/crypto/policy.c
index c6d431a5cce9..76d99e0af39a 100644
--- a/fs/crypto/policy.c
+++ b/fs/crypto/policy.c
@@ -52,7 +52,7 @@ static int create_encryption_context_from_policy(struct inode *inode,
 	BUILD_BUG_ON(sizeof(ctx.nonce) != FS_KEY_DERIVATION_NONCE_SIZE);
 	get_random_bytes(ctx.nonce, FS_KEY_DERIVATION_NONCE_SIZE);
 
-	return inode->i_sb->s_cop->set_context(inode, &ctx, sizeof(ctx), NULL);
+	return inode_sb(inode)->s_cop->set_context(inode, &ctx, sizeof(ctx), NULL);
 }
 
 int fscrypt_ioctl_set_policy(struct file *filp, const void __user *arg)
@@ -77,11 +77,11 @@ int fscrypt_ioctl_set_policy(struct file *filp, const void __user *arg)
 
 	inode_lock(inode);
 
-	ret = inode->i_sb->s_cop->get_context(inode, &ctx, sizeof(ctx));
+	ret = inode_sb(inode)->s_cop->get_context(inode, &ctx, sizeof(ctx));
 	if (ret == -ENODATA) {
 		if (!S_ISDIR(inode->i_mode))
 			ret = -ENOTDIR;
-		else if (!inode->i_sb->s_cop->empty_dir(inode))
+		else if (!inode_sb(inode)->s_cop->empty_dir(inode))
 			ret = -ENOTEMPTY;
 		else
 			ret = create_encryption_context_from_policy(inode,
@@ -113,7 +113,7 @@ int fscrypt_ioctl_get_policy(struct file *filp, void __user *arg)
 	if (!IS_ENCRYPTED(inode))
 		return -ENODATA;
 
-	res = inode->i_sb->s_cop->get_context(inode, &ctx, sizeof(ctx));
+	res = inode_sb(inode)->s_cop->get_context(inode, &ctx, sizeof(ctx));
 	if (res < 0 && res != -ERANGE)
 		return res;
 	if (res != sizeof(ctx))
@@ -156,7 +156,7 @@ EXPORT_SYMBOL(fscrypt_ioctl_get_policy);
  */
 int fscrypt_has_permitted_context(struct inode *parent, struct inode *child)
 {
-	const struct fscrypt_operations *cops = parent->i_sb->s_cop;
+	const struct fscrypt_operations *cops = inode_sb(parent)->s_cop;
 	const struct fscrypt_info *parent_ci, *child_ci;
 	struct fscrypt_context parent_ctx, child_ctx;
 	int res;
@@ -258,7 +258,7 @@ int fscrypt_inherit_context(struct inode *parent, struct inode *child,
 	       FS_KEY_DESCRIPTOR_SIZE);
 	get_random_bytes(ctx.nonce, FS_KEY_DERIVATION_NONCE_SIZE);
 	BUILD_BUG_ON(sizeof(ctx) != FSCRYPT_SET_CONTEXT_MAX_SIZE);
-	res = parent->i_sb->s_cop->set_context(child, &ctx,
+	res = inode_sb(parent)->s_cop->set_context(child, &ctx,
 						sizeof(ctx), fs_data);
 	if (res)
 		return res;
-- 
2.15.1

^ permalink raw reply related	[flat|nested] 88+ messages in thread

* [PATCH 25/76] fs/ecryptfs: Use inode_sb() helper instead of inode->i_sb
  2018-05-08 18:03 [RFC][PATCH 0/76] vfs: 'views' for filesystems with more than one root Mark Fasheh
                   ` (23 preceding siblings ...)
  2018-05-08 18:03 ` [PATCH 24/76] fs/crypto: " Mark Fasheh
@ 2018-05-08 18:03 ` Mark Fasheh
  2018-05-08 18:03 ` [PATCH 26/76] fs/efivarfs: " Mark Fasheh
                   ` (51 subsequent siblings)
  76 siblings, 0 replies; 88+ messages in thread
From: Mark Fasheh @ 2018-05-08 18:03 UTC (permalink / raw)
  To: linux-fsdevel; +Cc: linux-kernel, linux-btrfs, Mark Fasheh

Signed-off-by: Mark Fasheh <mfasheh@suse.de>
---
 fs/ecryptfs/crypto.c |  5 ++---
 fs/ecryptfs/file.c   |  5 ++---
 fs/ecryptfs/inode.c  | 15 +++++++--------
 3 files changed, 11 insertions(+), 14 deletions(-)

diff --git a/fs/ecryptfs/crypto.c b/fs/ecryptfs/crypto.c
index 846ca150d52e..ae979420d9d1 100644
--- a/fs/ecryptfs/crypto.c
+++ b/fs/ecryptfs/crypto.c
@@ -800,8 +800,7 @@ int ecryptfs_new_file_context(struct inode *ecryptfs_inode)
 	struct ecryptfs_crypt_stat *crypt_stat =
 	    &ecryptfs_inode_to_private(ecryptfs_inode)->crypt_stat;
 	struct ecryptfs_mount_crypt_stat *mount_crypt_stat =
-	    &ecryptfs_superblock_to_private(
-		    ecryptfs_inode->i_sb)->mount_crypt_stat;
+	    &ecryptfs_superblock_to_private(inode_sb(ecryptfs_inode))->mount_crypt_stat;
 	int cipher_name_len;
 	int rc = 0;
 
@@ -1263,7 +1262,7 @@ void ecryptfs_i_size_init(const char *page_virt, struct inode *inode)
 
 	crypt_stat = &ecryptfs_inode_to_private(inode)->crypt_stat;
 	mount_crypt_stat =
-		&ecryptfs_superblock_to_private(inode->i_sb)->mount_crypt_stat;
+		&ecryptfs_superblock_to_private(inode_sb(inode))->mount_crypt_stat;
 	if (mount_crypt_stat->flags & ECRYPTFS_ENCRYPTED_VIEW_ENABLED) {
 		file_size = i_size_read(ecryptfs_inode_to_lower(inode));
 		if (crypt_stat->flags & ECRYPTFS_METADATA_IN_XATTR)
diff --git a/fs/ecryptfs/file.c b/fs/ecryptfs/file.c
index c74ed3ca3372..0fa5050bcbc2 100644
--- a/fs/ecryptfs/file.c
+++ b/fs/ecryptfs/file.c
@@ -109,7 +109,7 @@ static int ecryptfs_readdir(struct file *file, struct dir_context *ctx)
 	struct ecryptfs_getdents_callback buf = {
 		.ctx.actor = ecryptfs_filldir,
 		.caller = ctx,
-		.sb = inode->i_sb,
+		.sb = inode_sb(inode),
 	};
 	lower_file = ecryptfs_file_to_lower(file);
 	rc = iterate_dir(lower_file, &buf.ctx);
@@ -135,8 +135,7 @@ static int read_or_initialize_metadata(struct dentry *dentry)
 	int rc;
 
 	crypt_stat = &ecryptfs_inode_to_private(inode)->crypt_stat;
-	mount_crypt_stat = &ecryptfs_superblock_to_private(
-						inode->i_sb)->mount_crypt_stat;
+	mount_crypt_stat = &ecryptfs_superblock_to_private(inode_sb(inode))->mount_crypt_stat;
 	mutex_lock(&crypt_stat->cs_mutex);
 
 	if (crypt_stat->flags & ECRYPTFS_POLICY_APPLIED &&
diff --git a/fs/ecryptfs/inode.c b/fs/ecryptfs/inode.c
index 847904aa63a9..ea205c666f5b 100644
--- a/fs/ecryptfs/inode.c
+++ b/fs/ecryptfs/inode.c
@@ -88,7 +88,7 @@ static struct inode *__ecryptfs_get_inode(struct inode *lower_inode,
 {
 	struct inode *inode;
 
-	if (lower_inode->i_sb != ecryptfs_superblock_to_lower(sb))
+	if (inode_sb(lower_inode) != ecryptfs_superblock_to_lower(sb))
 		return ERR_PTR(-EXDEV);
 	if (!igrab(lower_inode))
 		return ERR_PTR(-ESTALE);
@@ -194,7 +194,7 @@ ecryptfs_do_create(struct inode *directory_inode,
 		goto out_lock;
 	}
 	inode = __ecryptfs_get_inode(d_inode(lower_dentry),
-				     directory_inode->i_sb);
+				     inode_sb(directory_inode));
 	if (IS_ERR(inode)) {
 		vfs_unlink(d_inode(lower_dir_dentry), lower_dentry, NULL);
 		goto out_lock;
@@ -441,7 +441,7 @@ static int ecryptfs_link(struct dentry *old_dentry, struct inode *dir,
 		      lower_new_dentry, NULL);
 	if (rc || d_really_is_negative(lower_new_dentry))
 		goto out_lock;
-	rc = ecryptfs_interpose(lower_new_dentry, new_dentry, dir->i_sb);
+	rc = ecryptfs_interpose(lower_new_dentry, new_dentry, inode_sb(dir));
 	if (rc)
 		goto out_lock;
 	fsstack_copy_attr_times(dir, d_inode(lower_dir_dentry));
@@ -474,8 +474,7 @@ static int ecryptfs_symlink(struct inode *dir, struct dentry *dentry,
 	lower_dentry = ecryptfs_dentry_to_lower(dentry);
 	dget(lower_dentry);
 	lower_dir_dentry = lock_parent(lower_dentry);
-	mount_crypt_stat = &ecryptfs_superblock_to_private(
-		dir->i_sb)->mount_crypt_stat;
+	mount_crypt_stat = &ecryptfs_superblock_to_private(inode_sb(dir))->mount_crypt_stat;
 	rc = ecryptfs_encrypt_and_encode_filename(&encoded_symname,
 						  &encoded_symlen,
 						  mount_crypt_stat, symname,
@@ -487,7 +486,7 @@ static int ecryptfs_symlink(struct inode *dir, struct dentry *dentry,
 	kfree(encoded_symname);
 	if (rc || d_really_is_negative(lower_dentry))
 		goto out_lock;
-	rc = ecryptfs_interpose(lower_dentry, dentry, dir->i_sb);
+	rc = ecryptfs_interpose(lower_dentry, dentry, inode_sb(dir));
 	if (rc)
 		goto out_lock;
 	fsstack_copy_attr_times(dir, d_inode(lower_dir_dentry));
@@ -511,7 +510,7 @@ static int ecryptfs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode
 	rc = vfs_mkdir(d_inode(lower_dir_dentry), lower_dentry, mode);
 	if (rc || d_really_is_negative(lower_dentry))
 		goto out;
-	rc = ecryptfs_interpose(lower_dentry, dentry, dir->i_sb);
+	rc = ecryptfs_interpose(lower_dentry, dentry, inode_sb(dir));
 	if (rc)
 		goto out;
 	fsstack_copy_attr_times(dir, d_inode(lower_dir_dentry));
@@ -559,7 +558,7 @@ ecryptfs_mknod(struct inode *dir, struct dentry *dentry, umode_t mode, dev_t dev
 	rc = vfs_mknod(d_inode(lower_dir_dentry), lower_dentry, mode, dev);
 	if (rc || d_really_is_negative(lower_dentry))
 		goto out;
-	rc = ecryptfs_interpose(lower_dentry, dentry, dir->i_sb);
+	rc = ecryptfs_interpose(lower_dentry, dentry, inode_sb(dir));
 	if (rc)
 		goto out;
 	fsstack_copy_attr_times(dir, d_inode(lower_dir_dentry));
-- 
2.15.1

^ permalink raw reply related	[flat|nested] 88+ messages in thread

* [PATCH 26/76] fs/efivarfs: Use inode_sb() helper instead of inode->i_sb
  2018-05-08 18:03 [RFC][PATCH 0/76] vfs: 'views' for filesystems with more than one root Mark Fasheh
                   ` (24 preceding siblings ...)
  2018-05-08 18:03 ` [PATCH 25/76] fs/ecryptfs: " Mark Fasheh
@ 2018-05-08 18:03 ` Mark Fasheh
  2018-05-08 18:03 ` [PATCH 27/76] fs/efs: " Mark Fasheh
                   ` (50 subsequent siblings)
  76 siblings, 0 replies; 88+ messages in thread
From: Mark Fasheh @ 2018-05-08 18:03 UTC (permalink / raw)
  To: linux-fsdevel; +Cc: linux-kernel, linux-btrfs, Mark Fasheh

Signed-off-by: Mark Fasheh <mfasheh@suse.de>
---
 fs/efivarfs/inode.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/efivarfs/inode.c b/fs/efivarfs/inode.c
index 71fccccf317e..5e0de72476bf 100644
--- a/fs/efivarfs/inode.c
+++ b/fs/efivarfs/inode.c
@@ -92,7 +92,7 @@ static int efivarfs_create(struct inode *dir, struct dentry *dentry,
 					 dentry->d_name.name, namelen))
 		is_removable = true;
 
-	inode = efivarfs_get_inode(dir->i_sb, dir, mode, 0, is_removable);
+	inode = efivarfs_get_inode(inode_sb(dir), dir, mode, 0, is_removable);
 	if (!inode) {
 		err = -ENOMEM;
 		goto out;
-- 
2.15.1

^ permalink raw reply related	[flat|nested] 88+ messages in thread

* [PATCH 27/76] fs/efs: Use inode_sb() helper instead of inode->i_sb
  2018-05-08 18:03 [RFC][PATCH 0/76] vfs: 'views' for filesystems with more than one root Mark Fasheh
                   ` (25 preceding siblings ...)
  2018-05-08 18:03 ` [PATCH 26/76] fs/efivarfs: " Mark Fasheh
@ 2018-05-08 18:03 ` Mark Fasheh
  2018-05-08 18:03 ` [PATCH 28/76] fs/exofs: " Mark Fasheh
                   ` (49 subsequent siblings)
  76 siblings, 0 replies; 88+ messages in thread
From: Mark Fasheh @ 2018-05-08 18:03 UTC (permalink / raw)
  To: linux-fsdevel; +Cc: linux-kernel, linux-btrfs, Mark Fasheh

Signed-off-by: Mark Fasheh <mfasheh@suse.de>
---
 fs/efs/dir.c     | 2 +-
 fs/efs/file.c    | 2 +-
 fs/efs/inode.c   | 6 +++---
 fs/efs/namei.c   | 4 ++--
 fs/efs/symlink.c | 4 ++--
 5 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/fs/efs/dir.c b/fs/efs/dir.c
index f892ac7c2a35..55663c4f49ce 100644
--- a/fs/efs/dir.c
+++ b/fs/efs/dir.c
@@ -42,7 +42,7 @@ static int efs_readdir(struct file *file, struct dir_context *ctx)
 		struct buffer_head *bh;
 
 		/* read the dir block */
-		bh = sb_bread(inode->i_sb, efs_bmap(inode, block));
+		bh = sb_bread(inode_sb(inode), efs_bmap(inode, block));
 
 		if (!bh) {
 			pr_err("%s(): failed to read dir block %d\n",
diff --git a/fs/efs/file.c b/fs/efs/file.c
index 9e641da6fab2..4e7cf6d70872 100644
--- a/fs/efs/file.c
+++ b/fs/efs/file.c
@@ -30,7 +30,7 @@ int efs_get_block(struct inode *inode, sector_t iblock,
 	}
 	phys = efs_map_block(inode, iblock);
 	if (phys)
-		map_bh(bh_result, inode->i_sb, phys);
+		map_bh(bh_result, inode_sb(inode), phys);
 	return 0;
 }
 
diff --git a/fs/efs/inode.c b/fs/efs/inode.c
index cdf0872382af..a62f6029fc1c 100644
--- a/fs/efs/inode.c
+++ b/fs/efs/inode.c
@@ -87,7 +87,7 @@ struct inode *efs_iget(struct super_block *super, unsigned long ino)
 			(EFS_BLOCKSIZE / sizeof(struct efs_dinode))) *
 		sizeof(struct efs_dinode);
 
-	bh = sb_bread(inode->i_sb, block);
+	bh = sb_bread(inode_sb(inode), block);
 	if (!bh) {
 		pr_warn("%s() failed at block %d\n", __func__, block);
 		goto read_inode_error;
@@ -196,7 +196,7 @@ efs_extent_check(efs_extent *ptr, efs_block_t block, struct efs_sb_info *sb) {
 }
 
 efs_block_t efs_map_block(struct inode *inode, efs_block_t block) {
-	struct efs_sb_info    *sb = SUPER_INFO(inode->i_sb);
+	struct efs_sb_info    *sb = SUPER_INFO(inode_sb(inode));
 	struct efs_inode_info *in = INODE_INFO(inode);
 	struct buffer_head    *bh = NULL;
 
@@ -275,7 +275,7 @@ efs_block_t efs_map_block(struct inode *inode, efs_block_t block) {
 		if (first || lastblock != iblock) {
 			if (bh) brelse(bh);
 
-			bh = sb_bread(inode->i_sb, iblock);
+			bh = sb_bread(inode_sb(inode), iblock);
 			if (!bh) {
 				pr_err("%s() failed at block %d\n",
 				       __func__, iblock);
diff --git a/fs/efs/namei.c b/fs/efs/namei.c
index 38961ee1d1af..d1f3132b50a8 100644
--- a/fs/efs/namei.c
+++ b/fs/efs/namei.c
@@ -30,7 +30,7 @@ static efs_ino_t efs_find_entry(struct inode *inode, const char *name, int len)
 
 	for(block = 0; block < inode->i_blocks; block++) {
 
-		bh = sb_bread(inode->i_sb, efs_bmap(inode, block));
+		bh = sb_bread(inode_sb(inode), efs_bmap(inode, block));
 		if (!bh) {
 			pr_err("%s(): failed to read dir block %d\n",
 			       __func__, block);
@@ -69,7 +69,7 @@ struct dentry *efs_lookup(struct inode *dir, struct dentry *dentry, unsigned int
 
 	inodenum = efs_find_entry(dir, dentry->d_name.name, dentry->d_name.len);
 	if (inodenum)
-		inode = efs_iget(dir->i_sb, inodenum);
+		inode = efs_iget(inode_sb(dir), inodenum);
 
 	return d_splice_alias(inode, dentry);
 }
diff --git a/fs/efs/symlink.c b/fs/efs/symlink.c
index 923eb91654d5..f6b8b33e9600 100644
--- a/fs/efs/symlink.c
+++ b/fs/efs/symlink.c
@@ -26,13 +26,13 @@ static int efs_symlink_readpage(struct file *file, struct page *page)
   
 	/* read first 512 bytes of link target */
 	err = -EIO;
-	bh = sb_bread(inode->i_sb, efs_bmap(inode, 0));
+	bh = sb_bread(inode_sb(inode), efs_bmap(inode, 0));
 	if (!bh)
 		goto fail;
 	memcpy(link, bh->b_data, (size > EFS_BLOCKSIZE) ? EFS_BLOCKSIZE : size);
 	brelse(bh);
 	if (size > EFS_BLOCKSIZE) {
-		bh = sb_bread(inode->i_sb, efs_bmap(inode, 1));
+		bh = sb_bread(inode_sb(inode), efs_bmap(inode, 1));
 		if (!bh)
 			goto fail;
 		memcpy(link + EFS_BLOCKSIZE, bh->b_data, size - EFS_BLOCKSIZE);
-- 
2.15.1

^ permalink raw reply related	[flat|nested] 88+ messages in thread

* [PATCH 28/76] fs/exofs: Use inode_sb() helper instead of inode->i_sb
  2018-05-08 18:03 [RFC][PATCH 0/76] vfs: 'views' for filesystems with more than one root Mark Fasheh
                   ` (26 preceding siblings ...)
  2018-05-08 18:03 ` [PATCH 27/76] fs/efs: " Mark Fasheh
@ 2018-05-08 18:03 ` Mark Fasheh
  2018-05-08 18:03 ` [PATCH 29/76] fs/exportfs: " Mark Fasheh
                   ` (48 subsequent siblings)
  76 siblings, 0 replies; 88+ messages in thread
From: Mark Fasheh @ 2018-05-08 18:03 UTC (permalink / raw)
  To: linux-fsdevel; +Cc: linux-kernel, linux-btrfs, Mark Fasheh

Signed-off-by: Mark Fasheh <mfasheh@suse.de>
---
 fs/exofs/dir.c   |  6 +++---
 fs/exofs/inode.c | 12 ++++++------
 fs/exofs/namei.c |  4 ++--
 3 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/fs/exofs/dir.c b/fs/exofs/dir.c
index f0138674c1ed..592471362243 100644
--- a/fs/exofs/dir.c
+++ b/fs/exofs/dir.c
@@ -36,7 +36,7 @@
 
 static inline unsigned exofs_chunk_size(struct inode *inode)
 {
-	return inode->i_sb->s_blocksize;
+	return inode_sb(inode)->s_blocksize;
 }
 
 static inline void exofs_put_page(struct page *page)
@@ -430,7 +430,7 @@ int exofs_add_link(struct dentry *dentry, struct inode *inode)
 	unsigned reclen = EXOFS_DIR_REC_LEN(namelen);
 	unsigned short rec_len, name_len;
 	struct page *page = NULL;
-	struct exofs_sb_info *sbi = inode->i_sb->s_fs_info;
+	struct exofs_sb_info *sbi = inode_sb(inode)->s_fs_info;
 	struct exofs_dir_entry *de;
 	unsigned long npages = dir_pages(dir);
 	unsigned long n;
@@ -520,7 +520,7 @@ int exofs_delete_entry(struct exofs_dir_entry *dir, struct page *page)
 {
 	struct address_space *mapping = page->mapping;
 	struct inode *inode = mapping->host;
-	struct exofs_sb_info *sbi = inode->i_sb->s_fs_info;
+	struct exofs_sb_info *sbi = inode_sb(inode)->s_fs_info;
 	char *kaddr = page_address(page);
 	unsigned from = ((char *)dir - kaddr) & ~(exofs_chunk_size(inode)-1);
 	unsigned to = ((char *)dir - kaddr) + le16_to_cpu(dir->rec_len);
diff --git a/fs/exofs/inode.c b/fs/exofs/inode.c
index 0ac62811b341..c52a83f76a7a 100644
--- a/fs/exofs/inode.c
+++ b/fs/exofs/inode.c
@@ -66,7 +66,7 @@ struct page_collect {
 static void _pcol_init(struct page_collect *pcol, unsigned expected_pages,
 		       struct inode *inode)
 {
-	struct exofs_sb_info *sbi = inode->i_sb->s_fs_info;
+	struct exofs_sb_info *sbi = inode_sb(inode)->s_fs_info;
 
 	pcol->sbi = sbi;
 	pcol->inode = inode;
@@ -996,7 +996,7 @@ static inline int exofs_inode_is_fast_symlink(struct inode *inode)
 static int _do_truncate(struct inode *inode, loff_t newsize)
 {
 	struct exofs_i_info *oi = exofs_i(inode);
-	struct exofs_sb_info *sbi = inode->i_sb->s_fs_info;
+	struct exofs_sb_info *sbi = inode_sb(inode)->s_fs_info;
 	int ret;
 
 	inode->i_mtime = inode->i_ctime = current_time(inode);
@@ -1256,7 +1256,7 @@ static void create_done(struct ore_io_state *ios, void *p)
 {
 	struct inode *inode = p;
 	struct exofs_i_info *oi = exofs_i(inode);
-	struct exofs_sb_info *sbi = inode->i_sb->s_fs_info;
+	struct exofs_sb_info *sbi = inode_sb(inode)->s_fs_info;
 	int ret;
 
 	ret = ore_check_io(ios, NULL);
@@ -1286,7 +1286,7 @@ static void create_done(struct ore_io_state *ios, void *p)
  */
 struct inode *exofs_new_inode(struct inode *dir, umode_t mode)
 {
-	struct super_block *sb = dir->i_sb;
+	struct super_block *sb = inode_sb(dir);
 	struct exofs_sb_info *sbi = sb->s_fs_info;
 	struct inode *inode;
 	struct exofs_i_info *oi;
@@ -1366,7 +1366,7 @@ static void updatei_done(struct ore_io_state *ios, void *p)
 static int exofs_update_inode(struct inode *inode, int do_sync)
 {
 	struct exofs_i_info *oi = exofs_i(inode);
-	struct super_block *sb = inode->i_sb;
+	struct super_block *sb = inode_sb(inode);
 	struct exofs_sb_info *sbi = sb->s_fs_info;
 	struct ore_io_state *ios;
 	struct osd_attr attr;
@@ -1468,7 +1468,7 @@ static void delete_done(struct ore_io_state *ios, void *p)
 void exofs_evict_inode(struct inode *inode)
 {
 	struct exofs_i_info *oi = exofs_i(inode);
-	struct super_block *sb = inode->i_sb;
+	struct super_block *sb = inode_sb(inode);
 	struct exofs_sb_info *sbi = sb->s_fs_info;
 	struct ore_io_state *ios;
 	int ret;
diff --git a/fs/exofs/namei.c b/fs/exofs/namei.c
index 7295cd722770..655400486da5 100644
--- a/fs/exofs/namei.c
+++ b/fs/exofs/namei.c
@@ -55,7 +55,7 @@ static struct dentry *exofs_lookup(struct inode *dir, struct dentry *dentry,
 		return ERR_PTR(-ENAMETOOLONG);
 
 	ino = exofs_inode_by_name(dir, dentry);
-	inode = ino ? exofs_iget(dir->i_sb, ino) : NULL;
+	inode = ino ? exofs_iget(inode_sb(dir), ino) : NULL;
 	return d_splice_alias(inode, dentry);
 }
 
@@ -93,7 +93,7 @@ static int exofs_mknod(struct inode *dir, struct dentry *dentry, umode_t mode,
 static int exofs_symlink(struct inode *dir, struct dentry *dentry,
 			  const char *symname)
 {
-	struct super_block *sb = dir->i_sb;
+	struct super_block *sb = inode_sb(dir);
 	int err = -ENAMETOOLONG;
 	unsigned l = strlen(symname)+1;
 	struct inode *inode;
-- 
2.15.1

^ permalink raw reply related	[flat|nested] 88+ messages in thread

* [PATCH 29/76] fs/exportfs: Use inode_sb() helper instead of inode->i_sb
  2018-05-08 18:03 [RFC][PATCH 0/76] vfs: 'views' for filesystems with more than one root Mark Fasheh
                   ` (27 preceding siblings ...)
  2018-05-08 18:03 ` [PATCH 28/76] fs/exofs: " Mark Fasheh
@ 2018-05-08 18:03 ` Mark Fasheh
  2018-05-08 18:03 ` [PATCH 30/76] fs/ext2: " Mark Fasheh
                   ` (47 subsequent siblings)
  76 siblings, 0 replies; 88+ messages in thread
From: Mark Fasheh @ 2018-05-08 18:03 UTC (permalink / raw)
  To: linux-fsdevel; +Cc: linux-kernel, linux-btrfs, Mark Fasheh

Signed-off-by: Mark Fasheh <mfasheh@suse.de>
---
 fs/exportfs/expfs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/exportfs/expfs.c b/fs/exportfs/expfs.c
index 329a5d103846..d0ce48374bda 100644
--- a/fs/exportfs/expfs.c
+++ b/fs/exportfs/expfs.c
@@ -383,7 +383,7 @@ static int export_encode_fh(struct inode *inode, struct fid *fid,
 int exportfs_encode_inode_fh(struct inode *inode, struct fid *fid,
 			     int *max_len, struct inode *parent)
 {
-	const struct export_operations *nop = inode->i_sb->s_export_op;
+	const struct export_operations *nop = inode_sb(inode)->s_export_op;
 
 	if (nop && nop->encode_fh)
 		return nop->encode_fh(inode, fid->raw, max_len, parent);
-- 
2.15.1

^ permalink raw reply related	[flat|nested] 88+ messages in thread

* [PATCH 30/76] fs/ext2: Use inode_sb() helper instead of inode->i_sb
  2018-05-08 18:03 [RFC][PATCH 0/76] vfs: 'views' for filesystems with more than one root Mark Fasheh
                   ` (28 preceding siblings ...)
  2018-05-08 18:03 ` [PATCH 29/76] fs/exportfs: " Mark Fasheh
@ 2018-05-08 18:03 ` Mark Fasheh
  2018-05-08 18:03 ` [PATCH 31/76] fs/ext4: " Mark Fasheh
                   ` (46 subsequent siblings)
  76 siblings, 0 replies; 88+ messages in thread
From: Mark Fasheh @ 2018-05-08 18:03 UTC (permalink / raw)
  To: linux-fsdevel; +Cc: linux-kernel, linux-btrfs, Mark Fasheh

Signed-off-by: Mark Fasheh <mfasheh@suse.de>
---
 fs/ext2/balloc.c     | 10 +++----
 fs/ext2/dir.c        | 32 ++++++++++----------
 fs/ext2/file.c       |  6 ++--
 fs/ext2/ialloc.c     | 16 +++++-----
 fs/ext2/inode.c      | 82 +++++++++++++++++++++++++++-------------------------
 fs/ext2/ioctl.c      |  4 +--
 fs/ext2/namei.c      | 14 ++++-----
 fs/ext2/xattr.c      | 59 ++++++++++++++++++-------------------
 fs/ext2/xattr_user.c |  4 +--
 9 files changed, 115 insertions(+), 112 deletions(-)

diff --git a/fs/ext2/balloc.c b/fs/ext2/balloc.c
index 33db13365c5e..0ac54114ea9a 100644
--- a/fs/ext2/balloc.c
+++ b/fs/ext2/balloc.c
@@ -413,7 +413,7 @@ void ext2_init_block_alloc_info(struct inode *inode)
 {
 	struct ext2_inode_info *ei = EXT2_I(inode);
 	struct ext2_block_alloc_info *block_i;
-	struct super_block *sb = inode->i_sb;
+	struct super_block *sb = inode_sb(inode);
 
 	block_i = kmalloc(sizeof(*block_i), GFP_NOFS);
 	if (block_i) {
@@ -455,7 +455,7 @@ void ext2_discard_reservation(struct inode *inode)
 	struct ext2_inode_info *ei = EXT2_I(inode);
 	struct ext2_block_alloc_info *block_i = ei->i_block_alloc_info;
 	struct ext2_reserve_window_node *rsv;
-	spinlock_t *rsv_lock = &EXT2_SB(inode->i_sb)->s_rsv_window_lock;
+	spinlock_t *rsv_lock = &EXT2_SB(inode_sb(inode))->s_rsv_window_lock;
 
 	if (!block_i)
 		return;
@@ -464,7 +464,7 @@ void ext2_discard_reservation(struct inode *inode)
 	if (!rsv_is_empty(&rsv->rsv_window)) {
 		spin_lock(rsv_lock);
 		if (!rsv_is_empty(&rsv->rsv_window))
-			rsv_window_remove(inode->i_sb, rsv);
+			rsv_window_remove(inode_sb(inode), rsv);
 		spin_unlock(rsv_lock);
 	}
 }
@@ -484,7 +484,7 @@ void ext2_free_blocks (struct inode * inode, unsigned long block,
 	unsigned long bit;
 	unsigned long i;
 	unsigned long overflow;
-	struct super_block * sb = inode->i_sb;
+	struct super_block * sb = inode_sb(inode);
 	struct ext2_sb_info * sbi = EXT2_SB(sb);
 	struct ext2_group_desc * desc;
 	struct ext2_super_block * es = sbi->s_es;
@@ -1255,7 +1255,7 @@ ext2_fsblk_t ext2_new_blocks(struct inode *inode, ext2_fsblk_t goal,
 	int ret;
 
 	*errp = -ENOSPC;
-	sb = inode->i_sb;
+	sb = inode_sb(inode);
 
 	/*
 	 * Check quota for allocation of this block.
diff --git a/fs/ext2/dir.c b/fs/ext2/dir.c
index 3b8114def693..b9565d7b86e8 100644
--- a/fs/ext2/dir.c
+++ b/fs/ext2/dir.c
@@ -63,7 +63,7 @@ static inline __le16 ext2_rec_len_to_disk(unsigned len)
  */
 static inline unsigned ext2_chunk_size(struct inode *inode)
 {
-	return inode->i_sb->s_blocksize;
+	return inode_sb(inode)->s_blocksize;
 }
 
 static inline void ext2_put_page(struct page *page)
@@ -115,7 +115,7 @@ static int ext2_commit_chunk(struct page *page, loff_t pos, unsigned len)
 static bool ext2_check_page(struct page *page, int quiet)
 {
 	struct inode *dir = page->mapping->host;
-	struct super_block *sb = dir->i_sb;
+	struct super_block *sb = inode_sb(dir);
 	unsigned chunk_size = ext2_chunk_size(dir);
 	char *kaddr = page_address(page);
 	u32 max_inumber = le32_to_cpu(EXT2_SB(sb)->s_es->s_inodes_count);
@@ -277,7 +277,7 @@ static unsigned char ext2_type_by_mode[S_IFMT >> S_SHIFT] = {
 static inline void ext2_set_de_type(ext2_dirent *de, struct inode *inode)
 {
 	umode_t mode = inode->i_mode;
-	if (EXT2_HAS_INCOMPAT_FEATURE(inode->i_sb, EXT2_FEATURE_INCOMPAT_FILETYPE))
+	if (EXT2_HAS_INCOMPAT_FEATURE(inode_sb(inode), EXT2_FEATURE_INCOMPAT_FILETYPE))
 		de->file_type = ext2_type_by_mode[(mode & S_IFMT)>>S_SHIFT];
 	else
 		de->file_type = 0;
@@ -288,7 +288,7 @@ ext2_readdir(struct file *file, struct dir_context *ctx)
 {
 	loff_t pos = ctx->pos;
 	struct inode *inode = file_inode(file);
-	struct super_block *sb = inode->i_sb;
+	struct super_block *sb = inode_sb(inode);
 	unsigned int offset = pos & ~PAGE_MASK;
 	unsigned long n = pos >> PAGE_SHIFT;
 	unsigned long npages = dir_pages(inode);
@@ -392,8 +392,8 @@ struct ext2_dir_entry_2 *ext2_find_entry (struct inode *dir,
 			kaddr += ext2_last_byte(dir, n) - reclen;
 			while ((char *) de <= kaddr) {
 				if (de->rec_len == 0) {
-					ext2_error(dir->i_sb, __func__,
-						"zero-length directory entry");
+					ext2_error(inode_sb(dir), __func__,
+						   "zero-length directory entry");
 					ext2_put_page(page);
 					goto out;
 				}
@@ -409,10 +409,10 @@ struct ext2_dir_entry_2 *ext2_find_entry (struct inode *dir,
 			n = 0;
 		/* next page is past the blocks we've got */
 		if (unlikely(n > (dir->i_blocks >> (PAGE_SHIFT - 9)))) {
-			ext2_error(dir->i_sb, __func__,
-				"dir %lu size %lld exceeds block count %llu",
-				dir->i_ino, dir->i_size,
-				(unsigned long long)dir->i_blocks);
+			ext2_error(inode_sb(dir), __func__,
+				   "dir %lu size %lld exceeds block count %llu",
+				   dir->i_ino, dir->i_size,
+				   (unsigned long long)dir->i_blocks);
 			goto out;
 		}
 	} while (n != start);
@@ -524,8 +524,8 @@ int ext2_add_link (struct dentry *dentry, struct inode *inode)
 				goto got_it;
 			}
 			if (de->rec_len == 0) {
-				ext2_error(dir->i_sb, __func__,
-					"zero-length directory entry");
+				ext2_error(inode_sb(dir), __func__,
+					   "zero-length directory entry");
 				err = -EIO;
 				goto out_unlock;
 			}
@@ -594,8 +594,8 @@ int ext2_delete_entry (struct ext2_dir_entry_2 * dir, struct page * page )
 
 	while ((char*)de < (char*)dir) {
 		if (de->rec_len == 0) {
-			ext2_error(inode->i_sb, __func__,
-				"zero-length directory entry");
+			ext2_error(inode_sb(inode), __func__,
+				   "zero-length directory entry");
 			err = -EIO;
 			goto out;
 		}
@@ -686,8 +686,8 @@ int ext2_empty_dir (struct inode * inode)
 
 		while ((char *)de <= kaddr) {
 			if (de->rec_len == 0) {
-				ext2_error(inode->i_sb, __func__,
-					"zero-length directory entry");
+				ext2_error(inode_sb(inode), __func__,
+					   "zero-length directory entry");
 				printk("kaddr=%p, de=%p\n", kaddr, de);
 				goto not_empty;
 			}
diff --git a/fs/ext2/file.c b/fs/ext2/file.c
index 09640220fda8..b7279d6ad130 100644
--- a/fs/ext2/file.c
+++ b/fs/ext2/file.c
@@ -95,7 +95,7 @@ static int ext2_dax_fault(struct vm_fault *vmf)
 	int ret;
 
 	if (vmf->flags & FAULT_FLAG_WRITE) {
-		sb_start_pagefault(inode->i_sb);
+		sb_start_pagefault(inode_sb(inode));
 		file_update_time(vmf->vma->vm_file);
 	}
 	down_read(&ei->dax_sem);
@@ -104,7 +104,7 @@ static int ext2_dax_fault(struct vm_fault *vmf)
 
 	up_read(&ei->dax_sem);
 	if (vmf->flags & FAULT_FLAG_WRITE)
-		sb_end_pagefault(inode->i_sb);
+		sb_end_pagefault(inode_sb(inode));
 	return ret;
 }
 
@@ -151,7 +151,7 @@ static int ext2_release_file (struct inode * inode, struct file * filp)
 int ext2_fsync(struct file *file, loff_t start, loff_t end, int datasync)
 {
 	int ret;
-	struct super_block *sb = file->f_mapping->host->i_sb;
+	struct super_block *sb = inode_sb(file->f_mapping->host);
 
 	ret = generic_file_fsync(file, start, end, datasync);
 	if (ret == -EIO)
diff --git a/fs/ext2/ialloc.c b/fs/ext2/ialloc.c
index 6484199b35d1..549a0e7efec1 100644
--- a/fs/ext2/ialloc.c
+++ b/fs/ext2/ialloc.c
@@ -103,7 +103,7 @@ static void ext2_release_inode(struct super_block *sb, int group, int dir)
  */
 void ext2_free_inode (struct inode * inode)
 {
-	struct super_block * sb = inode->i_sb;
+	struct super_block * sb = inode_sb(inode);
 	int is_directory;
 	unsigned long ino;
 	struct buffer_head *bitmap_bh;
@@ -177,19 +177,19 @@ static void ext2_preread_inode(struct inode *inode)
 	if (bdi_write_congested(bdi))
 		return;
 
-	block_group = (inode->i_ino - 1) / EXT2_INODES_PER_GROUP(inode->i_sb);
-	gdp = ext2_get_group_desc(inode->i_sb, block_group, NULL);
+	block_group = (inode->i_ino - 1) / EXT2_INODES_PER_GROUP(inode_sb(inode));
+	gdp = ext2_get_group_desc(inode_sb(inode), block_group, NULL);
 	if (gdp == NULL)
 		return;
 
 	/*
 	 * Figure out the offset within the block group inode table
 	 */
-	offset = ((inode->i_ino - 1) % EXT2_INODES_PER_GROUP(inode->i_sb)) *
-				EXT2_INODE_SIZE(inode->i_sb);
+	offset = ((inode->i_ino - 1) % EXT2_INODES_PER_GROUP(inode_sb(inode))) *
+				EXT2_INODE_SIZE(inode_sb(inode));
 	block = le32_to_cpu(gdp->bg_inode_table) +
-				(offset >> EXT2_BLOCK_SIZE_BITS(inode->i_sb));
-	sb_breadahead(inode->i_sb, block);
+				(offset >> EXT2_BLOCK_SIZE_BITS(inode_sb(inode)));
+	sb_breadahead(inode_sb(inode), block);
 }
 
 /*
@@ -443,7 +443,7 @@ struct inode *ext2_new_inode(struct inode *dir, umode_t mode,
 	struct ext2_sb_info *sbi;
 	int err;
 
-	sb = dir->i_sb;
+	sb = inode_sb(dir);
 	inode = new_inode(sb);
 	if (!inode)
 		return ERR_PTR(-ENOMEM);
diff --git a/fs/ext2/inode.c b/fs/ext2/inode.c
index 9b2ac55ac34f..47b7129f2db7 100644
--- a/fs/ext2/inode.c
+++ b/fs/ext2/inode.c
@@ -48,7 +48,7 @@ static int __ext2_write_inode(struct inode *inode, int do_sync);
 static inline int ext2_inode_is_fast_symlink(struct inode *inode)
 {
 	int ea_blocks = EXT2_I(inode)->i_file_acl ?
-		(inode->i_sb->s_blocksize >> 9) : 0;
+		(inode_sb(inode)->s_blocksize >> 9) : 0;
 
 	return (S_ISLNK(inode->i_mode) &&
 		inode->i_blocks - ea_blocks == 0);
@@ -84,7 +84,7 @@ void ext2_evict_inode(struct inode * inode)
 	truncate_inode_pages_final(&inode->i_data);
 
 	if (want_delete) {
-		sb_start_intwrite(inode->i_sb);
+		sb_start_intwrite(inode_sb(inode));
 		/* set dtime */
 		EXT2_I(inode)->i_dtime	= get_seconds();
 		mark_inode_dirty(inode);
@@ -107,7 +107,7 @@ void ext2_evict_inode(struct inode * inode)
 
 	if (want_delete) {
 		ext2_free_inode(inode);
-		sb_end_intwrite(inode->i_sb);
+		sb_end_intwrite(inode_sb(inode));
 	}
 }
 
@@ -147,7 +147,7 @@ static inline int verify_chain(Indirect *from, Indirect *to)
  *
  *	Note: function doesn't find node addresses, so no IO is needed. All
  *	we need to know is the capacity of indirect blocks (taken from the
- *	inode->i_sb).
+ *	inode_sb(inode)).
  */
 
 /*
@@ -163,8 +163,8 @@ static inline int verify_chain(Indirect *from, Indirect *to)
 static int ext2_block_to_path(struct inode *inode,
 			long i_block, int offsets[4], int *boundary)
 {
-	int ptrs = EXT2_ADDR_PER_BLOCK(inode->i_sb);
-	int ptrs_bits = EXT2_ADDR_PER_BLOCK_BITS(inode->i_sb);
+	int ptrs = EXT2_ADDR_PER_BLOCK(inode_sb(inode));
+	int ptrs_bits = EXT2_ADDR_PER_BLOCK_BITS(inode_sb(inode));
 	const long direct_blocks = EXT2_NDIR_BLOCKS,
 		indirect_blocks = ptrs,
 		double_blocks = (1 << (ptrs_bits * 2));
@@ -172,8 +172,8 @@ static int ext2_block_to_path(struct inode *inode,
 	int final = 0;
 
 	if (i_block < 0) {
-		ext2_msg(inode->i_sb, KERN_WARNING,
-			"warning: %s: block < 0", __func__);
+		ext2_msg(inode_sb(inode), KERN_WARNING,
+			 "warning: %s: block < 0", __func__);
 	} else if (i_block < direct_blocks) {
 		offsets[n++] = i_block;
 		final = direct_blocks;
@@ -193,8 +193,8 @@ static int ext2_block_to_path(struct inode *inode,
 		offsets[n++] = i_block & (ptrs - 1);
 		final = ptrs;
 	} else {
-		ext2_msg(inode->i_sb, KERN_WARNING,
-			"warning: %s: block is too big", __func__);
+		ext2_msg(inode_sb(inode), KERN_WARNING,
+			 "warning: %s: block is too big", __func__);
 	}
 	if (boundary)
 		*boundary = final - 1 - (i_block & (ptrs - 1));
@@ -237,7 +237,7 @@ static Indirect *ext2_get_branch(struct inode *inode,
 				 Indirect chain[4],
 				 int *err)
 {
-	struct super_block *sb = inode->i_sb;
+	struct super_block *sb = inode_sb(inode);
 	Indirect *p = chain;
 	struct buffer_head *bh;
 
@@ -312,9 +312,10 @@ static ext2_fsblk_t ext2_find_near(struct inode *inode, Indirect *ind)
 	 * It is going to be referred from inode itself? OK, just put it into
 	 * the same cylinder group then.
 	 */
-	bg_start = ext2_group_first_block_no(inode->i_sb, ei->i_block_group);
+	bg_start = ext2_group_first_block_no(inode_sb(inode),
+					     ei->i_block_group);
 	colour = (current->pid % 16) *
-			(EXT2_BLOCKS_PER_GROUP(inode->i_sb) / 16);
+			(EXT2_BLOCKS_PER_GROUP(inode_sb(inode)) / 16);
 	return bg_start + colour;
 }
 
@@ -477,7 +478,7 @@ static int ext2_alloc_branch(struct inode *inode,
 			int indirect_blks, int *blks, ext2_fsblk_t goal,
 			int *offsets, Indirect *branch)
 {
-	int blocksize = inode->i_sb->s_blocksize;
+	int blocksize = inode_sb(inode)->s_blocksize;
 	int i, n = 0;
 	int err = 0;
 	struct buffer_head *bh;
@@ -500,7 +501,7 @@ static int ext2_alloc_branch(struct inode *inode,
 		 * and set the pointer to new one, then send
 		 * parent to disk.
 		 */
-		bh = sb_getblk(inode->i_sb, new_blocks[n-1]);
+		bh = sb_getblk(inode_sb(inode), new_blocks[n-1]);
 		if (unlikely(!bh)) {
 			err = -ENOMEM;
 			goto failed;
@@ -738,7 +739,7 @@ static int ext2_get_blocks(struct inode *inode,
 		 * We must unmap blocks before zeroing so that writeback cannot
 		 * overwrite zeros with stale data from block device page cache.
 		 */
-		clean_bdev_aliases(inode->i_sb->s_bdev,
+		clean_bdev_aliases(inode_sb(inode)->s_bdev,
 				   le32_to_cpu(chain[depth-1].key),
 				   count);
 		/*
@@ -746,9 +747,9 @@ static int ext2_get_blocks(struct inode *inode,
 		 * so that it's not found by another thread before it's
 		 * initialised
 		 */
-		err = sb_issue_zeroout(inode->i_sb,
-				le32_to_cpu(chain[depth-1].key), count,
-				GFP_NOFS);
+		err = sb_issue_zeroout(inode_sb(inode),
+				       le32_to_cpu(chain[depth-1].key), count,
+				       GFP_NOFS);
 		if (err) {
 			mutex_unlock(&ei->truncate_mutex);
 			goto cleanup;
@@ -787,7 +788,7 @@ int ext2_get_block(struct inode *inode, sector_t iblock,
 	if (ret <= 0)
 		return ret;
 
-	map_bh(bh_result, inode->i_sb, bno);
+	map_bh(bh_result, inode_sb(inode), bno);
 	bh_result->b_size = (ret << inode->i_blkbits);
 	if (new)
 		set_buffer_new(bh_result);
@@ -804,7 +805,7 @@ static int ext2_iomap_begin(struct inode *inode, loff_t offset, loff_t length,
 	unsigned int blkbits = inode->i_blkbits;
 	unsigned long first_block = offset >> blkbits;
 	unsigned long max_blocks = (length + (1 << blkbits) - 1) >> blkbits;
-	struct ext2_sb_info *sbi = EXT2_SB(inode->i_sb);
+	struct ext2_sb_info *sbi = EXT2_SB(inode_sb(inode));
 	bool new = false, boundary = false;
 	u32 bno;
 	int ret;
@@ -815,7 +816,7 @@ static int ext2_iomap_begin(struct inode *inode, loff_t offset, loff_t length,
 		return ret;
 
 	iomap->flags = 0;
-	iomap->bdev = inode->i_sb->s_bdev;
+	iomap->bdev = inode_sb(inode)->s_bdev;
 	iomap->offset = (u64)first_block << blkbits;
 	iomap->dax_dev = sbi->s_daxdev;
 
@@ -955,7 +956,7 @@ ext2_writepages(struct address_space *mapping, struct writeback_control *wbc)
 #ifdef CONFIG_FS_DAX
 	if (dax_mapping(mapping)) {
 		return dax_writeback_mapping_range(mapping,
-						   mapping->host->i_sb->s_bdev,
+						   inode_sb(mapping->host)->s_bdev,
 						   wbc);
 	}
 #endif
@@ -1142,21 +1143,22 @@ static void ext2_free_branches(struct inode *inode, __le32 *p, __le32 *q, int de
 	unsigned long nr;
 
 	if (depth--) {
-		int addr_per_block = EXT2_ADDR_PER_BLOCK(inode->i_sb);
+		int addr_per_block = EXT2_ADDR_PER_BLOCK(inode_sb(inode));
 		for ( ; p < q ; p++) {
 			nr = le32_to_cpu(*p);
 			if (!nr)
 				continue;
 			*p = 0;
-			bh = sb_bread(inode->i_sb, nr);
+			bh = sb_bread(inode_sb(inode), nr);
 			/*
 			 * A read failure? Report error and clear slot
 			 * (should be rare).
 			 */ 
 			if (!bh) {
-				ext2_error(inode->i_sb, "ext2_free_branches",
-					"Read failure, inode=%ld, block=%ld",
-					inode->i_ino, nr);
+				ext2_error(inode_sb(inode),
+				           "ext2_free_branches",
+				           "Read failure, inode=%ld, block=%ld",
+				           inode->i_ino, nr);
 				continue;
 			}
 			ext2_free_branches(inode,
@@ -1176,7 +1178,7 @@ static void __ext2_truncate_blocks(struct inode *inode, loff_t offset)
 {
 	__le32 *i_data = EXT2_I(inode)->i_data;
 	struct ext2_inode_info *ei = EXT2_I(inode);
-	int addr_per_block = EXT2_ADDR_PER_BLOCK(inode->i_sb);
+	int addr_per_block = EXT2_ADDR_PER_BLOCK(inode_sb(inode));
 	int offsets[4];
 	Indirect chain[4];
 	Indirect *partial;
@@ -1184,8 +1186,8 @@ static void __ext2_truncate_blocks(struct inode *inode, loff_t offset)
 	int n;
 	long iblock;
 	unsigned blocksize;
-	blocksize = inode->i_sb->s_blocksize;
-	iblock = (offset + blocksize-1) >> EXT2_BLOCK_SIZE_BITS(inode->i_sb);
+	blocksize = inode_sb(inode)->s_blocksize;
+	iblock = (offset + blocksize-1) >> EXT2_BLOCK_SIZE_BITS(inode_sb(inode));
 
 #ifdef CONFIG_FS_DAX
 	WARN_ON(!rwsem_is_locked(&ei->dax_sem));
@@ -1300,7 +1302,7 @@ static int ext2_setsize(struct inode *inode, loff_t newsize)
 		error = iomap_zero_range(inode, newsize,
 					 PAGE_ALIGN(newsize) - newsize, NULL,
 					 &ext2_iomap_ops);
-	} else if (test_opt(inode->i_sb, NOBH))
+	} else if (test_opt(inode_sb(inode), NOBH))
 		error = nobh_truncate_page(inode->i_mapping,
 				newsize, ext2_get_block);
 	else
@@ -1384,7 +1386,7 @@ void ext2_set_inode_flags(struct inode *inode)
 		inode->i_flags |= S_NOATIME;
 	if (flags & EXT2_DIRSYNC_FL)
 		inode->i_flags |= S_DIRSYNC;
-	if (test_opt(inode->i_sb, DAX) && S_ISREG(inode->i_mode))
+	if (test_opt(inode_sb(inode), DAX) && S_ISREG(inode->i_mode))
 		inode->i_flags |= S_DAX;
 }
 
@@ -1408,7 +1410,7 @@ struct inode *ext2_iget (struct super_block *sb, unsigned long ino)
 	ei = EXT2_I(inode);
 	ei->i_block_alloc_info = NULL;
 
-	raw_inode = ext2_get_inode(inode->i_sb, ino, &bh);
+	raw_inode = ext2_get_inode(inode_sb(inode), ino, &bh);
 	if (IS_ERR(raw_inode)) {
 		ret = PTR_ERR(raw_inode);
  		goto bad_inode;
@@ -1417,7 +1419,7 @@ struct inode *ext2_iget (struct super_block *sb, unsigned long ino)
 	inode->i_mode = le16_to_cpu(raw_inode->i_mode);
 	i_uid = (uid_t)le16_to_cpu(raw_inode->i_uid_low);
 	i_gid = (gid_t)le16_to_cpu(raw_inode->i_gid_low);
-	if (!(test_opt (inode->i_sb, NO_UID32))) {
+	if (!(test_opt (inode_sb(inode), NO_UID32))) {
 		i_uid |= le16_to_cpu(raw_inode->i_uid_high) << 16;
 		i_gid |= le16_to_cpu(raw_inode->i_gid_high) << 16;
 	}
@@ -1469,7 +1471,7 @@ struct inode *ext2_iget (struct super_block *sb, unsigned long ino)
 	ei->i_dtime = 0;
 	inode->i_generation = le32_to_cpu(raw_inode->i_generation);
 	ei->i_state = 0;
-	ei->i_block_group = (ino - 1) / EXT2_INODES_PER_GROUP(inode->i_sb);
+	ei->i_block_group = (ino - 1) / EXT2_INODES_PER_GROUP(inode_sb(inode));
 	ei->i_dir_start_lookup = 0;
 
 	/*
@@ -1481,7 +1483,7 @@ struct inode *ext2_iget (struct super_block *sb, unsigned long ino)
 
 	if (S_ISREG(inode->i_mode)) {
 		inode->i_op = &ext2_file_inode_operations;
-		if (test_opt(inode->i_sb, NOBH)) {
+		if (test_opt(inode_sb(inode), NOBH)) {
 			inode->i_mapping->a_ops = &ext2_nobh_aops;
 			inode->i_fop = &ext2_file_operations;
 		} else {
@@ -1491,7 +1493,7 @@ struct inode *ext2_iget (struct super_block *sb, unsigned long ino)
 	} else if (S_ISDIR(inode->i_mode)) {
 		inode->i_op = &ext2_dir_inode_operations;
 		inode->i_fop = &ext2_dir_operations;
-		if (test_opt(inode->i_sb, NOBH))
+		if (test_opt(inode_sb(inode), NOBH))
 			inode->i_mapping->a_ops = &ext2_nobh_aops;
 		else
 			inode->i_mapping->a_ops = &ext2_aops;
@@ -1504,7 +1506,7 @@ struct inode *ext2_iget (struct super_block *sb, unsigned long ino)
 		} else {
 			inode->i_op = &ext2_symlink_inode_operations;
 			inode_nohighmem(inode);
-			if (test_opt(inode->i_sb, NOBH))
+			if (test_opt(inode_sb(inode), NOBH))
 				inode->i_mapping->a_ops = &ext2_nobh_aops;
 			else
 				inode->i_mapping->a_ops = &ext2_aops;
@@ -1531,7 +1533,7 @@ struct inode *ext2_iget (struct super_block *sb, unsigned long ino)
 static int __ext2_write_inode(struct inode *inode, int do_sync)
 {
 	struct ext2_inode_info *ei = EXT2_I(inode);
-	struct super_block *sb = inode->i_sb;
+	struct super_block *sb = inode_sb(inode);
 	ino_t ino = inode->i_ino;
 	uid_t uid = i_uid_read(inode);
 	gid_t gid = i_gid_read(inode);
diff --git a/fs/ext2/ioctl.c b/fs/ext2/ioctl.c
index 0367c0039e68..d927a865d13e 100644
--- a/fs/ext2/ioctl.c
+++ b/fs/ext2/ioctl.c
@@ -113,7 +113,7 @@ long ext2_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
 		return ret;
 	}
 	case EXT2_IOC_GETRSVSZ:
-		if (test_opt(inode->i_sb, RESERVATION)
+		if (test_opt(inode_sb(inode), RESERVATION)
 			&& S_ISREG(inode->i_mode)
 			&& ei->i_block_alloc_info) {
 			rsv_window_size = ei->i_block_alloc_info->rsv_window_node.rsv_goal_size;
@@ -122,7 +122,7 @@ long ext2_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
 		return -ENOTTY;
 	case EXT2_IOC_SETRSVSZ: {
 
-		if (!test_opt(inode->i_sb, RESERVATION) ||!S_ISREG(inode->i_mode))
+		if (!test_opt(inode_sb(inode), RESERVATION) ||!S_ISREG(inode->i_mode))
 			return -ENOTTY;
 
 		if (!inode_owner_or_capable(inode))
diff --git a/fs/ext2/namei.c b/fs/ext2/namei.c
index e078075dc66f..2e5f7d3d371b 100644
--- a/fs/ext2/namei.c
+++ b/fs/ext2/namei.c
@@ -66,9 +66,9 @@ static struct dentry *ext2_lookup(struct inode * dir, struct dentry *dentry, uns
 	ino = ext2_inode_by_name(dir, &dentry->d_name);
 	inode = NULL;
 	if (ino) {
-		inode = ext2_iget(dir->i_sb, ino);
+		inode = ext2_iget(inode_sb(dir), ino);
 		if (inode == ERR_PTR(-ESTALE)) {
-			ext2_error(dir->i_sb, __func__,
+			ext2_error(inode_sb(dir), __func__,
 					"deleted inode referenced: %lu",
 					(unsigned long) ino);
 			return ERR_PTR(-EIO);
@@ -108,7 +108,7 @@ static int ext2_create (struct inode * dir, struct dentry * dentry, umode_t mode
 		return PTR_ERR(inode);
 
 	inode->i_op = &ext2_file_inode_operations;
-	if (test_opt(inode->i_sb, NOBH)) {
+	if (test_opt(inode_sb(inode), NOBH)) {
 		inode->i_mapping->a_ops = &ext2_nobh_aops;
 		inode->i_fop = &ext2_file_operations;
 	} else {
@@ -126,7 +126,7 @@ static int ext2_tmpfile(struct inode *dir, struct dentry *dentry, umode_t mode)
 		return PTR_ERR(inode);
 
 	inode->i_op = &ext2_file_inode_operations;
-	if (test_opt(inode->i_sb, NOBH)) {
+	if (test_opt(inode_sb(inode), NOBH)) {
 		inode->i_mapping->a_ops = &ext2_nobh_aops;
 		inode->i_fop = &ext2_file_operations;
 	} else {
@@ -164,7 +164,7 @@ static int ext2_mknod (struct inode * dir, struct dentry *dentry, umode_t mode,
 static int ext2_symlink (struct inode * dir, struct dentry * dentry,
 	const char * symname)
 {
-	struct super_block * sb = dir->i_sb;
+	struct super_block * sb = inode_sb(dir);
 	int err = -ENAMETOOLONG;
 	unsigned l = strlen(symname)+1;
 	struct inode * inode;
@@ -185,7 +185,7 @@ static int ext2_symlink (struct inode * dir, struct dentry * dentry,
 		/* slow symlink */
 		inode->i_op = &ext2_symlink_inode_operations;
 		inode_nohighmem(inode);
-		if (test_opt(inode->i_sb, NOBH))
+		if (test_opt(inode_sb(inode), NOBH))
 			inode->i_mapping->a_ops = &ext2_nobh_aops;
 		else
 			inode->i_mapping->a_ops = &ext2_aops;
@@ -254,7 +254,7 @@ static int ext2_mkdir(struct inode * dir, struct dentry * dentry, umode_t mode)
 
 	inode->i_op = &ext2_dir_inode_operations;
 	inode->i_fop = &ext2_dir_operations;
-	if (test_opt(inode->i_sb, NOBH))
+	if (test_opt(inode_sb(inode), NOBH))
 		inode->i_mapping->a_ops = &ext2_nobh_aops;
 	else
 		inode->i_mapping->a_ops = &ext2_aops;
diff --git a/fs/ext2/xattr.c b/fs/ext2/xattr.c
index 62d9a659a8ff..613cfcae7b48 100644
--- a/fs/ext2/xattr.c
+++ b/fs/ext2/xattr.c
@@ -73,7 +73,8 @@
 #ifdef EXT2_XATTR_DEBUG
 # define ea_idebug(inode, f...) do { \
 		printk(KERN_DEBUG "inode %s:%ld: ", \
-			inode->i_sb->s_id, inode->i_ino); \
+			inode_sb(inode)->s_id,
+		       inode->i_ino); \
 		printk(f); \
 		printk("\n"); \
 	} while (0)
@@ -122,7 +123,7 @@ const struct xattr_handler *ext2_xattr_handlers[] = {
 	NULL
 };
 
-#define EA_BLOCK_CACHE(inode)	(EXT2_SB(inode->i_sb)->s_ea_block_cache)
+#define EA_BLOCK_CACHE(inode)	(EXT2_SB(inode_sb(inode))->s_ea_block_cache)
 
 static inline const struct xattr_handler *
 ext2_xattr_handler(int name_index)
@@ -169,7 +170,7 @@ ext2_xattr_get(struct inode *inode, int name_index, const char *name,
 	if (!EXT2_I(inode)->i_file_acl)
 		goto cleanup;
 	ea_idebug(inode, "reading block %d", EXT2_I(inode)->i_file_acl);
-	bh = sb_bread(inode->i_sb, EXT2_I(inode)->i_file_acl);
+	bh = sb_bread(inode_sb(inode), EXT2_I(inode)->i_file_acl);
 	error = -EIO;
 	if (!bh)
 		goto cleanup;
@@ -178,9 +179,9 @@ ext2_xattr_get(struct inode *inode, int name_index, const char *name,
 	end = bh->b_data + bh->b_size;
 	if (HDR(bh)->h_magic != cpu_to_le32(EXT2_XATTR_MAGIC) ||
 	    HDR(bh)->h_blocks != cpu_to_le32(1)) {
-bad_block:	ext2_error(inode->i_sb, "ext2_xattr_get",
-			"inode %ld: bad block %d", inode->i_ino,
-			EXT2_I(inode)->i_file_acl);
+bad_block:	ext2_error(inode_sb(inode), "ext2_xattr_get",
+			     "inode %ld: bad block %d", inode->i_ino,
+			     EXT2_I(inode)->i_file_acl);
 		error = -EIO;
 		goto cleanup;
 	}
@@ -207,8 +208,8 @@ bad_block:	ext2_error(inode->i_sb, "ext2_xattr_get",
 	if (entry->e_value_block != 0)
 		goto bad_block;
 	size = le32_to_cpu(entry->e_value_size);
-	if (size > inode->i_sb->s_blocksize ||
-	    le16_to_cpu(entry->e_value_offs) + size > inode->i_sb->s_blocksize)
+	if (size > inode_sb(inode)->s_blocksize ||
+	    le16_to_cpu(entry->e_value_offs) + size > inode_sb(inode)->s_blocksize)
 		goto bad_block;
 
 	if (ext2_xattr_cache_insert(ea_block_cache, bh))
@@ -259,7 +260,7 @@ ext2_xattr_list(struct dentry *dentry, char *buffer, size_t buffer_size)
 	if (!EXT2_I(inode)->i_file_acl)
 		goto cleanup;
 	ea_idebug(inode, "reading block %d", EXT2_I(inode)->i_file_acl);
-	bh = sb_bread(inode->i_sb, EXT2_I(inode)->i_file_acl);
+	bh = sb_bread(inode_sb(inode), EXT2_I(inode)->i_file_acl);
 	error = -EIO;
 	if (!bh)
 		goto cleanup;
@@ -268,9 +269,9 @@ ext2_xattr_list(struct dentry *dentry, char *buffer, size_t buffer_size)
 	end = bh->b_data + bh->b_size;
 	if (HDR(bh)->h_magic != cpu_to_le32(EXT2_XATTR_MAGIC) ||
 	    HDR(bh)->h_blocks != cpu_to_le32(1)) {
-bad_block:	ext2_error(inode->i_sb, "ext2_xattr_list",
-			"inode %ld: bad block %d", inode->i_ino,
-			EXT2_I(inode)->i_file_acl);
+bad_block:	ext2_error(inode_sb(inode), "ext2_xattr_list",
+			     "inode %ld: bad block %d", inode->i_ino,
+			     EXT2_I(inode)->i_file_acl);
 		error = -EIO;
 		goto cleanup;
 	}
@@ -363,7 +364,7 @@ int
 ext2_xattr_set(struct inode *inode, int name_index, const char *name,
 	       const void *value, size_t value_len, int flags)
 {
-	struct super_block *sb = inode->i_sb;
+	struct super_block *sb = inode_sb(inode);
 	struct buffer_head *bh = NULL;
 	struct ext2_xattr_header *header = NULL;
 	struct ext2_xattr_entry *here, *last;
@@ -627,7 +628,7 @@ static int
 ext2_xattr_set2(struct inode *inode, struct buffer_head *old_bh,
 		struct ext2_xattr_header *header)
 {
-	struct super_block *sb = inode->i_sb;
+	struct super_block *sb = inode_sb(inode);
 	struct buffer_head *new_bh = NULL;
 	int error;
 	struct mb_cache *ea_block_cache = EA_BLOCK_CACHE(inode);
@@ -762,32 +763,32 @@ void
 ext2_xattr_delete_inode(struct inode *inode)
 {
 	struct buffer_head *bh = NULL;
-	struct ext2_sb_info *sbi = EXT2_SB(inode->i_sb);
+	struct ext2_sb_info *sbi = EXT2_SB(inode_sb(inode));
 
 	down_write(&EXT2_I(inode)->xattr_sem);
 	if (!EXT2_I(inode)->i_file_acl)
 		goto cleanup;
 
 	if (!ext2_data_block_valid(sbi, EXT2_I(inode)->i_file_acl, 0)) {
-		ext2_error(inode->i_sb, "ext2_xattr_delete_inode",
-			"inode %ld: xattr block %d is out of data blocks range",
-			inode->i_ino, EXT2_I(inode)->i_file_acl);
+		ext2_error(inode_sb(inode), "ext2_xattr_delete_inode",
+			   "inode %ld: xattr block %d is out of data blocks range",
+			   inode->i_ino, EXT2_I(inode)->i_file_acl);
 		goto cleanup;
 	}
 
-	bh = sb_bread(inode->i_sb, EXT2_I(inode)->i_file_acl);
+	bh = sb_bread(inode_sb(inode), EXT2_I(inode)->i_file_acl);
 	if (!bh) {
-		ext2_error(inode->i_sb, "ext2_xattr_delete_inode",
-			"inode %ld: block %d read error", inode->i_ino,
-			EXT2_I(inode)->i_file_acl);
+		ext2_error(inode_sb(inode), "ext2_xattr_delete_inode",
+			   "inode %ld: block %d read error", inode->i_ino,
+			   EXT2_I(inode)->i_file_acl);
 		goto cleanup;
 	}
 	ea_bdebug(bh, "b_count=%d", atomic_read(&(bh->b_count)));
 	if (HDR(bh)->h_magic != cpu_to_le32(EXT2_XATTR_MAGIC) ||
 	    HDR(bh)->h_blocks != cpu_to_le32(1)) {
-		ext2_error(inode->i_sb, "ext2_xattr_delete_inode",
-			"inode %ld: bad block %d", inode->i_ino,
-			EXT2_I(inode)->i_file_acl);
+		ext2_error(inode_sb(inode), "ext2_xattr_delete_inode",
+			   "inode %ld: bad block %d", inode->i_ino,
+			   EXT2_I(inode)->i_file_acl);
 		goto cleanup;
 	}
 	lock_buffer(bh);
@@ -910,11 +911,11 @@ ext2_xattr_cache_find(struct inode *inode, struct ext2_xattr_header *header)
 	while (ce) {
 		struct buffer_head *bh;
 
-		bh = sb_bread(inode->i_sb, ce->e_value);
+		bh = sb_bread(inode_sb(inode), ce->e_value);
 		if (!bh) {
-			ext2_error(inode->i_sb, "ext2_xattr_cache_find",
-				"inode %ld: block %ld read error",
-				inode->i_ino, (unsigned long) ce->e_value);
+			ext2_error(inode_sb(inode), "ext2_xattr_cache_find",
+				   "inode %ld: block %ld read error",
+				   inode->i_ino, (unsigned long) ce->e_value);
 		} else {
 			lock_buffer(bh);
 			/*
diff --git a/fs/ext2/xattr_user.c b/fs/ext2/xattr_user.c
index c243a3b4d69d..e2ca8f4829b1 100644
--- a/fs/ext2/xattr_user.c
+++ b/fs/ext2/xattr_user.c
@@ -22,7 +22,7 @@ ext2_xattr_user_get(const struct xattr_handler *handler,
 		    struct dentry *unused, struct inode *inode,
 		    const char *name, void *buffer, size_t size)
 {
-	if (!test_opt(inode->i_sb, XATTR_USER))
+	if (!test_opt(inode_sb(inode), XATTR_USER))
 		return -EOPNOTSUPP;
 	return ext2_xattr_get(inode, EXT2_XATTR_INDEX_USER,
 			      name, buffer, size);
@@ -34,7 +34,7 @@ ext2_xattr_user_set(const struct xattr_handler *handler,
 		    const char *name, const void *value,
 		    size_t size, int flags)
 {
-	if (!test_opt(inode->i_sb, XATTR_USER))
+	if (!test_opt(inode_sb(inode), XATTR_USER))
 		return -EOPNOTSUPP;
 
 	return ext2_xattr_set(inode, EXT2_XATTR_INDEX_USER,
-- 
2.15.1

^ permalink raw reply related	[flat|nested] 88+ messages in thread

* [PATCH 31/76] fs/ext4: Use inode_sb() helper instead of inode->i_sb
  2018-05-08 18:03 [RFC][PATCH 0/76] vfs: 'views' for filesystems with more than one root Mark Fasheh
                   ` (29 preceding siblings ...)
  2018-05-08 18:03 ` [PATCH 30/76] fs/ext2: " Mark Fasheh
@ 2018-05-08 18:03 ` Mark Fasheh
  2018-05-08 18:03 ` [PATCH 32/76] fs/f2fs: " Mark Fasheh
                   ` (45 subsequent siblings)
  76 siblings, 0 replies; 88+ messages in thread
From: Mark Fasheh @ 2018-05-08 18:03 UTC (permalink / raw)
  To: linux-fsdevel; +Cc: linux-kernel, linux-btrfs, Mark Fasheh

Signed-off-by: Mark Fasheh <mfasheh@suse.de>
---
 fs/ext4/acl.c            |   2 +-
 fs/ext4/balloc.c         |  14 +--
 fs/ext4/block_validity.c |   4 +-
 fs/ext4/dir.c            |  12 +-
 fs/ext4/ext4.h           |   8 +-
 fs/ext4/ext4_jbd2.c      |  10 +-
 fs/ext4/ext4_jbd2.h      |  14 +--
 fs/ext4/extents.c        | 107 ++++++++---------
 fs/ext4/extents_status.c |  23 ++--
 fs/ext4/file.c           |  22 ++--
 fs/ext4/fsync.c          |  15 +--
 fs/ext4/ialloc.c         |   7 +-
 fs/ext4/indirect.c       |  53 ++++-----
 fs/ext4/inline.c         |  53 ++++-----
 fs/ext4/inode.c          | 295 ++++++++++++++++++++++++-----------------------
 fs/ext4/ioctl.c          |  24 ++--
 fs/ext4/mballoc.c        |  13 ++-
 fs/ext4/migrate.c        |  44 +++----
 fs/ext4/move_extent.c    |  10 +-
 fs/ext4/namei.c          | 224 +++++++++++++++++------------------
 fs/ext4/page-io.c        |   9 +-
 fs/ext4/readpage.c       |   2 +-
 fs/ext4/resize.c         |   4 +-
 fs/ext4/super.c          |  52 +++++----
 fs/ext4/symlink.c        |   2 +-
 fs/ext4/sysfs.c          |   4 +-
 fs/ext4/truncate.h       |   4 +-
 fs/ext4/xattr.c          | 120 ++++++++++---------
 fs/ext4/xattr_user.c     |   4 +-
 29 files changed, 591 insertions(+), 564 deletions(-)

diff --git a/fs/ext4/acl.c b/fs/ext4/acl.c
index fb50f9aa6ead..651d49de6039 100644
--- a/fs/ext4/acl.c
+++ b/fs/ext4/acl.c
@@ -259,7 +259,7 @@ ext4_set_acl(struct inode *inode, struct posix_acl *acl, int type)
 	}
 out_stop:
 	ext4_journal_stop(handle);
-	if (error == -ENOSPC && ext4_should_retry_alloc(inode->i_sb, &retries))
+	if (error == -ENOSPC && ext4_should_retry_alloc(inode_sb(inode), &retries))
 		goto retry;
 	return error;
 }
diff --git a/fs/ext4/balloc.c b/fs/ext4/balloc.c
index f9b3e0a83526..7ea1ed70bdfe 100644
--- a/fs/ext4/balloc.c
+++ b/fs/ext4/balloc.c
@@ -654,7 +654,7 @@ ext4_fsblk_t ext4_new_meta_blocks(handle_t *handle, struct inode *inode,
 	 */
 	if (!(*errp) && (flags & EXT4_MB_DELALLOC_RESERVED)) {
 		dquot_alloc_block_nofail(inode,
-				EXT4_C2B(EXT4_SB(inode->i_sb), ar.len));
+				EXT4_C2B(EXT4_SB(inode_sb(inode)), ar.len));
 	}
 	return ret;
 }
@@ -855,7 +855,7 @@ ext4_fsblk_t ext4_inode_to_goal_block(struct inode *inode)
 	struct ext4_inode_info *ei = EXT4_I(inode);
 	ext4_group_t block_group;
 	ext4_grpblk_t colour;
-	int flex_size = ext4_flex_bg_size(EXT4_SB(inode->i_sb));
+	int flex_size = ext4_flex_bg_size(EXT4_SB(inode_sb(inode)));
 	ext4_fsblk_t bg_start;
 	ext4_fsblk_t last_block;
 
@@ -873,19 +873,19 @@ ext4_fsblk_t ext4_inode_to_goal_block(struct inode *inode)
 		if (S_ISREG(inode->i_mode))
 			block_group++;
 	}
-	bg_start = ext4_group_first_block_no(inode->i_sb, block_group);
-	last_block = ext4_blocks_count(EXT4_SB(inode->i_sb)->s_es) - 1;
+	bg_start = ext4_group_first_block_no(inode_sb(inode), block_group);
+	last_block = ext4_blocks_count(EXT4_SB(inode_sb(inode))->s_es) - 1;
 
 	/*
 	 * If we are doing delayed allocation, we don't need take
 	 * colour into account.
 	 */
-	if (test_opt(inode->i_sb, DELALLOC))
+	if (test_opt(inode_sb(inode), DELALLOC))
 		return bg_start;
 
-	if (bg_start + EXT4_BLOCKS_PER_GROUP(inode->i_sb) <= last_block)
+	if (bg_start + EXT4_BLOCKS_PER_GROUP(inode_sb(inode)) <= last_block)
 		colour = (current->pid % 16) *
-			(EXT4_BLOCKS_PER_GROUP(inode->i_sb) / 16);
+			(EXT4_BLOCKS_PER_GROUP(inode_sb(inode)) / 16);
 	else
 		colour = (current->pid % 16) * ((last_block - bg_start) / 16);
 	return bg_start + colour;
diff --git a/fs/ext4/block_validity.c b/fs/ext4/block_validity.c
index 913061c0de1b..4ff7e6e93b18 100644
--- a/fs/ext4/block_validity.c
+++ b/fs/ext4/block_validity.c
@@ -223,14 +223,14 @@ int ext4_data_block_valid(struct ext4_sb_info *sbi, ext4_fsblk_t start_blk,
 int ext4_check_blockref(const char *function, unsigned int line,
 			struct inode *inode, __le32 *p, unsigned int max)
 {
-	struct ext4_super_block *es = EXT4_SB(inode->i_sb)->s_es;
+	struct ext4_super_block *es = EXT4_SB(inode_sb(inode))->s_es;
 	__le32 *bref = p;
 	unsigned int blk;
 
 	while (bref < p+max) {
 		blk = le32_to_cpu(*bref++);
 		if (blk &&
-		    unlikely(!ext4_data_block_valid(EXT4_SB(inode->i_sb),
+		    unlikely(!ext4_data_block_valid(EXT4_SB(inode_sb(inode)),
 						    blk, 1))) {
 			es->s_last_error_block = cpu_to_le64(blk);
 			ext4_error_inode(inode, function, line, blk,
diff --git a/fs/ext4/dir.c b/fs/ext4/dir.c
index da87cf757f7d..78097b522abd 100644
--- a/fs/ext4/dir.c
+++ b/fs/ext4/dir.c
@@ -40,9 +40,9 @@ static int ext4_dx_readdir(struct file *, struct dir_context *);
  */
 static int is_dx_dir(struct inode *inode)
 {
-	struct super_block *sb = inode->i_sb;
+	struct super_block *sb = inode_sb(inode);
 
-	if (ext4_has_feature_dir_index(inode->i_sb) &&
+	if (ext4_has_feature_dir_index(inode_sb(inode)) &&
 	    ((ext4_test_inode_flag(inode, EXT4_INODE_INDEX)) ||
 	     ((inode->i_size >> sb->s_blocksize_bits) == 1) ||
 	     ext4_has_inline_data(inode)))
@@ -67,7 +67,7 @@ int __ext4_check_dir_entry(const char *function, unsigned int line,
 {
 	const char *error_msg = NULL;
 	const int rlen = ext4_rec_len_from_disk(de->rec_len,
-						dir->i_sb->s_blocksize);
+						inode_sb(dir)->s_blocksize);
 
 	if (unlikely(rlen < EXT4_DIR_REC_LEN(1)))
 		error_msg = "rec_len is smaller than minimal";
@@ -78,7 +78,7 @@ int __ext4_check_dir_entry(const char *function, unsigned int line,
 	else if (unlikely(((char *) de - buf) + rlen > size))
 		error_msg = "directory entry across range";
 	else if (unlikely(le32_to_cpu(de->inode) >
-			le32_to_cpu(EXT4_SB(dir->i_sb)->s_es->s_inodes_count)))
+			le32_to_cpu(EXT4_SB(inode_sb(dir))->s_es->s_inodes_count)))
 		error_msg = "inode out of bounds";
 	else
 		return 0;
@@ -108,7 +108,7 @@ static int ext4_readdir(struct file *file, struct dir_context *ctx)
 	struct ext4_dir_entry_2 *de;
 	int err;
 	struct inode *inode = file_inode(file);
-	struct super_block *sb = inode->i_sb;
+	struct super_block *sb = inode_sb(inode);
 	struct buffer_head *bh = NULL;
 	int dir_has_error = 0;
 	struct fscrypt_str fstr = FSTR_INIT(NULL, 0);
@@ -502,7 +502,7 @@ static int call_filldir(struct file *file, struct dir_context *ctx,
 {
 	struct dir_private_info *info = file->private_data;
 	struct inode *inode = file_inode(file);
-	struct super_block *sb = inode->i_sb;
+	struct super_block *sb = inode_sb(inode);
 
 	if (!fname) {
 		ext4_msg(sb, KERN_ERR, "%s:%d: inode #%lu: comm %s: "
diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h
index 3241475a1733..8a3784d7b51f 100644
--- a/fs/ext4/ext4.h
+++ b/fs/ext4/ext4.h
@@ -1978,10 +1978,10 @@ static inline __le16 ext4_rec_len_to_disk(unsigned len, unsigned blocksize)
  * (c) Daniel Phillips, 2001
  */
 
-#define is_dx(dir) (ext4_has_feature_dir_index((dir)->i_sb) && \
+#define is_dx(dir) (ext4_has_feature_dir_index(inode_sb((dir))) && \
 		    ext4_test_inode_flag((dir), EXT4_INODE_INDEX))
 #define EXT4_DIR_LINK_MAX(dir) unlikely((dir)->i_nlink >= EXT4_LINK_MAX && \
-		    !(ext4_has_feature_dir_nlink((dir)->i_sb) && is_dx(dir)))
+		    !(ext4_has_feature_dir_nlink(inode_sb((dir))) && is_dx(dir)))
 #define EXT4_DIR_LINK_EMPTY(dir) ((dir)->i_nlink == 2 || (dir)->i_nlink == 1)
 
 /* Legal values for the dx_root hash_version field: */
@@ -2341,7 +2341,7 @@ void ext4_insert_dentry(struct inode *inode,
 			struct ext4_filename *fname);
 static inline void ext4_update_dx_flag(struct inode *inode)
 {
-	if (!ext4_has_feature_dir_index(inode->i_sb))
+	if (!ext4_has_feature_dir_index(inode_sb(inode)))
 		ext4_clear_inode_flag(inode, EXT4_INODE_INDEX);
 }
 static const unsigned char ext4_filetype_table[] = {
@@ -2924,7 +2924,7 @@ static inline void ext4_unlock_group(struct super_block *sb,
 #define ext4_check_indirect_blockref(inode, bh)				\
 	ext4_check_blockref(__func__, __LINE__, inode,			\
 			    (__le32 *)(bh)->b_data,			\
-			    EXT4_ADDR_PER_BLOCK((inode)->i_sb))
+			    EXT4_ADDR_PER_BLOCK(inode_sb((inode))))
 
 #define ext4_ind_check_inode(inode)					\
 	ext4_check_blockref(__func__, __LINE__, inode,			\
diff --git a/fs/ext4/ext4_jbd2.c b/fs/ext4/ext4_jbd2.c
index 2d593201cf7a..151323c6844b 100644
--- a/fs/ext4/ext4_jbd2.c
+++ b/fs/ext4/ext4_jbd2.c
@@ -207,7 +207,7 @@ int __ext4_forget(const char *where, unsigned int line, handle_t *handle,
 	jbd_debug(4, "forgetting bh %p: is_metadata = %d, mode %o, "
 		  "data mode %x\n",
 		  bh, is_metadata, inode->i_mode,
-		  test_opt(inode->i_sb, DATA_FLAGS));
+		  test_opt(inode_sb(inode), DATA_FLAGS));
 
 	/* In the no journal case, we can just do a bforget and return */
 	if (!ext4_handle_valid(handle)) {
@@ -220,7 +220,7 @@ int __ext4_forget(const char *where, unsigned int line, handle_t *handle,
 	 * support it.  Otherwise, only skip the revoke on un-journaled
 	 * data blocks. */
 
-	if (test_opt(inode->i_sb, DATA_FLAGS) == EXT4_MOUNT_JOURNAL_DATA ||
+	if (test_opt(inode_sb(inode), DATA_FLAGS) == EXT4_MOUNT_JOURNAL_DATA ||
 	    (!is_metadata && !ext4_should_journal_data(inode))) {
 		if (bh) {
 			BUFFER_TRACE(bh, "call jbd2_journal_forget");
@@ -241,8 +241,8 @@ int __ext4_forget(const char *where, unsigned int line, handle_t *handle,
 	if (err) {
 		ext4_journal_abort_handle(where, line, __func__,
 					  bh, handle, err);
-		__ext4_abort(inode->i_sb, where, line,
-			   "error %d when attempting revoke", err);
+		__ext4_abort(inode_sb(inode), where, line,
+			     "error %d when attempting revoke", err);
 	}
 	BUFFER_TRACE(bh, "exit");
 	return err;
@@ -308,7 +308,7 @@ int __ext4_handle_dirty_metadata(const char *where, unsigned int line,
 			if (buffer_req(bh) && !buffer_uptodate(bh)) {
 				struct ext4_super_block *es;
 
-				es = EXT4_SB(inode->i_sb)->s_es;
+				es = EXT4_SB(inode_sb(inode))->s_es;
 				es->s_last_error_block =
 					cpu_to_le64(bh->b_blocknr);
 				ext4_error_inode(inode, where, line,
diff --git a/fs/ext4/ext4_jbd2.h b/fs/ext4/ext4_jbd2.h
index 15b6dd733780..029cfddd9035 100644
--- a/fs/ext4/ext4_jbd2.h
+++ b/fs/ext4/ext4_jbd2.h
@@ -16,7 +16,7 @@
 #include <linux/jbd2.h>
 #include "ext4.h"
 
-#define EXT4_JOURNAL(inode)	(EXT4_SB((inode)->i_sb)->s_journal)
+#define EXT4_JOURNAL(inode)	(EXT4_SB(inode_sb((inode)))->s_journal)
 
 /* Define the number of blocks we need to account to a transaction to
  * modify one block of data.
@@ -308,7 +308,7 @@ static inline handle_t *__ext4_journal_start(struct inode *inode,
 					     unsigned int line, int type,
 					     int blocks, int rsv_blocks)
 {
-	return __ext4_journal_start_sb(inode->i_sb, line, type, blocks,
+	return __ext4_journal_start_sb(inode_sb(inode), line, type, blocks,
 				       rsv_blocks);
 }
 
@@ -407,17 +407,17 @@ static inline int ext4_inode_journal_mode(struct inode *inode)
 		return EXT4_INODE_WRITEBACK_DATA_MODE;	/* writeback */
 	/* We do not support data journalling with delayed allocation */
 	if (!S_ISREG(inode->i_mode) ||
-	    test_opt(inode->i_sb, DATA_FLAGS) == EXT4_MOUNT_JOURNAL_DATA ||
+	    test_opt(inode_sb(inode), DATA_FLAGS) == EXT4_MOUNT_JOURNAL_DATA ||
 	    (ext4_test_inode_flag(inode, EXT4_INODE_JOURNAL_DATA) &&
-	    !test_opt(inode->i_sb, DELALLOC))) {
+	    !test_opt(inode_sb(inode), DELALLOC))) {
 		/* We do not support data journalling for encrypted data */
 		if (S_ISREG(inode->i_mode) && ext4_encrypted_inode(inode))
 			return EXT4_INODE_ORDERED_DATA_MODE;  /* ordered */
 		return EXT4_INODE_JOURNAL_DATA_MODE;	/* journal data */
 	}
-	if (test_opt(inode->i_sb, DATA_FLAGS) == EXT4_MOUNT_ORDERED_DATA)
+	if (test_opt(inode_sb(inode), DATA_FLAGS) == EXT4_MOUNT_ORDERED_DATA)
 		return EXT4_INODE_ORDERED_DATA_MODE;	/* ordered */
-	if (test_opt(inode->i_sb, DATA_FLAGS) == EXT4_MOUNT_WRITEBACK_DATA)
+	if (test_opt(inode_sb(inode), DATA_FLAGS) == EXT4_MOUNT_WRITEBACK_DATA)
 		return EXT4_INODE_WRITEBACK_DATA_MODE;	/* writeback */
 	BUG();
 }
@@ -448,7 +448,7 @@ static inline int ext4_should_writeback_data(struct inode *inode)
  */
 static inline int ext4_should_dioread_nolock(struct inode *inode)
 {
-	if (!test_opt(inode->i_sb, DIOREAD_NOLOCK))
+	if (!test_opt(inode_sb(inode), DIOREAD_NOLOCK))
 		return 0;
 	if (!S_ISREG(inode->i_mode))
 		return 0;
diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c
index 054416e9d827..5001725876ef 100644
--- a/fs/ext4/extents.c
+++ b/fs/ext4/extents.c
@@ -49,7 +49,7 @@ static __le32 ext4_extent_block_csum(struct inode *inode,
 				     struct ext4_extent_header *eh)
 {
 	struct ext4_inode_info *ei = EXT4_I(inode);
-	struct ext4_sb_info *sbi = EXT4_SB(inode->i_sb);
+	struct ext4_sb_info *sbi = EXT4_SB(inode_sb(inode));
 	__u32 csum;
 
 	csum = ext4_chksum(sbi, ei->i_csum_seed, (__u8 *)eh,
@@ -62,7 +62,7 @@ static int ext4_extent_block_csum_verify(struct inode *inode,
 {
 	struct ext4_extent_tail *et;
 
-	if (!ext4_has_metadata_csum(inode->i_sb))
+	if (!ext4_has_metadata_csum(inode_sb(inode)))
 		return 1;
 
 	et = find_ext4_extent_tail(eh);
@@ -76,7 +76,7 @@ static void ext4_extent_block_csum_set(struct inode *inode,
 {
 	struct ext4_extent_tail *et;
 
-	if (!ext4_has_metadata_csum(inode->i_sb))
+	if (!ext4_has_metadata_csum(inode_sb(inode)))
 		return;
 
 	et = find_ext4_extent_tail(eh);
@@ -233,7 +233,7 @@ static inline int ext4_ext_space_block(struct inode *inode, int check)
 {
 	int size;
 
-	size = (inode->i_sb->s_blocksize - sizeof(struct ext4_extent_header))
+	size = (inode_sb(inode)->s_blocksize - sizeof(struct ext4_extent_header))
 			/ sizeof(struct ext4_extent);
 #ifdef AGGRESSIVE_TEST
 	if (!check && size > 6)
@@ -246,7 +246,7 @@ static inline int ext4_ext_space_block_idx(struct inode *inode, int check)
 {
 	int size;
 
-	size = (inode->i_sb->s_blocksize - sizeof(struct ext4_extent_header))
+	size = (inode_sb(inode)->s_blocksize - sizeof(struct ext4_extent_header))
 			/ sizeof(struct ext4_extent_idx);
 #ifdef AGGRESSIVE_TEST
 	if (!check && size > 5)
@@ -307,7 +307,7 @@ int ext4_ext_calc_metadata_amount(struct inode *inode, ext4_lblk_t lblock)
 	struct ext4_inode_info *ei = EXT4_I(inode);
 	int idxs;
 
-	idxs = ((inode->i_sb->s_blocksize - sizeof(struct ext4_extent_header))
+	idxs = ((inode_sb(inode)->s_blocksize - sizeof(struct ext4_extent_header))
 		/ sizeof(struct ext4_extent_idx));
 
 	/*
@@ -377,7 +377,7 @@ static int ext4_valid_extent(struct inode *inode, struct ext4_extent *ext)
 	 */
 	if (lblock + len <= lblock)
 		return 0;
-	return ext4_data_block_valid(EXT4_SB(inode->i_sb), block, len);
+	return ext4_data_block_valid(EXT4_SB(inode_sb(inode)), block, len);
 }
 
 static int ext4_valid_extent_idx(struct inode *inode,
@@ -385,7 +385,7 @@ static int ext4_valid_extent_idx(struct inode *inode,
 {
 	ext4_fsblk_t block = ext4_idx_pblock(ext_idx);
 
-	return ext4_data_block_valid(EXT4_SB(inode->i_sb), block, 1);
+	return ext4_data_block_valid(EXT4_SB(inode_sb(inode)), block, 1);
 }
 
 static int ext4_valid_extent_entries(struct inode *inode,
@@ -401,7 +401,7 @@ static int ext4_valid_extent_entries(struct inode *inode,
 	if (depth == 0) {
 		/* leaf entries */
 		struct ext4_extent *ext = EXT_FIRST_EXTENT(eh);
-		struct ext4_super_block *es = EXT4_SB(inode->i_sb)->s_es;
+		struct ext4_super_block *es = EXT4_SB(inode_sb(inode))->s_es;
 		ext4_fsblk_t pblock = 0;
 		ext4_lblk_t lblock = 0;
 		ext4_lblk_t prev = 0;
@@ -506,7 +506,7 @@ __read_extent_tree_block(const char *function, unsigned int line,
 	struct buffer_head		*bh;
 	int				err;
 
-	bh = sb_getblk_gfp(inode->i_sb, pblk, __GFP_MOVABLE | GFP_NOFS);
+	bh = sb_getblk_gfp(inode_sb(inode), pblk, __GFP_MOVABLE | GFP_NOFS);
 	if (unlikely(!bh))
 		return ERR_PTR(-ENOMEM);
 
@@ -1000,7 +1000,7 @@ static int ext4_ext_insert_index(handle_t *handle, struct inode *inode,
 	}
 
 	err = ext4_ext_dirty(handle, inode, curp);
-	ext4_std_error(inode->i_sb, err);
+	ext4_std_error(inode_sb(inode), err);
 
 	return err;
 }
@@ -1084,7 +1084,8 @@ static int ext4_ext_split(handle_t *handle, struct inode *inode,
 		err = -EFSCORRUPTED;
 		goto cleanup;
 	}
-	bh = sb_getblk_gfp(inode->i_sb, newblock, __GFP_MOVABLE | GFP_NOFS);
+	bh = sb_getblk_gfp(inode_sb(inode), newblock,
+			   __GFP_MOVABLE | GFP_NOFS);
 	if (unlikely(!bh)) {
 		err = -ENOMEM;
 		goto cleanup;
@@ -1157,7 +1158,7 @@ static int ext4_ext_split(handle_t *handle, struct inode *inode,
 	while (k--) {
 		oldblock = newblock;
 		newblock = ablocks[--a];
-		bh = sb_getblk(inode->i_sb, newblock);
+		bh = sb_getblk(inode_sb(inode), newblock);
 		if (unlikely(!bh)) {
 			err = -ENOMEM;
 			goto cleanup;
@@ -1262,7 +1263,7 @@ static int ext4_ext_grow_indepth(handle_t *handle, struct inode *inode,
 	struct ext4_extent_header *neh;
 	struct buffer_head *bh;
 	ext4_fsblk_t newblock, goal = 0;
-	struct ext4_super_block *es = EXT4_SB(inode->i_sb)->s_es;
+	struct ext4_super_block *es = EXT4_SB(inode_sb(inode))->s_es;
 	int err = 0;
 
 	/* Try to prepend new index to old one */
@@ -1278,7 +1279,8 @@ static int ext4_ext_grow_indepth(handle_t *handle, struct inode *inode,
 	if (newblock == 0)
 		return err;
 
-	bh = sb_getblk_gfp(inode->i_sb, newblock, __GFP_MOVABLE | GFP_NOFS);
+	bh = sb_getblk_gfp(inode_sb(inode), newblock,
+			   __GFP_MOVABLE | GFP_NOFS);
 	if (unlikely(!bh))
 		return -ENOMEM;
 	lock_buffer(bh);
@@ -2154,7 +2156,7 @@ static int ext4_fill_fiemap_extents(struct inode *inode,
 	ext4_lblk_t last = block + num;
 	int exists, depth = 0, err = 0;
 	unsigned int flags = 0;
-	unsigned char blksize_bits = inode->i_sb->s_blocksize_bits;
+	unsigned char blksize_bits = inode_sb(inode)->s_blocksize_bits;
 
 	while (block < last && block != EXT_MAX_BLOCKS) {
 		num = last - block;
@@ -2438,7 +2440,7 @@ int ext4_ext_calc_credits_for_single_extent(struct inode *inode, int nrblocks,
 			 *  accounted.
 			 */
 			/* 1 bitmap, 1 block group descriptor */
-			ret = 2 + EXT4_META_TRANS_BLOCKS(inode->i_sb);
+			ret = 2 + EXT4_META_TRANS_BLOCKS(inode_sb(inode));
 			return ret;
 		}
 	}
@@ -2489,7 +2491,7 @@ static int ext4_remove_blocks(handle_t *handle, struct inode *inode,
 			      long long *partial_cluster,
 			      ext4_lblk_t from, ext4_lblk_t to)
 {
-	struct ext4_sb_info *sbi = EXT4_SB(inode->i_sb);
+	struct ext4_sb_info *sbi = EXT4_SB(inode_sb(inode));
 	unsigned short ee_len = ext4_ext_get_actual_len(ex);
 	ext4_fsblk_t pblk;
 	int flags = get_default_free_blocks_flags(inode);
@@ -2520,7 +2522,7 @@ static int ext4_remove_blocks(handle_t *handle, struct inode *inode,
 
 #ifdef EXTENTS_STATS
 	{
-		struct ext4_sb_info *sbi = EXT4_SB(inode->i_sb);
+		struct ext4_sb_info *sbi = EXT4_SB(inode_sb(inode));
 		spin_lock(&sbi->s_ext_stats_lock);
 		sbi->s_ext_blocks += ee_len;
 		sbi->s_ext_extents++;
@@ -2605,7 +2607,7 @@ ext4_ext_rm_leaf(handle_t *handle, struct inode *inode,
 		 long long *partial_cluster,
 		 ext4_lblk_t start, ext4_lblk_t end)
 {
-	struct ext4_sb_info *sbi = EXT4_SB(inode->i_sb);
+	struct ext4_sb_info *sbi = EXT4_SB(inode_sb(inode));
 	int err = 0, correct_index = 0;
 	int depth = ext_depth(inode), credits;
 	struct ext4_extent_header *eh;
@@ -2693,12 +2695,12 @@ ext4_ext_rm_leaf(handle_t *handle, struct inode *inode,
 		 * groups plus ex_ee_len/blocks_per_block_group for
 		 * the worst case
 		 */
-		credits = 7 + 2*(ex_ee_len/EXT4_BLOCKS_PER_GROUP(inode->i_sb));
+		credits = 7 + 2*(ex_ee_len/EXT4_BLOCKS_PER_GROUP(inode_sb(inode)));
 		if (ex == EXT_FIRST_EXTENT(eh)) {
 			correct_index = 1;
 			credits += (ext_depth(inode)) + 1;
 		}
-		credits += EXT4_MAXQUOTAS_TRANS_BLOCKS(inode->i_sb);
+		credits += EXT4_MAXQUOTAS_TRANS_BLOCKS(inode_sb(inode));
 
 		err = ext4_ext_truncate_extend_restart(handle, inode, credits);
 		if (err)
@@ -2810,7 +2812,7 @@ ext4_ext_more_to_rm(struct ext4_ext_path *path)
 int ext4_ext_remove_space(struct inode *inode, ext4_lblk_t start,
 			  ext4_lblk_t end)
 {
-	struct ext4_sb_info *sbi = EXT4_SB(inode->i_sb);
+	struct ext4_sb_info *sbi = EXT4_SB(inode_sb(inode));
 	int depth = ext_depth(inode);
 	struct ext4_ext_path *path = NULL;
 	long long partial_cluster = 0;
@@ -3414,9 +3416,9 @@ static int ext4_ext_convert_to_initialized(handle_t *handle,
 		"block %llu, max_blocks %u\n", inode->i_ino,
 		(unsigned long long)map->m_lblk, map_len);
 
-	sbi = EXT4_SB(inode->i_sb);
-	eof_block = (inode->i_size + inode->i_sb->s_blocksize - 1) >>
-		inode->i_sb->s_blocksize_bits;
+	sbi = EXT4_SB(inode_sb(inode));
+	eof_block = (inode->i_size + inode_sb(inode)->s_blocksize - 1) >>
+		inode_sb(inode)->s_blocksize_bits;
 	if (eof_block < map->m_lblk + map_len)
 		eof_block = map->m_lblk + map_len;
 
@@ -3561,7 +3563,7 @@ static int ext4_ext_convert_to_initialized(handle_t *handle,
 
 	if (EXT4_EXT_MAY_ZEROOUT & split_flag)
 		max_zeroout = sbi->s_extent_max_zeroout_kb >>
-			(inode->i_sb->s_blocksize_bits - 10);
+			(inode_sb(inode)->s_blocksize_bits - 10);
 
 	if (ext4_encrypted_inode(inode))
 		max_zeroout = 0;
@@ -3671,8 +3673,8 @@ static int ext4_split_convert_extents(handle_t *handle,
 		  __func__, inode->i_ino,
 		  (unsigned long long)map->m_lblk, map->m_len);
 
-	eof_block = (inode->i_size + inode->i_sb->s_blocksize - 1) >>
-		inode->i_sb->s_blocksize_bits;
+	eof_block = (inode->i_size + inode_sb(inode)->s_blocksize - 1) >>
+		inode_sb(inode)->s_blocksize_bits;
 	if (eof_block < map->m_lblk + map->m_len)
 		eof_block = map->m_lblk + map->m_len;
 	/*
@@ -3838,7 +3840,7 @@ int ext4_find_delalloc_range(struct inode *inode,
 
 int ext4_find_delalloc_cluster(struct inode *inode, ext4_lblk_t lblk)
 {
-	struct ext4_sb_info *sbi = EXT4_SB(inode->i_sb);
+	struct ext4_sb_info *sbi = EXT4_SB(inode_sb(inode));
 	ext4_lblk_t lblk_start, lblk_end;
 	lblk_start = EXT4_LBLK_CMASK(sbi, lblk);
 	lblk_end = lblk_start + sbi->s_cluster_ratio - 1;
@@ -3885,7 +3887,7 @@ static unsigned int
 get_reserved_cluster_alloc(struct inode *inode, ext4_lblk_t lblk_start,
 			   unsigned int num_blks)
 {
-	struct ext4_sb_info *sbi = EXT4_SB(inode->i_sb);
+	struct ext4_sb_info *sbi = EXT4_SB(inode_sb(inode));
 	ext4_lblk_t alloc_cluster_start, alloc_cluster_end;
 	ext4_lblk_t lblk_from, lblk_to, c_offset;
 	unsigned int allocated_clusters = 0;
@@ -4096,7 +4098,8 @@ ext4_ext_handle_unwritten_extents(handle_t *handle, struct inode *inode,
 	 * new.
 	 */
 	if (allocated > map->m_len) {
-		clean_bdev_aliases(inode->i_sb->s_bdev, newblock + map->m_len,
+		clean_bdev_aliases(inode_sb(inode)->s_bdev,
+				   newblock + map->m_len,
 				   allocated - map->m_len);
 		allocated = map->m_len;
 	}
@@ -4263,7 +4266,7 @@ int ext4_ext_map_blocks(handle_t *handle, struct inode *inode,
 {
 	struct ext4_ext_path *path = NULL;
 	struct ext4_extent newex, *ex, *ex2;
-	struct ext4_sb_info *sbi = EXT4_SB(inode->i_sb);
+	struct ext4_sb_info *sbi = EXT4_SB(inode_sb(inode));
 	ext4_fsblk_t newblock = 0;
 	int free_on_err = 0, err = 0, depth, ret;
 	unsigned int allocated = 0, offset = 0;
@@ -4382,7 +4385,7 @@ int ext4_ext_map_blocks(handle_t *handle, struct inode *inode,
 	 * by ext4_find_extent() implies a cluster we can use.
 	 */
 	if (cluster_offset && ex &&
-	    get_implied_cluster_alloc(inode->i_sb, map, ex, path)) {
+	    get_implied_cluster_alloc(inode_sb(inode), map, ex, path)) {
 		ar.len = allocated = map->m_len;
 		newblock = map->m_pblk;
 		map_from_cluster = true;
@@ -4403,7 +4406,7 @@ int ext4_ext_map_blocks(handle_t *handle, struct inode *inode,
 	/* Check if the extent after searching to the right implies a
 	 * cluster we can use. */
 	if ((sbi->s_cluster_ratio > 1) && ex2 &&
-	    get_implied_cluster_alloc(inode->i_sb, map, ex2, path)) {
+	    get_implied_cluster_alloc(inode_sb(inode), map, ex2, path)) {
 		ar.len = allocated = map->m_len;
 		newblock = map->m_pblk;
 		map_from_cluster = true;
@@ -4607,7 +4610,7 @@ int ext4_ext_map_blocks(handle_t *handle, struct inode *inode,
 
 int ext4_ext_truncate(handle_t *handle, struct inode *inode)
 {
-	struct super_block *sb = inode->i_sb;
+	struct super_block *sb = inode_sb(inode);
 	ext4_lblk_t last_block;
 	int err = 0;
 
@@ -4716,7 +4719,7 @@ static int ext4_alloc_file_blocks(struct file *file, ext4_lblk_t offset,
 			break;
 	}
 	if (ret == -ENOSPC &&
-			ext4_should_retry_alloc(inode->i_sb, &retries)) {
+			ext4_should_retry_alloc(inode_sb(inode), &retries)) {
 		ret = 0;
 		goto retry;
 	}
@@ -4746,7 +4749,7 @@ static long ext4_zero_range(struct file *file, loff_t offset,
 
 	/* Call ext4_force_commit to flush all data in case of data=journal. */
 	if (ext4_should_journal_data(inode)) {
-		ret = ext4_force_commit(inode->i_sb);
+		ret = ext4_force_commit(inode_sb(inode));
 		if (ret)
 			return ret;
 	}
@@ -4849,7 +4852,7 @@ static long ext4_zero_range(struct file *file, loff_t offset,
 	handle = ext4_journal_start(inode, EXT4_HT_MISC, credits);
 	if (IS_ERR(handle)) {
 		ret = PTR_ERR(handle);
-		ext4_std_error(inode->i_sb, ret);
+		ext4_std_error(inode_sb(inode), ret);
 		goto out_dio;
 	}
 
@@ -4972,8 +4975,8 @@ long ext4_fallocate(struct file *file, int mode, loff_t offset, loff_t len)
 	if (ret)
 		goto out;
 
-	if (file->f_flags & O_SYNC && EXT4_SB(inode->i_sb)->s_journal) {
-		ret = jbd2_complete_transaction(EXT4_SB(inode->i_sb)->s_journal,
+	if (file->f_flags & O_SYNC && EXT4_SB(inode_sb(inode))->s_journal) {
+		ret = jbd2_complete_transaction(EXT4_SB(inode_sb(inode))->s_journal,
 						EXT4_I(inode)->i_sync_tid);
 	}
 out:
@@ -5035,7 +5038,7 @@ int ext4_convert_unwritten_extents(handle_t *handle, struct inode *inode,
 		ret = ext4_map_blocks(handle, inode, &map,
 				      EXT4_GET_BLOCKS_IO_CONVERT_EXT);
 		if (ret <= 0)
-			ext4_warning(inode->i_sb,
+			ext4_warning(inode_sb(inode),
 				     "inode #%lu: block %u: len %u: "
 				     "ext4_ext_map_blocks returned %d",
 				     inode->i_ino, map.m_lblk,
@@ -5106,7 +5109,7 @@ static int ext4_xattr_fiemap(struct inode *inode,
 	__u64 physical = 0;
 	__u64 length;
 	__u32 flags = FIEMAP_EXTENT_LAST;
-	int blockbits = inode->i_sb->s_blocksize_bits;
+	int blockbits = inode_sb(inode)->s_blocksize_bits;
 	int error = 0;
 
 	/* in-inode? */
@@ -5121,12 +5124,12 @@ static int ext4_xattr_fiemap(struct inode *inode,
 		offset = EXT4_GOOD_OLD_INODE_SIZE +
 				EXT4_I(inode)->i_extra_isize;
 		physical += offset;
-		length = EXT4_SB(inode->i_sb)->s_inode_size - offset;
+		length = EXT4_SB(inode_sb(inode))->s_inode_size - offset;
 		flags |= FIEMAP_EXTENT_DATA_INLINE;
 		brelse(iloc.bh);
 	} else { /* external block */
 		physical = (__u64)EXT4_I(inode)->i_file_acl << blockbits;
-		length = inode->i_sb->s_blocksize;
+		length = inode_sb(inode)->s_blocksize;
 	}
 
 	if (physical)
@@ -5171,8 +5174,8 @@ int ext4_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo,
 		ext4_lblk_t len_blks;
 		__u64 last_blk;
 
-		start_blk = start >> inode->i_sb->s_blocksize_bits;
-		last_blk = (start + len - 1) >> inode->i_sb->s_blocksize_bits;
+		start_blk = start >> inode_sb(inode)->s_blocksize_bits;
+		last_blk = (start + len - 1) >> inode_sb(inode)->s_blocksize_bits;
 		if (last_blk >= EXT_MAX_BLOCKS)
 			last_blk = EXT_MAX_BLOCKS-1;
 		len_blks = ((ext4_lblk_t) last_blk) - start_blk + 1;
@@ -5433,7 +5436,7 @@ ext4_ext_shift_extents(struct inode *inode, handle_t *handle,
  */
 int ext4_collapse_range(struct inode *inode, loff_t offset, loff_t len)
 {
-	struct super_block *sb = inode->i_sb;
+	struct super_block *sb = inode_sb(inode);
 	ext4_lblk_t punch_start, punch_stop;
 	handle_t *handle;
 	unsigned int credits;
@@ -5463,7 +5466,7 @@ int ext4_collapse_range(struct inode *inode, loff_t offset, loff_t len)
 
 	/* Call ext4_force_commit to flush all data in case of data=journal. */
 	if (ext4_should_journal_data(inode)) {
-		ret = ext4_force_commit(inode->i_sb);
+		ret = ext4_force_commit(inode_sb(inode));
 		if (ret)
 			return ret;
 	}
@@ -5578,7 +5581,7 @@ int ext4_collapse_range(struct inode *inode, loff_t offset, loff_t len)
  */
 int ext4_insert_range(struct inode *inode, loff_t offset, loff_t len)
 {
-	struct super_block *sb = inode->i_sb;
+	struct super_block *sb = inode_sb(inode);
 	handle_t *handle;
 	struct ext4_ext_path *path;
 	struct ext4_extent *extent;
@@ -5610,7 +5613,7 @@ int ext4_insert_range(struct inode *inode, loff_t offset, loff_t len)
 
 	/* Call ext4_force_commit to flush all data in case of data=journal */
 	if (ext4_should_journal_data(inode)) {
-		ret = ext4_force_commit(inode->i_sb);
+		ret = ext4_force_commit(inode_sb(inode));
 		if (ret)
 			return ret;
 	}
@@ -5623,7 +5626,7 @@ int ext4_insert_range(struct inode *inode, loff_t offset, loff_t len)
 	}
 
 	/* Check for wrap through zero */
-	if (inode->i_size + len > inode->i_sb->s_maxbytes) {
+	if (inode->i_size + len > inode_sb(inode)->s_maxbytes) {
 		ret = -EFBIG;
 		goto out_mutex;
 	}
diff --git a/fs/ext4/extents_status.c b/fs/ext4/extents_status.c
index 763ef185dd17..56c59000c9cc 100644
--- a/fs/ext4/extents_status.c
+++ b/fs/ext4/extents_status.c
@@ -299,7 +299,7 @@ void ext4_es_find_delayed_extent_range(struct inode *inode,
 static void ext4_es_list_add(struct inode *inode)
 {
 	struct ext4_inode_info *ei = EXT4_I(inode);
-	struct ext4_sb_info *sbi = EXT4_SB(inode->i_sb);
+	struct ext4_sb_info *sbi = EXT4_SB(inode_sb(inode));
 
 	if (!list_empty(&ei->i_es_list))
 		return;
@@ -315,7 +315,7 @@ static void ext4_es_list_add(struct inode *inode)
 static void ext4_es_list_del(struct inode *inode)
 {
 	struct ext4_inode_info *ei = EXT4_I(inode);
-	struct ext4_sb_info *sbi = EXT4_SB(inode->i_sb);
+	struct ext4_sb_info *sbi = EXT4_SB(inode_sb(inode));
 
 	spin_lock(&sbi->s_es_lock);
 	if (!list_empty(&ei->i_es_list)) {
@@ -344,12 +344,12 @@ ext4_es_alloc_extent(struct inode *inode, ext4_lblk_t lblk, ext4_lblk_t len,
 	if (!ext4_es_is_delayed(es)) {
 		if (!EXT4_I(inode)->i_es_shk_nr++)
 			ext4_es_list_add(inode);
-		percpu_counter_inc(&EXT4_SB(inode->i_sb)->
+		percpu_counter_inc(&EXT4_SB(inode_sb(inode))->
 					s_es_stats.es_stats_shk_cnt);
 	}
 
 	EXT4_I(inode)->i_es_all_nr++;
-	percpu_counter_inc(&EXT4_SB(inode->i_sb)->s_es_stats.es_stats_all_cnt);
+	percpu_counter_inc(&EXT4_SB(inode_sb(inode))->s_es_stats.es_stats_all_cnt);
 
 	return es;
 }
@@ -357,14 +357,14 @@ ext4_es_alloc_extent(struct inode *inode, ext4_lblk_t lblk, ext4_lblk_t len,
 static void ext4_es_free_extent(struct inode *inode, struct extent_status *es)
 {
 	EXT4_I(inode)->i_es_all_nr--;
-	percpu_counter_dec(&EXT4_SB(inode->i_sb)->s_es_stats.es_stats_all_cnt);
+	percpu_counter_dec(&EXT4_SB(inode_sb(inode))->s_es_stats.es_stats_all_cnt);
 
 	/* Decrease the shrink counter when this es is not delayed */
 	if (!ext4_es_is_delayed(es)) {
 		BUG_ON(EXT4_I(inode)->i_es_shk_nr == 0);
 		if (!--EXT4_I(inode)->i_es_shk_nr)
 			ext4_es_list_del(inode);
-		percpu_counter_dec(&EXT4_SB(inode->i_sb)->
+		percpu_counter_dec(&EXT4_SB(inode_sb(inode))->
 					s_es_stats.es_stats_shk_cnt);
 	}
 
@@ -706,7 +706,7 @@ int ext4_es_insert_extent(struct inode *inode, ext4_lblk_t lblk,
 
 	if ((status & EXTENT_STATUS_DELAYED) &&
 	    (status & EXTENT_STATUS_WRITTEN)) {
-		ext4_warning(inode->i_sb, "Inserting extent [%u/%u] as "
+		ext4_warning(inode_sb(inode), "Inserting extent [%u/%u] as "
 				" delayed and written which can potentially "
 				" cause data loss.", lblk, len);
 		WARN_ON(1);
@@ -725,7 +725,7 @@ int ext4_es_insert_extent(struct inode *inode, ext4_lblk_t lblk,
 		goto error;
 retry:
 	err = __es_insert_extent(inode, &newes);
-	if (err == -ENOMEM && __es_shrink(EXT4_SB(inode->i_sb),
+	if (err == -ENOMEM && __es_shrink(EXT4_SB(inode_sb(inode)),
 					  128, EXT4_I(inode)))
 		goto retry;
 	if (err == -ENOMEM && !ext4_es_is_delayed(&newes))
@@ -818,7 +818,7 @@ int ext4_es_lookup_extent(struct inode *inode, ext4_lblk_t lblk,
 	}
 
 out:
-	stats = &EXT4_SB(inode->i_sb)->s_es_stats;
+	stats = &EXT4_SB(inode_sb(inode))->s_es_stats;
 	if (found) {
 		BUG_ON(!es1);
 		es->es_lblk = es1->es_lblk;
@@ -885,7 +885,7 @@ static int __es_remove_extent(struct inode *inode, ext4_lblk_t lblk,
 				es->es_lblk = orig_es.es_lblk;
 				es->es_len = orig_es.es_len;
 				if ((err == -ENOMEM) &&
-				    __es_shrink(EXT4_SB(inode->i_sb),
+				    __es_shrink(EXT4_SB(inode_sb(inode)),
 							128, EXT4_I(inode)))
 					goto retry;
 				goto out;
@@ -1244,7 +1244,8 @@ static int es_reclaim_extents(struct ext4_inode_info *ei, int *nr_to_scan)
 
 	if (ext4_test_inode_state(inode, EXT4_STATE_EXT_PRECACHED) &&
 	    __ratelimit(&_rs))
-		ext4_warning(inode->i_sb, "forced shrink of precached extents");
+		ext4_warning(inode_sb(inode),
+			     "forced shrink of precached extents");
 
 	if (!es_do_reclaim_extents(ei, EXT_MAX_BLOCKS, nr_to_scan, &nr_shrunk) &&
 	    start != 0)
diff --git a/fs/ext4/file.c b/fs/ext4/file.c
index fb6f023622fe..d6547085f4d2 100644
--- a/fs/ext4/file.c
+++ b/fs/ext4/file.c
@@ -64,7 +64,7 @@ static ssize_t ext4_dax_read_iter(struct kiocb *iocb, struct iov_iter *to)
 
 static ssize_t ext4_file_read_iter(struct kiocb *iocb, struct iov_iter *to)
 {
-	if (unlikely(ext4_forced_shutdown(EXT4_SB(file_inode(iocb->ki_filp)->i_sb))))
+	if (unlikely(ext4_forced_shutdown(EXT4_SB(inode_sb(file_inode(iocb->ki_filp))))))
 		return -EIO;
 
 	if (!iov_iter_count(to))
@@ -122,7 +122,7 @@ static void ext4_unwritten_wait(struct inode *inode)
 static int
 ext4_unaligned_aio(struct inode *inode, struct iov_iter *from, loff_t pos)
 {
-	struct super_block *sb = inode->i_sb;
+	struct super_block *sb = inode_sb(inode);
 	int blockmask = sb->s_blocksize - 1;
 
 	if (pos >= i_size_read(inode))
@@ -170,7 +170,7 @@ static ssize_t ext4_write_checks(struct kiocb *iocb, struct iov_iter *from)
 	 * is smaller than s_maxbytes, which is for extent-mapped files.
 	 */
 	if (!(ext4_test_inode_flag(inode, EXT4_INODE_EXTENTS))) {
-		struct ext4_sb_info *sbi = EXT4_SB(inode->i_sb);
+		struct ext4_sb_info *sbi = EXT4_SB(inode_sb(inode));
 
 		if (iocb->ki_pos >= sbi->s_bitmap_maxbytes)
 			return -EFBIG;
@@ -219,7 +219,7 @@ ext4_file_write_iter(struct kiocb *iocb, struct iov_iter *from)
 	int overwrite = 0;
 	ssize_t ret;
 
-	if (unlikely(ext4_forced_shutdown(EXT4_SB(inode->i_sb))))
+	if (unlikely(ext4_forced_shutdown(EXT4_SB(inode_sb(inode)))))
 		return -EIO;
 
 #ifdef CONFIG_FS_DAX
@@ -284,7 +284,7 @@ static int ext4_dax_huge_fault(struct vm_fault *vmf,
 	int retries = 0;
 	handle_t *handle = NULL;
 	struct inode *inode = file_inode(vmf->vma->vm_file);
-	struct super_block *sb = inode->i_sb;
+	struct super_block *sb = inode_sb(inode);
 
 	/*
 	 * We have to distinguish real writes from writes which will result in a
@@ -360,7 +360,7 @@ static int ext4_file_mmap(struct file *file, struct vm_area_struct *vma)
 {
 	struct inode *inode = file->f_mapping->host;
 
-	if (unlikely(ext4_forced_shutdown(EXT4_SB(inode->i_sb))))
+	if (unlikely(ext4_forced_shutdown(EXT4_SB(inode_sb(inode)))))
 		return -EIO;
 
 	/*
@@ -382,14 +382,14 @@ static int ext4_file_mmap(struct file *file, struct vm_area_struct *vma)
 
 static int ext4_file_open(struct inode * inode, struct file * filp)
 {
-	struct super_block *sb = inode->i_sb;
-	struct ext4_sb_info *sbi = EXT4_SB(inode->i_sb);
+	struct super_block *sb = inode_sb(inode);
+	struct ext4_sb_info *sbi = EXT4_SB(inode_sb(inode));
 	struct vfsmount *mnt = filp->f_path.mnt;
 	struct path path;
 	char buf[64], *cp;
 	int ret;
 
-	if (unlikely(ext4_forced_shutdown(EXT4_SB(inode->i_sb))))
+	if (unlikely(ext4_forced_shutdown(EXT4_SB(inode_sb(inode)))))
 		return -EIO;
 
 	if (unlikely(!(sbi->s_mount_flags & EXT4_MF_MNTDIR_SAMPLED) &&
@@ -454,9 +454,9 @@ loff_t ext4_llseek(struct file *file, loff_t offset, int whence)
 	loff_t maxbytes;
 
 	if (!(ext4_test_inode_flag(inode, EXT4_INODE_EXTENTS)))
-		maxbytes = EXT4_SB(inode->i_sb)->s_bitmap_maxbytes;
+		maxbytes = EXT4_SB(inode_sb(inode))->s_bitmap_maxbytes;
 	else
-		maxbytes = inode->i_sb->s_maxbytes;
+		maxbytes = inode_sb(inode)->s_maxbytes;
 
 	switch (whence) {
 	default:
diff --git a/fs/ext4/fsync.c b/fs/ext4/fsync.c
index 26a7fe5c4fd3..ad5a1fff59ec 100644
--- a/fs/ext4/fsync.c
+++ b/fs/ext4/fsync.c
@@ -96,22 +96,22 @@ int ext4_sync_file(struct file *file, loff_t start, loff_t end, int datasync)
 {
 	struct inode *inode = file->f_mapping->host;
 	struct ext4_inode_info *ei = EXT4_I(inode);
-	journal_t *journal = EXT4_SB(inode->i_sb)->s_journal;
+	journal_t *journal = EXT4_SB(inode_sb(inode))->s_journal;
 	int ret = 0, err;
 	tid_t commit_tid;
 	bool needs_barrier = false;
 
-	if (unlikely(ext4_forced_shutdown(EXT4_SB(inode->i_sb))))
+	if (unlikely(ext4_forced_shutdown(EXT4_SB(inode_sb(inode)))))
 		return -EIO;
 
 	J_ASSERT(ext4_journal_current_handle() == NULL);
 
 	trace_ext4_sync_file_enter(file, datasync);
 
-	if (sb_rdonly(inode->i_sb)) {
+	if (sb_rdonly(inode_sb(inode))) {
 		/* Make sure that we read updated s_mount_flags value */
 		smp_rmb();
-		if (EXT4_SB(inode->i_sb)->s_mount_flags & EXT4_MF_FS_ABORTED)
+		if (EXT4_SB(inode_sb(inode))->s_mount_flags & EXT4_MF_FS_ABORTED)
 			ret = -EROFS;
 		goto out;
 	}
@@ -120,7 +120,7 @@ int ext4_sync_file(struct file *file, loff_t start, loff_t end, int datasync)
 		ret = __generic_file_fsync(file, start, end, datasync);
 		if (!ret)
 			ret = ext4_sync_parent(inode);
-		if (test_opt(inode->i_sb, BARRIER))
+		if (test_opt(inode_sb(inode), BARRIER))
 			goto issue_flush;
 		goto out;
 	}
@@ -143,7 +143,7 @@ int ext4_sync_file(struct file *file, loff_t start, loff_t end, int datasync)
 	 *  safe in-journal, which is all fsync() needs to ensure.
 	 */
 	if (ext4_should_journal_data(inode)) {
-		ret = ext4_force_commit(inode->i_sb);
+		ret = ext4_force_commit(inode_sb(inode));
 		goto out;
 	}
 
@@ -154,7 +154,8 @@ int ext4_sync_file(struct file *file, loff_t start, loff_t end, int datasync)
 	ret = jbd2_complete_transaction(journal, commit_tid);
 	if (needs_barrier) {
 	issue_flush:
-		err = blkdev_issue_flush(inode->i_sb->s_bdev, GFP_KERNEL, NULL);
+		err = blkdev_issue_flush(inode_sb(inode)->s_bdev, GFP_KERNEL,
+					 NULL);
 		if (!ret)
 			ret = err;
 	}
diff --git a/fs/ext4/ialloc.c b/fs/ext4/ialloc.c
index 7830d28df331..95b8d6077faf 100644
--- a/fs/ext4/ialloc.c
+++ b/fs/ext4/ialloc.c
@@ -255,7 +255,7 @@ ext4_read_inode_bitmap(struct super_block *sb, ext4_group_t block_group)
  */
 void ext4_free_inode(handle_t *handle, struct inode *inode)
 {
-	struct super_block *sb = inode->i_sb;
+	struct super_block *sb = inode_sb(inode);
 	int is_directory;
 	unsigned long ino;
 	struct buffer_head *bitmap_bh = NULL;
@@ -795,7 +795,7 @@ struct inode *__ext4_new_inode(handle_t *handle, struct inode *dir,
 	if (!dir || !dir->i_nlink)
 		return ERR_PTR(-EPERM);
 
-	sb = dir->i_sb;
+	sb = inode_sb(dir);
 	sbi = EXT4_SB(sb);
 
 	if (unlikely(ext4_forced_shutdown(sbi)))
@@ -953,7 +953,8 @@ struct inode *__ext4_new_inode(handle_t *handle, struct inode *dir,
 
 		if (!handle) {
 			BUG_ON(nblocks <= 0);
-			handle = __ext4_journal_start_sb(dir->i_sb, line_no,
+			handle = __ext4_journal_start_sb(inode_sb(dir),
+							 line_no,
 							 handle_type, nblocks,
 							 0);
 			if (IS_ERR(handle)) {
diff --git a/fs/ext4/indirect.c b/fs/ext4/indirect.c
index c32802c956d5..8725e486df18 100644
--- a/fs/ext4/indirect.c
+++ b/fs/ext4/indirect.c
@@ -58,7 +58,7 @@ static inline void add_chain(Indirect *p, struct buffer_head *bh, __le32 *v)
  *
  *	Note: function doesn't find node addresses, so no IO is needed. All
  *	we need to know is the capacity of indirect blocks (taken from the
- *	inode->i_sb).
+ *	inode_sb(inode)).
  */
 
 /*
@@ -75,8 +75,8 @@ static int ext4_block_to_path(struct inode *inode,
 			      ext4_lblk_t i_block,
 			      ext4_lblk_t offsets[4], int *boundary)
 {
-	int ptrs = EXT4_ADDR_PER_BLOCK(inode->i_sb);
-	int ptrs_bits = EXT4_ADDR_PER_BLOCK_BITS(inode->i_sb);
+	int ptrs = EXT4_ADDR_PER_BLOCK(inode_sb(inode));
+	int ptrs_bits = EXT4_ADDR_PER_BLOCK_BITS(inode_sb(inode));
 	const long direct_blocks = EXT4_NDIR_BLOCKS,
 		indirect_blocks = ptrs,
 		double_blocks = (1 << (ptrs_bits * 2));
@@ -102,7 +102,7 @@ static int ext4_block_to_path(struct inode *inode,
 		offsets[n++] = i_block & (ptrs - 1);
 		final = ptrs;
 	} else {
-		ext4_warning(inode->i_sb, "block %lu > max in inode %lu",
+		ext4_warning(inode_sb(inode), "block %lu > max in inode %lu",
 			     i_block + direct_blocks +
 			     indirect_blocks + double_blocks, inode->i_ino);
 	}
@@ -145,7 +145,7 @@ static Indirect *ext4_get_branch(struct inode *inode, int depth,
 				 ext4_lblk_t  *offsets,
 				 Indirect chain[4], int *err)
 {
-	struct super_block *sb = inode->i_sb;
+	struct super_block *sb = inode_sb(inode);
 	Indirect *p = chain;
 	struct buffer_head *bh;
 	int ret = -EIO;
@@ -346,7 +346,8 @@ static int ext4_alloc_branch(handle_t *handle,
 		if (i == 0)
 			continue;
 
-		bh = branch[i].bh = sb_getblk(ar->inode->i_sb, new_blocks[i-1]);
+		bh = branch[i].bh = sb_getblk(inode_sb(ar->inode),
+					      new_blocks[i-1]);
 		if (unlikely(!bh)) {
 			err = -ENOMEM;
 			goto failed;
@@ -558,7 +559,7 @@ int ext4_ind_map_blocks(handle_t *handle, struct inode *inode,
 
 	/* Next simple case - plain lookup failed */
 	if ((flags & EXT4_GET_BLOCKS_CREATE) == 0) {
-		unsigned epb = inode->i_sb->s_blocksize / sizeof(u32);
+		unsigned epb = inode_sb(inode)->s_blocksize / sizeof(u32);
 		int i;
 
 		/* Count number blocks in a subtree under 'partial' */
@@ -578,7 +579,7 @@ int ext4_ind_map_blocks(handle_t *handle, struct inode *inode,
 	/*
 	 * Okay, we need to do block allocation.
 	*/
-	if (ext4_has_feature_bigalloc(inode->i_sb)) {
+	if (ext4_has_feature_bigalloc(inode_sb(inode))) {
 		EXT4_ERROR_INODE(inode, "Can't allocate blocks for "
 				 "non-extent mapped inodes with bigalloc");
 		return -EFSCORRUPTED;
@@ -656,7 +657,7 @@ int ext4_ind_map_blocks(handle_t *handle, struct inode *inode,
 int ext4_ind_calc_metadata_amount(struct inode *inode, sector_t lblock)
 {
 	struct ext4_inode_info *ei = EXT4_I(inode);
-	sector_t dind_mask = ~((sector_t)EXT4_ADDR_PER_BLOCK(inode->i_sb) - 1);
+	sector_t dind_mask = ~((sector_t)EXT4_ADDR_PER_BLOCK(inode_sb(inode)) - 1);
 	int blk_bits;
 
 	if (lblock < EXT4_NDIR_BLOCKS)
@@ -672,7 +673,7 @@ int ext4_ind_calc_metadata_amount(struct inode *inode, sector_t lblock)
 	ei->i_da_metadata_calc_last_lblock = lblock & dind_mask;
 	ei->i_da_metadata_calc_len = 1;
 	blk_bits = order_base_2(lblock);
-	return (blk_bits / EXT4_ADDR_PER_BLOCK_BITS(inode->i_sb)) + 1;
+	return (blk_bits / EXT4_ADDR_PER_BLOCK_BITS(inode_sb(inode))) + 1;
 }
 
 /*
@@ -683,10 +684,10 @@ int ext4_ind_trans_blocks(struct inode *inode, int nrblocks)
 {
 	/*
 	 * With N contiguous data blocks, we need at most
-	 * N/EXT4_ADDR_PER_BLOCK(inode->i_sb) + 1 indirect blocks,
+	 * N/EXT4_ADDR_PER_BLOCK(inode_sb(inode)) + 1 indirect blocks,
 	 * 2 dindirect blocks, and 1 tindirect block
 	 */
-	return DIV_ROUND_UP(nrblocks, EXT4_ADDR_PER_BLOCK(inode->i_sb)) + 4;
+	return DIV_ROUND_UP(nrblocks, EXT4_ADDR_PER_BLOCK(inode_sb(inode))) + 4;
 }
 
 /*
@@ -836,7 +837,7 @@ static int ext4_clear_blocks(handle_t *handle, struct inode *inode,
 	else if (ext4_should_journal_data(inode))
 		flags |= EXT4_FREE_BLOCKS_FORGET;
 
-	if (!ext4_data_block_valid(EXT4_SB(inode->i_sb), block_to_free,
+	if (!ext4_data_block_valid(EXT4_SB(inode_sb(inode)), block_to_free,
 				   count)) {
 		EXT4_ERROR_INODE(inode, "attempt to clear invalid "
 				 "blocks %llu len %lu",
@@ -872,7 +873,7 @@ static int ext4_clear_blocks(handle_t *handle, struct inode *inode,
 	ext4_free_blocks(handle, inode, NULL, block_to_free, count, flags);
 	return 0;
 out_err:
-	ext4_std_error(inode->i_sb, err);
+	ext4_std_error(inode_sb(inode), err);
 	return err;
 }
 
@@ -992,14 +993,14 @@ static void ext4_free_branches(handle_t *handle, struct inode *inode,
 
 	if (depth--) {
 		struct buffer_head *bh;
-		int addr_per_block = EXT4_ADDR_PER_BLOCK(inode->i_sb);
+		int addr_per_block = EXT4_ADDR_PER_BLOCK(inode_sb(inode));
 		p = last;
 		while (--p >= first) {
 			nr = le32_to_cpu(*p);
 			if (!nr)
 				continue;		/* A hole */
 
-			if (!ext4_data_block_valid(EXT4_SB(inode->i_sb),
+			if (!ext4_data_block_valid(EXT4_SB(inode_sb(inode)),
 						   nr, 1)) {
 				EXT4_ERROR_INODE(inode,
 						 "invalid indirect mapped "
@@ -1009,7 +1010,7 @@ static void ext4_free_branches(handle_t *handle, struct inode *inode,
 			}
 
 			/* Go read the buffer for the next level down */
-			bh = sb_bread(inode->i_sb, nr);
+			bh = sb_bread(inode_sb(inode), nr);
 
 			/*
 			 * A read failure? Report error and clear slot
@@ -1096,19 +1097,19 @@ void ext4_ind_truncate(handle_t *handle, struct inode *inode)
 {
 	struct ext4_inode_info *ei = EXT4_I(inode);
 	__le32 *i_data = ei->i_data;
-	int addr_per_block = EXT4_ADDR_PER_BLOCK(inode->i_sb);
+	int addr_per_block = EXT4_ADDR_PER_BLOCK(inode_sb(inode));
 	ext4_lblk_t offsets[4];
 	Indirect chain[4];
 	Indirect *partial;
 	__le32 nr = 0;
 	int n = 0;
 	ext4_lblk_t last_block, max_block;
-	unsigned blocksize = inode->i_sb->s_blocksize;
+	unsigned blocksize = inode_sb(inode)->s_blocksize;
 
 	last_block = (inode->i_size + blocksize-1)
-					>> EXT4_BLOCK_SIZE_BITS(inode->i_sb);
-	max_block = (EXT4_SB(inode->i_sb)->s_bitmap_maxbytes + blocksize-1)
-					>> EXT4_BLOCK_SIZE_BITS(inode->i_sb);
+					>> EXT4_BLOCK_SIZE_BITS(inode_sb(inode));
+	max_block = (EXT4_SB(inode_sb(inode))->s_bitmap_maxbytes + blocksize-1)
+					>> EXT4_BLOCK_SIZE_BITS(inode_sb(inode));
 
 	if (last_block != max_block) {
 		n = ext4_block_to_path(inode, last_block, offsets, NULL);
@@ -1209,17 +1210,17 @@ int ext4_ind_remove_space(handle_t *handle, struct inode *inode,
 {
 	struct ext4_inode_info *ei = EXT4_I(inode);
 	__le32 *i_data = ei->i_data;
-	int addr_per_block = EXT4_ADDR_PER_BLOCK(inode->i_sb);
+	int addr_per_block = EXT4_ADDR_PER_BLOCK(inode_sb(inode));
 	ext4_lblk_t offsets[4], offsets2[4];
 	Indirect chain[4], chain2[4];
 	Indirect *partial, *partial2;
 	ext4_lblk_t max_block;
 	__le32 nr = 0, nr2 = 0;
 	int n = 0, n2 = 0;
-	unsigned blocksize = inode->i_sb->s_blocksize;
+	unsigned blocksize = inode_sb(inode)->s_blocksize;
 
-	max_block = (EXT4_SB(inode->i_sb)->s_bitmap_maxbytes + blocksize-1)
-					>> EXT4_BLOCK_SIZE_BITS(inode->i_sb);
+	max_block = (EXT4_SB(inode_sb(inode))->s_bitmap_maxbytes + blocksize-1)
+					>> EXT4_BLOCK_SIZE_BITS(inode_sb(inode));
 	if (end >= max_block)
 		end = max_block;
 	if ((start >= end) || (start > max_block))
diff --git a/fs/ext4/inline.c b/fs/ext4/inline.c
index 70cf4c7b268a..efd245dccae1 100644
--- a/fs/ext4/inline.c
+++ b/fs/ext4/inline.c
@@ -34,7 +34,7 @@ static int get_max_inline_xattr_value_size(struct inode *inode,
 	struct ext4_inode *raw_inode;
 	int free, min_offs;
 
-	min_offs = EXT4_SB(inode->i_sb)->s_inode_size -
+	min_offs = EXT4_SB(inode_sb(inode))->s_inode_size -
 			EXT4_GOOD_OLD_INODE_SIZE -
 			EXT4_I(inode)->i_extra_isize -
 			sizeof(struct ext4_xattr_ibody_header);
@@ -209,7 +209,7 @@ static void ext4_write_inline_data(struct inode *inode, struct ext4_iloc *iloc,
 	struct ext4_inode *raw_inode;
 	int cp_len = 0;
 
-	if (unlikely(ext4_forced_shutdown(EXT4_SB(inode->i_sb))))
+	if (unlikely(ext4_forced_shutdown(EXT4_SB(inode_sb(inode)))))
 		return;
 
 	BUG_ON(!EXT4_I(inode)->i_inline_off);
@@ -432,7 +432,7 @@ static int ext4_destroy_inline_data_nolock(handle_t *handle,
 	memset((void *)ext4_raw_inode(&is.iloc)->i_block,
 		0, EXT4_MIN_INLINE_DATA_SIZE);
 
-	if (ext4_has_feature_extents(inode->i_sb)) {
+	if (ext4_has_feature_extents(inode_sb(inode))) {
 		if (S_ISDIR(inode->i_mode) ||
 		    S_ISREG(inode->i_mode) || S_ISLNK(inode->i_mode)) {
 			ext4_set_inode_flag(inode, EXT4_INODE_EXTENTS);
@@ -466,7 +466,8 @@ static int ext4_read_inline_page(struct inode *inode, struct page *page)
 	BUG_ON(page->index);
 
 	if (!EXT4_I(inode)->i_inline_off) {
-		ext4_warning(inode->i_sb, "inode %lu doesn't have inline data.",
+		ext4_warning(inode_sb(inode),
+			     "inode %lu doesn't have inline data.",
 			     inode->i_ino);
 		goto out;
 	}
@@ -611,7 +612,7 @@ static int ext4_convert_inline_data_to_extent(struct address_space *mapping,
 			ext4_orphan_del(NULL, inode);
 	}
 
-	if (ret == -ENOSPC && ext4_should_retry_alloc(inode->i_sb, &retries))
+	if (ret == -ENOSPC && ext4_should_retry_alloc(inode_sb(inode), &retries))
 		goto retry;
 
 	if (page)
@@ -728,7 +729,7 @@ int ext4_write_inline_data_end(struct inode *inode, loff_t pos, unsigned len,
 
 	ret = ext4_get_inode_loc(inode, &iloc);
 	if (ret) {
-		ext4_std_error(inode->i_sb, ret);
+		ext4_std_error(inode_sb(inode), ret);
 		copied = 0;
 		goto out;
 	}
@@ -760,7 +761,7 @@ ext4_journalled_write_inline_data(struct inode *inode,
 
 	ret = ext4_get_inode_loc(inode, &iloc);
 	if (ret) {
-		ext4_std_error(inode->i_sb, ret);
+		ext4_std_error(inode_sb(inode), ret);
 		return NULL;
 	}
 
@@ -886,7 +887,7 @@ int ext4_da_write_inline_data_begin(struct address_space *mapping,
 							    fsdata);
 		ext4_journal_stop(handle);
 		if (ret == -ENOSPC &&
-		    ext4_should_retry_alloc(inode->i_sb, &retries))
+		    ext4_should_retry_alloc(inode_sb(inode), &retries))
 			goto retry_journal;
 		goto out;
 	}
@@ -1128,27 +1129,27 @@ static int ext4_finish_convert_inline_dir(handle_t *handle,
 	 */
 	de = (struct ext4_dir_entry_2 *)target;
 	de = ext4_init_dot_dotdot(inode, de,
-		inode->i_sb->s_blocksize, csum_size,
+		inode_sb(inode)->s_blocksize, csum_size,
 		le32_to_cpu(((struct ext4_dir_entry_2 *)buf)->inode), 1);
 	header_size = (void *)de - target;
 
 	memcpy((void *)de, buf + EXT4_INLINE_DOTDOT_SIZE,
 		inline_size - EXT4_INLINE_DOTDOT_SIZE);
 
-	if (ext4_has_metadata_csum(inode->i_sb))
+	if (ext4_has_metadata_csum(inode_sb(inode)))
 		csum_size = sizeof(struct ext4_dir_entry_tail);
 
-	inode->i_size = inode->i_sb->s_blocksize;
-	i_size_write(inode, inode->i_sb->s_blocksize);
-	EXT4_I(inode)->i_disksize = inode->i_sb->s_blocksize;
+	inode->i_size = inode_sb(inode)->s_blocksize;
+	i_size_write(inode, inode_sb(inode)->s_blocksize);
+	EXT4_I(inode)->i_disksize = inode_sb(inode)->s_blocksize;
 	ext4_update_final_de(dir_block->b_data,
 			inline_size - EXT4_INLINE_DOTDOT_SIZE + header_size,
-			inode->i_sb->s_blocksize - csum_size);
+			inode_sb(inode)->s_blocksize - csum_size);
 
 	if (csum_size) {
 		t = EXT4_DIRENT_TAIL(dir_block->b_data,
-				     inode->i_sb->s_blocksize);
-		initialize_dirent_tail(t, inode->i_sb->s_blocksize);
+				     inode_sb(inode)->s_blocksize);
+		initialize_dirent_tail(t, inode_sb(inode)->s_blocksize);
 	}
 	set_buffer_uptodate(dir_block);
 	err = ext4_handle_dirty_dirent_node(handle, inode, dir_block);
@@ -1206,7 +1207,7 @@ static int ext4_convert_inline_data_nolock(handle_t *handle,
 		goto out_restore;
 	}
 
-	data_bh = sb_getblk(inode->i_sb, map.m_pblk);
+	data_bh = sb_getblk(inode_sb(inode), map.m_pblk);
 	if (!data_bh) {
 		error = -ENOMEM;
 		goto out_restore;
@@ -1219,7 +1220,7 @@ static int ext4_convert_inline_data_nolock(handle_t *handle,
 		error = -EIO;
 		goto out_restore;
 	}
-	memset(data_bh->b_data, 0, inode->i_sb->s_blocksize);
+	memset(data_bh->b_data, 0, inode_sb(inode)->s_blocksize);
 
 	if (!S_ISDIR(inode->i_mode)) {
 		memcpy(data_bh->b_data, buf, inline_size);
@@ -1370,7 +1371,7 @@ int htree_inlinedir_to_tree(struct file *dir_file,
 			fake.rec_len = ext4_rec_len_to_disk(
 						EXT4_DIR_REC_LEN(fake.name_len),
 						inline_size);
-			ext4_set_de_type(inode->i_sb, &fake, S_IFDIR);
+			ext4_set_de_type(inode_sb(inode), &fake, S_IFDIR);
 			de = &fake;
 			pos = EXT4_INLINE_DOTDOT_OFFSET;
 		} else if (pos == EXT4_INLINE_DOTDOT_OFFSET) {
@@ -1380,7 +1381,7 @@ int htree_inlinedir_to_tree(struct file *dir_file,
 			fake.rec_len = ext4_rec_len_to_disk(
 						EXT4_DIR_REC_LEN(fake.name_len),
 						inline_size);
-			ext4_set_de_type(inode->i_sb, &fake, S_IFDIR);
+			ext4_set_de_type(inode_sb(inode), &fake, S_IFDIR);
 			de = &fake;
 			pos = EXT4_INLINE_DOTDOT_SIZE;
 		} else {
@@ -1465,7 +1466,7 @@ int ext4_read_inline_dir(struct file *file,
 		goto out;
 
 	ret = 0;
-	sb = inode->i_sb;
+	sb = inode_sb(inode);
 	parent_ino = le32_to_cpu(((struct ext4_dir_entry_2 *)dir_buf)->inode);
 	offset = ctx->pos;
 
@@ -1706,7 +1707,7 @@ int ext4_delete_inline_entry(handle_t *handle,
 		err = ext4_mark_inode_dirty(handle, dir);
 	brelse(iloc.bh);
 	if (err != -ENOENT)
-		ext4_std_error(dir->i_sb, err);
+		ext4_std_error(inode_sb(dir), err);
 	return err;
 }
 
@@ -1763,7 +1764,7 @@ bool empty_inline_dir(struct inode *dir, int *has_inline_data)
 
 	de = (struct ext4_dir_entry_2 *)ext4_raw_inode(&iloc)->i_block;
 	if (!le32_to_cpu(de->inode)) {
-		ext4_warning(dir->i_sb,
+		ext4_warning(inode_sb(dir),
 			     "bad inline directory (dir #%lu) - no `..'",
 			     dir->i_ino);
 		ret = true;
@@ -1777,7 +1778,7 @@ bool empty_inline_dir(struct inode *dir, int *has_inline_data)
 		if (ext4_check_dir_entry(dir, NULL, de,
 					 iloc.bh, inline_pos,
 					 inline_size, offset)) {
-			ext4_warning(dir->i_sb,
+			ext4_warning(inode_sb(dir),
 				     "bad inline directory (dir #%lu) - "
 				     "inode %u, rec_len %u, name_len %d"
 				     "inline size %d",
@@ -1825,7 +1826,7 @@ int ext4_inline_data_iomap(struct inode *inode, struct iomap *iomap)
 	if (error)
 		goto out;
 
-	addr = (__u64)iloc.bh->b_blocknr << inode->i_sb->s_blocksize_bits;
+	addr = (__u64)iloc.bh->b_blocknr << inode_sb(inode)->s_blocksize_bits;
 	addr += (char *)ext4_raw_inode(&iloc) - iloc.bh->b_data;
 	addr += offsetof(struct ext4_inode, i_block);
 
@@ -1871,7 +1872,7 @@ int ext4_inline_data_fiemap(struct inode *inode,
 	if (error)
 		goto out;
 
-	physical = (__u64)iloc.bh->b_blocknr << inode->i_sb->s_blocksize_bits;
+	physical = (__u64)iloc.bh->b_blocknr << inode_sb(inode)->s_blocksize_bits;
 	physical += (char *)ext4_raw_inode(&iloc) - iloc.bh->b_data;
 	physical += offsetof(struct ext4_inode, i_block);
 
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index c94780075b04..89e91fec7cc9 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -53,7 +53,7 @@
 static __u32 ext4_inode_csum(struct inode *inode, struct ext4_inode *raw,
 			      struct ext4_inode_info *ei)
 {
-	struct ext4_sb_info *sbi = EXT4_SB(inode->i_sb);
+	struct ext4_sb_info *sbi = EXT4_SB(inode_sb(inode));
 	__u32 csum;
 	__u16 dummy_csum = 0;
 	int offset = offsetof(struct ext4_inode, i_checksum_lo);
@@ -65,7 +65,7 @@ static __u32 ext4_inode_csum(struct inode *inode, struct ext4_inode *raw,
 	csum = ext4_chksum(sbi, csum, (__u8 *)raw + offset,
 			   EXT4_GOOD_OLD_INODE_SIZE - offset);
 
-	if (EXT4_INODE_SIZE(inode->i_sb) > EXT4_GOOD_OLD_INODE_SIZE) {
+	if (EXT4_INODE_SIZE(inode_sb(inode)) > EXT4_GOOD_OLD_INODE_SIZE) {
 		offset = offsetof(struct ext4_inode, i_checksum_hi);
 		csum = ext4_chksum(sbi, csum, (__u8 *)raw +
 				   EXT4_GOOD_OLD_INODE_SIZE,
@@ -76,7 +76,7 @@ static __u32 ext4_inode_csum(struct inode *inode, struct ext4_inode *raw,
 			offset += csum_size;
 		}
 		csum = ext4_chksum(sbi, csum, (__u8 *)raw + offset,
-				   EXT4_INODE_SIZE(inode->i_sb) - offset);
+				   EXT4_INODE_SIZE(inode_sb(inode)) - offset);
 	}
 
 	return csum;
@@ -87,14 +87,14 @@ static int ext4_inode_csum_verify(struct inode *inode, struct ext4_inode *raw,
 {
 	__u32 provided, calculated;
 
-	if (EXT4_SB(inode->i_sb)->s_es->s_creator_os !=
+	if (EXT4_SB(inode_sb(inode))->s_es->s_creator_os !=
 	    cpu_to_le32(EXT4_OS_LINUX) ||
-	    !ext4_has_metadata_csum(inode->i_sb))
+	    !ext4_has_metadata_csum(inode_sb(inode)))
 		return 1;
 
 	provided = le16_to_cpu(raw->i_checksum_lo);
 	calculated = ext4_inode_csum(inode, raw, ei);
-	if (EXT4_INODE_SIZE(inode->i_sb) > EXT4_GOOD_OLD_INODE_SIZE &&
+	if (EXT4_INODE_SIZE(inode_sb(inode)) > EXT4_GOOD_OLD_INODE_SIZE &&
 	    EXT4_FITS_IN_INODE(raw, ei, i_checksum_hi))
 		provided |= ((__u32)le16_to_cpu(raw->i_checksum_hi)) << 16;
 	else
@@ -108,14 +108,14 @@ static void ext4_inode_csum_set(struct inode *inode, struct ext4_inode *raw,
 {
 	__u32 csum;
 
-	if (EXT4_SB(inode->i_sb)->s_es->s_creator_os !=
+	if (EXT4_SB(inode_sb(inode))->s_es->s_creator_os !=
 	    cpu_to_le32(EXT4_OS_LINUX) ||
-	    !ext4_has_metadata_csum(inode->i_sb))
+	    !ext4_has_metadata_csum(inode_sb(inode)))
 		return;
 
 	csum = ext4_inode_csum(inode, raw, ei);
 	raw->i_checksum_lo = cpu_to_le16(csum & 0xFFFF);
-	if (EXT4_INODE_SIZE(inode->i_sb) > EXT4_GOOD_OLD_INODE_SIZE &&
+	if (EXT4_INODE_SIZE(inode_sb(inode)) > EXT4_GOOD_OLD_INODE_SIZE &&
 	    EXT4_FITS_IN_INODE(raw, ei, i_checksum_hi))
 		raw->i_checksum_hi = cpu_to_le16(csum >> 16);
 }
@@ -152,7 +152,7 @@ int ext4_inode_is_fast_symlink(struct inode *inode)
 {
 	if (!(EXT4_I(inode)->i_flags & EXT4_EA_INODE_FL)) {
 		int ea_blocks = EXT4_I(inode)->i_file_acl ?
-				EXT4_CLUSTER_SIZE(inode->i_sb) >> 9 : 0;
+				EXT4_CLUSTER_SIZE(inode_sb(inode)) >> 9 : 0;
 
 		if (ext4_has_inline_data(inode))
 			return 0;
@@ -224,7 +224,7 @@ void ext4_evict_inode(struct inode *inode)
 		    ext4_should_journal_data(inode) &&
 		    (S_ISLNK(inode->i_mode) || S_ISREG(inode->i_mode)) &&
 		    inode->i_data.nrpages) {
-			journal_t *journal = EXT4_SB(inode->i_sb)->s_journal;
+			journal_t *journal = EXT4_SB(inode_sb(inode))->s_journal;
 			tid_t commit_tid = EXT4_I(inode)->i_datasync_tid;
 
 			jbd2_complete_transaction(journal, commit_tid);
@@ -247,22 +247,22 @@ void ext4_evict_inode(struct inode *inode)
 	 * Protect us against freezing - iput() caller didn't have to have any
 	 * protection against it
 	 */
-	sb_start_intwrite(inode->i_sb);
+	sb_start_intwrite(inode_sb(inode));
 
 	if (!IS_NOQUOTA(inode))
-		extra_credits += EXT4_MAXQUOTAS_DEL_BLOCKS(inode->i_sb);
+		extra_credits += EXT4_MAXQUOTAS_DEL_BLOCKS(inode_sb(inode));
 
 	handle = ext4_journal_start(inode, EXT4_HT_TRUNCATE,
 				 ext4_blocks_for_truncate(inode)+extra_credits);
 	if (IS_ERR(handle)) {
-		ext4_std_error(inode->i_sb, PTR_ERR(handle));
+		ext4_std_error(inode_sb(inode), PTR_ERR(handle));
 		/*
 		 * If we're going to skip the normal cleanup, we still need to
 		 * make sure that the in-core orphan linked list is properly
 		 * cleaned up.
 		 */
 		ext4_orphan_del(NULL, inode);
-		sb_end_intwrite(inode->i_sb);
+		sb_end_intwrite(inode_sb(inode));
 		goto no_delete;
 	}
 
@@ -281,14 +281,14 @@ void ext4_evict_inode(struct inode *inode)
 	inode->i_size = 0;
 	err = ext4_mark_inode_dirty(handle, inode);
 	if (err) {
-		ext4_warning(inode->i_sb,
+		ext4_warning(inode_sb(inode),
 			     "couldn't mark inode dirty (err %d)", err);
 		goto stop_handle;
 	}
 	if (inode->i_blocks) {
 		err = ext4_truncate(inode);
 		if (err) {
-			ext4_error(inode->i_sb,
+			ext4_error(inode_sb(inode),
 				   "couldn't truncate inode %lu (err %d)",
 				   inode->i_ino, err);
 			goto stop_handle;
@@ -299,11 +299,11 @@ void ext4_evict_inode(struct inode *inode)
 	err = ext4_xattr_delete_inode(handle, inode, &ea_inode_array,
 				      extra_credits);
 	if (err) {
-		ext4_warning(inode->i_sb, "xattr delete (err %d)", err);
+		ext4_warning(inode_sb(inode), "xattr delete (err %d)", err);
 stop_handle:
 		ext4_journal_stop(handle);
 		ext4_orphan_del(NULL, inode);
-		sb_end_intwrite(inode->i_sb);
+		sb_end_intwrite(inode_sb(inode));
 		ext4_xattr_inode_array_free(ea_inode_array);
 		goto no_delete;
 	}
@@ -332,7 +332,7 @@ void ext4_evict_inode(struct inode *inode)
 	else
 		ext4_free_inode(handle, inode);
 	ext4_journal_stop(handle);
-	sb_end_intwrite(inode->i_sb);
+	sb_end_intwrite(inode_sb(inode));
 	ext4_xattr_inode_array_free(ea_inode_array);
 	return;
 no_delete:
@@ -353,16 +353,16 @@ qsize_t *ext4_get_reserved_space(struct inode *inode)
 void ext4_da_update_reserve_space(struct inode *inode,
 					int used, int quota_claim)
 {
-	struct ext4_sb_info *sbi = EXT4_SB(inode->i_sb);
+	struct ext4_sb_info *sbi = EXT4_SB(inode_sb(inode));
 	struct ext4_inode_info *ei = EXT4_I(inode);
 
 	spin_lock(&ei->i_block_reservation_lock);
 	trace_ext4_da_update_reserve_space(inode, used, quota_claim);
 	if (unlikely(used > ei->i_reserved_data_blocks)) {
-		ext4_warning(inode->i_sb, "%s: ino %lu, used %d "
-			 "with only %d reserved data blocks",
-			 __func__, inode->i_ino, used,
-			 ei->i_reserved_data_blocks);
+		ext4_warning(inode_sb(inode), "%s: ino %lu, used %d "
+		             "with only %d reserved data blocks",
+		             __func__, inode->i_ino, used,
+		             ei->i_reserved_data_blocks);
 		WARN_ON(1);
 		used = ei->i_reserved_data_blocks;
 	}
@@ -399,7 +399,7 @@ static int __check_block_validity(struct inode *inode, const char *func,
 				unsigned int line,
 				struct ext4_map_blocks *map)
 {
-	if (!ext4_data_block_valid(EXT4_SB(inode->i_sb), map->m_pblk,
+	if (!ext4_data_block_valid(EXT4_SB(inode_sb(inode)), map->m_pblk,
 				   map->m_len)) {
 		ext4_error_inode(inode, func, line, map->m_pblk,
 				 "lblock %lu mapped to illegal pblock "
@@ -418,7 +418,7 @@ int ext4_issue_zeroout(struct inode *inode, ext4_lblk_t lblk, ext4_fsblk_t pblk,
 	if (ext4_encrypted_inode(inode))
 		return fscrypt_zeroout_range(inode, lblk, pblk, len);
 
-	ret = sb_issue_zeroout(inode->i_sb, pblk, len, GFP_NOFS);
+	ret = sb_issue_zeroout(inode_sb(inode), pblk, len, GFP_NOFS);
 	if (ret > 0)
 		ret = 0;
 
@@ -566,7 +566,7 @@ int ext4_map_blocks(handle_t *handle, struct inode *inode,
 		unsigned int status;
 
 		if (unlikely(retval != map->m_len)) {
-			ext4_warning(inode->i_sb,
+			ext4_warning(inode_sb(inode),
 				     "ES len assertion failed for inode "
 				     "%lu: retval %d != map->m_len %d",
 				     inode->i_ino, retval, map->m_len);
@@ -661,7 +661,7 @@ int ext4_map_blocks(handle_t *handle, struct inode *inode,
 		unsigned int status;
 
 		if (unlikely(retval != map->m_len)) {
-			ext4_warning(inode->i_sb,
+			ext4_warning(inode_sb(inode),
 				     "ES len assertion failed for inode "
 				     "%lu: retval %d != map->m_len %d",
 				     inode->i_ino, retval, map->m_len);
@@ -678,7 +678,8 @@ int ext4_map_blocks(handle_t *handle, struct inode *inode,
 		if (flags & EXT4_GET_BLOCKS_ZERO &&
 		    map->m_flags & EXT4_MAP_MAPPED &&
 		    map->m_flags & EXT4_MAP_NEW) {
-			clean_bdev_aliases(inode->i_sb->s_bdev, map->m_pblk,
+			clean_bdev_aliases(inode_sb(inode)->s_bdev,
+					   map->m_pblk,
 					   map->m_len);
 			ret = ext4_issue_zeroout(inode, map->m_lblk,
 						 map->m_pblk, map->m_len);
@@ -783,13 +784,13 @@ static int _ext4_get_block(struct inode *inode, sector_t iblock,
 	ret = ext4_map_blocks(ext4_journal_current_handle(), inode, &map,
 			      flags);
 	if (ret > 0) {
-		map_bh(bh, inode->i_sb, map.m_pblk);
+		map_bh(bh, inode_sb(inode), map.m_pblk);
 		ext4_update_bh_state(bh, map.m_flags);
-		bh->b_size = inode->i_sb->s_blocksize * map.m_len;
+		bh->b_size = inode_sb(inode)->s_blocksize * map.m_len;
 		ret = 0;
 	} else if (ret == 0) {
 		/* hole case, need to fill in bh->b_size */
-		bh->b_size = inode->i_sb->s_blocksize * map.m_len;
+		bh->b_size = inode_sb(inode)->s_blocksize * map.m_len;
 	}
 	return ret;
 }
@@ -844,7 +845,7 @@ static int ext4_get_block_trans(struct inode *inode, sector_t iblock,
 	ret = _ext4_get_block(inode, iblock, bh_result, flags);
 	ext4_journal_stop(handle);
 
-	if (ret == -ENOSPC && ext4_should_retry_alloc(inode->i_sb, &retries))
+	if (ret == -ENOSPC && ext4_should_retry_alloc(inode_sb(inode), &retries))
 		goto retry;
 	return ret;
 }
@@ -970,7 +971,7 @@ struct buffer_head *ext4_getblk(handle_t *handle, struct inode *inode,
 	if (err < 0)
 		return ERR_PTR(err);
 
-	bh = sb_getblk(inode->i_sb, map.m_pblk);
+	bh = sb_getblk(inode_sb(inode), map.m_pblk);
 	if (unlikely(!bh))
 		return ERR_PTR(-ENOMEM);
 	if (map.m_flags & EXT4_MAP_NEW) {
@@ -992,7 +993,7 @@ struct buffer_head *ext4_getblk(handle_t *handle, struct inode *inode,
 			goto errout;
 		}
 		if (!buffer_uptodate(bh)) {
-			memset(bh->b_data, 0, inode->i_sb->s_blocksize);
+			memset(bh->b_data, 0, inode_sb(inode)->s_blocksize);
 			set_buffer_uptodate(bh);
 		}
 		unlock_buffer(bh);
@@ -1160,7 +1161,7 @@ static int ext4_block_write_begin(struct page *page, loff_t pos, unsigned len,
 	unsigned block_start, block_end;
 	sector_t block;
 	int err = 0;
-	unsigned blocksize = inode->i_sb->s_blocksize;
+	unsigned blocksize = inode_sb(inode)->s_blocksize;
 	unsigned bbits;
 	struct buffer_head *bh, *head, *wait[2], **wait_bh = wait;
 	bool decrypt = false;
@@ -1250,7 +1251,7 @@ static int ext4_write_begin(struct file *file, struct address_space *mapping,
 	pgoff_t index;
 	unsigned from, to;
 
-	if (unlikely(ext4_forced_shutdown(EXT4_SB(inode->i_sb))))
+	if (unlikely(ext4_forced_shutdown(EXT4_SB(inode_sb(inode)))))
 		return -EIO;
 
 	trace_ext4_write_begin(inode, pos, len, flags);
@@ -1350,7 +1351,7 @@ static int ext4_write_begin(struct file *file, struct address_space *mapping,
 		}
 
 		if (ret == -ENOSPC &&
-		    ext4_should_retry_alloc(inode->i_sb, &retries))
+		    ext4_should_retry_alloc(inode_sb(inode), &retries))
 			goto retry_journal;
 		put_page(page);
 		return ret;
@@ -1567,7 +1568,7 @@ static int ext4_journalled_write_end(struct file *file,
  */
 static int ext4_da_reserve_space(struct inode *inode)
 {
-	struct ext4_sb_info *sbi = EXT4_SB(inode->i_sb);
+	struct ext4_sb_info *sbi = EXT4_SB(inode_sb(inode));
 	struct ext4_inode_info *ei = EXT4_I(inode);
 	int ret;
 
@@ -1595,7 +1596,7 @@ static int ext4_da_reserve_space(struct inode *inode)
 
 static void ext4_da_release_space(struct inode *inode, int to_free)
 {
-	struct ext4_sb_info *sbi = EXT4_SB(inode->i_sb);
+	struct ext4_sb_info *sbi = EXT4_SB(inode_sb(inode));
 	struct ext4_inode_info *ei = EXT4_I(inode);
 
 	if (!to_free)
@@ -1611,10 +1612,10 @@ static void ext4_da_release_space(struct inode *inode, int to_free)
 		 * function is called from invalidate page, it's
 		 * harmless to return without any action.
 		 */
-		ext4_warning(inode->i_sb, "ext4_da_release_space: "
-			 "ino %lu, to_free %d with only %d reserved "
-			 "data blocks", inode->i_ino, to_free,
-			 ei->i_reserved_data_blocks);
+		ext4_warning(inode_sb(inode), "ext4_da_release_space: "
+			     "ino %lu, to_free %d with only %d reserved "
+			     "data blocks", inode->i_ino, to_free,
+			     ei->i_reserved_data_blocks);
 		WARN_ON(1);
 		to_free = ei->i_reserved_data_blocks;
 	}
@@ -1636,7 +1637,7 @@ static void ext4_da_page_release_reservation(struct page *page,
 	struct buffer_head *head, *bh;
 	unsigned int curr_off = 0;
 	struct inode *inode = page->mapping->host;
-	struct ext4_sb_info *sbi = EXT4_SB(inode->i_sb);
+	struct ext4_sb_info *sbi = EXT4_SB(inode_sb(inode));
 	unsigned int stop = offset + length;
 	int num_clusters;
 	ext4_fsblk_t lblk;
@@ -1753,12 +1754,12 @@ static void mpage_release_unused_pages(struct mpage_da_data *mpd,
 
 static void ext4_print_free_blocks(struct inode *inode)
 {
-	struct ext4_sb_info *sbi = EXT4_SB(inode->i_sb);
-	struct super_block *sb = inode->i_sb;
+	struct ext4_sb_info *sbi = EXT4_SB(inode_sb(inode));
+	struct super_block *sb = inode_sb(inode);
 	struct ext4_inode_info *ei = EXT4_I(inode);
 
 	ext4_msg(sb, KERN_CRIT, "Total free blocks count %lld",
-	       EXT4_C2B(EXT4_SB(inode->i_sb),
+	       EXT4_C2B(EXT4_SB(inode_sb(inode)),
 			ext4_count_free_clusters(sb)));
 	ext4_msg(sb, KERN_CRIT, "Free/Dirty block details");
 	ext4_msg(sb, KERN_CRIT, "free_blocks=%lld",
@@ -1797,7 +1798,7 @@ static int ext4_da_map_blocks(struct inode *inode, sector_t iblock,
 	memcpy(&orig_map, map, sizeof(*map));
 #endif
 
-	if (invalid_block < ext4_blocks_count(EXT4_SB(inode->i_sb)->s_es))
+	if (invalid_block < ext4_blocks_count(EXT4_SB(inode_sb(inode))->s_es))
 		invalid_block = ~0;
 
 	map->m_flags = 0;
@@ -1818,7 +1819,7 @@ static int ext4_da_map_blocks(struct inode *inode, sector_t iblock,
 		 * So we need to check it.
 		 */
 		if (ext4_es_is_delayed(&es) && !ext4_es_is_unwritten(&es)) {
-			map_bh(bh, inode->i_sb, invalid_block);
+			map_bh(bh, inode_sb(inode), invalid_block);
 			set_buffer_new(bh);
 			set_buffer_delay(bh);
 			return 0;
@@ -1866,7 +1867,7 @@ static int ext4_da_map_blocks(struct inode *inode, sector_t iblock,
 		 * then we don't need to reserve it again. However we still need
 		 * to reserve metadata for every block we're going to write.
 		 */
-		if (EXT4_SB(inode->i_sb)->s_cluster_ratio == 1 ||
+		if (EXT4_SB(inode_sb(inode))->s_cluster_ratio == 1 ||
 		    !ext4_find_delalloc_cluster(inode, map->m_lblk)) {
 			ret = ext4_da_reserve_space(inode);
 			if (ret) {
@@ -1883,7 +1884,7 @@ static int ext4_da_map_blocks(struct inode *inode, sector_t iblock,
 			goto out_unlock;
 		}
 
-		map_bh(bh, inode->i_sb, invalid_block);
+		map_bh(bh, inode_sb(inode), invalid_block);
 		set_buffer_new(bh);
 		set_buffer_delay(bh);
 	} else if (retval > 0) {
@@ -1891,7 +1892,7 @@ static int ext4_da_map_blocks(struct inode *inode, sector_t iblock,
 		unsigned int status;
 
 		if (unlikely(retval != map->m_len)) {
-			ext4_warning(inode->i_sb,
+			ext4_warning(inode_sb(inode),
 				     "ES len assertion failed for inode "
 				     "%lu: retval %d != map->m_len %d",
 				     inode->i_ino, retval, map->m_len);
@@ -1931,7 +1932,7 @@ int ext4_da_get_block_prep(struct inode *inode, sector_t iblock,
 	int ret = 0;
 
 	BUG_ON(create == 0);
-	BUG_ON(bh->b_size != inode->i_sb->s_blocksize);
+	BUG_ON(bh->b_size != inode_sb(inode)->s_blocksize);
 
 	map.m_lblk = iblock;
 	map.m_len = 1;
@@ -1945,7 +1946,7 @@ int ext4_da_get_block_prep(struct inode *inode, sector_t iblock,
 	if (ret <= 0)
 		return ret;
 
-	map_bh(bh, inode->i_sb, map.m_pblk);
+	map_bh(bh, inode_sb(inode), map.m_pblk);
 	ext4_update_bh_state(bh, map.m_flags);
 
 	if (buffer_unwritten(bh)) {
@@ -2110,7 +2111,7 @@ static int ext4_writepage(struct page *page,
 	struct ext4_io_submit io_submit;
 	bool keep_towrite = false;
 
-	if (unlikely(ext4_forced_shutdown(EXT4_SB(inode->i_sb)))) {
+	if (unlikely(ext4_forced_shutdown(EXT4_SB(inode_sb(inode))))) {
 		ext4_invalidatepage(page, 0, PAGE_SIZE);
 		unlock_page(page);
 		return -EIO;
@@ -2145,7 +2146,7 @@ static int ext4_writepage(struct page *page,
 				   ext4_bh_delay_or_unwritten)) {
 		redirty_page_for_writepage(wbc, page);
 		if ((current->flags & PF_MEMALLOC) ||
-		    (inode->i_sb->s_blocksize == PAGE_SIZE)) {
+		    (inode_sb(inode)->s_blocksize == PAGE_SIZE)) {
 			/*
 			 * For memory cleaning there's no point in writing only
 			 * some buffers. So just bail out. Warn if we came here
@@ -2463,7 +2464,7 @@ static int mpage_map_one_extent(handle_t *handle, struct mpage_da_data *mpd)
 
 	BUG_ON(map->m_len == 0);
 	if (map->m_flags & EXT4_MAP_NEW) {
-		clean_bdev_aliases(inode->i_sb->s_bdev, map->m_pblk,
+		clean_bdev_aliases(inode_sb(inode)->s_bdev, map->m_pblk,
 				   map->m_len);
 	}
 	return 0;
@@ -2504,7 +2505,7 @@ static int mpage_map_and_submit_extent(handle_t *handle,
 	do {
 		err = mpage_map_one_extent(handle, mpd);
 		if (err < 0) {
-			struct super_block *sb = inode->i_sb;
+			struct super_block *sb = inode_sb(inode);
 
 			if (ext4_forced_shutdown(EXT4_SB(sb)) ||
 			    EXT4_SB(sb)->s_mount_flags & EXT4_MF_FS_ABORTED)
@@ -2565,7 +2566,7 @@ static int mpage_map_and_submit_extent(handle_t *handle,
 		up_write(&EXT4_I(inode)->i_data_sem);
 		err2 = ext4_mark_inode_dirty(handle, inode);
 		if (err2)
-			ext4_error(inode->i_sb,
+			ext4_error(inode_sb(inode),
 				   "Failed to mark inode %lu dirty",
 				   inode->i_ino);
 		if (!err)
@@ -2714,19 +2715,20 @@ static int ext4_writepages(struct address_space *mapping,
 	struct mpage_da_data mpd;
 	struct inode *inode = mapping->host;
 	int needed_blocks, rsv_blocks = 0, ret = 0;
-	struct ext4_sb_info *sbi = EXT4_SB(mapping->host->i_sb);
+	struct ext4_sb_info *sbi = EXT4_SB(inode_sb(mapping->host));
 	bool done;
 	struct blk_plug plug;
 	bool give_up_on_write = false;
 
-	if (unlikely(ext4_forced_shutdown(EXT4_SB(inode->i_sb))))
+	if (unlikely(ext4_forced_shutdown(EXT4_SB(inode_sb(inode)))))
 		return -EIO;
 
 	percpu_down_read(&sbi->s_journal_flag_rwsem);
 	trace_ext4_writepages(inode, wbc);
 
 	if (dax_mapping(mapping)) {
-		ret = dax_writeback_mapping_range(mapping, inode->i_sb->s_bdev,
+		ret = dax_writeback_mapping_range(mapping,
+						  inode_sb(inode)->s_bdev,
 						  wbc);
 		goto out_writepages;
 	}
@@ -2758,7 +2760,7 @@ static int ext4_writepages(struct address_space *mapping,
 	 * *never* be called, so if that ever happens, we would want
 	 * the stack trace.
 	 */
-	if (unlikely(ext4_forced_shutdown(EXT4_SB(mapping->host->i_sb)) ||
+	if (unlikely(ext4_forced_shutdown(EXT4_SB(inode_sb(mapping->host))) ||
 		     sbi->s_mount_flags & EXT4_MF_FS_ABORTED)) {
 		ret = -EROFS;
 		goto out_writepages;
@@ -2858,9 +2860,10 @@ static int ext4_writepages(struct address_space *mapping,
 				EXT4_HT_WRITE_PAGE, needed_blocks, rsv_blocks);
 		if (IS_ERR(handle)) {
 			ret = PTR_ERR(handle);
-			ext4_msg(inode->i_sb, KERN_CRIT, "%s: jbd2_start: "
-			       "%ld pages, ino %lu; err %d", __func__,
-				wbc->nr_to_write, inode->i_ino, ret);
+			ext4_msg(inode_sb(inode), KERN_CRIT,
+				 "%s: jbd2_start: "
+				 "%ld pages, ino %lu; err %d", __func__,
+				 wbc->nr_to_write, inode->i_ino, ret);
 			/* Release allocated io_end */
 			ext4_put_io_end(mpd.io_submit.io_end);
 			mpd.io_submit.io_end = NULL;
@@ -2992,7 +2995,7 @@ static int ext4_nonda_switch(struct super_block *sb)
 /* We always reserve for an inode update; the superblock could be there too */
 static int ext4_da_write_credits(struct inode *inode, loff_t pos, unsigned len)
 {
-	if (likely(ext4_has_feature_large_file(inode->i_sb)))
+	if (likely(ext4_has_feature_large_file(inode_sb(inode))))
 		return 1;
 
 	if (pos + len <= 0x7fffffffULL)
@@ -3012,12 +3015,12 @@ static int ext4_da_write_begin(struct file *file, struct address_space *mapping,
 	struct inode *inode = mapping->host;
 	handle_t *handle;
 
-	if (unlikely(ext4_forced_shutdown(EXT4_SB(inode->i_sb))))
+	if (unlikely(ext4_forced_shutdown(EXT4_SB(inode_sb(inode)))))
 		return -EIO;
 
 	index = pos >> PAGE_SHIFT;
 
-	if (ext4_nonda_switch(inode->i_sb) ||
+	if (ext4_nonda_switch(inode_sb(inode)) ||
 	    S_ISLNK(inode->i_mode)) {
 		*fsdata = (void *)FALL_BACK_TO_NONDELALLOC;
 		return ext4_write_begin(file, mapping, pos,
@@ -3092,7 +3095,7 @@ static int ext4_da_write_begin(struct file *file, struct address_space *mapping,
 			ext4_truncate_failed_write(inode);
 
 		if (ret == -ENOSPC &&
-		    ext4_should_retry_alloc(inode->i_sb, &retries))
+		    ext4_should_retry_alloc(inode_sb(inode), &retries))
 			goto retry_journal;
 
 		put_page(page);
@@ -3272,7 +3275,7 @@ static sector_t ext4_bmap(struct address_space *mapping, sector_t block)
 		return 0;
 
 	if (mapping_tagged(mapping, PAGECACHE_TAG_DIRTY) &&
-			test_opt(inode->i_sb, DELALLOC)) {
+			test_opt(inode_sb(inode), DELALLOC)) {
 		/*
 		 * With delalloc we want to sync the file
 		 * so that we can make sure we allocate
@@ -3396,7 +3399,7 @@ static int ext4_releasepage(struct page *page, gfp_t wait)
 
 static bool ext4_inode_datasync_dirty(struct inode *inode)
 {
-	journal_t *journal = EXT4_SB(inode->i_sb)->s_journal;
+	journal_t *journal = EXT4_SB(inode_sb(inode))->s_journal;
 
 	if (journal)
 		return !jbd2_transaction_committed(journal,
@@ -3410,7 +3413,7 @@ static bool ext4_inode_datasync_dirty(struct inode *inode)
 static int ext4_iomap_begin(struct inode *inode, loff_t offset, loff_t length,
 			    unsigned flags, struct iomap *iomap)
 {
-	struct ext4_sb_info *sbi = EXT4_SB(inode->i_sb);
+	struct ext4_sb_info *sbi = EXT4_SB(inode_sb(inode));
 	unsigned int blkbits = inode->i_blkbits;
 	unsigned long first_block = offset >> blkbits;
 	unsigned long last_block = (offset + length - 1) >> blkbits;
@@ -3488,7 +3491,7 @@ static int ext4_iomap_begin(struct inode *inode, loff_t offset, loff_t length,
 		if (ret < 0) {
 			ext4_journal_stop(handle);
 			if (ret == -ENOSPC &&
-			    ext4_should_retry_alloc(inode->i_sb, &retries))
+			    ext4_should_retry_alloc(inode_sb(inode), &retries))
 				goto retry;
 			return ret;
 		}
@@ -3522,7 +3525,7 @@ static int ext4_iomap_begin(struct inode *inode, loff_t offset, loff_t length,
 	iomap->flags = 0;
 	if (ext4_inode_datasync_dirty(inode))
 		iomap->flags |= IOMAP_F_DIRTY;
-	iomap->bdev = inode->i_sb->s_bdev;
+	iomap->bdev = inode_sb(inode)->s_bdev;
 	iomap->dax_dev = sbi->s_daxdev;
 	iomap->offset = first_block << blkbits;
 	iomap->length = (u64)map.m_len << blkbits;
@@ -3735,7 +3738,7 @@ static ssize_t ext4_direct_IO_write(struct kiocb *iocb, struct iov_iter *iter)
 		get_block_func = ext4_dio_get_block_unwritten_async;
 		dio_flags = DIO_LOCKING;
 	}
-	ret = __blockdev_direct_IO(iocb, inode, inode->i_sb->s_bdev, iter,
+	ret = __blockdev_direct_IO(iocb, inode, inode_sb(inode)->s_bdev, iter,
 				   get_block_func, ext4_end_io_dio, NULL,
 				   dio_flags);
 
@@ -3827,7 +3830,7 @@ static ssize_t ext4_direct_IO_read(struct kiocb *iocb, struct iov_iter *iter)
 					   iocb->ki_pos + count - 1);
 	if (ret)
 		goto out_unlock;
-	ret = __blockdev_direct_IO(iocb, inode, inode->i_sb->s_bdev,
+	ret = __blockdev_direct_IO(iocb, inode, inode_sb(inode)->s_bdev,
 				   iter, ext4_dio_get_block, NULL, NULL, 0);
 out_unlock:
 	inode_unlock_shared(inode);
@@ -3958,7 +3961,7 @@ void ext4_set_aops(struct inode *inode)
 	default:
 		BUG();
 	}
-	if (test_opt(inode->i_sb, DELALLOC))
+	if (test_opt(inode_sb(inode), DELALLOC))
 		inode->i_mapping->a_ops = &ext4_da_aops;
 	else
 		inode->i_mapping->a_ops = &ext4_aops;
@@ -3981,9 +3984,9 @@ static int __ext4_block_zero_page_range(handle_t *handle,
 	if (!page)
 		return -ENOMEM;
 
-	blocksize = inode->i_sb->s_blocksize;
+	blocksize = inode_sb(inode)->s_blocksize;
 
-	iblock = index << (PAGE_SHIFT - inode->i_sb->s_blocksize_bits);
+	iblock = index << (PAGE_SHIFT - inode_sb(inode)->s_blocksize_bits);
 
 	if (!page_has_buffers(page))
 		create_empty_buffers(page, blocksize, 0);
@@ -4066,7 +4069,7 @@ static int ext4_block_zero_page_range(handle_t *handle,
 {
 	struct inode *inode = mapping->host;
 	unsigned offset = from & (PAGE_SIZE-1);
-	unsigned blocksize = inode->i_sb->s_blocksize;
+	unsigned blocksize = inode_sb(inode)->s_blocksize;
 	unsigned max = blocksize - (offset & (blocksize - 1));
 
 	/*
@@ -4101,7 +4104,7 @@ static int ext4_block_truncate_page(handle_t *handle,
 	if (ext4_encrypted_inode(inode) && !fscrypt_has_encryption_key(inode))
 		return 0;
 
-	blocksize = inode->i_sb->s_blocksize;
+	blocksize = inode_sb(inode)->s_blocksize;
 	length = blocksize - (offset & (blocksize - 1));
 
 	return ext4_block_zero_page_range(handle, mapping, from, length);
@@ -4110,7 +4113,7 @@ static int ext4_block_truncate_page(handle_t *handle,
 int ext4_zero_partial_blocks(handle_t *handle, struct inode *inode,
 			     loff_t lstart, loff_t length)
 {
-	struct super_block *sb = inode->i_sb;
+	struct super_block *sb = inode_sb(inode);
 	struct address_space *mapping = inode->i_mapping;
 	unsigned partial_start, partial_end;
 	ext4_fsblk_t start, end;
@@ -4198,7 +4201,7 @@ int ext4_update_disksize_before_punch(struct inode *inode, loff_t offset,
 
 int ext4_punch_hole(struct inode *inode, loff_t offset, loff_t length)
 {
-	struct super_block *sb = inode->i_sb;
+	struct super_block *sb = inode_sb(inode);
 	ext4_lblk_t first_block, stop_block;
 	struct address_space *mapping = inode->i_mapping;
 	loff_t first_block_offset, last_block_offset;
@@ -4335,7 +4338,7 @@ int ext4_inode_attach_jinode(struct inode *inode)
 	struct ext4_inode_info *ei = EXT4_I(inode);
 	struct jbd2_inode *jinode;
 
-	if (ei->jinode || !EXT4_SB(inode->i_sb)->s_journal)
+	if (ei->jinode || !EXT4_SB(inode_sb(inode))->s_journal)
 		return 0;
 
 	jinode = jbd2_alloc_inode(GFP_KERNEL);
@@ -4405,7 +4408,7 @@ int ext4_truncate(struct inode *inode)
 
 	ext4_clear_inode_flag(inode, EXT4_INODE_EOFBLOCKS);
 
-	if (inode->i_size == 0 && !test_opt(inode->i_sb, NO_AUTO_DA_ALLOC))
+	if (inode->i_size == 0 && !test_opt(inode_sb(inode), NO_AUTO_DA_ALLOC))
 		ext4_set_inode_state(inode, EXT4_STATE_DA_ALLOC_CLOSE);
 
 	if (ext4_has_inline_data(inode)) {
@@ -4419,7 +4422,7 @@ int ext4_truncate(struct inode *inode)
 	}
 
 	/* If we zero-out tail of the page, we have to create jinode for jbd2 */
-	if (inode->i_size & (inode->i_sb->s_blocksize - 1)) {
+	if (inode->i_size & (inode_sb(inode)->s_blocksize - 1)) {
 		if (ext4_inode_attach_jinode(inode) < 0)
 			return 0;
 	}
@@ -4433,7 +4436,7 @@ int ext4_truncate(struct inode *inode)
 	if (IS_ERR(handle))
 		return PTR_ERR(handle);
 
-	if (inode->i_size & (inode->i_sb->s_blocksize - 1))
+	if (inode->i_size & (inode_sb(inode)->s_blocksize - 1))
 		ext4_block_truncate_page(handle, mapping, inode->i_size);
 
 	/*
@@ -4495,7 +4498,7 @@ static int __ext4_get_inode_loc(struct inode *inode,
 {
 	struct ext4_group_desc	*gdp;
 	struct buffer_head	*bh;
-	struct super_block	*sb = inode->i_sb;
+	struct super_block	*sb = inode_sb(inode);
 	ext4_fsblk_t		block;
 	int			inodes_per_block, inode_offset;
 
@@ -4636,7 +4639,7 @@ int ext4_get_inode_loc(struct inode *inode, struct ext4_iloc *iloc)
 
 static bool ext4_should_use_dax(struct inode *inode)
 {
-	if (!test_opt(inode->i_sb, DAX))
+	if (!test_opt(inode_sb(inode), DAX))
 		return false;
 	if (!S_ISREG(inode->i_mode))
 		return false;
@@ -4678,7 +4681,7 @@ static blkcnt_t ext4_inode_blocks(struct ext4_inode *raw_inode,
 {
 	blkcnt_t i_blocks ;
 	struct inode *inode = &(ei->vfs_inode);
-	struct super_block *sb = inode->i_sb;
+	struct super_block *sb = inode_sb(inode);
 
 	if (ext4_has_feature_huge_file(sb)) {
 		/* we are using combined 48 bit field */
@@ -4702,7 +4705,7 @@ static inline void ext4_iget_extra_inode(struct inode *inode,
 	__le32 *magic = (void *)raw_inode +
 			EXT4_GOOD_OLD_INODE_SIZE + ei->i_extra_isize;
 	if (EXT4_GOOD_OLD_INODE_SIZE + ei->i_extra_isize + sizeof(__le32) <=
-	    EXT4_INODE_SIZE(inode->i_sb) &&
+	    EXT4_INODE_SIZE(inode_sb(inode)) &&
 	    *magic == cpu_to_le32(EXT4_XATTR_MAGIC)) {
 		ext4_set_inode_state(inode, EXT4_STATE_XATTR);
 		ext4_find_inline_data_nolock(inode);
@@ -4712,7 +4715,7 @@ static inline void ext4_iget_extra_inode(struct inode *inode,
 
 int ext4_get_projid(struct inode *inode, kprojid_t *projid)
 {
-	if (!ext4_has_feature_project(inode->i_sb))
+	if (!ext4_has_feature_project(inode_sb(inode)))
 		return -EOPNOTSUPP;
 	*projid = EXT4_I(inode)->i_projid;
 	return 0;
@@ -4746,15 +4749,15 @@ struct inode *ext4_iget(struct super_block *sb, unsigned long ino)
 		goto bad_inode;
 	raw_inode = ext4_raw_inode(&iloc);
 
-	if (EXT4_INODE_SIZE(inode->i_sb) > EXT4_GOOD_OLD_INODE_SIZE) {
+	if (EXT4_INODE_SIZE(inode_sb(inode)) > EXT4_GOOD_OLD_INODE_SIZE) {
 		ei->i_extra_isize = le16_to_cpu(raw_inode->i_extra_isize);
 		if (EXT4_GOOD_OLD_INODE_SIZE + ei->i_extra_isize >
-			EXT4_INODE_SIZE(inode->i_sb) ||
-		    (ei->i_extra_isize & 3)) {
+			EXT4_INODE_SIZE(inode_sb(inode)) ||
+			(ei->i_extra_isize & 3)) {
 			EXT4_ERROR_INODE(inode,
 					 "bad extra_isize %u (inode size %u)",
 					 ei->i_extra_isize,
-					 EXT4_INODE_SIZE(inode->i_sb));
+					 EXT4_INODE_SIZE(inode_sb(inode)));
 			ret = -EFSCORRUPTED;
 			goto bad_inode;
 		}
@@ -4763,7 +4766,7 @@ struct inode *ext4_iget(struct super_block *sb, unsigned long ino)
 
 	/* Precompute checksum seed for inode metadata */
 	if (ext4_has_metadata_csum(sb)) {
-		struct ext4_sb_info *sbi = EXT4_SB(inode->i_sb);
+		struct ext4_sb_info *sbi = EXT4_SB(inode_sb(inode));
 		__u32 csum;
 		__le32 inum = cpu_to_le32(inode->i_ino);
 		__le32 gen = raw_inode->i_generation;
@@ -4789,7 +4792,7 @@ struct inode *ext4_iget(struct super_block *sb, unsigned long ino)
 	else
 		i_projid = EXT4_DEF_PROJID;
 
-	if (!(test_opt(inode->i_sb, NO_UID32))) {
+	if (!(test_opt(inode_sb(inode), NO_UID32))) {
 		i_uid |= le16_to_cpu(raw_inode->i_uid_high) << 16;
 		i_gid |= le16_to_cpu(raw_inode->i_gid_high) << 16;
 	}
@@ -4809,7 +4812,7 @@ struct inode *ext4_iget(struct super_block *sb, unsigned long ino)
 	 */
 	if (inode->i_nlink == 0) {
 		if ((inode->i_mode == 0 ||
-		     !(EXT4_SB(inode->i_sb)->s_mount_state & EXT4_ORPHAN_FS)) &&
+		     !(EXT4_SB(inode_sb(inode))->s_mount_state & EXT4_ORPHAN_FS)) &&
 		    ino != EXT4_BOOT_LOADER_INO) {
 			/* this inode is deleted */
 			ret = -ESTALE;
@@ -4874,7 +4877,7 @@ struct inode *ext4_iget(struct super_block *sb, unsigned long ino)
 		ei->i_datasync_tid = tid;
 	}
 
-	if (EXT4_INODE_SIZE(inode->i_sb) > EXT4_GOOD_OLD_INODE_SIZE) {
+	if (EXT4_INODE_SIZE(inode_sb(inode)) > EXT4_GOOD_OLD_INODE_SIZE) {
 		if (ei->i_extra_isize == 0) {
 			/* The extra space is currently unused. Use it. */
 			BUILD_BUG_ON(sizeof(struct ext4_inode) & 3);
@@ -4890,10 +4893,10 @@ struct inode *ext4_iget(struct super_block *sb, unsigned long ino)
 	EXT4_INODE_GET_XTIME(i_atime, inode, raw_inode);
 	EXT4_EINODE_GET_XTIME(i_crtime, ei, raw_inode);
 
-	if (likely(!test_opt2(inode->i_sb, HURD_COMPAT))) {
+	if (likely(!test_opt2(inode_sb(inode), HURD_COMPAT))) {
 		u64 ivers = le32_to_cpu(raw_inode->i_disk_version);
 
-		if (EXT4_INODE_SIZE(inode->i_sb) > EXT4_GOOD_OLD_INODE_SIZE) {
+		if (EXT4_INODE_SIZE(inode_sb(inode)) > EXT4_GOOD_OLD_INODE_SIZE) {
 			if (EXT4_FITS_IN_INODE(raw_inode, ei, i_version_hi))
 				ivers |=
 		    (__u64)(le32_to_cpu(raw_inode->i_version_hi)) << 32;
@@ -4987,7 +4990,7 @@ static int ext4_inode_blocks_set(handle_t *handle,
 {
 	struct inode *inode = &(ei->vfs_inode);
 	u64 i_blocks = inode->i_blocks;
-	struct super_block *sb = inode->i_sb;
+	struct super_block *sb = inode_sb(inode);
 
 	if (i_blocks <= ~0U) {
 		/*
@@ -5098,7 +5101,7 @@ static int ext4_do_update_inode(handle_t *handle,
 	struct ext4_inode *raw_inode = ext4_raw_inode(iloc);
 	struct ext4_inode_info *ei = EXT4_I(inode);
 	struct buffer_head *bh = iloc->bh;
-	struct super_block *sb = inode->i_sb;
+	struct super_block *sb = inode_sb(inode);
 	int err = 0, rc, block;
 	int need_datasync = 0, set_large_file = 0;
 	uid_t i_uid;
@@ -5110,13 +5113,13 @@ static int ext4_do_update_inode(handle_t *handle,
 	/* For fields not tracked in the in-memory inode,
 	 * initialise them to zero for new inodes. */
 	if (ext4_test_inode_state(inode, EXT4_STATE_NEW))
-		memset(raw_inode, 0, EXT4_SB(inode->i_sb)->s_inode_size);
+		memset(raw_inode, 0, EXT4_SB(inode_sb(inode))->s_inode_size);
 
 	raw_inode->i_mode = cpu_to_le16(inode->i_mode);
 	i_uid = i_uid_read(inode);
 	i_gid = i_gid_read(inode);
 	i_projid = from_kprojid(&init_user_ns, ei->i_projid);
-	if (!(test_opt(inode->i_sb, NO_UID32))) {
+	if (!(test_opt(inode_sb(inode), NO_UID32))) {
 		raw_inode->i_uid_low = cpu_to_le16(low_16_bits(i_uid));
 		raw_inode->i_gid_low = cpu_to_le16(low_16_bits(i_gid));
 /*
@@ -5152,11 +5155,11 @@ static int ext4_do_update_inode(handle_t *handle,
 	}
 	raw_inode->i_dtime = cpu_to_le32(ei->i_dtime);
 	raw_inode->i_flags = cpu_to_le32(ei->i_flags & 0xFFFFFFFF);
-	if (likely(!test_opt2(inode->i_sb, HURD_COMPAT)))
+	if (likely(!test_opt2(inode_sb(inode), HURD_COMPAT)))
 		raw_inode->i_file_acl_high =
 			cpu_to_le16(ei->i_file_acl >> 32);
 	raw_inode->i_file_acl_lo = cpu_to_le32(ei->i_file_acl);
-	if (ei->i_disksize != ext4_isize(inode->i_sb, raw_inode)) {
+	if (ei->i_disksize != ext4_isize(inode_sb(inode), raw_inode)) {
 		ext4_isize_set(raw_inode, ei->i_disksize);
 		need_datasync = 1;
 	}
@@ -5183,7 +5186,7 @@ static int ext4_do_update_inode(handle_t *handle,
 			raw_inode->i_block[block] = ei->i_data[block];
 	}
 
-	if (likely(!test_opt2(inode->i_sb, HURD_COMPAT))) {
+	if (likely(!test_opt2(inode_sb(inode), HURD_COMPAT))) {
 		u64 ivers = inode_peek_iversion(inode);
 
 		raw_inode->i_disk_version = cpu_to_le32(ivers);
@@ -5196,17 +5199,17 @@ static int ext4_do_update_inode(handle_t *handle,
 		}
 	}
 
-	BUG_ON(!ext4_has_feature_project(inode->i_sb) &&
+	BUG_ON(!ext4_has_feature_project(inode_sb(inode)) &&
 	       i_projid != EXT4_DEF_PROJID);
 
-	if (EXT4_INODE_SIZE(inode->i_sb) > EXT4_GOOD_OLD_INODE_SIZE &&
+	if (EXT4_INODE_SIZE(inode_sb(inode)) > EXT4_GOOD_OLD_INODE_SIZE &&
 	    EXT4_FITS_IN_INODE(raw_inode, ei, i_projid))
 		raw_inode->i_projid = cpu_to_le32(i_projid);
 
 	ext4_inode_csum_set(inode, raw_inode, ei);
 	spin_unlock(&ei->i_raw_lock);
-	if (inode->i_sb->s_flags & SB_LAZYTIME)
-		ext4_update_other_inodes_time(inode->i_sb, inode->i_ino,
+	if (inode_sb(inode)->s_flags & SB_LAZYTIME)
+		ext4_update_other_inodes_time(inode_sb(inode), inode->i_ino,
 					      bh->b_data);
 
 	BUFFER_TRACE(bh, "call ext4_handle_dirty_metadata");
@@ -5227,7 +5230,7 @@ static int ext4_do_update_inode(handle_t *handle,
 	ext4_update_inode_fsync_trans(handle, inode, need_datasync);
 out_brelse:
 	brelse(bh);
-	ext4_std_error(inode->i_sb, err);
+	ext4_std_error(inode_sb(inode), err);
 	return err;
 }
 
@@ -5272,7 +5275,7 @@ int ext4_write_inode(struct inode *inode, struct writeback_control *wbc)
 	if (WARN_ON_ONCE(current->flags & PF_MEMALLOC))
 		return 0;
 
-	if (EXT4_SB(inode->i_sb)->s_journal) {
+	if (EXT4_SB(inode_sb(inode))->s_journal) {
 		if (ext4_journal_current_handle()) {
 			jbd_debug(1, "called recursively, non-PF_MEMALLOC!\n");
 			dump_stack();
@@ -5287,7 +5290,7 @@ int ext4_write_inode(struct inode *inode, struct writeback_control *wbc)
 		if (wbc->sync_mode != WB_SYNC_ALL || wbc->for_sync)
 			return 0;
 
-		err = ext4_force_commit(inode->i_sb);
+		err = ext4_force_commit(inode_sb(inode));
 	} else {
 		struct ext4_iloc iloc;
 
@@ -5319,7 +5322,7 @@ static void ext4_wait_for_tail_page_commit(struct inode *inode)
 {
 	struct page *page;
 	unsigned offset;
-	journal_t *journal = EXT4_SB(inode->i_sb)->s_journal;
+	journal_t *journal = EXT4_SB(inode_sb(inode))->s_journal;
 	tid_t commit_tid = 0;
 	int ret;
 
@@ -5383,7 +5386,7 @@ int ext4_setattr(struct dentry *dentry, struct iattr *attr)
 	int orphan = 0;
 	const unsigned int ia_valid = attr->ia_valid;
 
-	if (unlikely(ext4_forced_shutdown(EXT4_SB(inode->i_sb))))
+	if (unlikely(ext4_forced_shutdown(EXT4_SB(inode_sb(inode)))))
 		return -EIO;
 
 	error = setattr_prepare(dentry, attr);
@@ -5406,8 +5409,8 @@ int ext4_setattr(struct dentry *dentry, struct iattr *attr)
 		/* (user+group)*(old+new) structure, inode write (sb,
 		 * inode block, ? - but truncate inode update has it) */
 		handle = ext4_journal_start(inode, EXT4_HT_QUOTA,
-			(EXT4_MAXQUOTAS_INIT_BLOCKS(inode->i_sb) +
-			 EXT4_MAXQUOTAS_DEL_BLOCKS(inode->i_sb)) + 3);
+			(EXT4_MAXQUOTAS_INIT_BLOCKS(inode_sb(inode)) +
+			 EXT4_MAXQUOTAS_DEL_BLOCKS(inode_sb(inode))) + 3);
 		if (IS_ERR(handle)) {
 			error = PTR_ERR(handle);
 			goto err_out;
@@ -5440,7 +5443,7 @@ int ext4_setattr(struct dentry *dentry, struct iattr *attr)
 		int shrink = (attr->ia_size <= inode->i_size);
 
 		if (!(ext4_test_inode_flag(inode, EXT4_INODE_EXTENTS))) {
-			struct ext4_sb_info *sbi = EXT4_SB(inode->i_sb);
+			struct ext4_sb_info *sbi = EXT4_SB(inode_sb(inode));
 
 			if (attr->ia_size > sbi->s_bitmap_maxbytes)
 				return -EFBIG;
@@ -5542,7 +5545,7 @@ int ext4_setattr(struct dentry *dentry, struct iattr *attr)
 		rc = posix_acl_chmod(inode, inode->i_mode);
 
 err_out:
-	ext4_std_error(inode->i_sb, error);
+	ext4_std_error(inode_sb(inode), error);
 	if (!error)
 		error = rc;
 	return error;
@@ -5611,9 +5614,9 @@ int ext4_file_getattr(const struct path *path, struct kstat *stat,
 	 * will return the blocks that include the delayed allocation
 	 * blocks for this file.
 	 */
-	delalloc_blocks = EXT4_C2B(EXT4_SB(inode->i_sb),
+	delalloc_blocks = EXT4_C2B(EXT4_SB(inode_sb(inode)),
 				   EXT4_I(inode)->i_reserved_data_blocks);
-	stat->blocks += delalloc_blocks << (inode->i_sb->s_blocksize_bits - 9);
+	stat->blocks += delalloc_blocks << (inode_sb(inode)->s_blocksize_bits - 9);
 	return 0;
 }
 
@@ -5639,7 +5642,7 @@ static int ext4_index_trans_blocks(struct inode *inode, int lblocks,
 static int ext4_meta_trans_blocks(struct inode *inode, int lblocks,
 				  int pextents)
 {
-	ext4_group_t groups, ngroups = ext4_get_groups_count(inode->i_sb);
+	ext4_group_t groups, ngroups = ext4_get_groups_count(inode_sb(inode));
 	int gdpblocks;
 	int idxblocks;
 	int ret = 0;
@@ -5660,14 +5663,14 @@ static int ext4_meta_trans_blocks(struct inode *inode, int lblocks,
 	gdpblocks = groups;
 	if (groups > ngroups)
 		groups = ngroups;
-	if (groups > EXT4_SB(inode->i_sb)->s_gdb_count)
-		gdpblocks = EXT4_SB(inode->i_sb)->s_gdb_count;
+	if (groups > EXT4_SB(inode_sb(inode))->s_gdb_count)
+		gdpblocks = EXT4_SB(inode_sb(inode))->s_gdb_count;
 
 	/* bitmaps and block group descriptor blocks */
 	ret += groups + gdpblocks;
 
 	/* Blocks for super block, inode, quota and xattr blocks */
-	ret += EXT4_META_TRANS_BLOCKS(inode->i_sb);
+	ret += EXT4_META_TRANS_BLOCKS(inode_sb(inode));
 
 	return ret;
 }
@@ -5718,7 +5721,7 @@ int ext4_mark_iloc_dirty(handle_t *handle,
 {
 	int err = 0;
 
-	if (unlikely(ext4_forced_shutdown(EXT4_SB(inode->i_sb))))
+	if (unlikely(ext4_forced_shutdown(EXT4_SB(inode_sb(inode)))))
 		return -EIO;
 
 	if (IS_I_VERSION(inode))
@@ -5744,7 +5747,7 @@ ext4_reserve_inode_write(handle_t *handle, struct inode *inode,
 {
 	int err;
 
-	if (unlikely(ext4_forced_shutdown(EXT4_SB(inode->i_sb))))
+	if (unlikely(ext4_forced_shutdown(EXT4_SB(inode_sb(inode)))))
 		return -EIO;
 
 	err = ext4_get_inode_loc(inode, iloc);
@@ -5756,7 +5759,7 @@ ext4_reserve_inode_write(handle_t *handle, struct inode *inode,
 			iloc->bh = NULL;
 		}
 	}
-	ext4_std_error(inode->i_sb, err);
+	ext4_std_error(inode_sb(inode), err);
 	return err;
 }
 
@@ -5822,7 +5825,7 @@ static int ext4_try_to_expand_extra_isize(struct inode *inode,
 	 */
 	if (ext4_handle_valid(handle) &&
 	    jbd2_journal_extend(handle,
-				EXT4_DATA_TRANS_BLOCKS(inode->i_sb)) != 0)
+				EXT4_DATA_TRANS_BLOCKS(inode_sb(inode))) != 0)
 		return -ENOSPC;
 
 	if (ext4_write_trylock_xattr(inode, &no_expand) == 0)
@@ -5849,7 +5852,7 @@ int ext4_expand_extra_isize(struct inode *inode,
 	}
 
 	handle = ext4_journal_start(inode, EXT4_HT_INODE,
-				    EXT4_DATA_TRANS_BLOCKS(inode->i_sb));
+				    EXT4_DATA_TRANS_BLOCKS(inode_sb(inode)));
 	if (IS_ERR(handle)) {
 		error = PTR_ERR(handle);
 		brelse(iloc->bh);
@@ -5894,7 +5897,7 @@ int ext4_expand_extra_isize(struct inode *inode,
 int ext4_mark_inode_dirty(handle_t *handle, struct inode *inode)
 {
 	struct ext4_iloc iloc;
-	struct ext4_sb_info *sbi = EXT4_SB(inode->i_sb);
+	struct ext4_sb_info *sbi = EXT4_SB(inode_sb(inode));
 	int err;
 
 	might_sleep();
@@ -5970,7 +5973,7 @@ static int ext4_pin_inode(handle_t *handle, struct inode *inode)
 			brelse(iloc.bh);
 		}
 	}
-	ext4_std_error(inode->i_sb, err);
+	ext4_std_error(inode_sb(inode), err);
 	return err;
 }
 #endif
@@ -5980,7 +5983,7 @@ int ext4_change_inode_journal_flag(struct inode *inode, int val)
 	journal_t *journal;
 	handle_t *handle;
 	int err;
-	struct ext4_sb_info *sbi = EXT4_SB(inode->i_sb);
+	struct ext4_sb_info *sbi = EXT4_SB(inode_sb(inode));
 
 	/*
 	 * We have to be very careful here: changing a data block's
@@ -6061,7 +6064,7 @@ int ext4_change_inode_journal_flag(struct inode *inode, int val)
 	err = ext4_mark_inode_dirty(handle, inode);
 	ext4_handle_sync(handle);
 	ext4_journal_stop(handle);
-	ext4_std_error(inode->i_sb, err);
+	ext4_std_error(inode_sb(inode), err);
 
 	return err;
 }
@@ -6085,7 +6088,7 @@ int ext4_page_mkwrite(struct vm_fault *vmf)
 	get_block_t *get_block;
 	int retries = 0;
 
-	sb_start_pagefault(inode->i_sb);
+	sb_start_pagefault(inode_sb(inode));
 	file_update_time(vma->vm_file);
 
 	down_read(&EXT4_I(inode)->i_mmap_sem);
@@ -6095,14 +6098,14 @@ int ext4_page_mkwrite(struct vm_fault *vmf)
 		goto out_ret;
 
 	/* Delalloc case is easy... */
-	if (test_opt(inode->i_sb, DELALLOC) &&
+	if (test_opt(inode_sb(inode), DELALLOC) &&
 	    !ext4_should_journal_data(inode) &&
-	    !ext4_nonda_switch(inode->i_sb)) {
+	    !ext4_nonda_switch(inode_sb(inode))) {
 		do {
 			ret = block_page_mkwrite(vma, vmf,
 						   ext4_da_get_block_prep);
 		} while (ret == -ENOSPC &&
-		       ext4_should_retry_alloc(inode->i_sb, &retries));
+		       ext4_should_retry_alloc(inode_sb(inode), &retries));
 		goto out_ret;
 	}
 
@@ -6158,13 +6161,13 @@ int ext4_page_mkwrite(struct vm_fault *vmf)
 		ext4_set_inode_state(inode, EXT4_STATE_JDATA);
 	}
 	ext4_journal_stop(handle);
-	if (ret == -ENOSPC && ext4_should_retry_alloc(inode->i_sb, &retries))
+	if (ret == -ENOSPC && ext4_should_retry_alloc(inode_sb(inode), &retries))
 		goto retry_alloc;
 out_ret:
 	ret = block_page_mkwrite_return(ret);
 out:
 	up_read(&EXT4_I(inode)->i_mmap_sem);
-	sb_end_pagefault(inode->i_sb);
+	sb_end_pagefault(inode_sb(inode));
 	return ret;
 }
 
diff --git a/fs/ext4/ioctl.c b/fs/ext4/ioctl.c
index 7e99ad02f1ba..d8a9930f0ff6 100644
--- a/fs/ext4/ioctl.c
+++ b/fs/ext4/ioctl.c
@@ -166,17 +166,17 @@ static long swap_inode_boot_loader(struct super_block *sb,
 
 	err = ext4_mark_inode_dirty(handle, inode);
 	if (err < 0) {
-		ext4_warning(inode->i_sb,
-			"couldn't mark inode #%lu dirty (err %d)",
-			inode->i_ino, err);
+		ext4_warning(inode_sb(inode),
+			     "couldn't mark inode #%lu dirty (err %d)",
+			     inode->i_ino, err);
 		/* Revert all changes: */
 		swap_inode_data(inode, inode_bl);
 	} else {
 		err = ext4_mark_inode_dirty(handle, inode_bl);
 		if (err < 0) {
-			ext4_warning(inode_bl->i_sb,
-				"couldn't mark inode #%lu dirty (err %d)",
-				inode_bl->i_ino, err);
+			ext4_warning(inode_sb(inode_bl),
+				     "couldn't mark inode #%lu dirty (err %d)",
+				     inode_bl->i_ino, err);
 			/* Revert all changes: */
 			swap_inode_data(inode, inode_bl);
 			ext4_mark_inode_dirty(handle, inode);
@@ -295,7 +295,7 @@ static int ext4_ioctl_setflags(struct inode *inode,
 		 * Changes to the journaling mode can cause unsafe changes to
 		 * S_DAX if we are using the DAX mount option.
 		 */
-		if (test_opt(inode->i_sb, DAX)) {
+		if (test_opt(inode_sb(inode), DAX)) {
 			err = -EBUSY;
 			goto flags_out;
 		}
@@ -319,7 +319,7 @@ static int ext4_ioctl_setflags(struct inode *inode,
 static int ext4_ioctl_setproject(struct file *filp, __u32 projid)
 {
 	struct inode *inode = file_inode(filp);
-	struct super_block *sb = inode->i_sb;
+	struct super_block *sb = inode_sb(inode);
 	struct ext4_inode_info *ei = EXT4_I(inode);
 	int err, rc;
 	handle_t *handle;
@@ -596,7 +596,7 @@ static int ext4_ioc_getfsmap(struct super_block *sb,
 static long ext4_ioctl_group_add(struct file *file,
 				 struct ext4_new_group_data *input)
 {
-	struct super_block *sb = file_inode(file)->i_sb;
+	struct super_block *sb = inode_sb(file_inode(file));
 	int err, err2=0;
 
 	err = ext4_resize_begin(sb);
@@ -634,7 +634,7 @@ static long ext4_ioctl_group_add(struct file *file,
 long ext4_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
 {
 	struct inode *inode = file_inode(filp);
-	struct super_block *sb = inode->i_sb;
+	struct super_block *sb = inode_sb(inode);
 	struct ext4_inode_info *ei = EXT4_I(inode);
 	unsigned int flags;
 
@@ -690,7 +690,7 @@ long ext4_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
 		if (!inode_owner_or_capable(inode))
 			return -EPERM;
 
-		if (ext4_has_metadata_csum(inode->i_sb)) {
+		if (ext4_has_metadata_csum(inode_sb(inode))) {
 			ext4_warning(sb, "Setting inode version is not "
 				     "supported with metadata_csum enabled.");
 			return -ENOTTY;
@@ -995,7 +995,7 @@ long ext4_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
 		memset(&fa, 0, sizeof(struct fsxattr));
 		fa.fsx_xflags = ext4_iflags_to_xflags(ei->i_flags & EXT4_FL_USER_VISIBLE);
 
-		if (ext4_has_feature_project(inode->i_sb)) {
+		if (ext4_has_feature_project(inode_sb(inode))) {
 			fa.fsx_projid = (__u32)from_kprojid(&init_user_ns,
 				EXT4_I(inode)->i_projid);
 		}
diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c
index 769a62708b1c..051379dc75f2 100644
--- a/fs/ext4/mballoc.c
+++ b/fs/ext4/mballoc.c
@@ -822,7 +822,7 @@ static int ext4_mb_init_cache(struct page *page, char *incore, gfp_t gfp)
 	mb_debug(1, "init page %lu\n", page->index);
 
 	inode = page->mapping->host;
-	sb = inode->i_sb;
+	sb = inode_sb(inode);
 	ngroups = ext4_get_groups_count(sb);
 	blocksize = i_blocksize(inode);
 	blocks_per_page = PAGE_SIZE / blocksize;
@@ -4006,7 +4006,7 @@ ext4_mb_discard_group_preallocations(struct super_block *sb,
 void ext4_discard_preallocations(struct inode *inode)
 {
 	struct ext4_inode_info *ei = EXT4_I(inode);
-	struct super_block *sb = inode->i_sb;
+	struct super_block *sb = inode_sb(inode);
 	struct buffer_head *bitmap_bh = NULL;
 	struct ext4_prealloc_space *pa, *tmp;
 	ext4_group_t group = 0;
@@ -4233,7 +4233,7 @@ static noinline_for_stack int
 ext4_mb_initialize_context(struct ext4_allocation_context *ac,
 				struct ext4_allocation_request *ar)
 {
-	struct super_block *sb = ar->inode->i_sb;
+	struct super_block *sb = inode_sb(ar->inode);
 	struct ext4_sb_info *sbi = EXT4_SB(sb);
 	struct ext4_super_block *es = sbi->s_es;
 	ext4_group_t group;
@@ -4490,7 +4490,7 @@ ext4_fsblk_t ext4_mb_new_blocks(handle_t *handle,
 	unsigned int reserv_clstrs = 0;
 
 	might_sleep();
-	sb = ar->inode->i_sb;
+	sb = inode_sb(ar->inode);
 	sbi = EXT4_SB(sb);
 
 	trace_ext4_request_blocks(ar);
@@ -4723,7 +4723,7 @@ void ext4_free_blocks(handle_t *handle, struct inode *inode,
 		      unsigned long count, int flags)
 {
 	struct buffer_head *bitmap_bh = NULL;
-	struct super_block *sb = inode->i_sb;
+	struct super_block *sb = inode_sb(inode);
 	struct ext4_group_desc *gdp;
 	unsigned int overflow;
 	ext4_grpblk_t bit;
@@ -4800,7 +4800,8 @@ void ext4_free_blocks(handle_t *handle, struct inode *inode,
 		for (i = 0; i < count; i++) {
 			cond_resched();
 			if (is_metadata)
-				bh = sb_find_get_block(inode->i_sb, block + i);
+				bh = sb_find_get_block(inode_sb(inode),
+						       block + i);
 			ext4_forget(handle, is_metadata, inode, bh, block + i);
 		}
 	}
diff --git a/fs/ext4/migrate.c b/fs/ext4/migrate.c
index 61a9d1927817..479e3b54d5be 100644
--- a/fs/ext4/migrate.c
+++ b/fs/ext4/migrate.c
@@ -114,9 +114,9 @@ static int update_ind_extent_range(handle_t *handle, struct inode *inode,
 	struct buffer_head *bh;
 	__le32 *i_data;
 	int i, retval = 0;
-	unsigned long max_entries = inode->i_sb->s_blocksize >> 2;
+	unsigned long max_entries = inode_sb(inode)->s_blocksize >> 2;
 
-	bh = sb_bread(inode->i_sb, pblock);
+	bh = sb_bread(inode_sb(inode), pblock);
 	if (!bh)
 		return -EIO;
 
@@ -143,9 +143,9 @@ static int update_dind_extent_range(handle_t *handle, struct inode *inode,
 	struct buffer_head *bh;
 	__le32 *i_data;
 	int i, retval = 0;
-	unsigned long max_entries = inode->i_sb->s_blocksize >> 2;
+	unsigned long max_entries = inode_sb(inode)->s_blocksize >> 2;
 
-	bh = sb_bread(inode->i_sb, pblock);
+	bh = sb_bread(inode_sb(inode), pblock);
 	if (!bh)
 		return -EIO;
 
@@ -173,9 +173,9 @@ static int update_tind_extent_range(handle_t *handle, struct inode *inode,
 	struct buffer_head *bh;
 	__le32 *i_data;
 	int i, retval = 0;
-	unsigned long max_entries = inode->i_sb->s_blocksize >> 2;
+	unsigned long max_entries = inode_sb(inode)->s_blocksize >> 2;
 
-	bh = sb_bread(inode->i_sb, pblock);
+	bh = sb_bread(inode_sb(inode), pblock);
 	if (!bh)
 		return -EIO;
 
@@ -208,7 +208,7 @@ static int extend_credit_for_blkdel(handle_t *handle, struct inode *inode)
 	 * So allocate a credit of 3. We may update
 	 * quota (user and group).
 	 */
-	needed = 3 + EXT4_MAXQUOTAS_TRANS_BLOCKS(inode->i_sb);
+	needed = 3 + EXT4_MAXQUOTAS_TRANS_BLOCKS(inode_sb(inode));
 
 	if (ext4_journal_extend(handle, needed) != 0)
 		retval = ext4_journal_restart(handle, needed);
@@ -222,9 +222,9 @@ static int free_dind_blocks(handle_t *handle,
 	int i;
 	__le32 *tmp_idata;
 	struct buffer_head *bh;
-	unsigned long max_entries = inode->i_sb->s_blocksize >> 2;
+	unsigned long max_entries = inode_sb(inode)->s_blocksize >> 2;
 
-	bh = sb_bread(inode->i_sb, le32_to_cpu(i_data));
+	bh = sb_bread(inode_sb(inode), le32_to_cpu(i_data));
 	if (!bh)
 		return -EIO;
 
@@ -252,9 +252,9 @@ static int free_tind_blocks(handle_t *handle,
 	int i, retval = 0;
 	__le32 *tmp_idata;
 	struct buffer_head *bh;
-	unsigned long max_entries = inode->i_sb->s_blocksize >> 2;
+	unsigned long max_entries = inode_sb(inode)->s_blocksize >> 2;
 
-	bh = sb_bread(inode->i_sb, le32_to_cpu(i_data));
+	bh = sb_bread(inode_sb(inode), le32_to_cpu(i_data));
 	if (!bh)
 		return -EIO;
 
@@ -382,7 +382,7 @@ static int free_ext_idx(handle_t *handle, struct inode *inode,
 	struct ext4_extent_header *eh;
 
 	block = ext4_idx_pblock(ix);
-	bh = sb_bread(inode->i_sb, block);
+	bh = sb_bread(inode_sb(inode), block);
 	if (!bh)
 		return -EIO;
 
@@ -441,7 +441,7 @@ int ext4_ext_migrate(struct inode *inode)
 	 * If the filesystem does not support extents, or the inode
 	 * already is extent-based, error out.
 	 */
-	if (!ext4_has_feature_extents(inode->i_sb) ||
+	if (!ext4_has_feature_extents(inode_sb(inode)) ||
 	    (ext4_test_inode_flag(inode, EXT4_INODE_EXTENTS)))
 		return -EINVAL;
 
@@ -457,17 +457,17 @@ int ext4_ext_migrate(struct inode *inode)
 	 * need to worry about credits for modifying the quota inode.
 	 */
 	handle = ext4_journal_start(inode, EXT4_HT_MIGRATE,
-		4 + EXT4_MAXQUOTAS_TRANS_BLOCKS(inode->i_sb));
+		4 + EXT4_MAXQUOTAS_TRANS_BLOCKS(inode_sb(inode)));
 
 	if (IS_ERR(handle)) {
 		retval = PTR_ERR(handle);
 		return retval;
 	}
-	goal = (((inode->i_ino - 1) / EXT4_INODES_PER_GROUP(inode->i_sb)) *
-		EXT4_INODES_PER_GROUP(inode->i_sb)) + 1;
+	goal = (((inode->i_ino - 1) / EXT4_INODES_PER_GROUP(inode_sb(inode))) *
+		EXT4_INODES_PER_GROUP(inode_sb(inode))) + 1;
 	owner[0] = i_uid_read(inode);
 	owner[1] = i_gid_read(inode);
-	tmp_inode = ext4_new_inode(handle, d_inode(inode->i_sb->s_root),
+	tmp_inode = ext4_new_inode(handle, d_inode(inode_sb(inode)->s_root),
 				   S_IFREG, NULL, goal, owner, 0);
 	if (IS_ERR(tmp_inode)) {
 		retval = PTR_ERR(tmp_inode);
@@ -522,7 +522,7 @@ int ext4_ext_migrate(struct inode *inode)
 	memset(&lb, 0, sizeof(lb));
 
 	/* 32 bit block address 4 bytes */
-	max_entries = inode->i_sb->s_blocksize >> 2;
+	max_entries = inode_sb(inode)->s_blocksize >> 2;
 	for (i = 0; i < EXT4_NDIR_BLOCKS; i++) {
 		if (i_data[i]) {
 			retval = update_extent_range(handle, tmp_inode,
@@ -608,7 +608,7 @@ int ext4_ext_migrate(struct inode *inode)
 int ext4_ind_migrate(struct inode *inode)
 {
 	struct ext4_extent_header	*eh;
-	struct ext4_super_block		*es = EXT4_SB(inode->i_sb)->s_es;
+	struct ext4_super_block		*es = EXT4_SB(inode_sb(inode))->s_es;
 	struct ext4_inode_info		*ei = EXT4_I(inode);
 	struct ext4_extent		*ex;
 	unsigned int			i, len;
@@ -617,11 +617,11 @@ int ext4_ind_migrate(struct inode *inode)
 	handle_t			*handle;
 	int				ret;
 
-	if (!ext4_has_feature_extents(inode->i_sb) ||
+	if (!ext4_has_feature_extents(inode_sb(inode)) ||
 	    (!ext4_test_inode_flag(inode, EXT4_INODE_EXTENTS)))
 		return -EINVAL;
 
-	if (ext4_has_feature_bigalloc(inode->i_sb))
+	if (ext4_has_feature_bigalloc(inode_sb(inode)))
 		return -EOPNOTSUPP;
 
 	/*
@@ -629,7 +629,7 @@ int ext4_ind_migrate(struct inode *inode)
 	 * blocks to be allocated, otherwise delayed allocation blocks may not
 	 * be reflected and bypass the checks on extent header.
 	 */
-	if (test_opt(inode->i_sb, DELALLOC))
+	if (test_opt(inode_sb(inode), DELALLOC))
 		ext4_alloc_da_blocks(inode);
 
 	handle = ext4_journal_start(inode, EXT4_HT_MIGRATE, 1);
diff --git a/fs/ext4/move_extent.c b/fs/ext4/move_extent.c
index b96e4bd3b3ec..670ccca993a0 100644
--- a/fs/ext4/move_extent.c
+++ b/fs/ext4/move_extent.c
@@ -255,13 +255,13 @@ move_extent_per_page(struct file *o_filp, struct inode *donor_inode,
 	struct page *pagep[2] = {NULL, NULL};
 	handle_t *handle;
 	ext4_lblk_t orig_blk_offset, donor_blk_offset;
-	unsigned long blocksize = orig_inode->i_sb->s_blocksize;
+	unsigned long blocksize = inode_sb(orig_inode)->s_blocksize;
 	unsigned int tmp_data_size, data_size, replaced_size;
 	int i, err2, jblocks, retries = 0;
 	int replaced_count = 0;
 	int from = data_offset_in_page << orig_inode->i_blkbits;
 	int blocks_per_page = PAGE_SIZE >> orig_inode->i_blkbits;
-	struct super_block *sb = orig_inode->i_sb;
+	struct super_block *sb = inode_sb(orig_inode);
 	struct buffer_head *bh = NULL;
 
 	/*
@@ -558,7 +558,7 @@ ext4_move_extents(struct file *o_filp, struct file *d_filp, __u64 orig_blk,
 	ext4_lblk_t d_start = donor_blk;
 	int ret;
 
-	if (orig_inode->i_sb != donor_inode->i_sb) {
+	if (inode_sb(orig_inode) != inode_sb(donor_inode)) {
 		ext4_debug("ext4 move extent: The argument files "
 			"should be in same FS [ino:orig %lu, donor %lu]\n",
 			orig_inode->i_ino, donor_inode->i_ino);
@@ -585,14 +585,14 @@ ext4_move_extents(struct file *o_filp, struct file *d_filp, __u64 orig_blk,
 	   journaling enabled */
 	if (ext4_should_journal_data(orig_inode) ||
 	    ext4_should_journal_data(donor_inode)) {
-		ext4_msg(orig_inode->i_sb, KERN_ERR,
+		ext4_msg(inode_sb(orig_inode), KERN_ERR,
 			 "Online defrag not supported with data journaling");
 		return -EOPNOTSUPP;
 	}
 
 	if (ext4_encrypted_inode(orig_inode) ||
 	    ext4_encrypted_inode(donor_inode)) {
-		ext4_msg(orig_inode->i_sb, KERN_ERR,
+		ext4_msg(inode_sb(orig_inode), KERN_ERR,
 			 "Online defrag not supported for encrypted files");
 		return -EOPNOTSUPP;
 	}
diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c
index b1f21e3a0763..68d59adb8590 100644
--- a/fs/ext4/namei.c
+++ b/fs/ext4/namei.c
@@ -56,23 +56,23 @@ static struct buffer_head *ext4_append(handle_t *handle,
 	struct buffer_head *bh;
 	int err;
 
-	if (unlikely(EXT4_SB(inode->i_sb)->s_max_dir_size_kb &&
+	if (unlikely(EXT4_SB(inode_sb(inode))->s_max_dir_size_kb &&
 		     ((inode->i_size >> 10) >=
-		      EXT4_SB(inode->i_sb)->s_max_dir_size_kb)))
+		      EXT4_SB(inode_sb(inode))->s_max_dir_size_kb)))
 		return ERR_PTR(-ENOSPC);
 
-	*block = inode->i_size >> inode->i_sb->s_blocksize_bits;
+	*block = inode->i_size >> inode_sb(inode)->s_blocksize_bits;
 
 	bh = ext4_bread(handle, inode, *block, EXT4_GET_BLOCKS_CREATE);
 	if (IS_ERR(bh))
 		return bh;
-	inode->i_size += inode->i_sb->s_blocksize;
+	inode->i_size += inode_sb(inode)->s_blocksize;
 	EXT4_I(inode)->i_disksize = inode->i_size;
 	BUFFER_TRACE(bh, "get_write_access");
 	err = ext4_journal_get_write_access(handle, bh);
 	if (err) {
 		brelse(bh);
-		ext4_std_error(inode->i_sb, err);
+		ext4_std_error(inode_sb(inode), err);
 		return ERR_PTR(err);
 	}
 	return bh;
@@ -100,7 +100,7 @@ static struct buffer_head *__ext4_read_dirblock(struct inode *inode,
 
 	bh = ext4_bread(NULL, inode, block, 0);
 	if (IS_ERR(bh)) {
-		__ext4_warning(inode->i_sb, func, line,
+		__ext4_warning(inode_sb(inode), func, line,
 			       "inode #%lu: lblock %lu: comm %s: "
 			       "error %ld reading directory block",
 			       inode->i_ino, (unsigned long)block,
@@ -119,8 +119,8 @@ static struct buffer_head *__ext4_read_dirblock(struct inode *inode,
 		if (block == 0)
 			is_dx_block = 1;
 		else if (ext4_rec_len_from_disk(dirent->rec_len,
-						inode->i_sb->s_blocksize) ==
-			 inode->i_sb->s_blocksize)
+						inode_sb(inode)->s_blocksize) ==
+			 inode_sb(inode)->s_blocksize)
 			is_dx_block = 1;
 	}
 	if (!is_dx_block && type == INDEX) {
@@ -128,7 +128,7 @@ static struct buffer_head *__ext4_read_dirblock(struct inode *inode,
 		       "directory leaf block found instead of index block");
 		return ERR_PTR(-EFSCORRUPTED);
 	}
-	if (!ext4_has_metadata_csum(inode->i_sb) ||
+	if (!ext4_has_metadata_csum(inode_sb(inode)) ||
 	    buffer_verified(bh))
 		return bh;
 
@@ -298,8 +298,8 @@ static struct ext4_dir_entry_tail *get_dirent_tail(struct inode *inode,
 
 	d = de;
 	top = (struct ext4_dir_entry *)(((void *)de) +
-		(EXT4_BLOCK_SIZE(inode->i_sb) -
-		sizeof(struct ext4_dir_entry_tail)));
+		(EXT4_BLOCK_SIZE(inode_sb(inode)) -
+		 sizeof(struct ext4_dir_entry_tail)));
 	while (d < top && d->rec_len)
 		d = (struct ext4_dir_entry *)(((void *)d) +
 		    le16_to_cpu(d->rec_len));
@@ -309,7 +309,7 @@ static struct ext4_dir_entry_tail *get_dirent_tail(struct inode *inode,
 
 	t = (struct ext4_dir_entry_tail *)d;
 #else
-	t = EXT4_DIRENT_TAIL(de, EXT4_BLOCK_SIZE(inode->i_sb));
+	t = EXT4_DIRENT_TAIL(de, EXT4_BLOCK_SIZE(inode_sb(inode)));
 #endif
 
 	if (t->det_reserved_zero1 ||
@@ -324,7 +324,7 @@ static struct ext4_dir_entry_tail *get_dirent_tail(struct inode *inode,
 static __le32 ext4_dirent_csum(struct inode *inode,
 			       struct ext4_dir_entry *dirent, int size)
 {
-	struct ext4_sb_info *sbi = EXT4_SB(inode->i_sb);
+	struct ext4_sb_info *sbi = EXT4_SB(inode_sb(inode));
 	struct ext4_inode_info *ei = EXT4_I(inode);
 	__u32 csum;
 
@@ -346,7 +346,7 @@ int ext4_dirent_csum_verify(struct inode *inode, struct ext4_dir_entry *dirent)
 {
 	struct ext4_dir_entry_tail *t;
 
-	if (!ext4_has_metadata_csum(inode->i_sb))
+	if (!ext4_has_metadata_csum(inode_sb(inode)))
 		return 1;
 
 	t = get_dirent_tail(inode, dirent);
@@ -367,7 +367,7 @@ static void ext4_dirent_csum_set(struct inode *inode,
 {
 	struct ext4_dir_entry_tail *t;
 
-	if (!ext4_has_metadata_csum(inode->i_sb))
+	if (!ext4_has_metadata_csum(inode_sb(inode)))
 		return;
 
 	t = get_dirent_tail(inode, dirent);
@@ -396,12 +396,12 @@ static struct dx_countlimit *get_dx_countlimit(struct inode *inode,
 	struct dx_root_info *root;
 	int count_offset;
 
-	if (le16_to_cpu(dirent->rec_len) == EXT4_BLOCK_SIZE(inode->i_sb))
+	if (le16_to_cpu(dirent->rec_len) == EXT4_BLOCK_SIZE(inode_sb(inode)))
 		count_offset = 8;
 	else if (le16_to_cpu(dirent->rec_len) == 12) {
 		dp = (struct ext4_dir_entry *)(((void *)dirent) + 12);
 		if (le16_to_cpu(dp->rec_len) !=
-		    EXT4_BLOCK_SIZE(inode->i_sb) - 12)
+		    EXT4_BLOCK_SIZE(inode_sb(inode)) - 12)
 			return NULL;
 		root = (struct dx_root_info *)(((void *)dp + 12));
 		if (root->reserved_zero ||
@@ -419,7 +419,7 @@ static struct dx_countlimit *get_dx_countlimit(struct inode *inode,
 static __le32 ext4_dx_csum(struct inode *inode, struct ext4_dir_entry *dirent,
 			   int count_offset, int count, struct dx_tail *t)
 {
-	struct ext4_sb_info *sbi = EXT4_SB(inode->i_sb);
+	struct ext4_sb_info *sbi = EXT4_SB(inode_sb(inode));
 	struct ext4_inode_info *ei = EXT4_I(inode);
 	__u32 csum;
 	int size;
@@ -441,7 +441,7 @@ static int ext4_dx_csum_verify(struct inode *inode,
 	struct dx_tail *t;
 	int count_offset, limit, count;
 
-	if (!ext4_has_metadata_csum(inode->i_sb))
+	if (!ext4_has_metadata_csum(inode_sb(inode)))
 		return 1;
 
 	c = get_dx_countlimit(inode, dirent, &count_offset);
@@ -452,7 +452,7 @@ static int ext4_dx_csum_verify(struct inode *inode,
 	limit = le16_to_cpu(c->limit);
 	count = le16_to_cpu(c->count);
 	if (count_offset + (limit * sizeof(struct dx_entry)) >
-	    EXT4_BLOCK_SIZE(inode->i_sb) - sizeof(struct dx_tail)) {
+	    EXT4_BLOCK_SIZE(inode_sb(inode)) - sizeof(struct dx_tail)) {
 		warn_no_space_for_csum(inode);
 		return 0;
 	}
@@ -470,7 +470,7 @@ static void ext4_dx_csum_set(struct inode *inode, struct ext4_dir_entry *dirent)
 	struct dx_tail *t;
 	int count_offset, limit, count;
 
-	if (!ext4_has_metadata_csum(inode->i_sb))
+	if (!ext4_has_metadata_csum(inode_sb(inode)))
 		return;
 
 	c = get_dx_countlimit(inode, dirent, &count_offset);
@@ -481,7 +481,7 @@ static void ext4_dx_csum_set(struct inode *inode, struct ext4_dir_entry *dirent)
 	limit = le16_to_cpu(c->limit);
 	count = le16_to_cpu(c->count);
 	if (count_offset + (limit * sizeof(struct dx_entry)) >
-	    EXT4_BLOCK_SIZE(inode->i_sb) - sizeof(struct dx_tail)) {
+	    EXT4_BLOCK_SIZE(inode_sb(inode)) - sizeof(struct dx_tail)) {
 		warn_no_space_for_csum(inode);
 		return;
 	}
@@ -555,19 +555,19 @@ static inline void dx_set_limit(struct dx_entry *entries, unsigned value)
 
 static inline unsigned dx_root_limit(struct inode *dir, unsigned infosize)
 {
-	unsigned entry_space = dir->i_sb->s_blocksize - EXT4_DIR_REC_LEN(1) -
+	unsigned entry_space = inode_sb(dir)->s_blocksize - EXT4_DIR_REC_LEN(1) -
 		EXT4_DIR_REC_LEN(2) - infosize;
 
-	if (ext4_has_metadata_csum(dir->i_sb))
+	if (ext4_has_metadata_csum(inode_sb(dir)))
 		entry_space -= sizeof(struct dx_tail);
 	return entry_space / sizeof(struct dx_entry);
 }
 
 static inline unsigned dx_node_limit(struct inode *dir)
 {
-	unsigned entry_space = dir->i_sb->s_blocksize - EXT4_DIR_REC_LEN(0);
+	unsigned entry_space = inode_sb(dir)->s_blocksize - EXT4_DIR_REC_LEN(0);
 
-	if (ext4_has_metadata_csum(dir->i_sb))
+	if (ext4_has_metadata_csum(inode_sb(dir)))
 		entry_space -= sizeof(struct dx_tail);
 	return entry_space / sizeof(struct dx_entry);
 }
@@ -689,7 +689,7 @@ static struct stats dx_show_leaf(struct inode *dir,
 struct stats dx_show_entries(struct dx_hash_info *hinfo, struct inode *dir,
 			     struct dx_entry *entries, int levels)
 {
-	unsigned blocksize = dir->i_sb->s_blocksize;
+	unsigned blocksize = inode_sb(dir)->s_blocksize;
 	unsigned count = dx_get_count(entries), names = 0, space = 0, i;
 	unsigned bcount = 0;
 	struct buffer_head *bh;
@@ -758,8 +758,8 @@ dx_probe(struct ext4_filename *fname, struct inode *dir,
 		hinfo = &fname->hinfo;
 	hinfo->hash_version = root->info.hash_version;
 	if (hinfo->hash_version <= DX_HASH_TEA)
-		hinfo->hash_version += EXT4_SB(dir->i_sb)->s_hash_unsigned;
-	hinfo->seed = EXT4_SB(dir->i_sb)->s_hash_seed;
+		hinfo->hash_version += EXT4_SB(inode_sb(dir))->s_hash_unsigned;
+	hinfo->seed = EXT4_SB(inode_sb(dir))->s_hash_seed;
 	if (fname && fname_name(fname))
 		ext4fs_dirhash(fname_name(fname), fname_len(fname), hinfo);
 	hash = hinfo->hash;
@@ -771,13 +771,13 @@ dx_probe(struct ext4_filename *fname, struct inode *dir,
 	}
 
 	indirect = root->info.indirect_levels;
-	if (indirect >= ext4_dir_htree_level(dir->i_sb)) {
-		ext4_warning(dir->i_sb,
+	if (indirect >= ext4_dir_htree_level(inode_sb(dir))) {
+		ext4_warning(inode_sb(dir),
 			     "Directory (ino: %lu) htree depth %#06x exceed"
 			     "supported value", dir->i_ino,
-			     ext4_dir_htree_level(dir->i_sb));
-		if (ext4_dir_htree_level(dir->i_sb) < EXT4_HTREE_LEVEL) {
-			ext4_warning(dir->i_sb, "Enable large directory "
+			     ext4_dir_htree_level(inode_sb(dir)));
+		if (ext4_dir_htree_level(inode_sb(dir)) < EXT4_HTREE_LEVEL) {
+			ext4_warning(inode_sb(dir), "Enable large directory "
 						"feature to access it");
 		}
 		goto fail;
@@ -981,7 +981,7 @@ static int htree_dirblock_to_tree(struct file *dir_file,
 
 	de = (struct ext4_dir_entry_2 *) bh->b_data;
 	top = (struct ext4_dir_entry_2 *) ((char *) de +
-					   dir->i_sb->s_blocksize -
+					   inode_sb(dir)->s_blocksize -
 					   EXT4_DIR_REC_LEN(0));
 #ifdef CONFIG_EXT4_FS_ENCRYPTION
 	/* Check if the directory is encrypted */
@@ -999,11 +999,11 @@ static int htree_dirblock_to_tree(struct file *dir_file,
 		}
 	}
 #endif
-	for (; de < top; de = ext4_next_entry(de, dir->i_sb->s_blocksize)) {
+	for (; de < top; de = ext4_next_entry(de, inode_sb(dir)->s_blocksize)) {
 		if (ext4_check_dir_entry(dir, NULL, de, bh,
 				bh->b_data, bh->b_size,
-				(block<<EXT4_BLOCK_SIZE_BITS(dir->i_sb))
-					 + ((char *)de - bh->b_data))) {
+				(block<<EXT4_BLOCK_SIZE_BITS(inode_sb(dir)))
+				+ ((char *)de - bh->b_data))) {
 			/* silently ignore the rest of the block */
 			break;
 		}
@@ -1078,11 +1078,11 @@ int ext4_htree_fill_tree(struct file *dir_file, __u32 start_hash,
 		       start_hash, start_minor_hash));
 	dir = file_inode(dir_file);
 	if (!(ext4_test_inode_flag(dir, EXT4_INODE_INDEX))) {
-		hinfo.hash_version = EXT4_SB(dir->i_sb)->s_def_hash_version;
+		hinfo.hash_version = EXT4_SB(inode_sb(dir))->s_def_hash_version;
 		if (hinfo.hash_version <= DX_HASH_TEA)
 			hinfo.hash_version +=
-				EXT4_SB(dir->i_sb)->s_hash_unsigned;
-		hinfo.seed = EXT4_SB(dir->i_sb)->s_hash_seed;
+				EXT4_SB(inode_sb(dir))->s_hash_unsigned;
+		hinfo.seed = EXT4_SB(inode_sb(dir))->s_hash_seed;
 		if (ext4_has_inline_data(dir)) {
 			int has_inline_data = 1;
 			count = htree_inlinedir_to_tree(dir_file, dir, 0,
@@ -1118,7 +1118,7 @@ int ext4_htree_fill_tree(struct file *dir_file, __u32 start_hash,
 	}
 	if (start_hash < 2 || (start_hash ==2 && start_minor_hash==0)) {
 		de = (struct ext4_dir_entry_2 *) frames[0].bh->b_data;
-		de = ext4_next_entry(de, dir->i_sb->s_blocksize);
+		de = ext4_next_entry(de, inode_sb(dir)->s_blocksize);
 		tmp_str.name = de->name;
 		tmp_str.len = de->name_len;
 		err = ext4_htree_store_dirent(dir_file, 2, 0,
@@ -1174,7 +1174,8 @@ static inline int search_dirblock(struct buffer_head *bh,
 				  unsigned int offset,
 				  struct ext4_dir_entry_2 **res_dir)
 {
-	return ext4_search_dir(bh, bh->b_data, dir->i_sb->s_blocksize, dir,
+	return ext4_search_dir(bh, bh->b_data, inode_sb(dir)->s_blocksize,
+			       dir,
 			       fname, offset, res_dir);
 }
 
@@ -1300,7 +1301,7 @@ int ext4_search_dir(struct buffer_head *bh, char *search_buf, int buf_size,
 		}
 		/* prevent looping on a bad block */
 		de_len = ext4_rec_len_from_disk(de->rec_len,
-						dir->i_sb->s_blocksize);
+						inode_sb(dir)->s_blocksize);
 		if (de_len <= 0)
 			return -1;
 		offset += de_len;
@@ -1312,7 +1313,7 @@ int ext4_search_dir(struct buffer_head *bh, char *search_buf, int buf_size,
 static int is_dx_internal_node(struct inode *dir, ext4_lblk_t block,
 			       struct ext4_dir_entry *de)
 {
-	struct super_block *sb = dir->i_sb;
+	struct super_block *sb = inode_sb(dir);
 
 	if (!is_dx(dir))
 		return 0;
@@ -1355,7 +1356,7 @@ static struct buffer_head * ext4_find_entry (struct inode *dir,
 	struct ext4_filename fname;
 
 	*res_dir = NULL;
-	sb = dir->i_sb;
+	sb = inode_sb(dir);
 	namelen = d_name->len;
 	if (namelen > EXT4_NAME_LEN)
 		return NULL;
@@ -1490,7 +1491,7 @@ static struct buffer_head * ext4_dx_find_entry(struct inode *dir,
 			struct ext4_filename *fname,
 			struct ext4_dir_entry_2 **res_dir)
 {
-	struct super_block * sb = dir->i_sb;
+	struct super_block * sb = inode_sb(dir);
 	struct dx_frame frames[EXT4_HTREE_LEVEL], *frame;
 	struct buffer_head *bh;
 	ext4_lblk_t block;
@@ -1560,7 +1561,7 @@ static struct dentry *ext4_lookup(struct inode *dir, struct dentry *dentry, unsi
 	if (bh) {
 		__u32 ino = le32_to_cpu(de->inode);
 		brelse(bh);
-		if (!ext4_valid_inum(dir->i_sb, ino)) {
+		if (!ext4_valid_inum(inode_sb(dir), ino)) {
 			EXT4_ERROR_INODE(dir, "bad inode number: %u", ino);
 			return ERR_PTR(-EFSCORRUPTED);
 		}
@@ -1569,7 +1570,7 @@ static struct dentry *ext4_lookup(struct inode *dir, struct dentry *dentry, unsi
 					 dentry);
 			return ERR_PTR(-EFSCORRUPTED);
 		}
-		inode = ext4_iget_normal(dir->i_sb, ino);
+		inode = ext4_iget_normal(inode_sb(dir), ino);
 		if (inode == ERR_PTR(-ESTALE)) {
 			EXT4_ERROR_INODE(dir,
 					 "deleted inode referenced: %u",
@@ -1579,7 +1580,7 @@ static struct dentry *ext4_lookup(struct inode *dir, struct dentry *dentry, unsi
 		if (!IS_ERR(inode) && ext4_encrypted_inode(dir) &&
 		    (S_ISDIR(inode->i_mode) || S_ISLNK(inode->i_mode)) &&
 		    !fscrypt_has_permitted_context(dir, inode)) {
-			ext4_warning(inode->i_sb,
+			ext4_warning(inode_sb(inode),
 				     "Inconsistent encryption contexts: %lu/%lu",
 				     dir->i_ino, inode->i_ino);
 			iput(inode);
@@ -1672,7 +1673,7 @@ static struct ext4_dir_entry_2 *do_split(handle_t *handle, struct inode *dir,
 			struct buffer_head **bh,struct dx_frame *frame,
 			struct dx_hash_info *hinfo)
 {
-	unsigned blocksize = dir->i_sb->s_blocksize;
+	unsigned blocksize = inode_sb(dir)->s_blocksize;
 	unsigned count, continued;
 	struct buffer_head *bh2;
 	ext4_lblk_t newblock;
@@ -1685,7 +1686,7 @@ static struct ext4_dir_entry_2 *do_split(handle_t *handle, struct inode *dir,
 	int	csum_size = 0;
 	int	err = 0, i;
 
-	if (ext4_has_metadata_csum(dir->i_sb))
+	if (ext4_has_metadata_csum(inode_sb(dir)))
 		csum_size = sizeof(struct ext4_dir_entry_tail);
 
 	bh2 = ext4_append(handle, dir, &newblock);
@@ -1774,7 +1775,7 @@ static struct ext4_dir_entry_2 *do_split(handle_t *handle, struct inode *dir,
 	brelse(*bh);
 	brelse(bh2);
 	*bh = NULL;
-	ext4_std_error(dir->i_sb, err);
+	ext4_std_error(inode_sb(dir), err);
 	return ERR_PTR(err);
 }
 
@@ -1831,7 +1832,7 @@ void ext4_insert_dentry(struct inode *inode,
 	}
 	de->file_type = EXT4_FT_UNKNOWN;
 	de->inode = cpu_to_le32(inode->i_ino);
-	ext4_set_de_type(inode->i_sb, de, inode->i_mode);
+	ext4_set_de_type(inode_sb(inode), de, inode->i_mode);
 	de->name_len = fname_len(fname);
 	memcpy(de->name, fname_name(fname), fname_len(fname));
 }
@@ -1849,11 +1850,11 @@ static int add_dirent_to_buf(handle_t *handle, struct ext4_filename *fname,
 			     struct inode *inode, struct ext4_dir_entry_2 *de,
 			     struct buffer_head *bh)
 {
-	unsigned int	blocksize = dir->i_sb->s_blocksize;
+	unsigned int	blocksize = inode_sb(dir)->s_blocksize;
 	int		csum_size = 0;
 	int		err;
 
-	if (ext4_has_metadata_csum(inode->i_sb))
+	if (ext4_has_metadata_csum(inode_sb(inode)))
 		csum_size = sizeof(struct ext4_dir_entry_tail);
 
 	if (!de) {
@@ -1865,7 +1866,7 @@ static int add_dirent_to_buf(handle_t *handle, struct ext4_filename *fname,
 	BUFFER_TRACE(bh, "get_write_access");
 	err = ext4_journal_get_write_access(handle, bh);
 	if (err) {
-		ext4_std_error(dir->i_sb, err);
+		ext4_std_error(inode_sb(dir), err);
 		return err;
 	}
 
@@ -1890,7 +1891,7 @@ static int add_dirent_to_buf(handle_t *handle, struct ext4_filename *fname,
 	BUFFER_TRACE(bh, "call ext4_handle_dirty_metadata");
 	err = ext4_handle_dirty_dirent_node(handle, dir, bh);
 	if (err)
-		ext4_std_error(dir->i_sb, err);
+		ext4_std_error(inode_sb(dir), err);
 	return 0;
 }
 
@@ -1916,15 +1917,15 @@ static int make_indexed_dir(handle_t *handle, struct ext4_filename *fname,
 	struct fake_dirent *fde;
 	int csum_size = 0;
 
-	if (ext4_has_metadata_csum(inode->i_sb))
+	if (ext4_has_metadata_csum(inode_sb(inode)))
 		csum_size = sizeof(struct ext4_dir_entry_tail);
 
-	blocksize =  dir->i_sb->s_blocksize;
+	blocksize =  inode_sb(dir)->s_blocksize;
 	dxtrace(printk(KERN_DEBUG "Creating index: inode %lu\n", dir->i_ino));
 	BUFFER_TRACE(bh, "get_write_access");
 	retval = ext4_journal_get_write_access(handle, bh);
 	if (retval) {
-		ext4_std_error(dir->i_sb, retval);
+		ext4_std_error(inode_sb(dir), retval);
 		brelse(bh);
 		return retval;
 	}
@@ -1970,7 +1971,7 @@ static int make_indexed_dir(handle_t *handle, struct ext4_filename *fname,
 					   blocksize);
 	memset (&root->info, 0, sizeof(root->info));
 	root->info.info_length = sizeof(root->info);
-	root->info.hash_version = EXT4_SB(dir->i_sb)->s_def_hash_version;
+	root->info.hash_version = EXT4_SB(inode_sb(dir))->s_def_hash_version;
 	entries = root->entries;
 	dx_set_block(entries, 1);
 	dx_set_count(entries, 1);
@@ -1979,8 +1980,8 @@ static int make_indexed_dir(handle_t *handle, struct ext4_filename *fname,
 	/* Initialize as for dx_probe */
 	fname->hinfo.hash_version = root->info.hash_version;
 	if (fname->hinfo.hash_version <= DX_HASH_TEA)
-		fname->hinfo.hash_version += EXT4_SB(dir->i_sb)->s_hash_unsigned;
-	fname->hinfo.seed = EXT4_SB(dir->i_sb)->s_hash_seed;
+		fname->hinfo.hash_version += EXT4_SB(inode_sb(dir))->s_hash_unsigned;
+	fname->hinfo.seed = EXT4_SB(inode_sb(dir))->s_hash_seed;
 	ext4fs_dirhash(fname_name(fname), fname_len(fname), &fname->hinfo);
 
 	memset(frames, 0, sizeof(frames));
@@ -2041,10 +2042,10 @@ static int ext4_add_entry(handle_t *handle, struct dentry *dentry,
 	ext4_lblk_t block, blocks;
 	int	csum_size = 0;
 
-	if (ext4_has_metadata_csum(inode->i_sb))
+	if (ext4_has_metadata_csum(inode_sb(inode)))
 		csum_size = sizeof(struct ext4_dir_entry_tail);
 
-	sb = dir->i_sb;
+	sb = inode_sb(dir);
 	blocksize = sb->s_blocksize;
 	if (!dentry->d_name.len)
 		return -EINVAL;
@@ -2126,7 +2127,7 @@ static int ext4_dx_add_entry(handle_t *handle, struct ext4_filename *fname,
 	struct dx_frame frames[EXT4_HTREE_LEVEL], *frame;
 	struct dx_entry *entries, *at;
 	struct buffer_head *bh;
-	struct super_block *sb = dir->i_sb;
+	struct super_block *sb = inode_sb(dir);
 	struct ext4_dir_entry_2 *de;
 	int restart;
 	int err;
@@ -2279,7 +2280,7 @@ static int ext4_dx_add_entry(handle_t *handle, struct ext4_filename *fname,
 	goto cleanup;
 
 journal_error:
-	ext4_std_error(dir->i_sb, err); /* this is a no-op if err == 0 */
+	ext4_std_error(inode_sb(dir), err); /* this is a no-op if err == 0 */
 cleanup:
 	brelse(bh);
 	dx_release(frames);
@@ -2304,7 +2305,7 @@ int ext4_generic_delete_entry(handle_t *handle,
 			      int csum_size)
 {
 	struct ext4_dir_entry_2 *de, *pde;
-	unsigned int blocksize = dir->i_sb->s_blocksize;
+	unsigned int blocksize = inode_sb(dir)->s_blocksize;
 	int i;
 
 	i = 0;
@@ -2349,7 +2350,7 @@ static int ext4_delete_entry(handle_t *handle,
 			return err;
 	}
 
-	if (ext4_has_metadata_csum(dir->i_sb))
+	if (ext4_has_metadata_csum(inode_sb(dir)))
 		csum_size = sizeof(struct ext4_dir_entry_tail);
 
 	BUFFER_TRACE(bh, "get_write_access");
@@ -2359,7 +2360,7 @@ static int ext4_delete_entry(handle_t *handle,
 
 	err = ext4_generic_delete_entry(handle, dir, de_del,
 					bh, bh->b_data,
-					dir->i_sb->s_blocksize, csum_size);
+					inode_sb(dir)->s_blocksize, csum_size);
 	if (err)
 		goto out;
 
@@ -2371,7 +2372,7 @@ static int ext4_delete_entry(handle_t *handle,
 	return 0;
 out:
 	if (err != -ENOENT)
-		ext4_std_error(dir->i_sb, err);
+		ext4_std_error(inode_sb(dir), err);
 	return err;
 }
 
@@ -2440,7 +2441,7 @@ static int ext4_create(struct inode *dir, struct dentry *dentry, umode_t mode,
 	if (err)
 		return err;
 
-	credits = (EXT4_DATA_TRANS_BLOCKS(dir->i_sb) +
+	credits = (EXT4_DATA_TRANS_BLOCKS(inode_sb(dir)) +
 		   EXT4_INDEX_EXTRA_TRANS_BLOCKS + 3);
 retry:
 	inode = ext4_new_inode_start_handle(dir, mode, &dentry->d_name, 0,
@@ -2457,7 +2458,7 @@ static int ext4_create(struct inode *dir, struct dentry *dentry, umode_t mode,
 	}
 	if (handle)
 		ext4_journal_stop(handle);
-	if (err == -ENOSPC && ext4_should_retry_alloc(dir->i_sb, &retries))
+	if (err == -ENOSPC && ext4_should_retry_alloc(inode_sb(dir), &retries))
 		goto retry;
 	return err;
 }
@@ -2473,7 +2474,7 @@ static int ext4_mknod(struct inode *dir, struct dentry *dentry,
 	if (err)
 		return err;
 
-	credits = (EXT4_DATA_TRANS_BLOCKS(dir->i_sb) +
+	credits = (EXT4_DATA_TRANS_BLOCKS(inode_sb(dir)) +
 		   EXT4_INDEX_EXTRA_TRANS_BLOCKS + 3);
 retry:
 	inode = ext4_new_inode_start_handle(dir, mode, &dentry->d_name, 0,
@@ -2489,7 +2490,7 @@ static int ext4_mknod(struct inode *dir, struct dentry *dentry,
 	}
 	if (handle)
 		ext4_journal_stop(handle);
-	if (err == -ENOSPC && ext4_should_retry_alloc(dir->i_sb, &retries))
+	if (err == -ENOSPC && ext4_should_retry_alloc(inode_sb(dir), &retries))
 		goto retry;
 	return err;
 }
@@ -2508,8 +2509,8 @@ static int ext4_tmpfile(struct inode *dir, struct dentry *dentry, umode_t mode)
 	inode = ext4_new_inode_start_handle(dir, mode,
 					    NULL, 0, NULL,
 					    EXT4_HT_DIR,
-			EXT4_MAXQUOTAS_INIT_BLOCKS(dir->i_sb) +
-			  4 + EXT4_XATTR_TRANS_BLOCKS);
+			EXT4_MAXQUOTAS_INIT_BLOCKS(inode_sb(dir)) +
+			4 + EXT4_XATTR_TRANS_BLOCKS);
 	handle = ext4_journal_current_handle();
 	err = PTR_ERR(inode);
 	if (!IS_ERR(inode)) {
@@ -2525,7 +2526,7 @@ static int ext4_tmpfile(struct inode *dir, struct dentry *dentry, umode_t mode)
 	}
 	if (handle)
 		ext4_journal_stop(handle);
-	if (err == -ENOSPC && ext4_should_retry_alloc(dir->i_sb, &retries))
+	if (err == -ENOSPC && ext4_should_retry_alloc(inode_sb(dir), &retries))
 		goto retry;
 	return err;
 err_unlock_inode:
@@ -2544,7 +2545,7 @@ struct ext4_dir_entry_2 *ext4_init_dot_dotdot(struct inode *inode,
 	de->rec_len = ext4_rec_len_to_disk(EXT4_DIR_REC_LEN(de->name_len),
 					   blocksize);
 	strcpy(de->name, ".");
-	ext4_set_de_type(inode->i_sb, de, S_IFDIR);
+	ext4_set_de_type(inode_sb(inode), de, S_IFDIR);
 
 	de = ext4_next_entry(de, blocksize);
 	de->inode = cpu_to_le32(parent_ino);
@@ -2557,7 +2558,7 @@ struct ext4_dir_entry_2 *ext4_init_dot_dotdot(struct inode *inode,
 		de->rec_len = ext4_rec_len_to_disk(
 				EXT4_DIR_REC_LEN(de->name_len), blocksize);
 	strcpy(de->name, "..");
-	ext4_set_de_type(inode->i_sb, de, S_IFDIR);
+	ext4_set_de_type(inode_sb(inode), de, S_IFDIR);
 
 	return ext4_next_entry(de, blocksize);
 }
@@ -2569,11 +2570,11 @@ static int ext4_init_new_dir(handle_t *handle, struct inode *dir,
 	struct ext4_dir_entry_2 *de;
 	struct ext4_dir_entry_tail *t;
 	ext4_lblk_t block = 0;
-	unsigned int blocksize = dir->i_sb->s_blocksize;
+	unsigned int blocksize = inode_sb(dir)->s_blocksize;
 	int csum_size = 0;
 	int err;
 
-	if (ext4_has_metadata_csum(dir->i_sb))
+	if (ext4_has_metadata_csum(inode_sb(dir)))
 		csum_size = sizeof(struct ext4_dir_entry_tail);
 
 	if (ext4_test_inode_state(inode, EXT4_STATE_MAY_INLINE_DATA)) {
@@ -2619,7 +2620,7 @@ static int ext4_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode)
 	if (err)
 		return err;
 
-	credits = (EXT4_DATA_TRANS_BLOCKS(dir->i_sb) +
+	credits = (EXT4_DATA_TRANS_BLOCKS(inode_sb(dir)) +
 		   EXT4_INDEX_EXTRA_TRANS_BLOCKS + 3);
 retry:
 	inode = ext4_new_inode_start_handle(dir, S_IFDIR | mode,
@@ -2659,7 +2660,7 @@ static int ext4_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode)
 out_stop:
 	if (handle)
 		ext4_journal_stop(handle);
-	if (err == -ENOSPC && ext4_should_retry_alloc(dir->i_sb, &retries))
+	if (err == -ENOSPC && ext4_should_retry_alloc(inode_sb(dir), &retries))
 		goto retry;
 	return err;
 }
@@ -2683,7 +2684,7 @@ bool ext4_empty_dir(struct inode *inode)
 			return ret;
 	}
 
-	sb = inode->i_sb;
+	sb = inode_sb(inode);
 	if (inode->i_size < EXT4_DIR_REC_LEN(1) + EXT4_DIR_REC_LEN(2)) {
 		EXT4_ERROR_INODE(inode, "invalid size");
 		return true;
@@ -2746,7 +2747,7 @@ bool ext4_empty_dir(struct inode *inode)
  */
 int ext4_orphan_add(handle_t *handle, struct inode *inode)
 {
-	struct super_block *sb = inode->i_sb;
+	struct super_block *sb = inode_sb(inode);
 	struct ext4_sb_info *sbi = EXT4_SB(sb);
 	struct ext4_iloc iloc;
 	int err = 0, rc;
@@ -2829,7 +2830,7 @@ int ext4_orphan_del(handle_t *handle, struct inode *inode)
 {
 	struct list_head *prev;
 	struct ext4_inode_info *ei = EXT4_I(inode);
-	struct ext4_sb_info *sbi = EXT4_SB(inode->i_sb);
+	struct ext4_sb_info *sbi = EXT4_SB(inode_sb(inode));
 	__u32 ino_next;
 	struct ext4_iloc iloc;
 	int err = 0;
@@ -2874,7 +2875,7 @@ int ext4_orphan_del(handle_t *handle, struct inode *inode)
 		}
 		sbi->s_es->s_last_orphan = cpu_to_le32(ino_next);
 		mutex_unlock(&sbi->s_orphan_lock);
-		err = ext4_handle_dirty_super(handle, inode->i_sb);
+		err = ext4_handle_dirty_super(handle, inode_sb(inode));
 	} else {
 		struct ext4_iloc iloc2;
 		struct inode *i_prev =
@@ -2896,7 +2897,7 @@ int ext4_orphan_del(handle_t *handle, struct inode *inode)
 	NEXT_ORPHAN(inode) = 0;
 	err = ext4_mark_iloc_dirty(handle, inode, &iloc);
 out_err:
-	ext4_std_error(inode->i_sb, err);
+	ext4_std_error(inode_sb(inode), err);
 	return err;
 
 out_brelse:
@@ -2912,7 +2913,7 @@ static int ext4_rmdir(struct inode *dir, struct dentry *dentry)
 	struct ext4_dir_entry_2 *de;
 	handle_t *handle = NULL;
 
-	if (unlikely(ext4_forced_shutdown(EXT4_SB(dir->i_sb))))
+	if (unlikely(ext4_forced_shutdown(EXT4_SB(inode_sb(dir)))))
 		return -EIO;
 
 	/* Initialize quotas before so that eventual writes go in
@@ -2942,7 +2943,7 @@ static int ext4_rmdir(struct inode *dir, struct dentry *dentry)
 		goto end_rmdir;
 
 	handle = ext4_journal_start(dir, EXT4_HT_DIR,
-				    EXT4_DATA_TRANS_BLOCKS(dir->i_sb));
+				    EXT4_DATA_TRANS_BLOCKS(inode_sb(dir)));
 	if (IS_ERR(handle)) {
 		retval = PTR_ERR(handle);
 		handle = NULL;
@@ -2988,7 +2989,7 @@ static int ext4_unlink(struct inode *dir, struct dentry *dentry)
 	struct ext4_dir_entry_2 *de;
 	handle_t *handle = NULL;
 
-	if (unlikely(ext4_forced_shutdown(EXT4_SB(dir->i_sb))))
+	if (unlikely(ext4_forced_shutdown(EXT4_SB(inode_sb(dir)))))
 		return -EIO;
 
 	trace_ext4_unlink_enter(dir, dentry);
@@ -3015,7 +3016,7 @@ static int ext4_unlink(struct inode *dir, struct dentry *dentry)
 		goto end_unlink;
 
 	handle = ext4_journal_start(dir, EXT4_HT_DIR,
-				    EXT4_DATA_TRANS_BLOCKS(dir->i_sb));
+				    EXT4_DATA_TRANS_BLOCKS(inode_sb(dir)));
 	if (IS_ERR(handle)) {
 		retval = PTR_ERR(handle);
 		handle = NULL;
@@ -3059,10 +3060,11 @@ static int ext4_symlink(struct inode *dir,
 	int credits;
 	struct fscrypt_str disk_link;
 
-	if (unlikely(ext4_forced_shutdown(EXT4_SB(dir->i_sb))))
+	if (unlikely(ext4_forced_shutdown(EXT4_SB(inode_sb(dir)))))
 		return -EIO;
 
-	err = fscrypt_prepare_symlink(dir, symname, len, dir->i_sb->s_blocksize,
+	err = fscrypt_prepare_symlink(dir, symname, len,
+				      inode_sb(dir)->s_blocksize,
 				      &disk_link);
 	if (err)
 		return err;
@@ -3078,7 +3080,7 @@ static int ext4_symlink(struct inode *dir,
 		 * group descriptor, sb, inode block, quota blocks, and
 		 * possibly selinux xattr blocks.
 		 */
-		credits = 4 + EXT4_MAXQUOTAS_INIT_BLOCKS(dir->i_sb) +
+		credits = 4 + EXT4_MAXQUOTAS_INIT_BLOCKS(inode_sb(dir)) +
 			  EXT4_XATTR_TRANS_BLOCKS;
 	} else {
 		/*
@@ -3087,7 +3089,7 @@ static int ext4_symlink(struct inode *dir,
 		 * allocate new inode (bitmap, group descriptor, inode block,
 		 * quota blocks, sb is already counted in previous macros).
 		 */
-		credits = EXT4_DATA_TRANS_BLOCKS(dir->i_sb) +
+		credits = EXT4_DATA_TRANS_BLOCKS(inode_sb(dir)) +
 			  EXT4_INDEX_EXTRA_TRANS_BLOCKS + 3;
 	}
 
@@ -3137,7 +3139,7 @@ static int ext4_symlink(struct inode *dir,
 		 * + EXT4_INDEX_EXTRA_TRANS_BLOCKS), inode is also modified
 		 */
 		handle = ext4_journal_start(dir, EXT4_HT_DIR,
-				EXT4_DATA_TRANS_BLOCKS(dir->i_sb) +
+				EXT4_DATA_TRANS_BLOCKS(inode_sb(dir)) +
 				EXT4_INDEX_EXTRA_TRANS_BLOCKS + 1);
 		if (IS_ERR(handle)) {
 			err = PTR_ERR(handle);
@@ -3205,7 +3207,7 @@ static int ext4_link(struct dentry *old_dentry,
 
 retry:
 	handle = ext4_journal_start(dir, EXT4_HT_DIR,
-		(EXT4_DATA_TRANS_BLOCKS(dir->i_sb) +
+		(EXT4_DATA_TRANS_BLOCKS(inode_sb(dir)) +
 		 EXT4_INDEX_EXTRA_TRANS_BLOCKS) + 1);
 	if (IS_ERR(handle))
 		return PTR_ERR(handle);
@@ -3231,7 +3233,7 @@ static int ext4_link(struct dentry *old_dentry,
 		iput(inode);
 	}
 	ext4_journal_stop(handle);
-	if (err == -ENOSPC && ext4_should_retry_alloc(dir->i_sb, &retries))
+	if (err == -ENOSPC && ext4_should_retry_alloc(inode_sb(dir), &retries))
 		goto retry;
 	return err;
 }
@@ -3258,7 +3260,7 @@ static struct buffer_head *ext4_get_first_dir_block(handle_t *handle,
 		}
 		*parent_de = ext4_next_entry(
 					(struct ext4_dir_entry_2 *)bh->b_data,
-					inode->i_sb->s_blocksize);
+					inode_sb(inode)->s_blocksize);
 		return bh;
 	}
 
@@ -3320,7 +3322,7 @@ static int ext4_rename_dir_finish(handle_t *handle, struct ext4_renament *ent,
 		retval = ext4_mark_inode_dirty(handle, ent->inode);
 	}
 	if (retval) {
-		ext4_std_error(ent->dir->i_sb, retval);
+		ext4_std_error(inode_sb(ent->dir), retval);
 		return retval;
 	}
 	return 0;
@@ -3336,7 +3338,7 @@ static int ext4_setent(handle_t *handle, struct ext4_renament *ent,
 	if (retval)
 		return retval;
 	ent->de->inode = cpu_to_le32(ino);
-	if (ext4_has_feature_filetype(ent->dir->i_sb))
+	if (ext4_has_feature_filetype(inode_sb(ent->dir)))
 		ent->de->file_type = file_type;
 	inode_inc_iversion(ent->dir);
 	ent->dir->i_ctime = ent->dir->i_mtime =
@@ -3347,7 +3349,7 @@ static int ext4_setent(handle_t *handle, struct ext4_renament *ent,
 		retval = ext4_handle_dirty_dirent_node(handle,
 						       ent->dir, ent->bh);
 		if (unlikely(retval)) {
-			ext4_std_error(ent->dir->i_sb, retval);
+			ext4_std_error(inode_sb(ent->dir), retval);
 			return retval;
 		}
 	}
@@ -3428,7 +3430,7 @@ static struct inode *ext4_whiteout_for_rename(struct ext4_renament *ent,
 	 * for inode block, sb block, group summaries,
 	 * and inode bitmap
 	 */
-	credits += (EXT4_MAXQUOTAS_TRANS_BLOCKS(ent->dir->i_sb) +
+	credits += (EXT4_MAXQUOTAS_TRANS_BLOCKS(inode_sb(ent->dir)) +
 		    EXT4_XATTR_TRANS_BLOCKS + 4);
 retry:
 	wh = ext4_new_inode_start_handle(ent->dir, S_IFCHR | WHITEOUT_MODE,
@@ -3440,7 +3442,7 @@ static struct inode *ext4_whiteout_for_rename(struct ext4_renament *ent,
 		if (handle)
 			ext4_journal_stop(handle);
 		if (PTR_ERR(wh) == -ENOSPC &&
-		    ext4_should_retry_alloc(ent->dir->i_sb, &retries))
+		    ext4_should_retry_alloc(inode_sb(ent->dir), &retries))
 			goto retry;
 	} else {
 		*h = handle;
@@ -3525,10 +3527,10 @@ static int ext4_rename(struct inode *old_dir, struct dentry *old_dentry,
 			new.bh = NULL;
 		}
 	}
-	if (new.inode && !test_opt(new.dir->i_sb, NO_AUTO_DA_ALLOC))
+	if (new.inode && !test_opt(inode_sb(new.dir), NO_AUTO_DA_ALLOC))
 		ext4_alloc_da_blocks(old.inode);
 
-	credits = (2 * EXT4_DATA_TRANS_BLOCKS(old.dir->i_sb) +
+	credits = (2 * EXT4_DATA_TRANS_BLOCKS(inode_sb(old.dir)) +
 		   EXT4_INDEX_EXTRA_TRANS_BLOCKS + 2);
 	if (!(flags & RENAME_WHITEOUT)) {
 		handle = ext4_journal_start(old.dir, EXT4_HT_DIR, credits);
@@ -3719,7 +3721,7 @@ static int ext4_cross_rename(struct inode *old_dir, struct dentry *old_dentry,
 		goto end_rename;
 
 	handle = ext4_journal_start(old.dir, EXT4_HT_DIR,
-		(2 * EXT4_DATA_TRANS_BLOCKS(old.dir->i_sb) +
+		(2 * EXT4_DATA_TRANS_BLOCKS(inode_sb(old.dir)) +
 		 2 * EXT4_INDEX_EXTRA_TRANS_BLOCKS + 2));
 	if (IS_ERR(handle)) {
 		retval = PTR_ERR(handle);
@@ -3805,7 +3807,7 @@ static int ext4_rename2(struct inode *old_dir, struct dentry *old_dentry,
 {
 	int err;
 
-	if (unlikely(ext4_forced_shutdown(EXT4_SB(old_dir->i_sb))))
+	if (unlikely(ext4_forced_shutdown(EXT4_SB(inode_sb(old_dir)))))
 		return -EIO;
 
 	if (flags & ~(RENAME_NOREPLACE | RENAME_EXCHANGE | RENAME_WHITEOUT))
diff --git a/fs/ext4/page-io.c b/fs/ext4/page-io.c
index db7590178dfc..fb8493a31e94 100644
--- a/fs/ext4/page-io.c
+++ b/fs/ext4/page-io.c
@@ -158,8 +158,8 @@ static int ext4_end_io(ext4_io_end_t *io)
 
 	io->handle = NULL;	/* Following call will use up the handle */
 	ret = ext4_convert_unwritten_extents(handle, inode, offset, size);
-	if (ret < 0 && !ext4_forced_shutdown(EXT4_SB(inode->i_sb))) {
-		ext4_msg(inode->i_sb, KERN_EMERG,
+	if (ret < 0 && !ext4_forced_shutdown(EXT4_SB(inode_sb(inode)))) {
+		ext4_msg(inode_sb(inode), KERN_EMERG,
 			 "failed to convert unwritten extents to written "
 			 "extents -- potential data loss!  "
 			 "(inode %lu, offset %llu, size %zd, error %d)",
@@ -197,7 +197,7 @@ static void dump_completed_IO(struct inode *inode, struct list_head *head)
 static void ext4_add_complete_io(ext4_io_end_t *io_end)
 {
 	struct ext4_inode_info *ei = EXT4_I(io_end->inode);
-	struct ext4_sb_info *sbi = EXT4_SB(io_end->inode->i_sb);
+	struct ext4_sb_info *sbi = EXT4_SB(inode_sb(io_end->inode));
 	struct workqueue_struct *wq;
 	unsigned long flags;
 
@@ -314,7 +314,8 @@ static void ext4_end_bio(struct bio *bio)
 	if (bio->bi_status) {
 		struct inode *inode = io_end->inode;
 
-		ext4_warning(inode->i_sb, "I/O error %d writing to inode %lu "
+		ext4_warning(inode_sb(inode),
+			     "I/O error %d writing to inode %lu "
 			     "(offset %llu size %ld starting block %llu)",
 			     bio->bi_status, inode->i_ino,
 			     (unsigned long long) io_end->offset,
diff --git a/fs/ext4/readpage.c b/fs/ext4/readpage.c
index 9ffa6fad18db..7cfb7bd0fe1d 100644
--- a/fs/ext4/readpage.c
+++ b/fs/ext4/readpage.c
@@ -112,7 +112,7 @@ int ext4_mpage_readpages(struct address_space *mapping,
 	sector_t last_block_in_file;
 	sector_t blocks[MAX_BUF_PER_PAGE];
 	unsigned page_block;
-	struct block_device *bdev = inode->i_sb->s_bdev;
+	struct block_device *bdev = inode_sb(inode)->s_bdev;
 	int length;
 	unsigned relative_block = 0;
 	struct ext4_map_blocks map;
diff --git a/fs/ext4/resize.c b/fs/ext4/resize.c
index b6bec270a8e4..c1cf292c62fc 100644
--- a/fs/ext4/resize.c
+++ b/fs/ext4/resize.c
@@ -776,7 +776,7 @@ static int verify_reserved_gdb(struct super_block *sb,
 static int add_new_gdb(handle_t *handle, struct inode *inode,
 		       ext4_group_t group)
 {
-	struct super_block *sb = inode->i_sb;
+	struct super_block *sb = inode_sb(inode);
 	struct ext4_super_block *es = EXT4_SB(sb)->s_es;
 	unsigned long gdb_num = group / EXT4_DESC_PER_BLOCK(sb);
 	ext4_fsblk_t gdblock = EXT4_SB(sb)->s_sbh->b_blocknr + 1 + gdb_num;
@@ -957,7 +957,7 @@ static int add_new_gdb_meta_bg(struct super_block *sb,
 static int reserve_backup_gdb(handle_t *handle, struct inode *inode,
 			      ext4_group_t group)
 {
-	struct super_block *sb = inode->i_sb;
+	struct super_block *sb = inode_sb(inode);
 	int reserved_gdb =le16_to_cpu(EXT4_SB(sb)->s_es->s_reserved_gdt_blocks);
 	int cluster_bits = EXT4_SB(sb)->s_cluster_bits;
 	struct buffer_head **primary;
diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index 39bf464c35f1..144095b55900 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -467,31 +467,33 @@ void __ext4_error_inode(struct inode *inode, const char *function,
 {
 	va_list args;
 	struct va_format vaf;
-	struct ext4_super_block *es = EXT4_SB(inode->i_sb)->s_es;
+	struct ext4_super_block *es = EXT4_SB(inode_sb(inode))->s_es;
 
-	if (unlikely(ext4_forced_shutdown(EXT4_SB(inode->i_sb))))
+	if (unlikely(ext4_forced_shutdown(EXT4_SB(inode_sb(inode)))))
 		return;
 
 	es->s_last_error_ino = cpu_to_le32(inode->i_ino);
 	es->s_last_error_block = cpu_to_le64(block);
-	if (ext4_error_ratelimit(inode->i_sb)) {
+	if (ext4_error_ratelimit(inode_sb(inode))) {
 		va_start(args, fmt);
 		vaf.fmt = fmt;
 		vaf.va = &args;
 		if (block)
 			printk(KERN_CRIT "EXT4-fs error (device %s): %s:%d: "
 			       "inode #%lu: block %llu: comm %s: %pV\n",
-			       inode->i_sb->s_id, function, line, inode->i_ino,
+			       inode_sb(inode)->s_id, function, line,
+			       inode->i_ino,
 			       block, current->comm, &vaf);
 		else
 			printk(KERN_CRIT "EXT4-fs error (device %s): %s:%d: "
 			       "inode #%lu: comm %s: %pV\n",
-			       inode->i_sb->s_id, function, line, inode->i_ino,
+			       inode_sb(inode)->s_id, function, line,
+			       inode->i_ino,
 			       current->comm, &vaf);
 		va_end(args);
 	}
-	save_error_info(inode->i_sb, function, line);
-	ext4_handle_error(inode->i_sb);
+	save_error_info(inode_sb(inode), function, line);
+	ext4_handle_error(inode_sb(inode));
 }
 
 void __ext4_error_file(struct file *file, const char *function,
@@ -504,12 +506,12 @@ void __ext4_error_file(struct file *file, const char *function,
 	struct inode *inode = file_inode(file);
 	char pathname[80], *path;
 
-	if (unlikely(ext4_forced_shutdown(EXT4_SB(inode->i_sb))))
+	if (unlikely(ext4_forced_shutdown(EXT4_SB(inode_sb(inode)))))
 		return;
 
-	es = EXT4_SB(inode->i_sb)->s_es;
+	es = EXT4_SB(inode_sb(inode))->s_es;
 	es->s_last_error_ino = cpu_to_le32(inode->i_ino);
-	if (ext4_error_ratelimit(inode->i_sb)) {
+	if (ext4_error_ratelimit(inode_sb(inode))) {
 		path = file_path(file, pathname, sizeof(pathname));
 		if (IS_ERR(path))
 			path = "(unknown)";
@@ -520,18 +522,20 @@ void __ext4_error_file(struct file *file, const char *function,
 			printk(KERN_CRIT
 			       "EXT4-fs error (device %s): %s:%d: inode #%lu: "
 			       "block %llu: comm %s: path %s: %pV\n",
-			       inode->i_sb->s_id, function, line, inode->i_ino,
+			       inode_sb(inode)->s_id, function, line,
+			       inode->i_ino,
 			       block, current->comm, path, &vaf);
 		else
 			printk(KERN_CRIT
 			       "EXT4-fs error (device %s): %s:%d: inode #%lu: "
 			       "comm %s: path %s: %pV\n",
-			       inode->i_sb->s_id, function, line, inode->i_ino,
+			       inode_sb(inode)->s_id, function, line,
+			       inode->i_ino,
 			       current->comm, path, &vaf);
 		va_end(args);
 	}
-	save_error_info(inode->i_sb, function, line);
-	ext4_handle_error(inode->i_sb);
+	save_error_info(inode_sb(inode), function, line);
+	ext4_handle_error(inode_sb(inode));
 }
 
 const char *ext4_decode_error(struct super_block *sb, int errno,
@@ -693,14 +697,14 @@ void __ext4_warning_inode(const struct inode *inode, const char *function,
 	struct va_format vaf;
 	va_list args;
 
-	if (!ext4_warning_ratelimit(inode->i_sb))
+	if (!ext4_warning_ratelimit(inode_sb(inode)))
 		return;
 
 	va_start(args, fmt);
 	vaf.fmt = fmt;
 	vaf.va = &args;
 	printk(KERN_WARNING "EXT4-fs warning (device %s): %s:%d: "
-	       "inode #%lu: comm %s: %pV\n", inode->i_sb->s_id,
+	       "inode #%lu: comm %s: %pV\n", inode_sb(inode)->s_id,
 	       function, line, inode->i_ino, current->comm, &vaf);
 	va_end(args);
 }
@@ -840,7 +844,7 @@ static void dump_orphan_list(struct super_block *sb, struct ext4_sb_info *sbi)
 		struct inode *inode = orphan_list_entry(l);
 		printk(KERN_ERR "  "
 		       "inode %s:%lu at %p: mode %o, nlink %d, next %d\n",
-		       inode->i_sb->s_id, inode->i_ino, inode,
+		       inode_sb(inode)->s_id, inode->i_ino, inode,
 		       inode->i_mode, inode->i_nlink,
 		       NEXT_ORPHAN(inode));
 	}
@@ -1014,7 +1018,7 @@ static void ext4_i_callback(struct rcu_head *head)
 static void ext4_destroy_inode(struct inode *inode)
 {
 	if (!list_empty(&(EXT4_I(inode)->i_orphan))) {
-		ext4_msg(inode->i_sb, KERN_ERR,
+		ext4_msg(inode_sb(inode), KERN_ERR,
 			 "Inode %lu (%p): orphan list check failed!",
 			 inode->i_ino, EXT4_I(inode));
 		print_hex_dump(KERN_INFO, "", DUMP_PREFIX_ADDRESS, 16, 4,
@@ -1223,7 +1227,7 @@ static int ext4_set_context(struct inode *inode, const void *ctx, size_t len,
 	}
 	res2 = ext4_journal_stop(handle);
 
-	if (res == -ENOSPC && ext4_should_retry_alloc(inode->i_sb, &retries))
+	if (res == -ENOSPC && ext4_should_retry_alloc(inode_sb(inode), &retries))
 		goto retry;
 	if (!res)
 		res = res2;
@@ -1232,13 +1236,13 @@ static int ext4_set_context(struct inode *inode, const void *ctx, size_t len,
 
 static bool ext4_dummy_context(struct inode *inode)
 {
-	return DUMMY_ENCRYPTION_ENABLED(EXT4_SB(inode->i_sb));
+	return DUMMY_ENCRYPTION_ENABLED(EXT4_SB(inode_sb(inode)));
 }
 
 static unsigned ext4_max_namelen(struct inode *inode)
 {
-	return S_ISLNK(inode->i_mode) ? inode->i_sb->s_blocksize :
-		EXT4_NAME_LEN;
+	return S_ISLNK(inode->i_mode) ? inode_sb(inode)->s_blocksize :
+			EXT4_NAME_LEN;
 }
 
 static const struct fscrypt_operations ext4_cryptops = {
@@ -2509,7 +2513,7 @@ static void ext4_orphan_cleanup(struct super_block *sb,
 			truncate_inode_pages(inode->i_mapping, inode->i_size);
 			ret = ext4_truncate(inode);
 			if (ret)
-				ext4_std_error(inode->i_sb, ret);
+				ext4_std_error(inode_sb(inode), ret);
 			inode_unlock(inode);
 			nr_truncates++;
 		} else {
@@ -5674,7 +5678,7 @@ static ssize_t ext4_quota_write(struct super_block *sb, int type,
 				EXT4_GET_BLOCKS_CREATE |
 				EXT4_GET_BLOCKS_METADATA_NOFAIL);
 	} while (IS_ERR(bh) && (PTR_ERR(bh) == -ENOSPC) &&
-		 ext4_should_retry_alloc(inode->i_sb, &retries));
+		 ext4_should_retry_alloc(inode_sb(inode), &retries));
 	if (IS_ERR(bh))
 		return PTR_ERR(bh);
 	if (!bh)
diff --git a/fs/ext4/symlink.c b/fs/ext4/symlink.c
index dd05af983092..bae9b69192e9 100644
--- a/fs/ext4/symlink.c
+++ b/fs/ext4/symlink.c
@@ -43,7 +43,7 @@ static const char *ext4_encrypted_get_link(struct dentry *dentry,
 		if (IS_ERR(cpage))
 			return ERR_CAST(cpage);
 		caddr = page_address(cpage);
-		max_size = inode->i_sb->s_blocksize;
+		max_size = inode_sb(inode)->s_blocksize;
 	}
 
 	paddr = fscrypt_get_symlink(inode, caddr, max_size, done);
diff --git a/fs/ext4/sysfs.c b/fs/ext4/sysfs.c
index 1205261f130c..d36b4f0a3bf7 100644
--- a/fs/ext4/sysfs.c
+++ b/fs/ext4/sysfs.c
@@ -52,7 +52,7 @@ struct ext4_attr {
 static ssize_t session_write_kbytes_show(struct ext4_attr *a,
 					 struct ext4_sb_info *sbi, char *buf)
 {
-	struct super_block *sb = sbi->s_buddy_cache->i_sb;
+	struct super_block *sb = inode_sb(sbi->s_buddy_cache);
 
 	if (!sb->s_bdev->bd_part)
 		return snprintf(buf, PAGE_SIZE, "0\n");
@@ -64,7 +64,7 @@ static ssize_t session_write_kbytes_show(struct ext4_attr *a,
 static ssize_t lifetime_write_kbytes_show(struct ext4_attr *a,
 					  struct ext4_sb_info *sbi, char *buf)
 {
-	struct super_block *sb = sbi->s_buddy_cache->i_sb;
+	struct super_block *sb = inode_sb(sbi->s_buddy_cache);
 
 	if (!sb->s_bdev->bd_part)
 		return snprintf(buf, PAGE_SIZE, "0\n");
diff --git a/fs/ext4/truncate.h b/fs/ext4/truncate.h
index 0cb13badf473..aa73c6ec827b 100644
--- a/fs/ext4/truncate.h
+++ b/fs/ext4/truncate.h
@@ -25,7 +25,7 @@ static inline unsigned long ext4_blocks_for_truncate(struct inode *inode)
 {
 	ext4_lblk_t needed;
 
-	needed = inode->i_blocks >> (inode->i_sb->s_blocksize_bits - 9);
+	needed = inode->i_blocks >> (inode_sb(inode)->s_blocksize_bits - 9);
 
 	/* Give ourselves just enough room to cope with inodes in which
 	 * i_blocks is corrupt: we've seen disk corruptions in the past
@@ -41,6 +41,6 @@ static inline unsigned long ext4_blocks_for_truncate(struct inode *inode)
 	if (needed > EXT4_MAX_TRANS_DATA)
 		needed = EXT4_MAX_TRANS_DATA;
 
-	return EXT4_DATA_TRANS_BLOCKS(inode->i_sb) + needed;
+	return EXT4_DATA_TRANS_BLOCKS(inode_sb(inode)) + needed;
 }
 
diff --git a/fs/ext4/xattr.c b/fs/ext4/xattr.c
index 63656dbafdc4..26211c1db4cc 100644
--- a/fs/ext4/xattr.c
+++ b/fs/ext4/xattr.c
@@ -65,7 +65,8 @@
 #ifdef EXT4_XATTR_DEBUG
 # define ea_idebug(inode, fmt, ...)					\
 	printk(KERN_DEBUG "inode %s:%lu: " fmt "\n",			\
-	       inode->i_sb->s_id, inode->i_ino, ##__VA_ARGS__)
+	       inode_sb(inode)->s_id, inode->i_ino,
+	       ##__VA_ARGS__)
 # define ea_bdebug(bh, fmt, ...)					\
 	printk(KERN_DEBUG "block %pg:%lu: " fmt "\n",			\
 	       bh->b_bdev, (unsigned long)bh->b_blocknr, ##__VA_ARGS__)
@@ -109,10 +110,10 @@ const struct xattr_handler *ext4_xattr_handlers[] = {
 };
 
 #define EA_BLOCK_CACHE(inode)	(((struct ext4_sb_info *) \
-				inode->i_sb->s_fs_info)->s_ea_block_cache)
+				inode_sb(inode)->s_fs_info)->s_ea_block_cache)
 
 #define EA_INODE_CACHE(inode)	(((struct ext4_sb_info *) \
-				inode->i_sb->s_fs_info)->s_ea_inode_cache)
+				inode_sb(inode)->s_fs_info)->s_ea_inode_cache)
 
 static int
 ext4_expand_inode_array(struct ext4_xattr_inode_array **ea_inode_array,
@@ -129,7 +130,7 @@ static __le32 ext4_xattr_block_csum(struct inode *inode,
 				    sector_t block_nr,
 				    struct ext4_xattr_header *hdr)
 {
-	struct ext4_sb_info *sbi = EXT4_SB(inode->i_sb);
+	struct ext4_sb_info *sbi = EXT4_SB(inode_sb(inode));
 	__u32 csum;
 	__le64 dsk_block_nr = cpu_to_le64(block_nr);
 	__u32 dummy_csum = 0;
@@ -141,7 +142,7 @@ static __le32 ext4_xattr_block_csum(struct inode *inode,
 	csum = ext4_chksum(sbi, csum, (__u8 *)&dummy_csum, sizeof(dummy_csum));
 	offset += sizeof(dummy_csum);
 	csum = ext4_chksum(sbi, csum, (__u8 *)hdr + offset,
-			   EXT4_BLOCK_SIZE(inode->i_sb) - offset);
+			   EXT4_BLOCK_SIZE(inode_sb(inode)) - offset);
 
 	return cpu_to_le32(csum);
 }
@@ -152,7 +153,7 @@ static int ext4_xattr_block_csum_verify(struct inode *inode,
 	struct ext4_xattr_header *hdr = BHDR(bh);
 	int ret = 1;
 
-	if (ext4_has_metadata_csum(inode->i_sb)) {
+	if (ext4_has_metadata_csum(inode_sb(inode))) {
 		lock_buffer(bh);
 		ret = (hdr->h_checksum == ext4_xattr_block_csum(inode,
 							bh->b_blocknr, hdr));
@@ -164,7 +165,7 @@ static int ext4_xattr_block_csum_verify(struct inode *inode,
 static void ext4_xattr_block_csum_set(struct inode *inode,
 				      struct buffer_head *bh)
 {
-	if (ext4_has_metadata_csum(inode->i_sb))
+	if (ext4_has_metadata_csum(inode_sb(inode)))
 		BHDR(bh)->h_checksum = ext4_xattr_block_csum(inode,
 						bh->b_blocknr, BHDR(bh));
 }
@@ -364,17 +365,17 @@ static int ext4_xattr_inode_iget(struct inode *parent, unsigned long ea_ino,
 	struct inode *inode;
 	int err;
 
-	inode = ext4_iget(parent->i_sb, ea_ino);
+	inode = ext4_iget(inode_sb(parent), ea_ino);
 	if (IS_ERR(inode)) {
 		err = PTR_ERR(inode);
-		ext4_error(parent->i_sb,
+		ext4_error(inode_sb(parent),
 			   "error while reading EA inode %lu err=%d", ea_ino,
 			   err);
 		return err;
 	}
 
 	if (is_bad_inode(inode)) {
-		ext4_error(parent->i_sb,
+		ext4_error(inode_sb(parent),
 			   "error while reading EA inode %lu is_bad_inode",
 			   ea_ino);
 		err = -EIO;
@@ -382,7 +383,7 @@ static int ext4_xattr_inode_iget(struct inode *parent, unsigned long ea_ino,
 	}
 
 	if (!(EXT4_I(inode)->i_flags & EXT4_EA_INODE_FL)) {
-		ext4_error(parent->i_sb,
+		ext4_error(inode_sb(parent),
 			   "EA inode %lu does not have EXT4_EA_INODE_FL flag",
 			    ea_ino);
 		err = -EINVAL;
@@ -422,7 +423,8 @@ ext4_xattr_inode_verify_hashes(struct inode *ea_inode,
 	u32 hash;
 
 	/* Verify stored hash matches calculated hash. */
-	hash = ext4_xattr_inode_hash(EXT4_SB(ea_inode->i_sb), buffer, size);
+	hash = ext4_xattr_inode_hash(EXT4_SB(inode_sb(ea_inode)), buffer,
+				     size);
 	if (hash != ext4_xattr_inode_get_hash(ea_inode))
 		return -EFSCORRUPTED;
 
@@ -506,7 +508,7 @@ ext4_xattr_block_get(struct inode *inode, int name_index, const char *name,
 		goto cleanup;
 	ea_idebug(inode, "reading block %llu",
 		  (unsigned long long)EXT4_I(inode)->i_file_acl);
-	bh = sb_bread(inode->i_sb, EXT4_I(inode)->i_file_acl);
+	bh = sb_bread(inode_sb(inode), EXT4_I(inode)->i_file_acl);
 	if (!bh)
 		goto cleanup;
 	ea_bdebug(bh, "b_count=%d, refcount=%d",
@@ -563,7 +565,7 @@ ext4_xattr_ibody_get(struct inode *inode, int name_index, const char *name,
 		return error;
 	raw_inode = ext4_raw_inode(&iloc);
 	header = IHDR(inode, raw_inode);
-	end = (void *)raw_inode + EXT4_SB(inode->i_sb)->s_inode_size;
+	end = (void *)raw_inode + EXT4_SB(inode_sb(inode))->s_inode_size;
 	error = xattr_check_inode(inode, header, end);
 	if (error)
 		goto cleanup;
@@ -609,7 +611,7 @@ ext4_xattr_get(struct inode *inode, int name_index, const char *name,
 {
 	int error;
 
-	if (unlikely(ext4_forced_shutdown(EXT4_SB(inode->i_sb))))
+	if (unlikely(ext4_forced_shutdown(EXT4_SB(inode_sb(inode)))))
 		return -EIO;
 
 	if (strlen(name) > 255)
@@ -670,7 +672,7 @@ ext4_xattr_block_list(struct dentry *dentry, char *buffer, size_t buffer_size)
 		goto cleanup;
 	ea_idebug(inode, "reading block %llu",
 		  (unsigned long long)EXT4_I(inode)->i_file_acl);
-	bh = sb_bread(inode->i_sb, EXT4_I(inode)->i_file_acl);
+	bh = sb_bread(inode_sb(inode), EXT4_I(inode)->i_file_acl);
 	error = -EIO;
 	if (!bh)
 		goto cleanup;
@@ -708,7 +710,7 @@ ext4_xattr_ibody_list(struct dentry *dentry, char *buffer, size_t buffer_size)
 		return error;
 	raw_inode = ext4_raw_inode(&iloc);
 	header = IHDR(inode, raw_inode);
-	end = (void *)raw_inode + EXT4_SB(inode->i_sb)->s_inode_size;
+	end = (void *)raw_inode + EXT4_SB(inode_sb(inode))->s_inode_size;
 	error = xattr_check_inode(inode, header, end);
 	if (error)
 		goto cleanup;
@@ -790,7 +792,7 @@ int ext4_get_inode_usage(struct inode *inode, qsize_t *usage)
 			goto out;
 		raw_inode = ext4_raw_inode(&iloc);
 		header = IHDR(inode, raw_inode);
-		end = (void *)raw_inode + EXT4_SB(inode->i_sb)->s_inode_size;
+		end = (void *)raw_inode + EXT4_SB(inode_sb(inode))->s_inode_size;
 		ret = xattr_check_inode(inode, header, end);
 		if (ret)
 			goto out;
@@ -802,7 +804,7 @@ int ext4_get_inode_usage(struct inode *inode, qsize_t *usage)
 	}
 
 	if (EXT4_I(inode)->i_file_acl) {
-		bh = sb_bread(inode->i_sb, EXT4_I(inode)->i_file_acl);
+		bh = sb_bread(inode_sb(inode), EXT4_I(inode)->i_file_acl);
 		if (!bh) {
 			ret = -EIO;
 			goto out;
@@ -828,7 +830,7 @@ int ext4_get_inode_usage(struct inode *inode, qsize_t *usage)
 
 static inline size_t round_up_cluster(struct inode *inode, size_t length)
 {
-	struct super_block *sb = inode->i_sb;
+	struct super_block *sb = inode_sb(inode);
 	size_t cluster_size = 1 << (EXT4_SB(sb)->s_cluster_bits +
 				    inode->i_blkbits);
 	size_t mask = ~(cluster_size - 1);
@@ -959,7 +961,8 @@ static int ext4_xattr_ensure_credits(handle_t *handle, struct inode *inode,
 	if (!error)
 		return 0;
 	if (error < 0) {
-		ext4_warning(inode->i_sb, "Extend journal (error %d)", error);
+		ext4_warning(inode_sb(inode), "Extend journal (error %d)",
+			     error);
 		return error;
 	}
 
@@ -968,7 +971,8 @@ static int ext4_xattr_ensure_credits(handle_t *handle, struct inode *inode,
 			ext4_xattr_block_csum_set(inode, bh);
 		error = ext4_handle_dirty_metadata(handle, NULL, bh);
 		if (error) {
-			ext4_warning(inode->i_sb, "Handle metadata (error %d)",
+			ext4_warning(inode_sb(inode),
+				     "Handle metadata (error %d)",
 				     error);
 			return error;
 		}
@@ -976,14 +980,15 @@ static int ext4_xattr_ensure_credits(handle_t *handle, struct inode *inode,
 
 	error = ext4_journal_restart(handle, credits);
 	if (error) {
-		ext4_warning(inode->i_sb, "Restart journal (error %d)", error);
+		ext4_warning(inode_sb(inode), "Restart journal (error %d)",
+			     error);
 		return error;
 	}
 
 	if (bh) {
 		error = ext4_journal_get_write_access(handle, bh);
 		if (error) {
-			ext4_warning(inode->i_sb,
+			ext4_warning(inode_sb(inode),
 				     "Get write access failed (error %d)",
 				     error);
 			return error;
@@ -1115,7 +1120,7 @@ static int ext4_xattr_inode_inc_ref_all(handle_t *handle, struct inode *parent,
 					    le32_to_cpu(entry->e_hash),
 					    &ea_inode);
 		if (err) {
-			ext4_warning(parent->i_sb,
+			ext4_warning(inode_sb(parent),
 				     "cleanup ea_ino %u iget error %d", ea_ino,
 				     err);
 			continue;
@@ -1244,7 +1249,7 @@ ext4_xattr_release_block(handle_t *handle, struct inode *inode,
 		get_bh(bh);
 		unlock_buffer(bh);
 
-		if (ext4_has_feature_ea_inode(inode->i_sb))
+		if (ext4_has_feature_ea_inode(inode_sb(inode)))
 			ext4_xattr_inode_dec_ref_all(handle, inode, bh,
 						     BFIRST(bh),
 						     true /* block_csum */,
@@ -1288,12 +1293,12 @@ ext4_xattr_release_block(handle_t *handle, struct inode *inode,
 			error = ext4_handle_dirty_metadata(handle, inode, bh);
 		if (IS_SYNC(inode))
 			ext4_handle_sync(handle);
-		dquot_free_block(inode, EXT4_C2B(EXT4_SB(inode->i_sb), 1));
+		dquot_free_block(inode, EXT4_C2B(EXT4_SB(inode_sb(inode)), 1));
 		ea_bdebug(bh, "refcount now=%d; releasing",
 			  le32_to_cpu(BHDR(bh)->h_refcount));
 	}
 out:
-	ext4_std_error(inode->i_sb, error);
+	ext4_std_error(inode_sb(inode), error);
 	return;
 }
 
@@ -1324,7 +1329,7 @@ static int ext4_xattr_inode_write(handle_t *handle, struct inode *ea_inode,
 {
 	struct buffer_head *bh = NULL;
 	unsigned long block = 0;
-	int blocksize = ea_inode->i_sb->s_blocksize;
+	int blocksize = inode_sb(ea_inode)->s_blocksize;
 	int max_blocks = (bufsize + blocksize - 1) >> ea_inode->i_blkbits;
 	int csize, wsize = 0;
 	int ret = 0;
@@ -1341,7 +1346,7 @@ static int ext4_xattr_inode_write(handle_t *handle, struct inode *ea_inode,
 		if (ret <= 0) {
 			ext4_mark_inode_dirty(handle, ea_inode);
 			if (ret == -ENOSPC &&
-			    ext4_should_retry_alloc(ea_inode->i_sb, &retries)) {
+			    ext4_should_retry_alloc(inode_sb(ea_inode), &retries)) {
 				ret = 0;
 				goto retry;
 			}
@@ -1401,7 +1406,7 @@ static struct inode *ext4_xattr_inode_create(handle_t *handle,
 	 * Let the next inode be the goal, so we try and allocate the EA inode
 	 * in the same group, or nearby one.
 	 */
-	ea_inode = ext4_new_inode(handle, inode->i_sb->s_root->d_inode,
+	ea_inode = ext4_new_inode(handle, inode_sb(inode)->s_root->d_inode,
 				  S_IFREG | 0600, NULL, inode->i_ino + 1, owner,
 				  EXT4_EA_INODE_FL);
 	if (!IS_ERR(ea_inode)) {
@@ -1457,7 +1462,7 @@ ext4_xattr_inode_cache_find(struct inode *inode, const void *value,
 	}
 
 	while (ce) {
-		ea_inode = ext4_iget(inode->i_sb, ce->e_value);
+		ea_inode = ext4_iget(inode_sb(inode), ce->e_value);
 		if (!IS_ERR(ea_inode) &&
 		    !is_bad_inode(ea_inode) &&
 		    (EXT4_I(ea_inode)->i_flags & EXT4_EA_INODE_FL) &&
@@ -1491,7 +1496,8 @@ static int ext4_xattr_inode_lookup_create(handle_t *handle, struct inode *inode,
 	u32 hash;
 	int err;
 
-	hash = ext4_xattr_inode_hash(EXT4_SB(inode->i_sb), value, value_len);
+	hash = ext4_xattr_inode_hash(EXT4_SB(inode_sb(inode)), value,
+				     value_len);
 	ea_inode = ext4_xattr_inode_cache_find(inode, value, value_len, hash);
 	if (ea_inode) {
 		err = ext4_xattr_inode_inc_ref(handle, ea_inode);
@@ -1597,7 +1603,7 @@ static int ext4_xattr_set_entry(struct ext4_xattr_info *i,
 		 * attribute block so that a long value does not occupy the
 		 * whole space and prevent futher entries being added.
 		 */
-		if (ext4_has_feature_ea_inode(inode->i_sb) &&
+		if (ext4_has_feature_ea_inode(inode_sb(inode)) &&
 		    new_size && is_block &&
 		    (min_offs + old_size - new_size) <
 					EXT4_XATTR_BLOCK_RESERVE(inode)) {
@@ -1778,7 +1784,7 @@ static int
 ext4_xattr_block_find(struct inode *inode, struct ext4_xattr_info *i,
 		      struct ext4_xattr_block_find *bs)
 {
-	struct super_block *sb = inode->i_sb;
+	struct super_block *sb = inode_sb(inode);
 	int error;
 
 	ea_idebug(inode, "name=%d.%s, value=%p, value_len=%ld",
@@ -1821,7 +1827,7 @@ ext4_xattr_block_set(handle_t *handle, struct inode *inode,
 		     struct ext4_xattr_info *i,
 		     struct ext4_xattr_block_find *bs)
 {
-	struct super_block *sb = inode->i_sb;
+	struct super_block *sb = inode_sb(inode);
 	struct buffer_head *new_bh = NULL;
 	struct ext4_xattr_search s_copy = bs->s;
 	struct ext4_xattr_search *s = &s_copy;
@@ -2158,7 +2164,7 @@ int ext4_xattr_ibody_find(struct inode *inode, struct ext4_xattr_info *i,
 	header = IHDR(inode, raw_inode);
 	is->s.base = is->s.first = IFIRST(header);
 	is->s.here = is->s.first;
-	is->s.end = (void *)raw_inode + EXT4_SB(inode->i_sb)->s_inode_size;
+	is->s.end = (void *)raw_inode + EXT4_SB(inode_sb(inode))->s_inode_size;
 	if (ext4_test_inode_state(inode, EXT4_STATE_XATTR)) {
 		error = xattr_check_inode(inode, header, is->s.end);
 		if (error)
@@ -2257,7 +2263,7 @@ static struct buffer_head *ext4_xattr_get_block(struct inode *inode)
 
 	if (!EXT4_I(inode)->i_file_acl)
 		return NULL;
-	bh = sb_bread(inode->i_sb, EXT4_I(inode)->i_file_acl);
+	bh = sb_bread(inode_sb(inode), EXT4_I(inode)->i_file_acl);
 	if (!bh)
 		return ERR_PTR(-EIO);
 	error = ext4_xattr_check_block(inode, bh);
@@ -2317,7 +2323,7 @@ ext4_xattr_set_handle(handle_t *handle, struct inode *inode, int name_index,
 			goto cleanup;
 		}
 
-		credits = __ext4_xattr_set_credits(inode->i_sb, inode, bh,
+		credits = __ext4_xattr_set_credits(inode_sb(inode), inode, bh,
 						   value_len,
 						   flags & XATTR_CREATE);
 		brelse(bh);
@@ -2334,7 +2340,7 @@ ext4_xattr_set_handle(handle_t *handle, struct inode *inode, int name_index,
 
 	if (ext4_test_inode_state(inode, EXT4_STATE_NEW)) {
 		struct ext4_inode *raw_inode = ext4_raw_inode(&is.iloc);
-		memset(raw_inode, 0, EXT4_SB(inode->i_sb)->s_inode_size);
+		memset(raw_inode, 0, EXT4_SB(inode_sb(inode))->s_inode_size);
 		ext4_clear_inode_state(inode, EXT4_STATE_NEW);
 	}
 
@@ -2371,9 +2377,9 @@ ext4_xattr_set_handle(handle_t *handle, struct inode *inode, int name_index,
 		if (!bs.s.not_found && ext4_xattr_value_same(&bs.s, &i))
 			goto cleanup;
 
-		if (ext4_has_feature_ea_inode(inode->i_sb) &&
+		if (ext4_has_feature_ea_inode(inode_sb(inode)) &&
 		    (EXT4_XATTR_SIZE(i.value_len) >
-			EXT4_XATTR_MIN_LARGE_EA_SIZE(inode->i_sb->s_blocksize)))
+			EXT4_XATTR_MIN_LARGE_EA_SIZE(inode_sb(inode)->s_blocksize)))
 			i.in_inode = 1;
 retry_inode:
 		error = ext4_xattr_ibody_set(handle, inode, &i, &is);
@@ -2396,7 +2402,7 @@ ext4_xattr_set_handle(handle_t *handle, struct inode *inode, int name_index,
 				 * Xattr does not fit in the block, store at
 				 * external inode if possible.
 				 */
-				if (ext4_has_feature_ea_inode(inode->i_sb) &&
+				if (ext4_has_feature_ea_inode(inode_sb(inode)) &&
 				    !i.in_inode) {
 					i.in_inode = 1;
 					goto retry_inode;
@@ -2405,7 +2411,7 @@ ext4_xattr_set_handle(handle_t *handle, struct inode *inode, int name_index,
 		}
 	}
 	if (!error) {
-		ext4_xattr_update_super_block(handle, inode->i_sb);
+		ext4_xattr_update_super_block(handle, inode_sb(inode));
 		inode->i_ctime = current_time(inode);
 		if (!value)
 			no_expand = 0;
@@ -2434,7 +2440,7 @@ int ext4_xattr_set_credits(struct inode *inode, size_t value_len,
 
 	*credits = 0;
 
-	if (!EXT4_SB(inode->i_sb)->s_journal)
+	if (!EXT4_SB(inode_sb(inode))->s_journal)
 		return 0;
 
 	down_read(&EXT4_I(inode)->xattr_sem);
@@ -2443,7 +2449,8 @@ int ext4_xattr_set_credits(struct inode *inode, size_t value_len,
 	if (IS_ERR(bh)) {
 		err = PTR_ERR(bh);
 	} else {
-		*credits = __ext4_xattr_set_credits(inode->i_sb, inode, bh,
+		*credits = __ext4_xattr_set_credits(inode_sb(inode), inode,
+						    bh,
 						    value_len, is_create);
 		brelse(bh);
 		err = 0;
@@ -2466,7 +2473,7 @@ ext4_xattr_set(struct inode *inode, int name_index, const char *name,
 	       const void *value, size_t value_len, int flags)
 {
 	handle_t *handle;
-	struct super_block *sb = inode->i_sb;
+	struct super_block *sb = inode_sb(inode);
 	int error, retries = 0;
 	int credits;
 
@@ -2677,7 +2684,7 @@ int ext4_expand_extra_isize_ea(struct inode *inode, int new_extra_isize,
 {
 	struct ext4_xattr_ibody_header *header;
 	struct buffer_head *bh;
-	struct ext4_sb_info *sbi = EXT4_SB(inode->i_sb);
+	struct ext4_sb_info *sbi = EXT4_SB(inode_sb(inode));
 	static unsigned int mnt_count;
 	size_t min_offs;
 	size_t ifree, bfree;
@@ -2700,7 +2707,7 @@ int ext4_expand_extra_isize_ea(struct inode *inode, int new_extra_isize,
 	 */
 
 	base = IFIRST(header);
-	end = (void *)raw_inode + EXT4_SB(inode->i_sb)->s_inode_size;
+	end = (void *)raw_inode + EXT4_SB(inode_sb(inode))->s_inode_size;
 	min_offs = end - base;
 	total_ino = sizeof(struct ext4_xattr_ibody_header);
 
@@ -2717,7 +2724,7 @@ int ext4_expand_extra_isize_ea(struct inode *inode, int new_extra_isize,
 	 * EA block can hold new_extra_isize bytes.
 	 */
 	if (EXT4_I(inode)->i_file_acl) {
-		bh = sb_bread(inode->i_sb, EXT4_I(inode)->i_file_acl);
+		bh = sb_bread(inode_sb(inode), EXT4_I(inode)->i_file_acl);
 		error = -EIO;
 		if (!bh)
 			goto cleanup;
@@ -2744,7 +2751,7 @@ int ext4_expand_extra_isize_ea(struct inode *inode, int new_extra_isize,
 			goto cleanup;
 		}
 	} else {
-		bfree = inode->i_sb->s_blocksize;
+		bfree = inode_sb(inode)->s_blocksize;
 	}
 
 	error = ext4_xattr_make_inode_space(handle, inode, raw_inode,
@@ -2769,7 +2776,8 @@ int ext4_expand_extra_isize_ea(struct inode *inode, int new_extra_isize,
 
 cleanup:
 	if (error && (mnt_count != le16_to_cpu(sbi->s_es->s_mnt_count))) {
-		ext4_warning(inode->i_sb, "Unable to expand inode %lu. Delete some EAs or run e2fsck.",
+		ext4_warning(inode_sb(inode),
+			     "Unable to expand inode %lu. Delete some EAs or run e2fsck.",
 			     inode->i_ino);
 		mnt_count = le16_to_cpu(sbi->s_es->s_mnt_count);
 	}
@@ -2849,7 +2857,7 @@ int ext4_xattr_delete_inode(handle_t *handle, struct inode *inode,
 		goto cleanup;
 	}
 
-	if (ext4_has_feature_ea_inode(inode->i_sb) &&
+	if (ext4_has_feature_ea_inode(inode_sb(inode)) &&
 	    ext4_test_inode_state(inode, EXT4_STATE_XATTR)) {
 
 		error = ext4_get_inode_loc(inode, &iloc);
@@ -2876,7 +2884,7 @@ int ext4_xattr_delete_inode(handle_t *handle, struct inode *inode,
 	}
 
 	if (EXT4_I(inode)->i_file_acl) {
-		bh = sb_bread(inode->i_sb, EXT4_I(inode)->i_file_acl);
+		bh = sb_bread(inode_sb(inode), EXT4_I(inode)->i_file_acl);
 		if (!bh) {
 			EXT4_ERROR_INODE(inode, "block %llu read error",
 					 EXT4_I(inode)->i_file_acl);
@@ -2890,7 +2898,7 @@ int ext4_xattr_delete_inode(handle_t *handle, struct inode *inode,
 			goto cleanup;
 		}
 
-		if (ext4_has_feature_ea_inode(inode->i_sb)) {
+		if (ext4_has_feature_ea_inode(inode_sb(inode))) {
 			for (entry = BFIRST(bh); !IS_LAST_ENTRY(entry);
 			     entry = EXT4_XATTR_NEXT(entry)) {
 				if (!entry->e_value_inum)
@@ -3036,7 +3044,7 @@ ext4_xattr_block_cache_find(struct inode *inode,
 	while (ce) {
 		struct buffer_head *bh;
 
-		bh = sb_bread(inode->i_sb, ce->e_value);
+		bh = sb_bread(inode_sb(inode), ce->e_value);
 		if (!bh) {
 			EXT4_ERROR_INODE(inode, "block %lu read error",
 					 (unsigned long)ce->e_value);
diff --git a/fs/ext4/xattr_user.c b/fs/ext4/xattr_user.c
index d4546184b34b..d2d0b8d2c871 100644
--- a/fs/ext4/xattr_user.c
+++ b/fs/ext4/xattr_user.c
@@ -23,7 +23,7 @@ ext4_xattr_user_get(const struct xattr_handler *handler,
 		    struct dentry *unused, struct inode *inode,
 		    const char *name, void *buffer, size_t size)
 {
-	if (!test_opt(inode->i_sb, XATTR_USER))
+	if (!test_opt(inode_sb(inode), XATTR_USER))
 		return -EOPNOTSUPP;
 	return ext4_xattr_get(inode, EXT4_XATTR_INDEX_USER,
 			      name, buffer, size);
@@ -35,7 +35,7 @@ ext4_xattr_user_set(const struct xattr_handler *handler,
 		    const char *name, const void *value,
 		    size_t size, int flags)
 {
-	if (!test_opt(inode->i_sb, XATTR_USER))
+	if (!test_opt(inode_sb(inode), XATTR_USER))
 		return -EOPNOTSUPP;
 	return ext4_xattr_set(inode, EXT4_XATTR_INDEX_USER,
 			      name, value, size, flags);
-- 
2.15.1

^ permalink raw reply related	[flat|nested] 88+ messages in thread

* [PATCH 32/76] fs/f2fs: Use inode_sb() helper instead of inode->i_sb
  2018-05-08 18:03 [RFC][PATCH 0/76] vfs: 'views' for filesystems with more than one root Mark Fasheh
                   ` (30 preceding siblings ...)
  2018-05-08 18:03 ` [PATCH 31/76] fs/ext4: " Mark Fasheh
@ 2018-05-08 18:03 ` Mark Fasheh
  2018-05-10 10:10   ` Chao Yu
  2018-05-08 18:03 ` [PATCH 33/76] fs/fat: " Mark Fasheh
                   ` (44 subsequent siblings)
  76 siblings, 1 reply; 88+ messages in thread
From: Mark Fasheh @ 2018-05-08 18:03 UTC (permalink / raw)
  To: linux-fsdevel; +Cc: linux-kernel, linux-btrfs, Mark Fasheh

Signed-off-by: Mark Fasheh <mfasheh@suse.de>
---
 fs/f2fs/data.c     |  6 +++---
 fs/f2fs/f2fs.h     |  2 +-
 fs/f2fs/file.c     | 36 ++++++++++++++++++------------------
 fs/f2fs/inline.c   |  4 ++--
 fs/f2fs/inode.c    |  6 +++---
 fs/f2fs/namei.c    | 11 ++++++-----
 fs/f2fs/recovery.c | 11 ++++++-----
 fs/f2fs/super.c    |  6 +++---
 fs/f2fs/trace.c    |  7 ++++---
 fs/f2fs/xattr.c    |  4 ++--
 10 files changed, 48 insertions(+), 45 deletions(-)

diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
index 7578ed1a85e0..f3e29f386f6e 100644
--- a/fs/f2fs/data.c
+++ b/fs/f2fs/data.c
@@ -1129,7 +1129,7 @@ static int __get_data_block(struct inode *inode, sector_t iblock,
 
 	err = f2fs_map_blocks(inode, &map, create, flag);
 	if (!err) {
-		map_bh(bh, inode->i_sb, map.m_pblk);
+		map_bh(bh, inode_sb(inode), map.m_pblk);
 		bh->b_state = (bh->b_state & ~F2FS_MAP_FLAGS) | map.m_flags;
 		bh->b_size = (u64)map.m_len << inode->i_blkbits;
 	}
@@ -1225,7 +1225,7 @@ static int f2fs_xattr_fiemap(struct inode *inode,
 		get_node_info(sbi, xnid, &ni);
 
 		phys = (__u64)blk_to_logical(inode, ni.blk_addr);
-		len = inode->i_sb->s_blocksize;
+		len = inode_sb(inode)->s_blocksize;
 
 		f2fs_put_page(page, 1);
 
@@ -2272,7 +2272,7 @@ static int f2fs_write_end(struct file *file,
 static int check_direct_IO(struct inode *inode, struct iov_iter *iter,
 			   loff_t offset)
 {
-	unsigned blocksize_mask = inode->i_sb->s_blocksize - 1;
+	unsigned blocksize_mask = inode_sb(inode)->s_blocksize - 1;
 
 	if (offset & blocksize_mask)
 		return -EINVAL;
diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
index 6300ac5bcbe4..504c84b68636 100644
--- a/fs/f2fs/f2fs.h
+++ b/fs/f2fs/f2fs.h
@@ -1331,7 +1331,7 @@ static inline struct f2fs_sb_info *F2FS_SB(struct super_block *sb)
 
 static inline struct f2fs_sb_info *F2FS_I_SB(struct inode *inode)
 {
-	return F2FS_SB(inode->i_sb);
+	return F2FS_SB(inode_sb(inode));
 }
 
 static inline struct f2fs_sb_info *F2FS_M_SB(struct address_space *mapping)
diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
index 672a542e5464..837333b9153d 100644
--- a/fs/f2fs/file.c
+++ b/fs/f2fs/file.c
@@ -58,7 +58,7 @@ static int f2fs_vm_page_mkwrite(struct vm_fault *vmf)
 		goto err;
 	}
 
-	sb_start_pagefault(inode->i_sb);
+	sb_start_pagefault(inode_sb(inode));
 
 	f2fs_bug_on(sbi, f2fs_has_inline_data(inode));
 
@@ -117,7 +117,7 @@ static int f2fs_vm_page_mkwrite(struct vm_fault *vmf)
 out_sem:
 	up_read(&F2FS_I(inode)->i_mmap_sem);
 out:
-	sb_end_pagefault(inode->i_sb);
+	sb_end_pagefault(inode_sb(inode));
 	f2fs_update_time(sbi, REQ_TIME);
 err:
 	return block_page_mkwrite_return(err);
@@ -211,7 +211,7 @@ static int f2fs_do_sync_file(struct file *file, loff_t start, loff_t end,
 		.for_reclaim = 0,
 	};
 
-	if (unlikely(f2fs_readonly(inode->i_sb)))
+	if (unlikely(f2fs_readonly(inode_sb(inode))))
 		return 0;
 
 	trace_f2fs_sync_file_enter(inode);
@@ -259,7 +259,7 @@ static int f2fs_do_sync_file(struct file *file, loff_t start, loff_t end,
 
 	if (cp_reason) {
 		/* all the dirty node pages should be flushed for POR */
-		ret = f2fs_sync_fs(inode->i_sb, 1);
+		ret = f2fs_sync_fs(inode_sb(inode), 1);
 
 		/*
 		 * We've secured consistency through sync_fs. Following pino
@@ -365,7 +365,7 @@ static bool __found_offset(block_t blkaddr, pgoff_t dirty, pgoff_t pgofs,
 static loff_t f2fs_seek_block(struct file *file, loff_t offset, int whence)
 {
 	struct inode *inode = file->f_mapping->host;
-	loff_t maxbytes = inode->i_sb->s_maxbytes;
+	loff_t maxbytes = inode_sb(inode)->s_maxbytes;
 	struct dnode_of_data dn;
 	pgoff_t pgofs, end_offset, dirty;
 	loff_t data_ofs = offset;
@@ -437,7 +437,7 @@ static loff_t f2fs_seek_block(struct file *file, loff_t offset, int whence)
 static loff_t f2fs_llseek(struct file *file, loff_t offset, int whence)
 {
 	struct inode *inode = file->f_mapping->host;
-	loff_t maxbytes = inode->i_sb->s_maxbytes;
+	loff_t maxbytes = inode_sb(inode)->s_maxbytes;
 
 	switch (whence) {
 	case SEEK_SET:
@@ -569,7 +569,7 @@ static int truncate_partial_data_page(struct inode *inode, u64 from,
 int truncate_blocks(struct inode *inode, u64 from, bool lock)
 {
 	struct f2fs_sb_info *sbi = F2FS_I_SB(inode);
-	unsigned int blocksize = inode->i_sb->s_blocksize;
+	unsigned int blocksize = inode_sb(inode)->s_blocksize;
 	struct dnode_of_data dn;
 	pgoff_t free_from;
 	int count = 0, err = 0;
@@ -676,7 +676,7 @@ int f2fs_getattr(const struct path *path, struct kstat *stat,
 	unsigned int flags;
 
 	if (f2fs_has_extra_attr(inode) &&
-			f2fs_sb_has_inode_crtime(inode->i_sb) &&
+			f2fs_sb_has_inode_crtime(inode_sb(inode)) &&
 			F2FS_FITS_IN_INODE(ri, fi->i_extra_isize, i_crtime)) {
 		stat->result_mask |= STATX_BTIME;
 		stat->btime.tv_sec = fi->i_crtime.tv_sec;
@@ -722,13 +722,13 @@ static void __setattr_copy(struct inode *inode, const struct iattr *attr)
 		inode->i_gid = attr->ia_gid;
 	if (ia_valid & ATTR_ATIME)
 		inode->i_atime = timespec_trunc(attr->ia_atime,
-						inode->i_sb->s_time_gran);
+						inode_sb(inode)->s_time_gran);
 	if (ia_valid & ATTR_MTIME)
 		inode->i_mtime = timespec_trunc(attr->ia_mtime,
-						inode->i_sb->s_time_gran);
+						inode_sb(inode)->s_time_gran);
 	if (ia_valid & ATTR_CTIME)
 		inode->i_ctime = timespec_trunc(attr->ia_ctime,
-						inode->i_sb->s_time_gran);
+						inode_sb(inode)->s_time_gran);
 	if (ia_valid & ATTR_MODE) {
 		umode_t mode = attr->ia_mode;
 
@@ -1891,7 +1891,7 @@ static int f2fs_ioc_shutdown(struct file *filp, unsigned long arg)
 static int f2fs_ioc_fitrim(struct file *filp, unsigned long arg)
 {
 	struct inode *inode = file_inode(filp);
-	struct super_block *sb = inode->i_sb;
+	struct super_block *sb = inode_sb(inode);
 	struct request_queue *q = bdev_get_queue(sb->s_bdev);
 	struct fstrim_range range;
 	int ret;
@@ -1938,7 +1938,7 @@ static int f2fs_ioc_set_encryption_policy(struct file *filp, unsigned long arg)
 {
 	struct inode *inode = file_inode(filp);
 
-	if (!f2fs_sb_has_crypto(inode->i_sb))
+	if (!f2fs_sb_has_crypto(inode_sb(inode)))
 		return -EOPNOTSUPP;
 
 	f2fs_update_time(F2FS_I_SB(inode), REQ_TIME);
@@ -1948,7 +1948,7 @@ static int f2fs_ioc_set_encryption_policy(struct file *filp, unsigned long arg)
 
 static int f2fs_ioc_get_encryption_policy(struct file *filp, unsigned long arg)
 {
-	if (!f2fs_sb_has_crypto(file_inode(filp)->i_sb))
+	if (!f2fs_sb_has_crypto(inode_sb(file_inode(filp))))
 		return -EOPNOTSUPP;
 	return fscrypt_ioctl_get_policy(filp, (void __user *)arg);
 }
@@ -1959,7 +1959,7 @@ static int f2fs_ioc_get_encryption_pwsalt(struct file *filp, unsigned long arg)
 	struct f2fs_sb_info *sbi = F2FS_I_SB(inode);
 	int err;
 
-	if (!f2fs_sb_has_crypto(inode->i_sb))
+	if (!f2fs_sb_has_crypto(inode_sb(inode)))
 		return -EOPNOTSUPP;
 
 	if (uuid_is_nonzero(sbi->raw_super->encrypt_pw_salt))
@@ -2290,10 +2290,10 @@ static int f2fs_move_file_range(struct file *file_in, loff_t pos_in,
 	int ret;
 
 	if (file_in->f_path.mnt != file_out->f_path.mnt ||
-				src->i_sb != dst->i_sb)
+				inode_sb(src) != inode_sb(dst))
 		return -EXDEV;
 
-	if (unlikely(f2fs_readonly(src->i_sb)))
+	if (unlikely(f2fs_readonly(inode_sb(src))))
 		return -EROFS;
 
 	if (!S_ISREG(src->i_mode) || !S_ISREG(dst->i_mode))
@@ -2644,7 +2644,7 @@ static int f2fs_ioc_fsgetxattr(struct file *filp, unsigned long arg)
 	fa.fsx_xflags = f2fs_iflags_to_xflags(fi->i_flags &
 				(FS_FL_USER_VISIBLE | FS_PROJINHERIT_FL));
 
-	if (f2fs_sb_has_project_quota(inode->i_sb))
+	if (f2fs_sb_has_project_quota(inode_sb(inode)))
 		fa.fsx_projid = (__u32)from_kprojid(&init_user_ns,
 							fi->i_projid);
 
diff --git a/fs/f2fs/inline.c b/fs/f2fs/inline.c
index 90e38d8ea688..eb8b1a085974 100644
--- a/fs/f2fs/inline.c
+++ b/fs/f2fs/inline.c
@@ -294,7 +294,7 @@ bool recover_inline_data(struct inode *inode, struct page *npage)
 struct f2fs_dir_entry *find_in_inline_dir(struct inode *dir,
 			struct fscrypt_name *fname, struct page **res_page)
 {
-	struct f2fs_sb_info *sbi = F2FS_SB(dir->i_sb);
+	struct f2fs_sb_info *sbi = F2FS_SB(inode_sb(dir));
 	struct qstr name = FSTR_TO_QSTR(&fname->disk_name);
 	struct f2fs_dir_entry *de;
 	struct f2fs_dentry_ptr d;
@@ -674,7 +674,7 @@ int f2fs_inline_data_fiemap(struct inode *inode,
 	ilen -= start;
 
 	get_node_info(F2FS_I_SB(inode), inode->i_ino, &ni);
-	byteaddr = (__u64)ni.blk_addr << inode->i_sb->s_blocksize_bits;
+	byteaddr = (__u64)ni.blk_addr << inode_sb(inode)->s_blocksize_bits;
 	byteaddr += (char *)inline_data_addr(inode, ipage) -
 					(char *)F2FS_INODE(ipage);
 	err = fiemap_fill_next_extent(fieinfo, start, byteaddr, ilen, flags);
diff --git a/fs/f2fs/inode.c b/fs/f2fs/inode.c
index 205add3d0f3a..4bc24cf161d3 100644
--- a/fs/f2fs/inode.c
+++ b/fs/f2fs/inode.c
@@ -195,7 +195,7 @@ static int do_read_inode(struct inode *inode)
 
 	/* Check if ino is within scope */
 	if (check_nid_range(sbi, inode->i_ino)) {
-		f2fs_msg(inode->i_sb, KERN_ERR, "bad inode number: %lu",
+		f2fs_msg(inode_sb(inode), KERN_ERR, "bad inode number: %lu",
 			 (unsigned long) inode->i_ino);
 		WARN_ON(1);
 		return -EINVAL;
@@ -522,7 +522,7 @@ void f2fs_evict_inode(struct inode *inode)
 	remove_ino_entry(sbi, inode->i_ino, UPDATE_INO);
 	remove_ino_entry(sbi, inode->i_ino, FLUSH_INO);
 
-	sb_start_intwrite(inode->i_sb);
+	sb_start_intwrite(inode_sb(inode));
 	set_inode_flag(inode, FI_NO_ALLOC);
 	i_size_write(inode, 0);
 retry:
@@ -552,7 +552,7 @@ void f2fs_evict_inode(struct inode *inode)
 	if (err)
 		update_inode_page(inode);
 	dquot_free_inode(inode);
-	sb_end_intwrite(inode->i_sb);
+	sb_end_intwrite(inode_sb(inode));
 no_delete:
 	dquot_drop(inode);
 
diff --git a/fs/f2fs/namei.c b/fs/f2fs/namei.c
index b68e7b03959f..17a171d258cb 100644
--- a/fs/f2fs/namei.c
+++ b/fs/f2fs/namei.c
@@ -32,7 +32,7 @@ static struct inode *f2fs_new_inode(struct inode *dir, umode_t mode)
 	int xattr_size = 0;
 	int err;
 
-	inode = new_inode(dir->i_sb);
+	inode = new_inode(inode_sb(dir));
 	if (!inode)
 		return ERR_PTR(-ENOMEM);
 
@@ -380,7 +380,7 @@ static struct dentry *f2fs_lookup(struct inode *dir, struct dentry *dentry,
 	f2fs_dentry_kunmap(dir, page);
 	f2fs_put_page(page, 0);
 
-	inode = f2fs_iget(dir->i_sb, ino);
+	inode = f2fs_iget(inode_sb(dir), ino);
 	if (IS_ERR(inode)) {
 		err = PTR_ERR(inode);
 		goto out;
@@ -400,7 +400,7 @@ static struct dentry *f2fs_lookup(struct inode *dir, struct dentry *dentry,
 	if (f2fs_encrypted_inode(dir) &&
 	    (S_ISDIR(inode->i_mode) || S_ISLNK(inode->i_mode)) &&
 	    !fscrypt_has_permitted_context(dir, inode)) {
-		f2fs_msg(inode->i_sb, KERN_WARNING,
+		f2fs_msg(inode_sb(inode), KERN_WARNING,
 			 "Inconsistent encryption contexts: %lu/%lu",
 			 dir->i_ino, inode->i_ino);
 		err = -EPERM;
@@ -492,7 +492,8 @@ static int f2fs_symlink(struct inode *dir, struct dentry *dentry,
 	if (unlikely(f2fs_cp_error(sbi)))
 		return -EIO;
 
-	err = fscrypt_prepare_symlink(dir, symname, len, dir->i_sb->s_blocksize,
+	err = fscrypt_prepare_symlink(dir, symname, len,
+				      inode_sb(dir)->s_blocksize,
 				      &disk_link);
 	if (err)
 		return err;
@@ -1125,7 +1126,7 @@ static const char *f2fs_encrypted_get_link(struct dentry *dentry,
 		return ERR_CAST(page);
 
 	target = fscrypt_get_symlink(inode, page_address(page),
-				     inode->i_sb->s_blocksize, done);
+				     inode_sb(inode)->s_blocksize, done);
 	put_page(page);
 	return target;
 }
diff --git a/fs/f2fs/recovery.c b/fs/f2fs/recovery.c
index 337f3363f48f..060d8259224d 100644
--- a/fs/f2fs/recovery.c
+++ b/fs/f2fs/recovery.c
@@ -147,7 +147,8 @@ static int recover_dentry(struct inode *inode, struct page *ipage,
 		goto out_unmap_put;
 
 	if (de) {
-		einode = f2fs_iget_retry(inode->i_sb, le32_to_cpu(de->ino));
+		einode = f2fs_iget_retry(inode_sb(inode),
+					 le32_to_cpu(de->ino));
 		if (IS_ERR(einode)) {
 			WARN_ON(1);
 			err = PTR_ERR(einode);
@@ -188,7 +189,7 @@ static int recover_dentry(struct inode *inode, struct page *ipage,
 		name = "<encrypted>";
 	else
 		name = raw_inode->i_name;
-	f2fs_msg(inode->i_sb, KERN_NOTICE,
+	f2fs_msg(inode_sb(inode), KERN_NOTICE,
 			"%s: ino = %x, name = %s, dir = %lx, err = %d",
 			__func__, ino_of_node(ipage), name,
 			IS_ERR(dir) ? 0 : dir->i_ino, err);
@@ -232,9 +233,9 @@ static void recover_inode(struct inode *inode, struct page *page)
 	else
 		name = F2FS_INODE(page)->i_name;
 
-	f2fs_msg(inode->i_sb, KERN_NOTICE,
-		"recover_inode: ino = %x, name = %s, inline = %x",
-			ino_of_node(page), name, raw->i_inline);
+	f2fs_msg(inode_sb(inode), KERN_NOTICE,
+		 "recover_inode: ino = %x, name = %s, inline = %x",
+		 ino_of_node(page), name, raw->i_inline);
 }
 
 static int find_fsync_dnodes(struct f2fs_sb_info *sbi, struct list_head *head,
diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c
index 8173ae688814..76cc211194c8 100644
--- a/fs/f2fs/super.c
+++ b/fs/f2fs/super.c
@@ -776,13 +776,13 @@ static int f2fs_drop_inode(struct inode *inode)
 			/* should remain fi->extent_tree for writepage */
 			f2fs_destroy_extent_node(inode);
 
-			sb_start_intwrite(inode->i_sb);
+			sb_start_intwrite(inode_sb(inode));
 			f2fs_i_size_write(inode, 0);
 
 			if (F2FS_HAS_BLOCKS(inode))
 				f2fs_truncate(inode);
 
-			sb_end_intwrite(inode->i_sb);
+			sb_end_intwrite(inode_sb(inode));
 
 			spin_lock(&inode->i_lock);
 			atomic_dec(&inode->i_count);
@@ -1805,7 +1805,7 @@ static int f2fs_set_context(struct inode *inode, const void *ctx, size_t len,
 static unsigned f2fs_max_namelen(struct inode *inode)
 {
 	return S_ISLNK(inode->i_mode) ?
-			inode->i_sb->s_blocksize : F2FS_NAME_LEN;
+			inode_sb(inode)->s_blocksize : F2FS_NAME_LEN;
 }
 
 static const struct fscrypt_operations f2fs_cryptops = {
diff --git a/fs/f2fs/trace.c b/fs/f2fs/trace.c
index a1fcd00bbb2b..235a3bca1f5f 100644
--- a/fs/f2fs/trace.c
+++ b/fs/f2fs/trace.c
@@ -74,7 +74,8 @@ void f2fs_trace_pid(struct page *page)
 	f2fs_radix_tree_insert(&pids, pid, current);
 
 	trace_printk("%3x:%3x %4x %-16s\n",
-			MAJOR(inode->i_sb->s_dev), MINOR(inode->i_sb->s_dev),
+			MAJOR(inode_sb(inode)->s_dev),
+			MINOR(inode_sb(inode)->s_dev),
 			pid, current->comm);
 out:
 	mutex_unlock(&pids_lock);
@@ -95,8 +96,8 @@ void f2fs_trace_ios(struct f2fs_io_info *fio, int flush)
 	inode = fio->page->mapping->host;
 	pid = page_private(fio->page);
 
-	major = MAJOR(inode->i_sb->s_dev);
-	minor = MINOR(inode->i_sb->s_dev);
+	major = MAJOR(inode_sb(inode)->s_dev);
+	minor = MINOR(inode_sb(inode)->s_dev);
 
 	if (last_io.major == major && last_io.minor == minor &&
 			last_io.pid == pid &&
diff --git a/fs/f2fs/xattr.c b/fs/f2fs/xattr.c
index ae2dfa709f5d..9d445f4f5d8b 100644
--- a/fs/f2fs/xattr.c
+++ b/fs/f2fs/xattr.c
@@ -29,7 +29,7 @@ static int f2fs_xattr_generic_get(const struct xattr_handler *handler,
 		struct dentry *unused, struct inode *inode,
 		const char *name, void *buffer, size_t size)
 {
-	struct f2fs_sb_info *sbi = F2FS_SB(inode->i_sb);
+	struct f2fs_sb_info *sbi = F2FS_SB(inode_sb(inode));
 
 	switch (handler->flags) {
 	case F2FS_XATTR_INDEX_USER:
@@ -54,7 +54,7 @@ static int f2fs_xattr_generic_set(const struct xattr_handler *handler,
 		const char *name, const void *value,
 		size_t size, int flags)
 {
-	struct f2fs_sb_info *sbi = F2FS_SB(inode->i_sb);
+	struct f2fs_sb_info *sbi = F2FS_SB(inode_sb(inode));
 
 	switch (handler->flags) {
 	case F2FS_XATTR_INDEX_USER:
-- 
2.15.1

^ permalink raw reply related	[flat|nested] 88+ messages in thread

* [PATCH 33/76] fs/fat: Use inode_sb() helper instead of inode->i_sb
  2018-05-08 18:03 [RFC][PATCH 0/76] vfs: 'views' for filesystems with more than one root Mark Fasheh
                   ` (31 preceding siblings ...)
  2018-05-08 18:03 ` [PATCH 32/76] fs/f2fs: " Mark Fasheh
@ 2018-05-08 18:03 ` Mark Fasheh
  2018-05-08 18:03 ` [PATCH 34/76] fs/freevxfs: " Mark Fasheh
                   ` (43 subsequent siblings)
  76 siblings, 0 replies; 88+ messages in thread
From: Mark Fasheh @ 2018-05-08 18:03 UTC (permalink / raw)
  To: linux-fsdevel; +Cc: linux-kernel, linux-btrfs, Mark Fasheh

Signed-off-by: Mark Fasheh <mfasheh@suse.de>
---
 fs/fat/cache.c       | 12 ++++++------
 fs/fat/dir.c         | 26 +++++++++++++-------------
 fs/fat/fat.h         |  2 +-
 fs/fat/fatent.c      | 10 +++++-----
 fs/fat/file.c        | 24 ++++++++++++------------
 fs/fat/inode.c       | 28 ++++++++++++++--------------
 fs/fat/misc.c        |  2 +-
 fs/fat/namei_msdos.c | 22 +++++++++++-----------
 fs/fat/namei_vfat.c  | 18 +++++++++---------
 fs/fat/nfs.c         |  4 ++--
 10 files changed, 74 insertions(+), 74 deletions(-)

diff --git a/fs/fat/cache.c b/fs/fat/cache.c
index e9bed49df6b7..bfe99b4a9ef8 100644
--- a/fs/fat/cache.c
+++ b/fs/fat/cache.c
@@ -224,7 +224,7 @@ static inline void cache_init(struct fat_cache_id *cid, int fclus, int dclus)
 
 int fat_get_cluster(struct inode *inode, int cluster, int *fclus, int *dclus)
 {
-	struct super_block *sb = inode->i_sb;
+	struct super_block *sb = inode_sb(inode);
 	const int limit = sb->s_maxbytes >> MSDOS_SB(sb)->cluster_bits;
 	struct fat_entry fatent;
 	struct fat_cache_id cid;
@@ -285,7 +285,7 @@ int fat_get_cluster(struct inode *inode, int cluster, int *fclus, int *dclus)
 
 static int fat_bmap_cluster(struct inode *inode, int cluster)
 {
-	struct super_block *sb = inode->i_sb;
+	struct super_block *sb = inode_sb(inode);
 	int ret, fclus, dclus;
 
 	if (MSDOS_I(inode)->i_start == 0)
@@ -306,7 +306,7 @@ int fat_get_mapped_cluster(struct inode *inode, sector_t sector,
 			   sector_t last_block,
 			   unsigned long *mapped_blocks, sector_t *bmap)
 {
-	struct super_block *sb = inode->i_sb;
+	struct super_block *sb = inode_sb(inode);
 	struct msdos_sb_info *sbi = MSDOS_SB(sb);
 	int cluster, offset;
 
@@ -328,7 +328,7 @@ int fat_get_mapped_cluster(struct inode *inode, sector_t sector,
 static int is_exceed_eof(struct inode *inode, sector_t sector,
 			 sector_t *last_block, int create)
 {
-	struct super_block *sb = inode->i_sb;
+	struct super_block *sb = inode_sb(inode);
 	const unsigned long blocksize = sb->s_blocksize;
 	const unsigned char blocksize_bits = sb->s_blocksize_bits;
 
@@ -353,7 +353,7 @@ static int is_exceed_eof(struct inode *inode, sector_t sector,
 int fat_bmap(struct inode *inode, sector_t sector, sector_t *phys,
 	     unsigned long *mapped_blocks, int create, bool from_bmap)
 {
-	struct msdos_sb_info *sbi = MSDOS_SB(inode->i_sb);
+	struct msdos_sb_info *sbi = MSDOS_SB(inode_sb(inode));
 	sector_t last_block;
 
 	*phys = 0;
@@ -371,7 +371,7 @@ int fat_bmap(struct inode *inode, sector_t sector, sector_t *phys,
 			return 0;
 	} else {
 		last_block = inode->i_blocks >>
-				(inode->i_sb->s_blocksize_bits - 9);
+				(inode_sb(inode)->s_blocksize_bits - 9);
 		if (sector >= last_block)
 			return 0;
 	}
diff --git a/fs/fat/dir.c b/fs/fat/dir.c
index 8e100c3bf72c..dce4b9f0c754 100644
--- a/fs/fat/dir.c
+++ b/fs/fat/dir.c
@@ -48,7 +48,7 @@ static inline loff_t fat_make_i_pos(struct super_block *sb,
 static inline void fat_dir_readahead(struct inode *dir, sector_t iblock,
 				     sector_t phys)
 {
-	struct super_block *sb = dir->i_sb;
+	struct super_block *sb = inode_sb(dir);
 	struct msdos_sb_info *sbi = MSDOS_SB(sb);
 	struct buffer_head *bh;
 	int sec;
@@ -81,7 +81,7 @@ static inline void fat_dir_readahead(struct inode *dir, sector_t iblock,
 static int fat__get_entry(struct inode *dir, loff_t *pos,
 			  struct buffer_head **bh, struct msdos_dir_entry **de)
 {
-	struct super_block *sb = dir->i_sb;
+	struct super_block *sb = inode_sb(dir);
 	sector_t phys, iblock;
 	unsigned long mapped_blocks;
 	int err, offset;
@@ -121,7 +121,7 @@ static inline int fat_get_entry(struct inode *dir, loff_t *pos,
 	/* Fast stuff first */
 	if (*bh && *de &&
 	   (*de - (struct msdos_dir_entry *)(*bh)->b_data) <
-				MSDOS_SB(dir->i_sb)->dir_per_block - 1) {
+				MSDOS_SB(inode_sb(dir))->dir_per_block - 1) {
 		*pos += sizeof(struct msdos_dir_entry);
 		(*de)++;
 		return 0;
@@ -462,7 +462,7 @@ static int fat_parse_short(struct super_block *sb,
 int fat_search_long(struct inode *inode, const unsigned char *name,
 		    int name_len, struct fat_slot_info *sinfo)
 {
-	struct super_block *sb = inode->i_sb;
+	struct super_block *sb = inode_sb(inode);
 	struct msdos_sb_info *sbi = MSDOS_SB(sb);
 	struct buffer_head *bh = NULL;
 	struct msdos_dir_entry *de;
@@ -553,7 +553,7 @@ static int __fat_readdir(struct inode *inode, struct file *file,
 			 struct dir_context *ctx, int short_only,
 			 struct fat_ioctl_filldir_callback *both)
 {
-	struct super_block *sb = inode->i_sb;
+	struct super_block *sb = inode_sb(inode);
 	struct msdos_sb_info *sbi = MSDOS_SB(sb);
 	struct buffer_head *bh;
 	struct msdos_dir_entry *de;
@@ -954,7 +954,7 @@ int fat_subdirs(struct inode *dir)
 int fat_scan(struct inode *dir, const unsigned char *name,
 	     struct fat_slot_info *sinfo)
 {
-	struct super_block *sb = dir->i_sb;
+	struct super_block *sb = inode_sb(dir);
 
 	sinfo->slot_off = 0;
 	sinfo->bh = NULL;
@@ -978,7 +978,7 @@ EXPORT_SYMBOL_GPL(fat_scan);
 int fat_scan_logstart(struct inode *dir, int i_logstart,
 		      struct fat_slot_info *sinfo)
 {
-	struct super_block *sb = dir->i_sb;
+	struct super_block *sb = inode_sb(dir);
 
 	sinfo->slot_off = 0;
 	sinfo->bh = NULL;
@@ -996,7 +996,7 @@ int fat_scan_logstart(struct inode *dir, int i_logstart,
 
 static int __fat_remove_entries(struct inode *dir, loff_t pos, int nr_slots)
 {
-	struct super_block *sb = dir->i_sb;
+	struct super_block *sb = inode_sb(dir);
 	struct buffer_head *bh;
 	struct msdos_dir_entry *de, *endp;
 	int err = 0, orig_slots;
@@ -1031,7 +1031,7 @@ static int __fat_remove_entries(struct inode *dir, loff_t pos, int nr_slots)
 
 int fat_remove_entries(struct inode *dir, struct fat_slot_info *sinfo)
 {
-	struct super_block *sb = dir->i_sb;
+	struct super_block *sb = inode_sb(dir);
 	struct msdos_dir_entry *de;
 	struct buffer_head *bh;
 	int err = 0, nr_slots;
@@ -1084,7 +1084,7 @@ EXPORT_SYMBOL_GPL(fat_remove_entries);
 static int fat_zeroed_cluster(struct inode *dir, sector_t blknr, int nr_used,
 			      struct buffer_head **bhs, int nr_bhs)
 {
-	struct super_block *sb = dir->i_sb;
+	struct super_block *sb = inode_sb(dir);
 	sector_t last_blknr = blknr + MSDOS_SB(sb)->sec_per_clus;
 	int err, i, n;
 
@@ -1132,7 +1132,7 @@ static int fat_zeroed_cluster(struct inode *dir, sector_t blknr, int nr_used,
 
 int fat_alloc_new_dir(struct inode *dir, struct timespec *ts)
 {
-	struct super_block *sb = dir->i_sb;
+	struct super_block *sb = inode_sb(dir);
 	struct msdos_sb_info *sbi = MSDOS_SB(sb);
 	struct buffer_head *bhs[MAX_BUF_PER_PAGE];
 	struct msdos_dir_entry *de;
@@ -1196,7 +1196,7 @@ static int fat_add_new_entries(struct inode *dir, void *slots, int nr_slots,
 			       int *nr_cluster, struct msdos_dir_entry **de,
 			       struct buffer_head **bh, loff_t *i_pos)
 {
-	struct super_block *sb = dir->i_sb;
+	struct super_block *sb = inode_sb(dir);
 	struct msdos_sb_info *sbi = MSDOS_SB(sb);
 	struct buffer_head *bhs[MAX_BUF_PER_PAGE];
 	sector_t blknr, start_blknr, last_blknr;
@@ -1275,7 +1275,7 @@ static int fat_add_new_entries(struct inode *dir, void *slots, int nr_slots,
 int fat_add_entries(struct inode *dir, void *slots, int nr_slots,
 		    struct fat_slot_info *sinfo)
 {
-	struct super_block *sb = dir->i_sb;
+	struct super_block *sb = inode_sb(dir);
 	struct msdos_sb_info *sbi = MSDOS_SB(sb);
 	struct buffer_head *bh, *prev, *bhs[3]; /* 32*slots (672bytes) */
 	struct msdos_dir_entry *uninitialized_var(de);
diff --git a/fs/fat/fat.h b/fs/fat/fat.h
index 8fc1093da47d..81c3776bc35d 100644
--- a/fs/fat/fat.h
+++ b/fs/fat/fat.h
@@ -156,7 +156,7 @@ static inline struct msdos_inode_info *MSDOS_I(struct inode *inode)
  */
 static inline int fat_mode_can_hold_ro(struct inode *inode)
 {
-	struct msdos_sb_info *sbi = MSDOS_SB(inode->i_sb);
+	struct msdos_sb_info *sbi = MSDOS_SB(inode_sb(inode));
 	umode_t mask;
 
 	if (S_ISDIR(inode->i_mode)) {
diff --git a/fs/fat/fatent.c b/fs/fat/fatent.c
index bac10de678cc..97d3c44eeee1 100644
--- a/fs/fat/fatent.c
+++ b/fs/fat/fatent.c
@@ -347,8 +347,8 @@ static inline int fat_ent_update_ptr(struct super_block *sb,
 
 int fat_ent_read(struct inode *inode, struct fat_entry *fatent, int entry)
 {
-	struct super_block *sb = inode->i_sb;
-	struct msdos_sb_info *sbi = MSDOS_SB(inode->i_sb);
+	struct super_block *sb = inode_sb(inode);
+	struct msdos_sb_info *sbi = MSDOS_SB(inode_sb(inode));
 	const struct fatent_operations *ops = sbi->fatent_ops;
 	int err, offset;
 	sector_t blocknr;
@@ -406,7 +406,7 @@ static int fat_mirror_bhs(struct super_block *sb, struct buffer_head **bhs,
 int fat_ent_write(struct inode *inode, struct fat_entry *fatent,
 		  int new, int wait)
 {
-	struct super_block *sb = inode->i_sb;
+	struct super_block *sb = inode_sb(inode);
 	const struct fatent_operations *ops = MSDOS_SB(sb)->fatent_ops;
 	int err;
 
@@ -461,7 +461,7 @@ static void fat_collect_bhs(struct buffer_head **bhs, int *nr_bhs,
 
 int fat_alloc_clusters(struct inode *inode, int *cluster, int nr_cluster)
 {
-	struct super_block *sb = inode->i_sb;
+	struct super_block *sb = inode_sb(inode);
 	struct msdos_sb_info *sbi = MSDOS_SB(sb);
 	const struct fatent_operations *ops = sbi->fatent_ops;
 	struct fat_entry fatent, prev_ent;
@@ -549,7 +549,7 @@ int fat_alloc_clusters(struct inode *inode, int *cluster, int nr_cluster)
 
 int fat_free_clusters(struct inode *inode, int cluster)
 {
-	struct super_block *sb = inode->i_sb;
+	struct super_block *sb = inode_sb(inode);
 	struct msdos_sb_info *sbi = MSDOS_SB(sb);
 	const struct fatent_operations *ops = sbi->fatent_ops;
 	struct fat_entry fatent;
diff --git a/fs/fat/file.c b/fs/fat/file.c
index 4724cc9ad650..b01165f8df4c 100644
--- a/fs/fat/file.c
+++ b/fs/fat/file.c
@@ -34,7 +34,7 @@ static int fat_ioctl_get_attributes(struct inode *inode, u32 __user *user_attr)
 static int fat_ioctl_set_attributes(struct file *file, u32 __user *user_attr)
 {
 	struct inode *inode = file_inode(file);
-	struct msdos_sb_info *sbi = MSDOS_SB(inode->i_sb);
+	struct msdos_sb_info *sbi = MSDOS_SB(inode_sb(inode));
 	int is_dir = S_ISDIR(inode->i_mode);
 	u32 attr, oldattr;
 	struct iattr ia;
@@ -117,7 +117,7 @@ static int fat_ioctl_set_attributes(struct file *file, u32 __user *user_attr)
 
 static int fat_ioctl_get_volume_id(struct inode *inode, u32 __user *user_attr)
 {
-	struct msdos_sb_info *sbi = MSDOS_SB(inode->i_sb);
+	struct msdos_sb_info *sbi = MSDOS_SB(inode_sb(inode));
 	return put_user(sbi->vol_id, user_attr);
 }
 
@@ -150,8 +150,8 @@ static long fat_generic_compat_ioctl(struct file *filp, unsigned int cmd,
 static int fat_file_release(struct inode *inode, struct file *filp)
 {
 	if ((filp->f_mode & FMODE_WRITE) &&
-	     MSDOS_SB(inode->i_sb)->options.flush) {
-		fat_flush_inodes(inode->i_sb, inode, NULL);
+	     MSDOS_SB(inode_sb(inode))->options.flush) {
+		fat_flush_inodes(inode_sb(inode), inode, NULL);
 		congestion_wait(BLK_RW_ASYNC, HZ/10);
 	}
 	return 0;
@@ -163,7 +163,7 @@ int fat_file_fsync(struct file *filp, loff_t start, loff_t end, int datasync)
 	int res, err;
 
 	res = generic_file_fsync(filp, start, end, datasync);
-	err = sync_mapping_buffers(MSDOS_SB(inode->i_sb)->fat_inode->i_mapping);
+	err = sync_mapping_buffers(MSDOS_SB(inode_sb(inode))->fat_inode->i_mapping);
 
 	return res ? res : err;
 }
@@ -234,7 +234,7 @@ static long fat_fallocate(struct file *file, int mode,
 	loff_t mm_bytes; /* Number of bytes to be allocated for file */
 	loff_t ondisksize; /* block aligned on-disk size in bytes*/
 	struct inode *inode = file->f_mapping->host;
-	struct super_block *sb = inode->i_sb;
+	struct super_block *sb = inode_sb(inode);
 	struct msdos_sb_info *sbi = MSDOS_SB(sb);
 	int err = 0;
 
@@ -279,7 +279,7 @@ static long fat_fallocate(struct file *file, int mode,
 /* Free all clusters after the skip'th cluster. */
 static int fat_free(struct inode *inode, int skip)
 {
-	struct super_block *sb = inode->i_sb;
+	struct super_block *sb = inode_sb(inode);
 	int err, wait, free_start, i_start, i_logstart;
 
 	if (MSDOS_I(inode)->i_start == 0)
@@ -348,7 +348,7 @@ static int fat_free(struct inode *inode, int skip)
 
 void fat_truncate_blocks(struct inode *inode, loff_t offset)
 {
-	struct msdos_sb_info *sbi = MSDOS_SB(inode->i_sb);
+	struct msdos_sb_info *sbi = MSDOS_SB(inode_sb(inode));
 	const unsigned int cluster_size = sbi->cluster_size;
 	int nr_clusters;
 
@@ -362,7 +362,7 @@ void fat_truncate_blocks(struct inode *inode, loff_t offset)
 	nr_clusters = (offset + (cluster_size - 1)) >> sbi->cluster_bits;
 
 	fat_free(inode, nr_clusters);
-	fat_flush_inodes(inode->i_sb, inode, NULL);
+	fat_flush_inodes(inode_sb(inode), inode, NULL);
 }
 
 int fat_getattr(const struct path *path, struct kstat *stat,
@@ -370,11 +370,11 @@ int fat_getattr(const struct path *path, struct kstat *stat,
 {
 	struct inode *inode = d_inode(path->dentry);
 	generic_fillattr(inode, stat);
-	stat->blksize = MSDOS_SB(inode->i_sb)->cluster_size;
+	stat->blksize = MSDOS_SB(inode_sb(inode))->cluster_size;
 
-	if (MSDOS_SB(inode->i_sb)->options.nfs == FAT_NFS_NOSTALE_RO) {
+	if (MSDOS_SB(inode_sb(inode))->options.nfs == FAT_NFS_NOSTALE_RO) {
 		/* Use i_pos for ino. This is used as fileid of nfs. */
-		stat->ino = fat_i_pos_read(MSDOS_SB(inode->i_sb), inode);
+		stat->ino = fat_i_pos_read(MSDOS_SB(inode_sb(inode)), inode);
 	}
 	return 0;
 }
diff --git a/fs/fat/inode.c b/fs/fat/inode.c
index ffbbf0520d9e..09025f390462 100644
--- a/fs/fat/inode.c
+++ b/fs/fat/inode.c
@@ -113,7 +113,7 @@ static inline int __fat_get_block(struct inode *inode, sector_t iblock,
 				  unsigned long *max_blocks,
 				  struct buffer_head *bh_result, int create)
 {
-	struct super_block *sb = inode->i_sb;
+	struct super_block *sb = inode_sb(inode);
 	struct msdos_sb_info *sbi = MSDOS_SB(sb);
 	unsigned long mapped_blocks;
 	sector_t phys, last_block;
@@ -170,7 +170,7 @@ static inline int __fat_get_block(struct inode *inode, sector_t iblock,
 static int fat_get_block(struct inode *inode, sector_t iblock,
 			 struct buffer_head *bh_result, int create)
 {
-	struct super_block *sb = inode->i_sb;
+	struct super_block *sb = inode_sb(inode);
 	unsigned long max_blocks = bh_result->b_size >> inode->i_blkbits;
 	int err;
 
@@ -283,7 +283,7 @@ static ssize_t fat_direct_IO(struct kiocb *iocb, struct iov_iter *iter)
 static int fat_get_block_bmap(struct inode *inode, sector_t iblock,
 		struct buffer_head *bh_result, int create)
 {
-	struct super_block *sb = inode->i_sb;
+	struct super_block *sb = inode_sb(inode);
 	unsigned long max_blocks = bh_result->b_size >> inode->i_blkbits;
 	int err;
 	sector_t bmap;
@@ -391,7 +391,7 @@ static void dir_hash_init(struct super_block *sb)
 
 void fat_attach(struct inode *inode, loff_t i_pos)
 {
-	struct msdos_sb_info *sbi = MSDOS_SB(inode->i_sb);
+	struct msdos_sb_info *sbi = MSDOS_SB(inode_sb(inode));
 
 	if (inode->i_ino != MSDOS_ROOT_INO) {
 		struct hlist_head *head =   sbi->inode_hashtable
@@ -420,7 +420,7 @@ EXPORT_SYMBOL_GPL(fat_attach);
 
 void fat_detach(struct inode *inode)
 {
-	struct msdos_sb_info *sbi = MSDOS_SB(inode->i_sb);
+	struct msdos_sb_info *sbi = MSDOS_SB(inode_sb(inode));
 	spin_lock(&sbi->inode_hash_lock);
 	MSDOS_I(inode)->i_pos = 0;
 	hlist_del_init(&MSDOS_I(inode)->i_fat_hash);
@@ -443,7 +443,7 @@ struct inode *fat_iget(struct super_block *sb, loff_t i_pos)
 
 	spin_lock(&sbi->inode_hash_lock);
 	hlist_for_each_entry(i, head, i_fat_hash) {
-		BUG_ON(i->vfs_inode.i_sb != sb);
+		BUG_ON(inode_sb(&i->vfs_inode) != sb);
 		if (i->i_pos != i_pos)
 			continue;
 		inode = igrab(&i->vfs_inode);
@@ -466,7 +466,7 @@ static int is_exec(unsigned char *extension)
 
 static int fat_calc_dir_size(struct inode *inode)
 {
-	struct msdos_sb_info *sbi = MSDOS_SB(inode->i_sb);
+	struct msdos_sb_info *sbi = MSDOS_SB(inode_sb(inode));
 	int ret, fclus, dclus;
 
 	inode->i_size = 0;
@@ -483,7 +483,7 @@ static int fat_calc_dir_size(struct inode *inode)
 
 static int fat_validate_dir(struct inode *dir)
 {
-	struct super_block *sb = dir->i_sb;
+	struct super_block *sb = inode_sb(dir);
 
 	if (dir->i_nlink < 2) {
 		/* Directory should have "."/".." entries at least. */
@@ -502,7 +502,7 @@ static int fat_validate_dir(struct inode *dir)
 /* doesn't deal with root inode */
 int fat_fill_inode(struct inode *inode, struct msdos_dir_entry *de)
 {
-	struct msdos_sb_info *sbi = MSDOS_SB(inode->i_sb);
+	struct msdos_sb_info *sbi = MSDOS_SB(inode_sb(inode));
 	int error;
 
 	MSDOS_I(inode)->i_pos = 0;
@@ -614,7 +614,7 @@ static void fat_free_eofblocks(struct inode *inode)
 	/* Release unwritten fallocated blocks on inode eviction. */
 	if ((inode->i_blocks << 9) >
 			round_up(MSDOS_I(inode)->mmu_private,
-				MSDOS_SB(inode->i_sb)->cluster_size)) {
+				MSDOS_SB(inode_sb(inode))->cluster_size)) {
 		int err;
 
 		fat_truncate_blocks(inode, MSDOS_I(inode)->mmu_private);
@@ -626,7 +626,7 @@ static void fat_free_eofblocks(struct inode *inode)
 		 */
 		err = __fat_write_inode(inode, inode_needs_sync(inode));
 		if (err) {
-			fat_msg(inode->i_sb, KERN_WARNING, "Failed to "
+			fat_msg(inode_sb(inode), KERN_WARNING, "Failed to "
 					"update on disk inode for unused "
 					"fallocated blocks, inode could be "
 					"corrupted. Please run fsck");
@@ -825,7 +825,7 @@ static int fat_statfs(struct dentry *dentry, struct kstatfs *buf)
 
 static int __fat_write_inode(struct inode *inode, int wait)
 {
-	struct super_block *sb = inode->i_sb;
+	struct super_block *sb = inode_sb(inode);
 	struct msdos_sb_info *sbi = MSDOS_SB(sb);
 	struct buffer_head *bh;
 	struct msdos_dir_entry *raw_entry;
@@ -885,7 +885,7 @@ static int fat_write_inode(struct inode *inode, struct writeback_control *wbc)
 	int err;
 
 	if (inode->i_ino == MSDOS_FSINFO_INO) {
-		struct super_block *sb = inode->i_sb;
+		struct super_block *sb = inode_sb(inode);
 
 		mutex_lock(&MSDOS_SB(sb)->s_lock);
 		err = fat_clusters_flush(sb);
@@ -1372,7 +1372,7 @@ static void fat_dummy_inode_init(struct inode *inode)
 
 static int fat_read_root(struct inode *inode)
 {
-	struct msdos_sb_info *sbi = MSDOS_SB(inode->i_sb);
+	struct msdos_sb_info *sbi = MSDOS_SB(inode_sb(inode));
 	int error;
 
 	MSDOS_I(inode)->i_pos = MSDOS_ROOT_INO;
diff --git a/fs/fat/misc.c b/fs/fat/misc.c
index f9bdc1e01c98..1fb76fac6d41 100644
--- a/fs/fat/misc.c
+++ b/fs/fat/misc.c
@@ -98,7 +98,7 @@ int fat_clusters_flush(struct super_block *sb)
  */
 int fat_chain_add(struct inode *inode, int new_dclus, int nr_cluster)
 {
-	struct super_block *sb = inode->i_sb;
+	struct super_block *sb = inode_sb(inode);
 	struct msdos_sb_info *sbi = MSDOS_SB(sb);
 	int ret, new_fclus, last;
 
diff --git a/fs/fat/namei_msdos.c b/fs/fat/namei_msdos.c
index 582ca731a6c9..b26d3be72b02 100644
--- a/fs/fat/namei_msdos.c
+++ b/fs/fat/namei_msdos.c
@@ -118,7 +118,7 @@ static int msdos_format_name(const unsigned char *name, int len,
 static int msdos_find(struct inode *dir, const unsigned char *name, int len,
 		      struct fat_slot_info *sinfo)
 {
-	struct msdos_sb_info *sbi = MSDOS_SB(dir->i_sb);
+	struct msdos_sb_info *sbi = MSDOS_SB(inode_sb(dir));
 	unsigned char msdos_name[MSDOS_NAME];
 	int err;
 
@@ -200,7 +200,7 @@ static const struct dentry_operations msdos_dentry_operations = {
 static struct dentry *msdos_lookup(struct inode *dir, struct dentry *dentry,
 				   unsigned int flags)
 {
-	struct super_block *sb = dir->i_sb;
+	struct super_block *sb = inode_sb(dir);
 	struct fat_slot_info sinfo;
 	struct inode *inode;
 	int err;
@@ -227,7 +227,7 @@ static int msdos_add_entry(struct inode *dir, const unsigned char *name,
 			   int is_dir, int is_hid, int cluster,
 			   struct timespec *ts, struct fat_slot_info *sinfo)
 {
-	struct msdos_sb_info *sbi = MSDOS_SB(dir->i_sb);
+	struct msdos_sb_info *sbi = MSDOS_SB(inode_sb(dir));
 	struct msdos_dir_entry de;
 	__le16 time, date;
 	int err;
@@ -263,7 +263,7 @@ static int msdos_add_entry(struct inode *dir, const unsigned char *name,
 static int msdos_create(struct inode *dir, struct dentry *dentry, umode_t mode,
 			bool excl)
 {
-	struct super_block *sb = dir->i_sb;
+	struct super_block *sb = inode_sb(dir);
 	struct inode *inode = NULL;
 	struct fat_slot_info sinfo;
 	struct timespec ts;
@@ -308,7 +308,7 @@ static int msdos_create(struct inode *dir, struct dentry *dentry, umode_t mode,
 /***** Remove a directory */
 static int msdos_rmdir(struct inode *dir, struct dentry *dentry)
 {
-	struct super_block *sb = dir->i_sb;
+	struct super_block *sb = inode_sb(dir);
 	struct inode *inode = d_inode(dentry);
 	struct fat_slot_info sinfo;
 	int err;
@@ -344,7 +344,7 @@ static int msdos_rmdir(struct inode *dir, struct dentry *dentry)
 /***** Make a directory */
 static int msdos_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode)
 {
-	struct super_block *sb = dir->i_sb;
+	struct super_block *sb = inode_sb(dir);
 	struct fat_slot_info sinfo;
 	struct inode *inode;
 	unsigned char msdos_name[MSDOS_NAME];
@@ -404,7 +404,7 @@ static int msdos_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode)
 static int msdos_unlink(struct inode *dir, struct dentry *dentry)
 {
 	struct inode *inode = d_inode(dentry);
-	struct super_block *sb = inode->i_sb;
+	struct super_block *sb = inode_sb(inode);
 	struct fat_slot_info sinfo;
 	int err;
 
@@ -588,7 +588,7 @@ static int do_msdos_rename(struct inode *old_dir, unsigned char *old_name,
 		sinfo.bh = NULL;
 	}
 	if (corrupt < 0) {
-		fat_fs_error(new_dir->i_sb,
+		fat_fs_error(inode_sb(new_dir),
 			     "%s: Filesystem corrupted (i_pos %lld)",
 			     __func__, sinfo.i_pos);
 	}
@@ -600,7 +600,7 @@ static int msdos_rename(struct inode *old_dir, struct dentry *old_dentry,
 			struct inode *new_dir, struct dentry *new_dentry,
 			unsigned int flags)
 {
-	struct super_block *sb = old_dir->i_sb;
+	struct super_block *sb = inode_sb(old_dir);
 	unsigned char old_msdos_name[MSDOS_NAME], new_msdos_name[MSDOS_NAME];
 	int err, is_hid;
 
@@ -611,12 +611,12 @@ static int msdos_rename(struct inode *old_dir, struct dentry *old_dentry,
 
 	err = msdos_format_name(old_dentry->d_name.name,
 				old_dentry->d_name.len, old_msdos_name,
-				&MSDOS_SB(old_dir->i_sb)->options);
+				&MSDOS_SB(inode_sb(old_dir))->options);
 	if (err)
 		goto out;
 	err = msdos_format_name(new_dentry->d_name.name,
 				new_dentry->d_name.len, new_msdos_name,
-				&MSDOS_SB(new_dir->i_sb)->options);
+				&MSDOS_SB(inode_sb(new_dir))->options);
 	if (err)
 		goto out;
 
diff --git a/fs/fat/namei_vfat.c b/fs/fat/namei_vfat.c
index 2649759c478a..5113f6703339 100644
--- a/fs/fat/namei_vfat.c
+++ b/fs/fat/namei_vfat.c
@@ -327,7 +327,7 @@ static int vfat_create_shortname(struct inode *dir, struct nls_table *nls,
 				 wchar_t *uname, int ulen,
 				 unsigned char *name_res, unsigned char *lcase)
 {
-	struct fat_mount_options *opts = &MSDOS_SB(dir->i_sb)->options;
+	struct fat_mount_options *opts = &MSDOS_SB(inode_sb(dir))->options;
 	wchar_t *ip, *ext_start, *end, *name_start;
 	unsigned char base[9], ext[4], buf[5], *p;
 	unsigned char charbuf[NLS_MAX_CHARSET_SIZE];
@@ -580,7 +580,7 @@ static int vfat_build_slots(struct inode *dir, const unsigned char *name,
 			    struct timespec *ts,
 			    struct msdos_dir_slot *slots, int *nr_slots)
 {
-	struct msdos_sb_info *sbi = MSDOS_SB(dir->i_sb);
+	struct msdos_sb_info *sbi = MSDOS_SB(inode_sb(dir));
 	struct fat_mount_options *opts = &sbi->options;
 	struct msdos_dir_slot *ps;
 	struct msdos_dir_entry *de;
@@ -709,7 +709,7 @@ static int vfat_d_anon_disconn(struct dentry *dentry)
 static struct dentry *vfat_lookup(struct inode *dir, struct dentry *dentry,
 				  unsigned int flags)
 {
-	struct super_block *sb = dir->i_sb;
+	struct super_block *sb = inode_sb(dir);
 	struct fat_slot_info sinfo;
 	struct inode *inode;
 	struct dentry *alias;
@@ -769,7 +769,7 @@ static struct dentry *vfat_lookup(struct inode *dir, struct dentry *dentry,
 static int vfat_create(struct inode *dir, struct dentry *dentry, umode_t mode,
 		       bool excl)
 {
-	struct super_block *sb = dir->i_sb;
+	struct super_block *sb = inode_sb(dir);
 	struct inode *inode;
 	struct fat_slot_info sinfo;
 	struct timespec ts;
@@ -802,7 +802,7 @@ static int vfat_create(struct inode *dir, struct dentry *dentry, umode_t mode,
 static int vfat_rmdir(struct inode *dir, struct dentry *dentry)
 {
 	struct inode *inode = d_inode(dentry);
-	struct super_block *sb = dir->i_sb;
+	struct super_block *sb = inode_sb(dir);
 	struct fat_slot_info sinfo;
 	int err;
 
@@ -833,7 +833,7 @@ static int vfat_rmdir(struct inode *dir, struct dentry *dentry)
 static int vfat_unlink(struct inode *dir, struct dentry *dentry)
 {
 	struct inode *inode = d_inode(dentry);
-	struct super_block *sb = dir->i_sb;
+	struct super_block *sb = inode_sb(dir);
 	struct fat_slot_info sinfo;
 	int err;
 
@@ -858,7 +858,7 @@ static int vfat_unlink(struct inode *dir, struct dentry *dentry)
 
 static int vfat_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode)
 {
-	struct super_block *sb = dir->i_sb;
+	struct super_block *sb = inode_sb(dir);
 	struct inode *inode;
 	struct fat_slot_info sinfo;
 	struct timespec ts;
@@ -913,7 +913,7 @@ static int vfat_rename(struct inode *old_dir, struct dentry *old_dentry,
 	struct timespec ts;
 	loff_t new_i_pos;
 	int err, is_dir, update_dotdot, corrupt = 0;
-	struct super_block *sb = old_dir->i_sb;
+	struct super_block *sb = inode_sb(old_dir);
 
 	if (flags & ~RENAME_NOREPLACE)
 		return -EINVAL;
@@ -1027,7 +1027,7 @@ static int vfat_rename(struct inode *old_dir, struct dentry *old_dentry,
 		sinfo.bh = NULL;
 	}
 	if (corrupt < 0) {
-		fat_fs_error(new_dir->i_sb,
+		fat_fs_error(inode_sb(new_dir),
 			     "%s: Filesystem corrupted (i_pos %lld)",
 			     __func__, sinfo.i_pos);
 	}
diff --git a/fs/fat/nfs.c b/fs/fat/nfs.c
index eb192656fba2..67f34ed8aeeb 100644
--- a/fs/fat/nfs.c
+++ b/fs/fat/nfs.c
@@ -39,7 +39,7 @@ static struct inode *fat_dget(struct super_block *sb, int i_logstart)
 	head = sbi->dir_hashtable + fat_dir_hash(i_logstart);
 	spin_lock(&sbi->dir_hash_lock);
 	hlist_for_each_entry(i, head, i_dir_hash) {
-		BUG_ON(i->vfs_inode.i_sb != sb);
+		BUG_ON(inode_sb(&i->vfs_inode) != sb);
 		if (i->i_logstart != i_logstart)
 			continue;
 		inode = igrab(&i->vfs_inode);
@@ -110,7 +110,7 @@ fat_encode_fh_nostale(struct inode *inode, __u32 *fh, int *lenp,
 		      struct inode *parent)
 {
 	int len = *lenp;
-	struct msdos_sb_info *sbi = MSDOS_SB(inode->i_sb);
+	struct msdos_sb_info *sbi = MSDOS_SB(inode_sb(inode));
 	struct fat_fid *fid = (struct fat_fid *) fh;
 	loff_t i_pos;
 	int type = FILEID_FAT_WITHOUT_PARENT;
-- 
2.15.1

^ permalink raw reply related	[flat|nested] 88+ messages in thread

* [PATCH 34/76] fs/freevxfs: Use inode_sb() helper instead of inode->i_sb
  2018-05-08 18:03 [RFC][PATCH 0/76] vfs: 'views' for filesystems with more than one root Mark Fasheh
                   ` (32 preceding siblings ...)
  2018-05-08 18:03 ` [PATCH 33/76] fs/fat: " Mark Fasheh
@ 2018-05-08 18:03 ` Mark Fasheh
  2018-05-08 18:03 ` [PATCH 35/76] fs/fuse: " Mark Fasheh
                   ` (42 subsequent siblings)
  76 siblings, 0 replies; 88+ messages in thread
From: Mark Fasheh @ 2018-05-08 18:03 UTC (permalink / raw)
  To: linux-fsdevel; +Cc: linux-kernel, linux-btrfs, Mark Fasheh

Signed-off-by: Mark Fasheh <mfasheh@suse.de>
---
 fs/freevxfs/vxfs_bmap.c   | 14 +++++++-------
 fs/freevxfs/vxfs_inode.c  |  2 +-
 fs/freevxfs/vxfs_lookup.c | 10 +++++-----
 fs/freevxfs/vxfs_subr.c   |  4 ++--
 4 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/fs/freevxfs/vxfs_bmap.c b/fs/freevxfs/vxfs_bmap.c
index 1fd41cf98b9f..55cfb03efb35 100644
--- a/fs/freevxfs/vxfs_bmap.c
+++ b/fs/freevxfs/vxfs_bmap.c
@@ -66,7 +66,7 @@ vxfs_typdump(struct vxfs_typed *typ)
 static daddr_t
 vxfs_bmap_ext4(struct inode *ip, long bn)
 {
-	struct super_block *sb = ip->i_sb;
+	struct super_block *sb = inode_sb(ip);
 	struct vxfs_inode_info *vip = VXFS_INO(ip);
 	struct vxfs_sb_info *sbi = VXFS_SBI(sb);
 	unsigned long bsize = sb->s_blocksize;
@@ -130,22 +130,22 @@ vxfs_bmap_ext4(struct inode *ip, long bn)
 static daddr_t
 vxfs_bmap_indir(struct inode *ip, long indir, int size, long block)
 {
-	struct vxfs_sb_info		*sbi = VXFS_SBI(ip->i_sb);
+	struct vxfs_sb_info		*sbi = VXFS_SBI(inode_sb(ip));
 	struct buffer_head		*bp = NULL;
 	daddr_t				pblock = 0;
 	int				i;
 
-	for (i = 0; i < size * VXFS_TYPED_PER_BLOCK(ip->i_sb); i++) {
+	for (i = 0; i < size * VXFS_TYPED_PER_BLOCK(inode_sb(ip)); i++) {
 		struct vxfs_typed	*typ;
 		int64_t			off;
 
-		bp = sb_bread(ip->i_sb,
-				indir + (i / VXFS_TYPED_PER_BLOCK(ip->i_sb)));
+		bp = sb_bread(inode_sb(ip),
+				indir + (i / VXFS_TYPED_PER_BLOCK(inode_sb(ip))));
 		if (!bp || !buffer_mapped(bp))
 			return 0;
 
 		typ = ((struct vxfs_typed *)bp->b_data) +
-			(i % VXFS_TYPED_PER_BLOCK(ip->i_sb));
+			(i % VXFS_TYPED_PER_BLOCK(inode_sb(ip)));
 		off = fs64_to_cpu(sbi, typ->vt_hdr) & VXFS_TYPED_OFFSETMASK;
 
 		if (block < off) {
@@ -210,7 +210,7 @@ static daddr_t
 vxfs_bmap_typed(struct inode *ip, long iblock)
 {
 	struct vxfs_inode_info		*vip = VXFS_INO(ip);
-	struct vxfs_sb_info		*sbi = VXFS_SBI(ip->i_sb);
+	struct vxfs_sb_info		*sbi = VXFS_SBI(inode_sb(ip));
 	daddr_t				pblock = 0;
 	int				i;
 
diff --git a/fs/freevxfs/vxfs_inode.c b/fs/freevxfs/vxfs_inode.c
index 1f41b25ef38b..fdb36340a25f 100644
--- a/fs/freevxfs/vxfs_inode.c
+++ b/fs/freevxfs/vxfs_inode.c
@@ -221,7 +221,7 @@ __vxfs_iget(struct inode *ilistp, struct vxfs_inode_info *vip, ino_t ino)
 		caddr_t			kaddr = (char *)page_address(pp);
 
 		dip = (struct vxfs_dinode *)(kaddr + offset);
-		dip2vip_cpy(VXFS_SBI(ilistp->i_sb), vip, dip);
+		dip2vip_cpy(VXFS_SBI(inode_sb(ilistp)), vip, dip);
 		vip->vfs_inode.i_mapping->a_ops = &vxfs_aops;
 #ifdef DIAGNOSTIC
 		vxfs_dumpi(vip, ino);
diff --git a/fs/freevxfs/vxfs_lookup.c b/fs/freevxfs/vxfs_lookup.c
index ce4785fd81c6..f2011edf525c 100644
--- a/fs/freevxfs/vxfs_lookup.c
+++ b/fs/freevxfs/vxfs_lookup.c
@@ -80,13 +80,13 @@ const struct file_operations vxfs_dir_operations = {
 static struct vxfs_direct *
 vxfs_find_entry(struct inode *ip, struct dentry *dp, struct page **ppp)
 {
-	u_long bsize = ip->i_sb->s_blocksize;
+	u_long bsize = inode_sb(ip)->s_blocksize;
 	const char *name = dp->d_name.name;
 	int namelen = dp->d_name.len;
 	loff_t limit = VXFS_DIRROUND(ip->i_size);
 	struct vxfs_direct *de_exit = NULL;
 	loff_t pos = 0;
-	struct vxfs_sb_info *sbi = VXFS_SBI(ip->i_sb);
+	struct vxfs_sb_info *sbi = VXFS_SBI(inode_sb(ip));
 
 	while (pos < limit) {
 		struct page *pp;
@@ -161,7 +161,7 @@ vxfs_inode_by_name(struct inode *dip, struct dentry *dp)
 
 	de = vxfs_find_entry(dip, dp, &pp);
 	if (de) {
-		ino = fs32_to_cpu(VXFS_SBI(dip->i_sb), de->d_ino);
+		ino = fs32_to_cpu(VXFS_SBI(inode_sb(dip)), de->d_ino);
 		kunmap(pp);
 		put_page(pp);
 	}
@@ -194,7 +194,7 @@ vxfs_lookup(struct inode *dip, struct dentry *dp, unsigned int flags)
 				 
 	ino = vxfs_inode_by_name(dip, dp);
 	if (ino) {
-		ip = vxfs_iget(dip->i_sb, ino);
+		ip = vxfs_iget(inode_sb(dip), ino);
 		if (IS_ERR(ip))
 			return ERR_CAST(ip);
 	}
@@ -219,7 +219,7 @@ static int
 vxfs_readdir(struct file *fp, struct dir_context *ctx)
 {
 	struct inode		*ip = file_inode(fp);
-	struct super_block	*sbp = ip->i_sb;
+	struct super_block	*sbp = inode_sb(ip);
 	u_long			bsize = sbp->s_blocksize;
 	loff_t			pos, limit;
 	struct vxfs_sb_info	*sbi = VXFS_SBI(sbp);
diff --git a/fs/freevxfs/vxfs_subr.c b/fs/freevxfs/vxfs_subr.c
index e806694d4145..8dfa00bd783c 100644
--- a/fs/freevxfs/vxfs_subr.c
+++ b/fs/freevxfs/vxfs_subr.c
@@ -105,7 +105,7 @@ vxfs_bread(struct inode *ip, int block)
 	daddr_t			pblock;
 
 	pblock = vxfs_bmap1(ip, block);
-	bp = sb_bread(ip->i_sb, pblock);
+	bp = sb_bread(inode_sb(ip), pblock);
 
 	return (bp);
 }
@@ -133,7 +133,7 @@ vxfs_getblk(struct inode *ip, sector_t iblock,
 
 	pblock = vxfs_bmap1(ip, iblock);
 	if (pblock != 0) {
-		map_bh(bp, ip->i_sb, pblock);
+		map_bh(bp, inode_sb(ip), pblock);
 		return 0;
 	}
 
-- 
2.15.1

^ permalink raw reply related	[flat|nested] 88+ messages in thread

* [PATCH 35/76] fs/fuse: Use inode_sb() helper instead of inode->i_sb
  2018-05-08 18:03 [RFC][PATCH 0/76] vfs: 'views' for filesystems with more than one root Mark Fasheh
                   ` (33 preceding siblings ...)
  2018-05-08 18:03 ` [PATCH 34/76] fs/freevxfs: " Mark Fasheh
@ 2018-05-08 18:03 ` Mark Fasheh
  2018-05-08 18:03 ` [PATCH 36/76] fs/gfs2: " Mark Fasheh
                   ` (41 subsequent siblings)
  76 siblings, 0 replies; 88+ messages in thread
From: Mark Fasheh @ 2018-05-08 18:03 UTC (permalink / raw)
  To: linux-fsdevel; +Cc: linux-kernel, linux-btrfs, Mark Fasheh

Signed-off-by: Mark Fasheh <mfasheh@suse.de>
---
 fs/fuse/dir.c    | 13 +++++++------
 fs/fuse/file.c   |  6 +++---
 fs/fuse/fuse_i.h |  2 +-
 fs/fuse/inode.c  |  7 ++++---
 4 files changed, 15 insertions(+), 13 deletions(-)

diff --git a/fs/fuse/dir.c b/fs/fuse/dir.c
index 24967382a7b1..b68adb3bd70d 100644
--- a/fs/fuse/dir.c
+++ b/fs/fuse/dir.c
@@ -357,7 +357,8 @@ static struct dentry *fuse_lookup(struct inode *dir, struct dentry *entry,
 	bool outarg_valid = true;
 
 	fuse_lock_inode(dir);
-	err = fuse_lookup_name(dir->i_sb, get_node_id(dir), &entry->d_name,
+	err = fuse_lookup_name(inode_sb(dir), get_node_id(dir),
+			       &entry->d_name,
 			       &outarg, &inode);
 	fuse_unlock_inode(dir);
 	if (err == -ENOENT) {
@@ -456,7 +457,7 @@ static int fuse_create_open(struct inode *dir, struct dentry *entry,
 	ff->fh = outopen.fh;
 	ff->nodeid = outentry.nodeid;
 	ff->open_flags = outopen.open_flags;
-	inode = fuse_iget(dir->i_sb, outentry.nodeid, outentry.generation,
+	inode = fuse_iget(inode_sb(dir), outentry.nodeid, outentry.generation,
 			  &outentry.attr, entry_attr_timeout(&outentry), 0);
 	if (!inode) {
 		flags &= ~(O_CREAT | O_EXCL | O_TRUNC);
@@ -562,7 +563,7 @@ static int create_new_entry(struct fuse_conn *fc, struct fuse_args *args,
 	if ((outarg.attr.mode ^ mode) & S_IFMT)
 		goto out_put_forget_req;
 
-	inode = fuse_iget(dir->i_sb, outarg.nodeid, outarg.generation,
+	inode = fuse_iget(inode_sb(dir), outarg.nodeid, outarg.generation,
 			  &outarg.attr, entry_attr_timeout(&outarg), 0);
 	if (!inode) {
 		fuse_queue_forget(fc, forget, outarg.nodeid, 1);
@@ -854,7 +855,7 @@ static void fuse_fillattr(struct inode *inode, struct fuse_attr *attr,
 		attr->ctimensec = inode->i_ctime.tv_nsec;
 	}
 
-	stat->dev = inode->i_sb->s_dev;
+	stat->dev = inode_sb(inode)->s_dev;
 	stat->ino = attr->ino;
 	stat->mode = (inode->i_mode & S_IFMT) | (attr->mode & 07777);
 	stat->nlink = attr->nlink;
@@ -873,7 +874,7 @@ static void fuse_fillattr(struct inode *inode, struct fuse_attr *attr,
 	if (attr->blksize != 0)
 		blkbits = ilog2(attr->blksize);
 	else
-		blkbits = inode->i_sb->s_blocksize_bits;
+		blkbits = inode_sb(inode)->s_blocksize_bits;
 
 	stat->blksize = 1 << blkbits;
 }
@@ -1255,7 +1256,7 @@ static int fuse_direntplus_link(struct file *file,
 		 * which bumps nlookup inside
 		 */
 	} else {
-		inode = fuse_iget(dir->i_sb, o->nodeid, o->generation,
+		inode = fuse_iget(inode_sb(dir), o->nodeid, o->generation,
 				  &o->attr, entry_attr_timeout(o),
 				  attr_version);
 		if (!inode)
diff --git a/fs/fuse/file.c b/fs/fuse/file.c
index a201fb0ac64f..14e55c348da7 100644
--- a/fs/fuse/file.c
+++ b/fs/fuse/file.c
@@ -2250,12 +2250,12 @@ static sector_t fuse_bmap(struct address_space *mapping, sector_t block)
 	struct fuse_bmap_out outarg;
 	int err;
 
-	if (!inode->i_sb->s_bdev || fc->no_bmap)
+	if (!inode_sb(inode)->s_bdev || fc->no_bmap)
 		return 0;
 
 	memset(&inarg, 0, sizeof(inarg));
 	inarg.block = block;
-	inarg.blocksize = inode->i_sb->s_blocksize;
+	inarg.blocksize = inode_sb(inode)->s_blocksize;
 	args.in.h.opcode = FUSE_BMAP;
 	args.in.h.nodeid = get_node_id(inode);
 	args.in.numargs = 1;
@@ -2305,7 +2305,7 @@ static loff_t fuse_lseek(struct file *file, loff_t offset, int whence)
 		return err;
 	}
 
-	return vfs_setpos(file, outarg.offset, inode->i_sb->s_maxbytes);
+	return vfs_setpos(file, outarg.offset, inode_sb(inode)->s_maxbytes);
 
 fallback:
 	err = fuse_update_attributes(inode, file);
diff --git a/fs/fuse/fuse_i.h b/fs/fuse/fuse_i.h
index c4c093bbf456..5ea9ddb9fa19 100644
--- a/fs/fuse/fuse_i.h
+++ b/fs/fuse/fuse_i.h
@@ -674,7 +674,7 @@ static inline struct fuse_conn *get_fuse_conn_super(struct super_block *sb)
 
 static inline struct fuse_conn *get_fuse_conn(struct inode *inode)
 {
-	return get_fuse_conn_super(inode->i_sb);
+	return get_fuse_conn_super(inode_sb(inode));
 }
 
 static inline struct fuse_inode *get_fuse_inode(struct inode *inode)
diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c
index 624f18bbfd2b..d6d2fbe6c3ec 100644
--- a/fs/fuse/inode.c
+++ b/fs/fuse/inode.c
@@ -130,7 +130,7 @@ static void fuse_evict_inode(struct inode *inode)
 {
 	truncate_inode_pages_final(&inode->i_data);
 	clear_inode(inode);
-	if (inode->i_sb->s_flags & SB_ACTIVE) {
+	if (inode_sb(inode)->s_flags & SB_ACTIVE) {
 		struct fuse_conn *fc = get_fuse_conn(inode);
 		struct fuse_inode *fi = get_fuse_inode(inode);
 		fuse_queue_forget(fc, fi->forget, fi->nodeid, fi->nlookup);
@@ -187,7 +187,7 @@ void fuse_change_attributes_common(struct inode *inode, struct fuse_attr *attr,
 	if (attr->blksize != 0)
 		inode->i_blkbits = ilog2(attr->blksize);
 	else
-		inode->i_blkbits = inode->i_sb->s_blocksize_bits;
+		inode->i_blkbits = inode_sb(inode)->s_blocksize_bits;
 
 	/*
 	 * Don't set the sticky bit in i_mode, unless we want the VFS
@@ -778,7 +778,8 @@ static struct dentry *fuse_get_parent(struct dentry *child)
 	if (!fc->export_support)
 		return ERR_PTR(-ESTALE);
 
-	err = fuse_lookup_name(child_inode->i_sb, get_node_id(child_inode),
+	err = fuse_lookup_name(inode_sb(child_inode),
+			       get_node_id(child_inode),
 			       &name, &outarg, &inode);
 	if (err) {
 		if (err == -ENOENT)
-- 
2.15.1

^ permalink raw reply related	[flat|nested] 88+ messages in thread

* [PATCH 36/76] fs/gfs2: Use inode_sb() helper instead of inode->i_sb
  2018-05-08 18:03 [RFC][PATCH 0/76] vfs: 'views' for filesystems with more than one root Mark Fasheh
                   ` (34 preceding siblings ...)
  2018-05-08 18:03 ` [PATCH 35/76] fs/fuse: " Mark Fasheh
@ 2018-05-08 18:03 ` Mark Fasheh
  2018-05-08 18:03 ` [PATCH 37/76] fs/hfs: " Mark Fasheh
                   ` (40 subsequent siblings)
  76 siblings, 0 replies; 88+ messages in thread
From: Mark Fasheh @ 2018-05-08 18:03 UTC (permalink / raw)
  To: linux-fsdevel; +Cc: linux-kernel, linux-btrfs, Mark Fasheh

Signed-off-by: Mark Fasheh <mfasheh@suse.de>
---
 fs/gfs2/aops.c    | 9 +++++----
 fs/gfs2/bmap.c    | 9 +++++----
 fs/gfs2/dir.c     | 3 ++-
 fs/gfs2/export.c  | 2 +-
 fs/gfs2/file.c    | 4 ++--
 fs/gfs2/incore.h  | 2 +-
 fs/gfs2/inode.c   | 8 ++++----
 fs/gfs2/meta_io.h | 2 +-
 fs/gfs2/super.c   | 2 +-
 9 files changed, 22 insertions(+), 19 deletions(-)

diff --git a/fs/gfs2/aops.c b/fs/gfs2/aops.c
index 2f725b4a386b..bd771df8b227 100644
--- a/fs/gfs2/aops.c
+++ b/fs/gfs2/aops.c
@@ -189,7 +189,8 @@ static int __gfs2_jdata_writepage(struct page *page, struct writeback_control *w
 	if (PageChecked(page)) {
 		ClearPageChecked(page);
 		if (!page_has_buffers(page)) {
-			create_empty_buffers(page, inode->i_sb->s_blocksize,
+			create_empty_buffers(page,
+					     inode_sb(inode)->s_blocksize,
 					     BIT(BH_Dirty)|BIT(BH_Uptodate));
 		}
 		gfs2_page_add_databufs(ip, page, 0, sdp->sd_vfs->s_blocksize);
@@ -271,7 +272,7 @@ static int gfs2_write_jdata_pagevec(struct address_space *mapping,
 {
 	struct inode *inode = mapping->host;
 	struct gfs2_sbd *sdp = GFS2_SB(inode);
-	unsigned nrblocks = nr_pages * (PAGE_SIZE/inode->i_sb->s_blocksize);
+	unsigned nrblocks = nr_pages * (PAGE_SIZE/inode_sb(inode)->s_blocksize);
 	int i;
 	int ret;
 
@@ -776,7 +777,7 @@ static int gfs2_write_begin(struct file *file, struct address_space *mapping,
  */
 static void adjust_fs_space(struct inode *inode)
 {
-	struct gfs2_sbd *sdp = inode->i_sb->s_fs_info;
+	struct gfs2_sbd *sdp = inode_sb(inode)->s_fs_info;
 	struct gfs2_inode *m_ip = GFS2_I(sdp->sd_statfs_inode);
 	struct gfs2_inode *l_ip = GFS2_I(sdp->sd_sc_inode);
 	struct gfs2_statfs_change_host *m_sc = &sdp->sd_statfs_master;
@@ -1112,7 +1113,7 @@ static ssize_t gfs2_direct_IO(struct kiocb *iocb, struct iov_iter *iter)
 			truncate_inode_pages_range(mapping, lstart, end);
 	}
 
-	rv = __blockdev_direct_IO(iocb, inode, inode->i_sb->s_bdev, iter,
+	rv = __blockdev_direct_IO(iocb, inode, inode_sb(inode)->s_bdev, iter,
 				  gfs2_get_block_direct, NULL, NULL, 0);
 out:
 	gfs2_glock_dq(&gh);
diff --git a/fs/gfs2/bmap.c b/fs/gfs2/bmap.c
index 51f940e76c5e..f523d2e7a71a 100644
--- a/fs/gfs2/bmap.c
+++ b/fs/gfs2/bmap.c
@@ -86,7 +86,7 @@ static int gfs2_unstuffer_page(struct gfs2_inode *ip, struct buffer_head *dibh,
 	bh = page_buffers(page);
 
 	if (!buffer_mapped(bh))
-		map_bh(bh, inode->i_sb, block);
+		map_bh(bh, inode_sb(inode), block);
 
 	set_buffer_uptodate(bh);
 	if (!gfs2_is_jdata(ip))
@@ -856,7 +856,8 @@ int gfs2_block_map(struct inode *inode, sector_t lblock,
 		iomap.flags &= ~IOMAP_F_BOUNDARY;
 	}
 	if (iomap.addr != IOMAP_NULL_ADDR)
-		map_bh(bh_map, inode->i_sb, iomap.addr >> inode->i_blkbits);
+		map_bh(bh_map, inode_sb(inode),
+		       iomap.addr >> inode->i_blkbits);
 	bh_map->b_size = iomap.length;
 	if (iomap.flags & IOMAP_F_BOUNDARY)
 		set_buffer_boundary(bh_map);
@@ -913,8 +914,8 @@ static int gfs2_block_zero_range(struct inode *inode, loff_t from,
 	if (!page)
 		return 0;
 
-	blocksize = inode->i_sb->s_blocksize;
-	iblock = index << (PAGE_SHIFT - inode->i_sb->s_blocksize_bits);
+	blocksize = inode_sb(inode)->s_blocksize;
+	iblock = index << (PAGE_SHIFT - inode_sb(inode)->s_blocksize_bits);
 
 	if (!page_has_buffers(page))
 		create_empty_buffers(page, blocksize, 0);
diff --git a/fs/gfs2/dir.c b/fs/gfs2/dir.c
index 7c21aea0266b..5ab5ed92ce78 100644
--- a/fs/gfs2/dir.c
+++ b/fs/gfs2/dir.c
@@ -1665,7 +1665,8 @@ struct inode *gfs2_dir_search(struct inode *dir, const struct qstr *name,
 		brelse(bh);
 		if (fail_on_exist)
 			return ERR_PTR(-EEXIST);
-		inode = gfs2_inode_lookup(dir->i_sb, dtype, addr, formal_ino,
+		inode = gfs2_inode_lookup(inode_sb(dir), dtype, addr,
+					  formal_ino,
 					  GFS2_BLKST_FREE /* ignore */);
 		if (!IS_ERR(inode))
 			GFS2_I(inode)->i_rahead = rahead;
diff --git a/fs/gfs2/export.c b/fs/gfs2/export.c
index a332f3cd925e..42e7f8e30683 100644
--- a/fs/gfs2/export.c
+++ b/fs/gfs2/export.c
@@ -32,7 +32,7 @@ static int gfs2_encode_fh(struct inode *inode, __u32 *p, int *len,
 			  struct inode *parent)
 {
 	__be32 *fh = (__force __be32 *)p;
-	struct super_block *sb = inode->i_sb;
+	struct super_block *sb = inode_sb(inode);
 	struct gfs2_inode *ip = GFS2_I(inode);
 
 	if (parent && (*len < GFS2_LARGE_FH_SIZE)) {
diff --git a/fs/gfs2/file.c b/fs/gfs2/file.c
index 4f88e201b3f0..ed7dc7ca8cbf 100644
--- a/fs/gfs2/file.c
+++ b/fs/gfs2/file.c
@@ -401,7 +401,7 @@ static int gfs2_page_mkwrite(struct vm_fault *vmf)
 	loff_t size;
 	int ret;
 
-	sb_start_pagefault(inode->i_sb);
+	sb_start_pagefault(inode_sb(inode));
 
 	ret = gfs2_rsqa_alloc(ip);
 	if (ret)
@@ -492,7 +492,7 @@ static int gfs2_page_mkwrite(struct vm_fault *vmf)
 		wait_for_stable_page(page);
 	}
 out:
-	sb_end_pagefault(inode->i_sb);
+	sb_end_pagefault(inode_sb(inode));
 	return block_page_mkwrite_return(ret);
 }
 
diff --git a/fs/gfs2/incore.h b/fs/gfs2/incore.h
index e0557b8a590a..b548684449fa 100644
--- a/fs/gfs2/incore.h
+++ b/fs/gfs2/incore.h
@@ -424,7 +424,7 @@ static inline struct gfs2_inode *GFS2_I(struct inode *inode)
 
 static inline struct gfs2_sbd *GFS2_SB(const struct inode *inode)
 {
-	return inode->i_sb->s_fs_info;
+	return inode_sb(inode)->s_fs_info;
 }
 
 struct gfs2_file {
diff --git a/fs/gfs2/inode.c b/fs/gfs2/inode.c
index 59e0560180ec..9f6f63bb987d 100644
--- a/fs/gfs2/inode.c
+++ b/fs/gfs2/inode.c
@@ -280,7 +280,7 @@ struct inode *gfs2_lookup_simple(struct inode *dip, const char *name)
 struct inode *gfs2_lookupi(struct inode *dir, const struct qstr *name,
 			   int is_root)
 {
-	struct super_block *sb = dir->i_sb;
+	struct super_block *sb = inode_sb(dir);
 	struct gfs2_inode *dip = GFS2_I(dir);
 	struct gfs2_holder d_gh;
 	int error = 0;
@@ -1279,7 +1279,7 @@ static int gfs2_atomic_open(struct inode *dir, struct dentry *dentry,
 static int gfs2_ok_to_move(struct gfs2_inode *this, struct gfs2_inode *to)
 {
 	struct inode *dir = &to->i_inode;
-	struct super_block *sb = dir->i_sb;
+	struct super_block *sb = inode_sb(dir);
 	struct inode *tmp;
 	int error = 0;
 
@@ -2056,7 +2056,7 @@ loff_t gfs2_seek_data(struct file *file, loff_t offset)
 
 	if (ret < 0)
 		return ret;
-	return vfs_setpos(file, ret, inode->i_sb->s_maxbytes);
+	return vfs_setpos(file, ret, inode_sb(inode)->s_maxbytes);
 }
 
 loff_t gfs2_seek_hole(struct file *file, loff_t offset)
@@ -2075,7 +2075,7 @@ loff_t gfs2_seek_hole(struct file *file, loff_t offset)
 
 	if (ret < 0)
 		return ret;
-	return vfs_setpos(file, ret, inode->i_sb->s_maxbytes);
+	return vfs_setpos(file, ret, inode_sb(inode)->s_maxbytes);
 }
 
 const struct inode_operations gfs2_file_iops = {
diff --git a/fs/gfs2/meta_io.h b/fs/gfs2/meta_io.h
index ffdf6aa3509d..fecae733bb95 100644
--- a/fs/gfs2/meta_io.h
+++ b/fs/gfs2/meta_io.h
@@ -48,7 +48,7 @@ static inline struct gfs2_sbd *gfs2_mapping2sbd(struct address_space *mapping)
 	else if (mapping->a_ops == &gfs2_rgrp_aops)
 		return container_of(mapping, struct gfs2_sbd, sd_aspace);
 	else
-		return inode->i_sb->s_fs_info;
+		return inode_sb(inode)->s_fs_info;
 }
 
 extern struct buffer_head *gfs2_meta_new(struct gfs2_glock *gl, u64 blkno);
diff --git a/fs/gfs2/super.c b/fs/gfs2/super.c
index 620be0521866..296952eea729 100644
--- a/fs/gfs2/super.c
+++ b/fs/gfs2/super.c
@@ -1568,7 +1568,7 @@ static void gfs2_glock_put_eventually(struct gfs2_glock *gl)
 
 static void gfs2_evict_inode(struct inode *inode)
 {
-	struct super_block *sb = inode->i_sb;
+	struct super_block *sb = inode_sb(inode);
 	struct gfs2_sbd *sdp = sb->s_fs_info;
 	struct gfs2_inode *ip = GFS2_I(inode);
 	struct gfs2_holder gh;
-- 
2.15.1

^ permalink raw reply related	[flat|nested] 88+ messages in thread

* [PATCH 37/76] fs/hfs: Use inode_sb() helper instead of inode->i_sb
  2018-05-08 18:03 [RFC][PATCH 0/76] vfs: 'views' for filesystems with more than one root Mark Fasheh
                   ` (35 preceding siblings ...)
  2018-05-08 18:03 ` [PATCH 36/76] fs/gfs2: " Mark Fasheh
@ 2018-05-08 18:03 ` Mark Fasheh
  2018-05-08 18:03 ` [PATCH 38/76] fs/hfsplus: " Mark Fasheh
                   ` (39 subsequent siblings)
  76 siblings, 0 replies; 88+ messages in thread
From: Mark Fasheh @ 2018-05-08 18:03 UTC (permalink / raw)
  To: linux-fsdevel; +Cc: linux-kernel, linux-btrfs, Mark Fasheh

Signed-off-by: Mark Fasheh <mfasheh@suse.de>
---
 fs/hfs/attr.c    |  4 ++--
 fs/hfs/catalog.c | 10 +++++-----
 fs/hfs/dir.c     | 11 ++++++-----
 fs/hfs/extent.c  | 10 +++++-----
 fs/hfs/inode.c   | 32 ++++++++++++++++----------------
 5 files changed, 34 insertions(+), 33 deletions(-)

diff --git a/fs/hfs/attr.c b/fs/hfs/attr.c
index 74fa62643136..60075ee27192 100644
--- a/fs/hfs/attr.c
+++ b/fs/hfs/attr.c
@@ -30,7 +30,7 @@ static int __hfs_setxattr(struct inode *inode, enum hfs_xattr_type type,
 	if (!S_ISREG(inode->i_mode) || HFS_IS_RSRC(inode))
 		return -EOPNOTSUPP;
 
-	res = hfs_find_init(HFS_SB(inode->i_sb)->cat_tree, &fd);
+	res = hfs_find_init(HFS_SB(inode_sb(inode))->cat_tree, &fd);
 	if (res)
 		return res;
 	fd.search_key->cat = HFS_I(inode)->cat_key;
@@ -77,7 +77,7 @@ static ssize_t __hfs_getxattr(struct inode *inode, enum hfs_xattr_type type,
 		return -EOPNOTSUPP;
 
 	if (size) {
-		res = hfs_find_init(HFS_SB(inode->i_sb)->cat_tree, &fd);
+		res = hfs_find_init(HFS_SB(inode_sb(inode))->cat_tree, &fd);
 		if (res)
 			return res;
 		fd.search_key->cat = HFS_I(inode)->cat_key;
diff --git a/fs/hfs/catalog.c b/fs/hfs/catalog.c
index 8a66405b0f8b..790d488a2c24 100644
--- a/fs/hfs/catalog.c
+++ b/fs/hfs/catalog.c
@@ -56,8 +56,8 @@ static int hfs_cat_build_record(hfs_cat_rec *rec, u32 cnid, struct inode *inode)
 		rec->file.CrDat = mtime;
 		rec->file.MdDat = mtime;
 		rec->file.BkDat = 0;
-		rec->file.UsrWds.fdType = HFS_SB(inode->i_sb)->s_type;
-		rec->file.UsrWds.fdCreator = HFS_SB(inode->i_sb)->s_creator;
+		rec->file.UsrWds.fdType = HFS_SB(inode_sb(inode))->s_type;
+		rec->file.UsrWds.fdCreator = HFS_SB(inode_sb(inode))->s_creator;
 		return sizeof(struct hfs_cat_file);
 	}
 }
@@ -92,7 +92,7 @@ int hfs_cat_create(u32 cnid, struct inode *dir, const struct qstr *str, struct i
 	if (dir->i_size >= HFS_MAX_VALENCE)
 		return -ENOSPC;
 
-	sb = dir->i_sb;
+	sb = inode_sb(dir);
 	err = hfs_find_init(HFS_SB(sb)->cat_tree, &fd);
 	if (err)
 		return err;
@@ -218,7 +218,7 @@ int hfs_cat_delete(u32 cnid, struct inode *dir, const struct qstr *str)
 	int res, type;
 
 	hfs_dbg(CAT_MOD, "delete_cat: %s,%u\n", str ? str->name : NULL, cnid);
-	sb = dir->i_sb;
+	sb = inode_sb(dir);
 	res = hfs_find_init(HFS_SB(sb)->cat_tree, &fd);
 	if (res)
 		return res;
@@ -289,7 +289,7 @@ int hfs_cat_move(u32 cnid, struct inode *src_dir, const struct qstr *src_name,
 	hfs_dbg(CAT_MOD, "rename_cat: %u - %lu,%s - %lu,%s\n",
 		cnid, src_dir->i_ino, src_name->name,
 		dst_dir->i_ino, dst_name->name);
-	sb = src_dir->i_sb;
+	sb = inode_sb(src_dir);
 	err = hfs_find_init(HFS_SB(sb)->cat_tree, &src_fd);
 	if (err)
 		return err;
diff --git a/fs/hfs/dir.c b/fs/hfs/dir.c
index 75b254280ff6..ae29580b3d0c 100644
--- a/fs/hfs/dir.c
+++ b/fs/hfs/dir.c
@@ -25,10 +25,11 @@ static struct dentry *hfs_lookup(struct inode *dir, struct dentry *dentry,
 	struct inode *inode = NULL;
 	int res;
 
-	res = hfs_find_init(HFS_SB(dir->i_sb)->cat_tree, &fd);
+	res = hfs_find_init(HFS_SB(inode_sb(dir))->cat_tree, &fd);
 	if (res)
 		return ERR_PTR(res);
-	hfs_cat_build_key(dir->i_sb, fd.search_key, dir->i_ino, &dentry->d_name);
+	hfs_cat_build_key(inode_sb(dir), fd.search_key, dir->i_ino,
+			  &dentry->d_name);
 	res = hfs_brec_read(&fd, &rec, sizeof(rec));
 	if (res) {
 		hfs_find_exit(&fd);
@@ -39,7 +40,7 @@ static struct dentry *hfs_lookup(struct inode *dir, struct dentry *dentry,
 		}
 		return ERR_PTR(res);
 	}
-	inode = hfs_iget(dir->i_sb, &fd.search_key->cat, &rec);
+	inode = hfs_iget(inode_sb(dir), &fd.search_key->cat, &rec);
 	hfs_find_exit(&fd);
 	if (!inode)
 		return ERR_PTR(-EACCES);
@@ -54,7 +55,7 @@ static struct dentry *hfs_lookup(struct inode *dir, struct dentry *dentry,
 static int hfs_readdir(struct file *file, struct dir_context *ctx)
 {
 	struct inode *inode = file_inode(file);
-	struct super_block *sb = inode->i_sb;
+	struct super_block *sb = inode_sb(inode);
 	int len, err;
 	char strbuf[HFS_MAX_NAMELEN];
 	union hfs_cat_rec entry;
@@ -305,7 +306,7 @@ static int hfs_rename(struct inode *old_dir, struct dentry *old_dentry,
 			   old_dir, &old_dentry->d_name,
 			   new_dir, &new_dentry->d_name);
 	if (!res)
-		hfs_cat_build_key(old_dir->i_sb,
+		hfs_cat_build_key(inode_sb(old_dir),
 				  (btree_key *)&HFS_I(d_inode(old_dentry))->cat_key,
 				  new_dir->i_ino, &new_dentry->d_name);
 	return res;
diff --git a/fs/hfs/extent.c b/fs/hfs/extent.c
index 5d0182654580..03e1f49fee30 100644
--- a/fs/hfs/extent.c
+++ b/fs/hfs/extent.c
@@ -134,7 +134,7 @@ int hfs_ext_write_extent(struct inode *inode)
 	int res = 0;
 
 	if (HFS_I(inode)->flags & HFS_FLG_EXT_DIRTY) {
-		res = hfs_find_init(HFS_SB(inode->i_sb)->ext_tree, &fd);
+		res = hfs_find_init(HFS_SB(inode_sb(inode))->ext_tree, &fd);
 		if (res)
 			return res;
 		res = __hfs_ext_write_extent(inode, &fd);
@@ -193,7 +193,7 @@ static int hfs_ext_read_extent(struct inode *inode, u16 block)
 	    block < HFS_I(inode)->cached_start + HFS_I(inode)->cached_blocks)
 		return 0;
 
-	res = hfs_find_init(HFS_SB(inode->i_sb)->ext_tree, &fd);
+	res = hfs_find_init(HFS_SB(inode_sb(inode))->ext_tree, &fd);
 	if (!res) {
 		res = __hfs_ext_cache_extent(&fd, inode, block);
 		hfs_find_exit(&fd);
@@ -336,7 +336,7 @@ int hfs_get_block(struct inode *inode, sector_t block,
 	u16 dblock, ablock;
 	int res;
 
-	sb = inode->i_sb;
+	sb = inode_sb(inode);
 	/* Convert inode block to disk allocation block */
 	ablock = (u32)block / HFS_SB(sb)->fs_div;
 
@@ -384,7 +384,7 @@ int hfs_get_block(struct inode *inode, sector_t block,
 
 int hfs_extend_file(struct inode *inode)
 {
-	struct super_block *sb = inode->i_sb;
+	struct super_block *sb = inode_sb(inode);
 	u32 start, len, goal;
 	int res;
 
@@ -469,7 +469,7 @@ int hfs_extend_file(struct inode *inode)
 
 void hfs_file_truncate(struct inode *inode)
 {
-	struct super_block *sb = inode->i_sb;
+	struct super_block *sb = inode_sb(inode);
 	struct hfs_find_data fd;
 	u16 blk_cnt, alloc_cnt, start;
 	u32 size;
diff --git a/fs/hfs/inode.c b/fs/hfs/inode.c
index 2538b49cc349..1d8e35f3f72d 100644
--- a/fs/hfs/inode.c
+++ b/fs/hfs/inode.c
@@ -72,7 +72,7 @@ static sector_t hfs_bmap(struct address_space *mapping, sector_t block)
 static int hfs_releasepage(struct page *page, gfp_t mask)
 {
 	struct inode *inode = page->mapping->host;
-	struct super_block *sb = inode->i_sb;
+	struct super_block *sb = inode_sb(inode);
 	struct hfs_btree *tree;
 	struct hfs_bnode *node;
 	u32 nidx;
@@ -181,7 +181,7 @@ const struct address_space_operations hfs_aops = {
  */
 struct inode *hfs_new_inode(struct inode *dir, const struct qstr *name, umode_t mode)
 {
-	struct super_block *sb = dir->i_sb;
+	struct super_block *sb = inode_sb(dir);
 	struct inode *inode = new_inode(sb);
 	if (!inode)
 		return NULL;
@@ -207,7 +207,7 @@ struct inode *hfs_new_inode(struct inode *dir, const struct qstr *name, umode_t
 		inode->i_op = &hfs_dir_inode_operations;
 		inode->i_fop = &hfs_dir_operations;
 		inode->i_mode |= S_IRWXUGO;
-		inode->i_mode &= ~HFS_SB(inode->i_sb)->s_dir_umask;
+		inode->i_mode &= ~HFS_SB(inode_sb(inode))->s_dir_umask;
 	} else if (S_ISREG(mode)) {
 		HFS_I(inode)->clump_blocks = HFS_SB(sb)->clumpablks;
 		HFS_SB(sb)->file_count++;
@@ -219,7 +219,7 @@ struct inode *hfs_new_inode(struct inode *dir, const struct qstr *name, umode_t
 		inode->i_mode |= S_IRUGO|S_IXUGO;
 		if (mode & S_IWUSR)
 			inode->i_mode |= S_IWUGO;
-		inode->i_mode &= ~HFS_SB(inode->i_sb)->s_file_umask;
+		inode->i_mode &= ~HFS_SB(inode_sb(inode))->s_file_umask;
 		HFS_I(inode)->phys_size = 0;
 		HFS_I(inode)->alloc_blocks = 0;
 		HFS_I(inode)->first_blocks = 0;
@@ -238,7 +238,7 @@ struct inode *hfs_new_inode(struct inode *dir, const struct qstr *name, umode_t
 
 void hfs_delete_inode(struct inode *inode)
 {
-	struct super_block *sb = inode->i_sb;
+	struct super_block *sb = inode_sb(inode);
 
 	hfs_dbg(INODE, "delete_inode: %lu\n", inode->i_ino);
 	if (S_ISDIR(inode->i_mode)) {
@@ -265,7 +265,7 @@ void hfs_delete_inode(struct inode *inode)
 void hfs_inode_read_fork(struct inode *inode, struct hfs_extent *ext,
 			 __be32 __log_size, __be32 phys_size, u32 clump_size)
 {
-	struct super_block *sb = inode->i_sb;
+	struct super_block *sb = inode_sb(inode);
 	u32 log_size = be32_to_cpu(__log_size);
 	u16 count;
 	int i;
@@ -313,7 +313,7 @@ static int hfs_test_inode(struct inode *inode, void *data)
 static int hfs_read_inode(struct inode *inode, void *data)
 {
 	struct hfs_iget_data *idata = data;
-	struct hfs_sb_info *hsb = HFS_SB(inode->i_sb);
+	struct hfs_sb_info *hsb = HFS_SB(inode_sb(inode));
 	hfs_cat_rec *rec;
 
 	HFS_I(inode)->flags = 0;
@@ -412,7 +412,7 @@ void hfs_inode_write_fork(struct inode *inode, struct hfs_extent *ext,
 		*log_size = cpu_to_be32(inode->i_size);
 	if (phys_size)
 		*phys_size = cpu_to_be32(HFS_I(inode)->alloc_blocks *
-					 HFS_SB(inode->i_sb)->alloc_blksz);
+					 HFS_SB(inode_sb(inode))->alloc_blksz);
 }
 
 int hfs_write_inode(struct inode *inode, struct writeback_control *wbc)
@@ -432,10 +432,10 @@ int hfs_write_inode(struct inode *inode, struct writeback_control *wbc)
 		case HFS_ROOT_CNID:
 			break;
 		case HFS_EXT_CNID:
-			hfs_btree_write(HFS_SB(inode->i_sb)->ext_tree);
+			hfs_btree_write(HFS_SB(inode_sb(inode))->ext_tree);
 			return 0;
 		case HFS_CAT_CNID:
-			hfs_btree_write(HFS_SB(inode->i_sb)->cat_tree);
+			hfs_btree_write(HFS_SB(inode_sb(inode))->cat_tree);
 			return 0;
 		default:
 			BUG();
@@ -449,7 +449,7 @@ int hfs_write_inode(struct inode *inode, struct writeback_control *wbc)
 	if (!main_inode->i_nlink)
 		return 0;
 
-	if (hfs_find_init(HFS_SB(main_inode->i_sb)->cat_tree, &fd))
+	if (hfs_find_init(HFS_SB(inode_sb(main_inode))->cat_tree, &fd))
 		/* panic? */
 		return -EIO;
 
@@ -518,11 +518,11 @@ static struct dentry *hfs_file_lookup(struct inode *dir, struct dentry *dentry,
 	if (inode)
 		goto out;
 
-	inode = new_inode(dir->i_sb);
+	inode = new_inode(inode_sb(dir));
 	if (!inode)
 		return ERR_PTR(-ENOMEM);
 
-	res = hfs_find_init(HFS_SB(dir->i_sb)->cat_tree, &fd);
+	res = hfs_find_init(HFS_SB(inode_sb(dir))->cat_tree, &fd);
 	if (res) {
 		iput(inode);
 		return ERR_PTR(res);
@@ -568,7 +568,7 @@ static int hfs_file_open(struct inode *inode, struct file *file)
 
 static int hfs_file_release(struct inode *inode, struct file *file)
 {
-	//struct super_block *sb = inode->i_sb;
+	//struct super_block *sb = inode_sb(inode);
 
 	if (HFS_IS_RSRC(inode))
 		inode = HFS_I(inode)->rsrc_inode;
@@ -604,7 +604,7 @@ static int hfs_file_release(struct inode *inode, struct file *file)
 int hfs_inode_setattr(struct dentry *dentry, struct iattr * attr)
 {
 	struct inode *inode = d_inode(dentry);
-	struct hfs_sb_info *hsb = HFS_SB(inode->i_sb);
+	struct hfs_sb_info *hsb = HFS_SB(inode_sb(inode));
 	int error;
 
 	error = setattr_prepare(dentry, attr); /* basic permission checks */
@@ -665,7 +665,7 @@ static int hfs_file_fsync(struct file *filp, loff_t start, loff_t end,
 	ret = write_inode_now(inode, 0);
 
 	/* sync the superblock to buffers */
-	sb = inode->i_sb;
+	sb = inode_sb(inode);
 	flush_delayed_work(&HFS_SB(sb)->mdb_work);
 	/* .. finally sync the buffers to disk */
 	err = sync_blockdev(sb->s_bdev);
-- 
2.15.1

^ permalink raw reply related	[flat|nested] 88+ messages in thread

* [PATCH 38/76] fs/hfsplus: Use inode_sb() helper instead of inode->i_sb
  2018-05-08 18:03 [RFC][PATCH 0/76] vfs: 'views' for filesystems with more than one root Mark Fasheh
                   ` (36 preceding siblings ...)
  2018-05-08 18:03 ` [PATCH 37/76] fs/hfs: " Mark Fasheh
@ 2018-05-08 18:03 ` Mark Fasheh
  2018-05-08 18:03 ` [PATCH 39/76] fs/hostfs: " Mark Fasheh
                   ` (38 subsequent siblings)
  76 siblings, 0 replies; 88+ messages in thread
From: Mark Fasheh @ 2018-05-08 18:03 UTC (permalink / raw)
  To: linux-fsdevel; +Cc: linux-kernel, linux-btrfs, Mark Fasheh

Signed-off-by: Mark Fasheh <mfasheh@suse.de>
---
 fs/hfsplus/attributes.c | 12 ++++++------
 fs/hfsplus/bnode.c      |  2 +-
 fs/hfsplus/catalog.c    | 12 ++++++------
 fs/hfsplus/dir.c        | 22 +++++++++++-----------
 fs/hfsplus/extents.c    | 11 ++++++-----
 fs/hfsplus/inode.c      | 18 +++++++++---------
 fs/hfsplus/ioctl.c      |  2 +-
 fs/hfsplus/super.c      | 14 ++++++++------
 fs/hfsplus/xattr.c      | 41 +++++++++++++++++++++--------------------
 9 files changed, 69 insertions(+), 65 deletions(-)

diff --git a/fs/hfsplus/attributes.c b/fs/hfsplus/attributes.c
index 2bab6b3cdba4..24af5a496912 100644
--- a/fs/hfsplus/attributes.c
+++ b/fs/hfsplus/attributes.c
@@ -169,7 +169,7 @@ int hfsplus_find_attr(struct super_block *sb, u32 cnid,
 int hfsplus_attr_exists(struct inode *inode, const char *name)
 {
 	int err = 0;
-	struct super_block *sb = inode->i_sb;
+	struct super_block *sb = inode_sb(inode);
 	struct hfs_find_data fd;
 
 	if (!HFSPLUS_SB(sb)->attr_tree)
@@ -195,7 +195,7 @@ int hfsplus_create_attr(struct inode *inode,
 				const char *name,
 				const void *value, size_t size)
 {
-	struct super_block *sb = inode->i_sb;
+	struct super_block *sb = inode_sb(inode);
 	struct hfs_find_data fd;
 	hfsplus_attr_entry *entry_ptr;
 	int entry_size;
@@ -298,7 +298,7 @@ static int __hfsplus_delete_attr(struct inode *inode, u32 cnid,
 int hfsplus_delete_attr(struct inode *inode, const char *name)
 {
 	int err = 0;
-	struct super_block *sb = inode->i_sb;
+	struct super_block *sb = inode_sb(inode);
 	struct hfs_find_data fd;
 
 	hfs_dbg(ATTR_MOD, "delete_attr: %s,%ld\n",
@@ -344,17 +344,17 @@ int hfsplus_delete_all_attrs(struct inode *dir, u32 cnid)
 
 	hfs_dbg(ATTR_MOD, "delete_all_attrs: %d\n", cnid);
 
-	if (!HFSPLUS_SB(dir->i_sb)->attr_tree) {
+	if (!HFSPLUS_SB(inode_sb(dir))->attr_tree) {
 		pr_err("attributes file doesn't exist\n");
 		return -EINVAL;
 	}
 
-	err = hfs_find_init(HFSPLUS_SB(dir->i_sb)->attr_tree, &fd);
+	err = hfs_find_init(HFSPLUS_SB(inode_sb(dir))->attr_tree, &fd);
 	if (err)
 		return err;
 
 	for (;;) {
-		err = hfsplus_find_attr(dir->i_sb, cnid, NULL, &fd);
+		err = hfsplus_find_attr(inode_sb(dir), cnid, NULL, &fd);
 		if (err) {
 			if (err != -ENOENT)
 				pr_err("xattr search failed\n");
diff --git a/fs/hfsplus/bnode.c b/fs/hfsplus/bnode.c
index 177fae4e6581..9da98a7955a0 100644
--- a/fs/hfsplus/bnode.c
+++ b/fs/hfsplus/bnode.c
@@ -656,7 +656,7 @@ void hfs_bnode_put(struct hfs_bnode *node)
  */
 bool hfs_bnode_need_zeroout(struct hfs_btree *tree)
 {
-	struct super_block *sb = tree->inode->i_sb;
+	struct super_block *sb = inode_sb(tree->inode);
 	struct hfsplus_sb_info *sbi = HFSPLUS_SB(sb);
 	const u32 volume_attr = be32_to_cpu(sbi->s_vhdr->attributes);
 
diff --git a/fs/hfsplus/catalog.c b/fs/hfsplus/catalog.c
index a196369ba779..23336c614b64 100644
--- a/fs/hfsplus/catalog.c
+++ b/fs/hfsplus/catalog.c
@@ -105,7 +105,7 @@ void hfsplus_cat_set_perms(struct inode *inode, struct hfsplus_perm *perms)
 static int hfsplus_cat_build_record(hfsplus_cat_entry *entry,
 		u32 cnid, struct inode *inode)
 {
-	struct hfsplus_sb_info *sbi = HFSPLUS_SB(inode->i_sb);
+	struct hfsplus_sb_info *sbi = HFSPLUS_SB(inode_sb(inode));
 
 	if (S_ISDIR(inode->i_mode)) {
 		struct hfsplus_cat_folder *folder;
@@ -222,7 +222,7 @@ int hfsplus_find_cat(struct super_block *sb, u32 cnid,
 
 static void hfsplus_subfolders_inc(struct inode *dir)
 {
-	struct hfsplus_sb_info *sbi = HFSPLUS_SB(dir->i_sb);
+	struct hfsplus_sb_info *sbi = HFSPLUS_SB(inode_sb(dir));
 
 	if (test_bit(HFSPLUS_SB_HFSX, &sbi->flags)) {
 		/*
@@ -235,7 +235,7 @@ static void hfsplus_subfolders_inc(struct inode *dir)
 
 static void hfsplus_subfolders_dec(struct inode *dir)
 {
-	struct hfsplus_sb_info *sbi = HFSPLUS_SB(dir->i_sb);
+	struct hfsplus_sb_info *sbi = HFSPLUS_SB(inode_sb(dir));
 
 	if (test_bit(HFSPLUS_SB_HFSX, &sbi->flags)) {
 		/*
@@ -253,7 +253,7 @@ static void hfsplus_subfolders_dec(struct inode *dir)
 int hfsplus_create_cat(u32 cnid, struct inode *dir,
 		const struct qstr *str, struct inode *inode)
 {
-	struct super_block *sb = dir->i_sb;
+	struct super_block *sb = inode_sb(dir);
 	struct hfs_find_data fd;
 	hfsplus_cat_entry entry;
 	int entry_size;
@@ -321,7 +321,7 @@ int hfsplus_create_cat(u32 cnid, struct inode *dir,
 
 int hfsplus_delete_cat(u32 cnid, struct inode *dir, const struct qstr *str)
 {
-	struct super_block *sb = dir->i_sb;
+	struct super_block *sb = inode_sb(dir);
 	struct hfs_find_data fd;
 	struct hfsplus_fork_raw fork;
 	struct list_head *pos;
@@ -419,7 +419,7 @@ int hfsplus_rename_cat(u32 cnid,
 		       struct inode *src_dir, const struct qstr *src_name,
 		       struct inode *dst_dir, const struct qstr *dst_name)
 {
-	struct super_block *sb = src_dir->i_sb;
+	struct super_block *sb = inode_sb(src_dir);
 	struct hfs_find_data src_fd, dst_fd;
 	hfsplus_cat_entry entry;
 	int entry_size, type;
diff --git a/fs/hfsplus/dir.c b/fs/hfsplus/dir.c
index 15e06fb552da..9d824fcc6185 100644
--- a/fs/hfsplus/dir.c
+++ b/fs/hfsplus/dir.c
@@ -39,7 +39,7 @@ static struct dentry *hfsplus_lookup(struct inode *dir, struct dentry *dentry,
 	u32 cnid, linkid = 0;
 	u16 type;
 
-	sb = dir->i_sb;
+	sb = inode_sb(dir);
 
 	dentry->d_fsdata = NULL;
 	err = hfs_find_init(HFSPLUS_SB(sb)->cat_tree, &fd);
@@ -116,7 +116,7 @@ static struct dentry *hfsplus_lookup(struct inode *dir, struct dentry *dentry,
 		goto fail;
 	}
 	hfs_find_exit(&fd);
-	inode = hfsplus_iget(dir->i_sb, cnid);
+	inode = hfsplus_iget(inode_sb(dir), cnid);
 	if (IS_ERR(inode))
 		return ERR_CAST(inode);
 	if (S_ISREG(inode->i_mode))
@@ -132,7 +132,7 @@ static struct dentry *hfsplus_lookup(struct inode *dir, struct dentry *dentry,
 static int hfsplus_readdir(struct file *file, struct dir_context *ctx)
 {
 	struct inode *inode = file_inode(file);
-	struct super_block *sb = inode->i_sb;
+	struct super_block *sb = inode_sb(inode);
 	int len, err;
 	char *strbuf;
 	hfsplus_cat_entry entry;
@@ -302,7 +302,7 @@ static int hfsplus_dir_release(struct inode *inode, struct file *file)
 static int hfsplus_link(struct dentry *src_dentry, struct inode *dst_dir,
 			struct dentry *dst_dentry)
 {
-	struct hfsplus_sb_info *sbi = HFSPLUS_SB(dst_dir->i_sb);
+	struct hfsplus_sb_info *sbi = HFSPLUS_SB(inode_sb(dst_dir));
 	struct inode *inode = d_inode(src_dentry);
 	struct inode *src_dir = d_inode(src_dentry->d_parent);
 	struct qstr str;
@@ -351,7 +351,7 @@ static int hfsplus_link(struct dentry *src_dentry, struct inode *dst_dir,
 	inode->i_ctime = current_time(inode);
 	mark_inode_dirty(inode);
 	sbi->file_count++;
-	hfsplus_mark_mdb_dirty(dst_dir->i_sb);
+	hfsplus_mark_mdb_dirty(inode_sb(dst_dir));
 out:
 	mutex_unlock(&sbi->vh_mutex);
 	return res;
@@ -359,7 +359,7 @@ static int hfsplus_link(struct dentry *src_dentry, struct inode *dst_dir,
 
 static int hfsplus_unlink(struct inode *dir, struct dentry *dentry)
 {
-	struct hfsplus_sb_info *sbi = HFSPLUS_SB(dir->i_sb);
+	struct hfsplus_sb_info *sbi = HFSPLUS_SB(inode_sb(dir));
 	struct inode *inode = d_inode(dentry);
 	struct qstr str;
 	char name[32];
@@ -416,7 +416,7 @@ static int hfsplus_unlink(struct inode *dir, struct dentry *dentry)
 
 static int hfsplus_rmdir(struct inode *dir, struct dentry *dentry)
 {
-	struct hfsplus_sb_info *sbi = HFSPLUS_SB(dir->i_sb);
+	struct hfsplus_sb_info *sbi = HFSPLUS_SB(inode_sb(dir));
 	struct inode *inode = d_inode(dentry);
 	int res;
 
@@ -439,12 +439,12 @@ static int hfsplus_rmdir(struct inode *dir, struct dentry *dentry)
 static int hfsplus_symlink(struct inode *dir, struct dentry *dentry,
 			   const char *symname)
 {
-	struct hfsplus_sb_info *sbi = HFSPLUS_SB(dir->i_sb);
+	struct hfsplus_sb_info *sbi = HFSPLUS_SB(inode_sb(dir));
 	struct inode *inode;
 	int res = -ENOMEM;
 
 	mutex_lock(&sbi->vh_mutex);
-	inode = hfsplus_new_inode(dir->i_sb, dir, S_IFLNK | S_IRWXUGO);
+	inode = hfsplus_new_inode(inode_sb(dir), dir, S_IFLNK | S_IRWXUGO);
 	if (!inode)
 		goto out;
 
@@ -481,12 +481,12 @@ static int hfsplus_symlink(struct inode *dir, struct dentry *dentry,
 static int hfsplus_mknod(struct inode *dir, struct dentry *dentry,
 			 umode_t mode, dev_t rdev)
 {
-	struct hfsplus_sb_info *sbi = HFSPLUS_SB(dir->i_sb);
+	struct hfsplus_sb_info *sbi = HFSPLUS_SB(inode_sb(dir));
 	struct inode *inode;
 	int res = -ENOMEM;
 
 	mutex_lock(&sbi->vh_mutex);
-	inode = hfsplus_new_inode(dir->i_sb, dir, mode);
+	inode = hfsplus_new_inode(inode_sb(dir), dir, mode);
 	if (!inode)
 		goto out;
 
diff --git a/fs/hfsplus/extents.c b/fs/hfsplus/extents.c
index e8770935ce6d..288ae891ed8d 100644
--- a/fs/hfsplus/extents.c
+++ b/fs/hfsplus/extents.c
@@ -129,7 +129,8 @@ static int hfsplus_ext_write_extent_locked(struct inode *inode)
 	if (HFSPLUS_I(inode)->extent_state & HFSPLUS_EXT_DIRTY) {
 		struct hfs_find_data fd;
 
-		res = hfs_find_init(HFSPLUS_SB(inode->i_sb)->ext_tree, &fd);
+		res = hfs_find_init(HFSPLUS_SB(inode_sb(inode))->ext_tree,
+				    &fd);
 		if (res)
 			return res;
 		res = __hfsplus_ext_write_extent(inode, &fd);
@@ -209,7 +210,7 @@ static int hfsplus_ext_read_extent(struct inode *inode, u32 block)
 	    block < hip->cached_start + hip->cached_blocks)
 		return 0;
 
-	res = hfs_find_init(HFSPLUS_SB(inode->i_sb)->ext_tree, &fd);
+	res = hfs_find_init(HFSPLUS_SB(inode_sb(inode))->ext_tree, &fd);
 	if (!res) {
 		res = __hfsplus_ext_cache_extent(&fd, inode, block);
 		hfs_find_exit(&fd);
@@ -221,7 +222,7 @@ static int hfsplus_ext_read_extent(struct inode *inode, u32 block)
 int hfsplus_get_block(struct inode *inode, sector_t iblock,
 		      struct buffer_head *bh_result, int create)
 {
-	struct super_block *sb = inode->i_sb;
+	struct super_block *sb = inode_sb(inode);
 	struct hfsplus_sb_info *sbi = HFSPLUS_SB(sb);
 	struct hfsplus_inode_info *hip = HFSPLUS_I(inode);
 	int res = -EIO;
@@ -428,7 +429,7 @@ int hfsplus_free_fork(struct super_block *sb, u32 cnid,
 
 int hfsplus_file_extend(struct inode *inode, bool zeroout)
 {
-	struct super_block *sb = inode->i_sb;
+	struct super_block *sb = inode_sb(inode);
 	struct hfsplus_sb_info *sbi = HFSPLUS_SB(sb);
 	struct hfsplus_inode_info *hip = HFSPLUS_I(inode);
 	u32 start, len, goal;
@@ -531,7 +532,7 @@ int hfsplus_file_extend(struct inode *inode, bool zeroout)
 
 void hfsplus_file_truncate(struct inode *inode)
 {
-	struct super_block *sb = inode->i_sb;
+	struct super_block *sb = inode_sb(inode);
 	struct hfsplus_inode_info *hip = HFSPLUS_I(inode);
 	struct hfs_find_data fd;
 	u32 alloc_cnt, blk_cnt, start;
diff --git a/fs/hfsplus/inode.c b/fs/hfsplus/inode.c
index c0c8d433864f..9ba18604c11f 100644
--- a/fs/hfsplus/inode.c
+++ b/fs/hfsplus/inode.c
@@ -67,7 +67,7 @@ static sector_t hfsplus_bmap(struct address_space *mapping, sector_t block)
 static int hfsplus_releasepage(struct page *page, gfp_t mask)
 {
 	struct inode *inode = page->mapping->host;
-	struct super_block *sb = inode->i_sb;
+	struct super_block *sb = inode_sb(inode);
 	struct hfs_btree *tree;
 	struct hfs_bnode *node;
 	u32 nidx;
@@ -182,7 +182,7 @@ const struct dentry_operations hfsplus_dentry_operations = {
 static void hfsplus_get_perms(struct inode *inode,
 		struct hfsplus_perm *perms, int dir)
 {
-	struct hfsplus_sb_info *sbi = HFSPLUS_SB(inode->i_sb);
+	struct hfsplus_sb_info *sbi = HFSPLUS_SB(inode_sb(inode));
 	u16 mode;
 
 	mode = be16_to_cpu(perms->mode);
@@ -225,7 +225,7 @@ static int hfsplus_file_open(struct inode *inode, struct file *file)
 
 static int hfsplus_file_release(struct inode *inode, struct file *file)
 {
-	struct super_block *sb = inode->i_sb;
+	struct super_block *sb = inode_sb(inode);
 
 	if (HFSPLUS_IS_RSRC(inode))
 		inode = HFSPLUS_I(inode)->rsrc_inode;
@@ -281,7 +281,7 @@ int hfsplus_file_fsync(struct file *file, loff_t start, loff_t end,
 {
 	struct inode *inode = file->f_mapping->host;
 	struct hfsplus_inode_info *hip = HFSPLUS_I(inode);
-	struct hfsplus_sb_info *sbi = HFSPLUS_SB(inode->i_sb);
+	struct hfsplus_sb_info *sbi = HFSPLUS_SB(inode_sb(inode));
 	int error = 0, error2;
 
 	error = file_write_and_wait_range(file, start, end);
@@ -326,7 +326,7 @@ int hfsplus_file_fsync(struct file *file, loff_t start, loff_t end,
 	}
 
 	if (!test_bit(HFSPLUS_SB_NOBARRIER, &sbi->flags))
-		blkdev_issue_flush(inode->i_sb->s_bdev, GFP_KERNEL, NULL);
+		blkdev_issue_flush(inode_sb(inode)->s_bdev, GFP_KERNEL, NULL);
 
 	inode_unlock(inode);
 
@@ -415,7 +415,7 @@ struct inode *hfsplus_new_inode(struct super_block *sb, struct inode *dir,
 
 void hfsplus_delete_inode(struct inode *inode)
 {
-	struct super_block *sb = inode->i_sb;
+	struct super_block *sb = inode_sb(inode);
 
 	if (S_ISDIR(inode->i_mode)) {
 		HFSPLUS_SB(sb)->folder_count--;
@@ -437,7 +437,7 @@ void hfsplus_delete_inode(struct inode *inode)
 
 void hfsplus_inode_read_fork(struct inode *inode, struct hfsplus_fork_raw *fork)
 {
-	struct super_block *sb = inode->i_sb;
+	struct super_block *sb = inode_sb(inode);
 	struct hfsplus_sb_info *sbi = HFSPLUS_SB(sb);
 	struct hfsplus_inode_info *hip = HFSPLUS_I(inode);
 	u32 count;
@@ -554,11 +554,11 @@ int hfsplus_cat_write_inode(struct inode *inode)
 	if (!main_inode->i_nlink)
 		return 0;
 
-	if (hfs_find_init(HFSPLUS_SB(main_inode->i_sb)->cat_tree, &fd))
+	if (hfs_find_init(HFSPLUS_SB(inode_sb(main_inode))->cat_tree, &fd))
 		/* panic? */
 		return -EIO;
 
-	if (hfsplus_find_cat(main_inode->i_sb, main_inode->i_ino, &fd))
+	if (hfsplus_find_cat(inode_sb(main_inode), main_inode->i_ino, &fd))
 		/* panic? */
 		goto out;
 
diff --git a/fs/hfsplus/ioctl.c b/fs/hfsplus/ioctl.c
index 5e6502ef7415..25f5cb0c6416 100644
--- a/fs/hfsplus/ioctl.c
+++ b/fs/hfsplus/ioctl.c
@@ -28,7 +28,7 @@ static int hfsplus_ioctl_bless(struct file *file, int __user *user_flags)
 {
 	struct dentry *dentry = file->f_path.dentry;
 	struct inode *inode = d_inode(dentry);
-	struct hfsplus_sb_info *sbi = HFSPLUS_SB(inode->i_sb);
+	struct hfsplus_sb_info *sbi = HFSPLUS_SB(inode_sb(inode));
 	struct hfsplus_vh *vh = sbi->s_vhdr;
 	struct hfsplus_vh *bvh = sbi->s_backup_vhdr;
 	u32 cnid = (unsigned long)dentry->d_fsdata;
diff --git a/fs/hfsplus/super.c b/fs/hfsplus/super.c
index 513c357c734b..b34f3110f46a 100644
--- a/fs/hfsplus/super.c
+++ b/fs/hfsplus/super.c
@@ -25,7 +25,7 @@ static void hfsplus_destroy_inode(struct inode *inode);
 
 static int hfsplus_system_read_inode(struct inode *inode)
 {
-	struct hfsplus_vh *vhdr = HFSPLUS_SB(inode->i_sb)->s_vhdr;
+	struct hfsplus_vh *vhdr = HFSPLUS_SB(inode_sb(inode))->s_vhdr;
 
 	switch (inode->i_ino) {
 	case HFSPLUS_EXT_CNID:
@@ -76,9 +76,11 @@ struct inode *hfsplus_iget(struct super_block *sb, unsigned long ino)
 
 	if (inode->i_ino >= HFSPLUS_FIRSTUSER_CNID ||
 	    inode->i_ino == HFSPLUS_ROOT_CNID) {
-		err = hfs_find_init(HFSPLUS_SB(inode->i_sb)->cat_tree, &fd);
+		err = hfs_find_init(HFSPLUS_SB(inode_sb(inode))->cat_tree,
+				    &fd);
 		if (!err) {
-			err = hfsplus_find_cat(inode->i_sb, inode->i_ino, &fd);
+			err = hfsplus_find_cat(inode_sb(inode), inode->i_ino,
+					       &fd);
 			if (!err)
 				err = hfsplus_cat_read_inode(inode, &fd);
 			hfs_find_exit(&fd);
@@ -98,7 +100,7 @@ struct inode *hfsplus_iget(struct super_block *sb, unsigned long ino)
 
 static int hfsplus_system_write_inode(struct inode *inode)
 {
-	struct hfsplus_sb_info *sbi = HFSPLUS_SB(inode->i_sb);
+	struct hfsplus_sb_info *sbi = HFSPLUS_SB(inode_sb(inode));
 	struct hfsplus_vh *vhdr = sbi->s_vhdr;
 	struct hfsplus_fork_raw *fork;
 	struct hfs_btree *tree = NULL;
@@ -128,7 +130,7 @@ static int hfsplus_system_write_inode(struct inode *inode)
 
 	if (fork->total_size != cpu_to_be64(inode->i_size)) {
 		set_bit(HFSPLUS_SB_WRITEBACKUP, &sbi->flags);
-		hfsplus_mark_mdb_dirty(inode->i_sb);
+		hfsplus_mark_mdb_dirty(inode_sb(inode));
 	}
 	hfsplus_inode_write_fork(inode, fork);
 	if (tree) {
@@ -254,7 +256,7 @@ static void delayed_sync_fs(struct work_struct *work)
 	sbi->work_queued = 0;
 	spin_unlock(&sbi->work_lock);
 
-	err = hfsplus_sync_fs(sbi->alloc_file->i_sb, 1);
+	err = hfsplus_sync_fs(inode_sb(sbi->alloc_file), 1);
 	if (err)
 		pr_err("delayed sync fs err %d\n", err);
 }
diff --git a/fs/hfsplus/xattr.c b/fs/hfsplus/xattr.c
index e538b758c448..0d03fcee78ae 100644
--- a/fs/hfsplus/xattr.c
+++ b/fs/hfsplus/xattr.c
@@ -281,13 +281,13 @@ int __hfsplus_setxattr(struct inode *inode, const char *name,
 	if (value == NULL)
 		return hfsplus_removexattr(inode, name);
 
-	err = hfs_find_init(HFSPLUS_SB(inode->i_sb)->cat_tree, &cat_fd);
+	err = hfs_find_init(HFSPLUS_SB(inode_sb(inode))->cat_tree, &cat_fd);
 	if (err) {
 		pr_err("can't init xattr find struct\n");
 		return err;
 	}
 
-	err = hfsplus_find_cat(inode->i_sb, inode->i_ino, &cat_fd);
+	err = hfsplus_find_cat(inode_sb(inode), inode->i_ino, &cat_fd);
 	if (err) {
 		pr_err("catalog searching failed\n");
 		goto end_setxattr;
@@ -334,8 +334,8 @@ int __hfsplus_setxattr(struct inode *inode, const char *name,
 		goto end_setxattr;
 	}
 
-	if (!HFSPLUS_SB(inode->i_sb)->attr_tree) {
-		err = hfsplus_create_attributes_file(inode->i_sb);
+	if (!HFSPLUS_SB(inode_sb(inode))->attr_tree) {
+		err = hfsplus_create_attributes_file(inode_sb(inode));
 		if (unlikely(err))
 			goto end_setxattr;
 	}
@@ -456,12 +456,13 @@ static ssize_t hfsplus_getxattr_finder_info(struct inode *inode,
 	u8 file_finder_info[sizeof(struct FInfo) + sizeof(struct FXInfo)];
 
 	if (size >= record_len) {
-		res = hfs_find_init(HFSPLUS_SB(inode->i_sb)->cat_tree, &fd);
+		res = hfs_find_init(HFSPLUS_SB(inode_sb(inode))->cat_tree,
+				    &fd);
 		if (res) {
 			pr_err("can't init xattr find struct\n");
 			return res;
 		}
-		res = hfsplus_find_cat(inode->i_sb, inode->i_ino, &fd);
+		res = hfsplus_find_cat(inode_sb(inode), inode->i_ino, &fd);
 		if (res)
 			goto end_getxattr_finder_info;
 		entry_type = hfs_bnode_read_u16(fd.bnode, fd.entryoffset);
@@ -511,7 +512,7 @@ ssize_t __hfsplus_getxattr(struct inode *inode, const char *name,
 	if (!strcmp_xattr_finder_info(name))
 		return hfsplus_getxattr_finder_info(inode, value, size);
 
-	if (!HFSPLUS_SB(inode->i_sb)->attr_tree)
+	if (!HFSPLUS_SB(inode_sb(inode))->attr_tree)
 		return -EOPNOTSUPP;
 
 	entry = hfsplus_alloc_attr_entry();
@@ -520,13 +521,13 @@ ssize_t __hfsplus_getxattr(struct inode *inode, const char *name,
 		return -ENOMEM;
 	}
 
-	res = hfs_find_init(HFSPLUS_SB(inode->i_sb)->attr_tree, &fd);
+	res = hfs_find_init(HFSPLUS_SB(inode_sb(inode))->attr_tree, &fd);
 	if (res) {
 		pr_err("can't init xattr find struct\n");
 		goto failed_getxattr_init;
 	}
 
-	res = hfsplus_find_attr(inode->i_sb, inode->i_ino, name, &fd);
+	res = hfsplus_find_attr(inode_sb(inode), inode->i_ino, name, &fd);
 	if (res) {
 		if (res == -ENOENT)
 			res = -ENODATA;
@@ -622,13 +623,13 @@ static ssize_t hfsplus_listxattr_finder_info(struct dentry *dentry,
 	unsigned long len, found_bit;
 	int xattr_name_len, symbols_count;
 
-	res = hfs_find_init(HFSPLUS_SB(inode->i_sb)->cat_tree, &fd);
+	res = hfs_find_init(HFSPLUS_SB(inode_sb(inode))->cat_tree, &fd);
 	if (res) {
 		pr_err("can't init xattr find struct\n");
 		return res;
 	}
 
-	res = hfsplus_find_cat(inode->i_sb, inode->i_ino, &fd);
+	res = hfsplus_find_cat(inode_sb(inode), inode->i_ino, &fd);
 	if (res)
 		goto end_listxattr_finder_info;
 
@@ -697,10 +698,10 @@ ssize_t hfsplus_listxattr(struct dentry *dentry, char *buffer, size_t size)
 	res = hfsplus_listxattr_finder_info(dentry, buffer, size);
 	if (res < 0)
 		return res;
-	else if (!HFSPLUS_SB(inode->i_sb)->attr_tree)
+	else if (!HFSPLUS_SB(inode_sb(inode))->attr_tree)
 		return (res == 0) ? -EOPNOTSUPP : res;
 
-	err = hfs_find_init(HFSPLUS_SB(inode->i_sb)->attr_tree, &fd);
+	err = hfs_find_init(HFSPLUS_SB(inode_sb(inode))->attr_tree, &fd);
 	if (err) {
 		pr_err("can't init xattr find struct\n");
 		return err;
@@ -713,7 +714,7 @@ ssize_t hfsplus_listxattr(struct dentry *dentry, char *buffer, size_t size)
 		goto out;
 	}
 
-	err = hfsplus_find_attr(inode->i_sb, inode->i_ino, NULL, &fd);
+	err = hfsplus_find_attr(inode_sb(inode), inode->i_ino, NULL, &fd);
 	if (err) {
 		if (err == -ENOENT) {
 			if (res == 0)
@@ -740,9 +741,9 @@ ssize_t hfsplus_listxattr(struct dentry *dentry, char *buffer, size_t size)
 			goto end_listxattr;
 
 		xattr_name_len = NLS_MAX_CHARSET_SIZE * HFSPLUS_ATTR_MAX_STRLEN;
-		if (hfsplus_uni2asc(inode->i_sb,
-			(const struct hfsplus_unistr *)&fd.key->attr.key_name,
-					strbuf, &xattr_name_len)) {
+		if (hfsplus_uni2asc(inode_sb(inode),
+				    (const struct hfsplus_unistr *)&fd.key->attr.key_name,
+				    strbuf, &xattr_name_len)) {
 			pr_err("unicode conversion failed\n");
 			res = -EIO;
 			goto end_listxattr;
@@ -780,19 +781,19 @@ static int hfsplus_removexattr(struct inode *inode, const char *name)
 	int is_xattr_acl_deleted = 0;
 	int is_all_xattrs_deleted = 0;
 
-	if (!HFSPLUS_SB(inode->i_sb)->attr_tree)
+	if (!HFSPLUS_SB(inode_sb(inode))->attr_tree)
 		return -EOPNOTSUPP;
 
 	if (!strcmp_xattr_finder_info(name))
 		return -EOPNOTSUPP;
 
-	err = hfs_find_init(HFSPLUS_SB(inode->i_sb)->cat_tree, &cat_fd);
+	err = hfs_find_init(HFSPLUS_SB(inode_sb(inode))->cat_tree, &cat_fd);
 	if (err) {
 		pr_err("can't init xattr find struct\n");
 		return err;
 	}
 
-	err = hfsplus_find_cat(inode->i_sb, inode->i_ino, &cat_fd);
+	err = hfsplus_find_cat(inode_sb(inode), inode->i_ino, &cat_fd);
 	if (err) {
 		pr_err("catalog searching failed\n");
 		goto end_removexattr;
-- 
2.15.1

^ permalink raw reply related	[flat|nested] 88+ messages in thread

* [PATCH 39/76] fs/hostfs: Use inode_sb() helper instead of inode->i_sb
  2018-05-08 18:03 [RFC][PATCH 0/76] vfs: 'views' for filesystems with more than one root Mark Fasheh
                   ` (37 preceding siblings ...)
  2018-05-08 18:03 ` [PATCH 38/76] fs/hfsplus: " Mark Fasheh
@ 2018-05-08 18:03 ` Mark Fasheh
  2018-05-08 18:04 ` [PATCH 40/76] fs/hpfs: " Mark Fasheh
                   ` (37 subsequent siblings)
  76 siblings, 0 replies; 88+ messages in thread
From: Mark Fasheh @ 2018-05-08 18:03 UTC (permalink / raw)
  To: linux-fsdevel; +Cc: linux-kernel, linux-btrfs, Mark Fasheh

Signed-off-by: Mark Fasheh <mfasheh@suse.de>
---
 fs/hostfs/hostfs_kern.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/fs/hostfs/hostfs_kern.c b/fs/hostfs/hostfs_kern.c
index c148e7f4f451..b99d08b7ef34 100644
--- a/fs/hostfs/hostfs_kern.c
+++ b/fs/hostfs/hostfs_kern.c
@@ -570,7 +570,7 @@ static int hostfs_create(struct inode *dir, struct dentry *dentry, umode_t mode,
 	char *name;
 	int error, fd;
 
-	inode = hostfs_iget(dir->i_sb);
+	inode = hostfs_iget(inode_sb(dir));
 	if (IS_ERR(inode)) {
 		error = PTR_ERR(inode);
 		goto out;
@@ -609,7 +609,7 @@ static struct dentry *hostfs_lookup(struct inode *ino, struct dentry *dentry,
 	char *name;
 	int err;
 
-	inode = hostfs_iget(ino->i_sb);
+	inode = hostfs_iget(inode_sb(ino));
 	if (IS_ERR(inode)) {
 		err = PTR_ERR(inode);
 		goto out;
@@ -717,7 +717,7 @@ static int hostfs_mknod(struct inode *dir, struct dentry *dentry, umode_t mode,
 	char *name;
 	int err;
 
-	inode = hostfs_iget(dir->i_sb);
+	inode = hostfs_iget(inode_sb(dir));
 	if (IS_ERR(inode)) {
 		err = PTR_ERR(inode);
 		goto out;
-- 
2.15.1

^ permalink raw reply related	[flat|nested] 88+ messages in thread

* [PATCH 40/76] fs/hpfs: Use inode_sb() helper instead of inode->i_sb
  2018-05-08 18:03 [RFC][PATCH 0/76] vfs: 'views' for filesystems with more than one root Mark Fasheh
                   ` (38 preceding siblings ...)
  2018-05-08 18:03 ` [PATCH 39/76] fs/hostfs: " Mark Fasheh
@ 2018-05-08 18:04 ` Mark Fasheh
  2018-05-08 18:04 ` [PATCH 41/76] fs/hugetlbfs: " Mark Fasheh
                   ` (36 subsequent siblings)
  76 siblings, 0 replies; 88+ messages in thread
From: Mark Fasheh @ 2018-05-08 18:04 UTC (permalink / raw)
  To: linux-fsdevel; +Cc: linux-kernel, linux-btrfs, Mark Fasheh

Signed-off-by: Mark Fasheh <mfasheh@suse.de>
---
 fs/hpfs/dir.c   |  76 +++++++++++++-----------
 fs/hpfs/dnode.c | 176 ++++++++++++++++++++++++++++++++------------------------
 fs/hpfs/ea.c    |   2 +-
 fs/hpfs/file.c  |  45 ++++++++-------
 fs/hpfs/inode.c |  77 +++++++++++++------------
 fs/hpfs/namei.c | 130 ++++++++++++++++++++++-------------------
 fs/hpfs/super.c |   6 +-
 7 files changed, 287 insertions(+), 225 deletions(-)

diff --git a/fs/hpfs/dir.c b/fs/hpfs/dir.c
index c83ece7facc5..416e6e238ee4 100644
--- a/fs/hpfs/dir.c
+++ b/fs/hpfs/dir.c
@@ -12,10 +12,10 @@
 
 static int hpfs_dir_release(struct inode *inode, struct file *filp)
 {
-	hpfs_lock(inode->i_sb);
+	hpfs_lock(inode_sb(inode));
 	hpfs_del_pos(inode, &filp->f_pos);
 	/*hpfs_write_if_changed(inode);*/
-	hpfs_unlock(inode->i_sb);
+	hpfs_unlock(inode_sb(inode));
 	return 0;
 }
 
@@ -28,7 +28,7 @@ static loff_t hpfs_dir_lseek(struct file *filp, loff_t off, int whence)
 	struct quad_buffer_head qbh;
 	struct inode *i = file_inode(filp);
 	struct hpfs_inode_info *hpfs_inode = hpfs_i(i);
-	struct super_block *s = i->i_sb;
+	struct super_block *s = inode_sb(i);
 
 	/* Somebody else will have to figure out what to do here */
 	if (whence == SEEK_DATA || whence == SEEK_HOLE)
@@ -74,34 +74,38 @@ static int hpfs_readdir(struct file *file, struct dir_context *ctx)
 	int c1, c2 = 0;
 	int ret = 0;
 
-	hpfs_lock(inode->i_sb);
+	hpfs_lock(inode_sb(inode));
 
-	if (hpfs_sb(inode->i_sb)->sb_chk) {
-		if (hpfs_chk_sectors(inode->i_sb, inode->i_ino, 1, "dir_fnode")) {
+	if (hpfs_sb(inode_sb(inode))->sb_chk) {
+		if (hpfs_chk_sectors(inode_sb(inode), inode->i_ino, 1, "dir_fnode")) {
 			ret = -EFSERROR;
 			goto out;
 		}
-		if (hpfs_chk_sectors(inode->i_sb, hpfs_inode->i_dno, 4, "dir_dnode")) {
+		if (hpfs_chk_sectors(inode_sb(inode), hpfs_inode->i_dno, 4, "dir_dnode")) {
 			ret = -EFSERROR;
 			goto out;
 		}
 	}
-	if (hpfs_sb(inode->i_sb)->sb_chk >= 2) {
+	if (hpfs_sb(inode_sb(inode))->sb_chk >= 2) {
 		struct buffer_head *bh;
 		struct fnode *fno;
 		int e = 0;
-		if (!(fno = hpfs_map_fnode(inode->i_sb, inode->i_ino, &bh))) {
+		if (!(fno = hpfs_map_fnode(inode_sb(inode), inode->i_ino, &bh))) {
 			ret = -EIOERROR;
 			goto out;
 		}
 		if (!fnode_is_dir(fno)) {
 			e = 1;
-			hpfs_error(inode->i_sb, "not a directory, fnode %08lx",
+			hpfs_error(inode_sb(inode),
+					"not a directory, fnode %08lx",
 					(unsigned long)inode->i_ino);
 		}
 		if (hpfs_inode->i_dno != le32_to_cpu(fno->u.external[0].disk_secno)) {
 			e = 1;
-			hpfs_error(inode->i_sb, "corrupted inode: i_dno == %08x, fnode -> dnode == %08x", hpfs_inode->i_dno, le32_to_cpu(fno->u.external[0].disk_secno));
+			hpfs_error(inode_sb(inode),
+				   "corrupted inode: i_dno == %08x, fnode -> dnode == %08x",
+				   hpfs_inode->i_dno,
+				   le32_to_cpu(fno->u.external[0].disk_secno));
 		}
 		brelse(bh);
 		if (e) {
@@ -109,7 +113,7 @@ static int hpfs_readdir(struct file *file, struct dir_context *ctx)
 			goto out;
 		}
 	}
-	lc = hpfs_sb(inode->i_sb)->sb_lowercase;
+	lc = hpfs_sb(inode_sb(inode))->sb_lowercase;
 	if (ctx->pos == 12) { /* diff -r requires this (note, that diff -r */
 		ctx->pos = 13; /* also fails on msdos filesystem in 2.0) */
 		goto out;
@@ -124,8 +128,8 @@ static int hpfs_readdir(struct file *file, struct dir_context *ctx)
 		/* This won't work when cycle is longer than number of dirents
 		   accepted by filldir, but what can I do?
 		   maybe killall -9 ls helps */
-		if (hpfs_sb(inode->i_sb)->sb_chk)
-			if (hpfs_stop_cycles(inode->i_sb, ctx->pos, &c1, &c2, "hpfs_readdir")) {
+		if (hpfs_sb(inode_sb(inode))->sb_chk)
+			if (hpfs_stop_cycles(inode_sb(inode), ctx->pos, &c1, &c2, "hpfs_readdir")) {
 				ret = -EFSERROR;
 				goto out;
 			}
@@ -149,7 +153,7 @@ static int hpfs_readdir(struct file *file, struct dir_context *ctx)
 			ret = hpfs_add_pos(inode, &file->f_pos);
 			if (unlikely(ret < 0))
 				goto out;
-			ctx->pos = ((loff_t) hpfs_de_as_down_as_possible(inode->i_sb, hpfs_inode->i_dno) << 4) + 1;
+			ctx->pos = ((loff_t) hpfs_de_as_down_as_possible(inode_sb(inode), hpfs_inode->i_dno) << 4) + 1;
 		}
 		next_pos = ctx->pos;
 		if (!(de = map_pos_dirent(inode, &next_pos, &qbh))) {
@@ -158,18 +162,23 @@ static int hpfs_readdir(struct file *file, struct dir_context *ctx)
 			goto out;
 		}
 		if (de->first || de->last) {
-			if (hpfs_sb(inode->i_sb)->sb_chk) {
+			if (hpfs_sb(inode_sb(inode))->sb_chk) {
 				if (de->first && !de->last && (de->namelen != 2
 				    || de ->name[0] != 1 || de->name[1] != 1))
-					hpfs_error(inode->i_sb, "hpfs_readdir: bad ^A^A entry; pos = %08lx", (unsigned long)ctx->pos);
+					hpfs_error(inode_sb(inode),
+						   "hpfs_readdir: bad ^A^A entry; pos = %08lx",
+						   (unsigned long)ctx->pos);
 				if (de->last && (de->namelen != 1 || de ->name[0] != 255))
-					hpfs_error(inode->i_sb, "hpfs_readdir: bad \\377 entry; pos = %08lx", (unsigned long)ctx->pos);
+					hpfs_error(inode_sb(inode),
+						   "hpfs_readdir: bad \\377 entry; pos = %08lx",
+						   (unsigned long)ctx->pos);
 			}
 			hpfs_brelse4(&qbh);
 			ctx->pos = next_pos;
 			goto again;
 		}
-		tempname = hpfs_translate_name(inode->i_sb, de->name, de->namelen, lc, de->not_8x3);
+		tempname = hpfs_translate_name(inode_sb(inode), de->name,
+					       de->namelen, lc, de->not_8x3);
 		if (!dir_emit(ctx, tempname, de->namelen, le32_to_cpu(de->fnode), DT_UNKNOWN)) {
 			if (tempname != de->name) kfree(tempname);
 			hpfs_brelse4(&qbh);
@@ -180,7 +189,7 @@ static int hpfs_readdir(struct file *file, struct dir_context *ctx)
 		hpfs_brelse4(&qbh);
 	}
 out:
-	hpfs_unlock(inode->i_sb);
+	hpfs_unlock(inode_sb(inode));
 	return ret;
 }
 
@@ -210,10 +219,10 @@ struct dentry *hpfs_lookup(struct inode *dir, struct dentry *dentry, unsigned in
 	struct inode *result = NULL;
 	struct hpfs_inode_info *hpfs_result;
 
-	hpfs_lock(dir->i_sb);
+	hpfs_lock(inode_sb(dir));
 	if ((err = hpfs_chk_name(name, &len))) {
 		if (err == -ENAMETOOLONG) {
-			hpfs_unlock(dir->i_sb);
+			hpfs_unlock(inode_sb(dir));
 			return ERR_PTR(-ENAMETOOLONG);
 		}
 		goto end_add;
@@ -241,16 +250,16 @@ struct dentry *hpfs_lookup(struct inode *dir, struct dentry *dentry, unsigned in
 	 * Go find or make an inode.
 	 */
 
-	result = iget_locked(dir->i_sb, ino);
+	result = iget_locked(inode_sb(dir), ino);
 	if (!result) {
-		hpfs_error(dir->i_sb, "hpfs_lookup: can't get inode");
+		hpfs_error(inode_sb(dir), "hpfs_lookup: can't get inode");
 		goto bail1;
 	}
 	if (result->i_state & I_NEW) {
 		hpfs_init_inode(result);
 		if (de->directory)
 			hpfs_read_inode(result);
-		else if (le32_to_cpu(de->ea_size) && hpfs_sb(dir->i_sb)->sb_eas)
+		else if (le32_to_cpu(de->ea_size) && hpfs_sb(inode_sb(dir))->sb_eas)
 			hpfs_read_inode(result);
 		else {
 			result->i_mode |= S_IFREG;
@@ -264,8 +273,9 @@ struct dentry *hpfs_lookup(struct inode *dir, struct dentry *dentry, unsigned in
 	hpfs_result = hpfs_i(result);
 	if (!de->directory) hpfs_result->i_parent_dir = dir->i_ino;
 
-	if (de->has_acl || de->has_xtd_perm) if (!sb_rdonly(dir->i_sb)) {
-		hpfs_error(result->i_sb, "ACLs or XPERM found. This is probably HPFS386. This driver doesn't support it now. Send me some info on these structures");
+	if (de->has_acl || de->has_xtd_perm) if (!sb_rdonly(inode_sb(dir))) {
+		hpfs_error(inode_sb(result),
+			   "ACLs or XPERM found. This is probably HPFS386. This driver doesn't support it now. Send me some info on these structures");
 		goto bail1;
 	}
 
@@ -275,12 +285,14 @@ struct dentry *hpfs_lookup(struct inode *dir, struct dentry *dentry, unsigned in
 	 */
 
 	if (!result->i_ctime.tv_sec) {
-		if (!(result->i_ctime.tv_sec = local_to_gmt(dir->i_sb, le32_to_cpu(de->creation_date))))
+		if (!(result->i_ctime.tv_sec = local_to_gmt(inode_sb(dir), le32_to_cpu(de->creation_date))))
 			result->i_ctime.tv_sec = 1;
 		result->i_ctime.tv_nsec = 0;
-		result->i_mtime.tv_sec = local_to_gmt(dir->i_sb, le32_to_cpu(de->write_date));
+		result->i_mtime.tv_sec = local_to_gmt(inode_sb(dir),
+						      le32_to_cpu(de->write_date));
 		result->i_mtime.tv_nsec = 0;
-		result->i_atime.tv_sec = local_to_gmt(dir->i_sb, le32_to_cpu(de->read_date));
+		result->i_atime.tv_sec = local_to_gmt(inode_sb(dir),
+						      le32_to_cpu(de->read_date));
 		result->i_atime.tv_nsec = 0;
 		hpfs_result->i_ea_size = le32_to_cpu(de->ea_size);
 		if (!hpfs_result->i_ea_mode && de->read_only)
@@ -309,7 +321,7 @@ struct dentry *hpfs_lookup(struct inode *dir, struct dentry *dentry, unsigned in
 
 	end:
 	end_add:
-	hpfs_unlock(dir->i_sb);
+	hpfs_unlock(inode_sb(dir));
 	d_add(dentry, result);
 	return NULL;
 
@@ -322,7 +334,7 @@ struct dentry *hpfs_lookup(struct inode *dir, struct dentry *dentry, unsigned in
 	
 	/*bail:*/
 
-	hpfs_unlock(dir->i_sb);
+	hpfs_unlock(inode_sb(dir));
 	return ERR_PTR(-ENOENT);
 }
 
diff --git a/fs/hpfs/dnode.c b/fs/hpfs/dnode.c
index a4ad18afbdec..085d8582cf14 100644
--- a/fs/hpfs/dnode.c
+++ b/fs/hpfs/dnode.c
@@ -254,19 +254,20 @@ static int hpfs_add_to_dnode(struct inode *i, dnode_secno dno,
 	}
 	go_up:
 	if (namelen >= 256) {
-		hpfs_error(i->i_sb, "%s(): namelen == %d", __func__, namelen);
+		hpfs_error(inode_sb(i), "%s(): namelen == %d", __func__,
+			   namelen);
 		kfree(nd);
 		kfree(nname);
 		return 1;
 	}
-	if (!(d = hpfs_map_dnode(i->i_sb, dno, &qbh))) {
+	if (!(d = hpfs_map_dnode(inode_sb(i), dno, &qbh))) {
 		kfree(nd);
 		kfree(nname);
 		return 1;
 	}
 	go_up_a:
-	if (hpfs_sb(i->i_sb)->sb_chk)
-		if (hpfs_stop_cycles(i->i_sb, dno, &c1, &c2, "hpfs_add_to_dnode")) {
+	if (hpfs_sb(inode_sb(i))->sb_chk)
+		if (hpfs_stop_cycles(inode_sb(i), dno, &c1, &c2, "hpfs_add_to_dnode")) {
 			hpfs_brelse4(&qbh);
 			kfree(nd);
 			kfree(nname);
@@ -274,7 +275,8 @@ static int hpfs_add_to_dnode(struct inode *i, dnode_secno dno,
 		}
 	if (le32_to_cpu(d->first_free) + de_size(namelen, down_ptr) <= 2048) {
 		loff_t t;
-		copy_de(de=hpfs_add_de(i->i_sb, d, name, namelen, down_ptr), new_de);
+		copy_de(de=hpfs_add_de(inode_sb(i), d, name, namelen, down_ptr),
+			new_de);
 		t = get_pos(d, de);
 		for_all_poss(i, hpfs_pos_ins, t, 1);
 		for_all_poss(i, hpfs_pos_subst, 4, t);
@@ -297,11 +299,13 @@ static int hpfs_add_to_dnode(struct inode *i, dnode_secno dno,
 		return 1;
 	}	
 	memcpy(nd, d, le32_to_cpu(d->first_free));
-	copy_de(de = hpfs_add_de(i->i_sb, nd, name, namelen, down_ptr), new_de);
+	copy_de(de = hpfs_add_de(inode_sb(i), nd, name, namelen, down_ptr),
+		new_de);
 	for_all_poss(i, hpfs_pos_ins, get_pos(nd, de), 1);
 	h = ((char *)dnode_last_de(nd) - (char *)nd) / 2 + 10;
-	if (!(ad = hpfs_alloc_dnode(i->i_sb, le32_to_cpu(d->up), &adno, &qbh1))) {
-		hpfs_error(i->i_sb, "unable to alloc dnode - dnode tree will be corrupted");
+	if (!(ad = hpfs_alloc_dnode(inode_sb(i), le32_to_cpu(d->up), &adno, &qbh1))) {
+		hpfs_error(inode_sb(i),
+			   "unable to alloc dnode - dnode tree will be corrupted");
 		hpfs_brelse4(&qbh);
 		kfree(nd);
 		kfree(nname);
@@ -311,7 +315,8 @@ static int hpfs_add_to_dnode(struct inode *i, dnode_secno dno,
 	i->i_blocks += 4;
 	pos = 1;
 	for (de = dnode_first_de(nd); (char *)de_next_de(de) - (char *)nd < h; de = de_next_de(de)) {
-		copy_de(hpfs_add_de(i->i_sb, ad, de->name, de->namelen, de->down ? de_down_pointer(de) : 0), de);
+		copy_de(hpfs_add_de(inode_sb(i), ad, de->name, de->namelen, de->down ? de_down_pointer(de) : 0),
+			de);
 		for_all_poss(i, hpfs_pos_subst, ((loff_t)dno << 4) | pos, ((loff_t)adno << 4) | pos);
 		pos++;
 	}
@@ -321,13 +326,13 @@ static int hpfs_add_to_dnode(struct inode *i, dnode_secno dno,
 	namelen = de->namelen;
 	for_all_poss(i, hpfs_pos_subst, ((loff_t)dno << 4) | pos, 4);
 	down_ptr = adno;
-	set_last_pointer(i->i_sb, ad, de->down ? de_down_pointer(de) : 0);
+	set_last_pointer(inode_sb(i), ad, de->down ? de_down_pointer(de) : 0);
 	de = de_next_de(de);
 	memmove((char *)nd + 20, de, le32_to_cpu(nd->first_free) + (char *)nd - (char *)de);
 	le32_add_cpu(&nd->first_free, -((char *)de - (char *)nd - 20));
 	memcpy(d, nd, le32_to_cpu(nd->first_free));
 	for_all_poss(i, hpfs_pos_del, (loff_t)dno << 4, pos);
-	fix_up_ptrs(i->i_sb, ad);
+	fix_up_ptrs(inode_sb(i), ad);
 	if (!d->root_dnode) {
 		ad->up = d->up;
 		dno = le32_to_cpu(ad->up);
@@ -337,8 +342,9 @@ static int hpfs_add_to_dnode(struct inode *i, dnode_secno dno,
 		hpfs_brelse4(&qbh1);
 		goto go_up;
 	}
-	if (!(rd = hpfs_alloc_dnode(i->i_sb, le32_to_cpu(d->up), &rdno, &qbh2))) {
-		hpfs_error(i->i_sb, "unable to alloc dnode - dnode tree will be corrupted");
+	if (!(rd = hpfs_alloc_dnode(inode_sb(i), le32_to_cpu(d->up), &rdno, &qbh2))) {
+		hpfs_error(inode_sb(i),
+			   "unable to alloc dnode - dnode tree will be corrupted");
 		hpfs_brelse4(&qbh);
 		hpfs_brelse4(&qbh1);
 		kfree(nd);
@@ -349,8 +355,8 @@ static int hpfs_add_to_dnode(struct inode *i, dnode_secno dno,
 	i->i_blocks += 4;
 	rd->root_dnode = 1;
 	rd->up = d->up;
-	if (!(fnode = hpfs_map_fnode(i->i_sb, le32_to_cpu(d->up), &bh))) {
-		hpfs_free_dnode(i->i_sb, rdno);
+	if (!(fnode = hpfs_map_fnode(inode_sb(i), le32_to_cpu(d->up), &bh))) {
+		hpfs_free_dnode(inode_sb(i), rdno);
 		hpfs_brelse4(&qbh);
 		hpfs_brelse4(&qbh1);
 		hpfs_brelse4(&qbh2);
@@ -369,7 +375,7 @@ static int hpfs_add_to_dnode(struct inode *i, dnode_secno dno,
 	hpfs_mark_4buffers_dirty(&qbh1);
 	hpfs_brelse4(&qbh1);
 	qbh = qbh2;
-	set_last_pointer(i->i_sb, rd, dno);
+	set_last_pointer(inode_sb(i), rd, dno);
 	dno = rdno;
 	d = rd;
 	goto go_up_a;
@@ -396,12 +402,12 @@ int hpfs_add_dirent(struct inode *i,
 	int c1, c2 = 0;
 	dno = hpfs_inode->i_dno;
 	down:
-	if (hpfs_sb(i->i_sb)->sb_chk)
-		if (hpfs_stop_cycles(i->i_sb, dno, &c1, &c2, "hpfs_add_dirent")) return 1;
-	if (!(d = hpfs_map_dnode(i->i_sb, dno, &qbh))) return 1;
+	if (hpfs_sb(inode_sb(i))->sb_chk)
+		if (hpfs_stop_cycles(inode_sb(i), dno, &c1, &c2, "hpfs_add_dirent")) return 1;
+	if (!(d = hpfs_map_dnode(inode_sb(i), dno, &qbh))) return 1;
 	de_end = dnode_end_de(d);
 	for (de = dnode_first_de(d); de < de_end; de = de_next_de(de)) {
-		if (!(c = hpfs_compare_names(i->i_sb, name, namelen, de->name, de->namelen, de->last))) {
+		if (!(c = hpfs_compare_names(inode_sb(i), name, namelen, de->name, de->namelen, de->last))) {
 			hpfs_brelse4(&qbh);
 			return -1;
 		}	
@@ -415,7 +421,7 @@ int hpfs_add_dirent(struct inode *i,
 		}
 	}
 	hpfs_brelse4(&qbh);
-	if (hpfs_check_free_dnodes(i->i_sb, FREE_DNODES_ADD)) {
+	if (hpfs_check_free_dnodes(inode_sb(i), FREE_DNODES_ADD)) {
 		c = 1;
 		goto ret;
 	}	
@@ -441,21 +447,25 @@ static secno move_to_top(struct inode *i, dnode_secno from, dnode_secno to)
 	int c1, c2 = 0;
 	dno = from;
 	while (1) {
-		if (hpfs_sb(i->i_sb)->sb_chk)
-			if (hpfs_stop_cycles(i->i_sb, dno, &c1, &c2, "move_to_top"))
+		if (hpfs_sb(inode_sb(i))->sb_chk)
+			if (hpfs_stop_cycles(inode_sb(i), dno, &c1, &c2, "move_to_top"))
 				return 0;
-		if (!(dnode = hpfs_map_dnode(i->i_sb, dno, &qbh))) return 0;
-		if (hpfs_sb(i->i_sb)->sb_chk) {
+		if (!(dnode = hpfs_map_dnode(inode_sb(i), dno, &qbh))) return 0;
+		if (hpfs_sb(inode_sb(i))->sb_chk) {
 			if (le32_to_cpu(dnode->up) != chk_up) {
-				hpfs_error(i->i_sb, "move_to_top: up pointer from %08x should be %08x, is %08x",
-					dno, chk_up, le32_to_cpu(dnode->up));
+				hpfs_error(inode_sb(i),
+					   "move_to_top: up pointer from %08x should be %08x, is %08x",
+					   dno, chk_up,
+					   le32_to_cpu(dnode->up));
 				hpfs_brelse4(&qbh);
 				return 0;
 			}
 			chk_up = dno;
 		}
 		if (!(de = dnode_last_de(dnode))) {
-			hpfs_error(i->i_sb, "move_to_top: dnode %08x has no last de", dno);
+			hpfs_error(inode_sb(i),
+				   "move_to_top: dnode %08x has no last de",
+				   dno);
 			hpfs_brelse4(&qbh);
 			return 0;
 		}
@@ -466,20 +476,24 @@ static secno move_to_top(struct inode *i, dnode_secno from, dnode_secno to)
 	while (!(de = dnode_pre_last_de(dnode))) {
 		dnode_secno up = le32_to_cpu(dnode->up);
 		hpfs_brelse4(&qbh);
-		hpfs_free_dnode(i->i_sb, dno);
+		hpfs_free_dnode(inode_sb(i), dno);
 		i->i_size -= 2048;
 		i->i_blocks -= 4;
 		for_all_poss(i, hpfs_pos_subst, ((loff_t)dno << 4) | 1, 5);
 		if (up == to) return to;
-		if (!(dnode = hpfs_map_dnode(i->i_sb, up, &qbh))) return 0;
+		if (!(dnode = hpfs_map_dnode(inode_sb(i), up, &qbh))) return 0;
 		if (dnode->root_dnode) {
-			hpfs_error(i->i_sb, "move_to_top: got to root_dnode while moving from %08x to %08x", from, to);
+			hpfs_error(inode_sb(i),
+				   "move_to_top: got to root_dnode while moving from %08x to %08x",
+				   from, to);
 			hpfs_brelse4(&qbh);
 			return 0;
 		}
 		de = dnode_last_de(dnode);
 		if (!de || !de->down) {
-			hpfs_error(i->i_sb, "move_to_top: dnode %08x doesn't point down to %08x", up, dno);
+			hpfs_error(inode_sb(i),
+				   "move_to_top: dnode %08x doesn't point down to %08x",
+				   up, dno);
 			hpfs_brelse4(&qbh);
 			return 0;
 		}
@@ -493,14 +507,15 @@ static secno move_to_top(struct inode *i, dnode_secno from, dnode_secno to)
 	for_all_poss(i, hpfs_pos_subst, t, 4);
 	for_all_poss(i, hpfs_pos_subst, t + 1, 5);
 	if (!(nde = kmalloc(le16_to_cpu(de->length), GFP_NOFS))) {
-		hpfs_error(i->i_sb, "out of memory for dirent - directory will be corrupted");
+		hpfs_error(inode_sb(i),
+			   "out of memory for dirent - directory will be corrupted");
 		hpfs_brelse4(&qbh);
 		return 0;
 	}
 	memcpy(nde, de, le16_to_cpu(de->length));
 	ddno = de->down ? de_down_pointer(de) : 0;
-	hpfs_delete_de(i->i_sb, dnode, de);
-	set_last_pointer(i->i_sb, dnode, ddno);
+	hpfs_delete_de(inode_sb(i), dnode, de);
+	set_last_pointer(inode_sb(i), dnode, ddno);
 	hpfs_mark_4buffers_dirty(&qbh);
 	hpfs_brelse4(&qbh);
 	a = hpfs_add_to_dnode(i, to, nde->name, nde->namelen, nde, from);
@@ -524,8 +539,8 @@ static void delete_empty_dnode(struct inode *i, dnode_secno dno)
 	struct hpfs_dirent *de;
 	int c1, c2 = 0;
 	try_it_again:
-	if (hpfs_stop_cycles(i->i_sb, dno, &c1, &c2, "delete_empty_dnode")) return;
-	if (!(dnode = hpfs_map_dnode(i->i_sb, dno, &qbh))) return;
+	if (hpfs_stop_cycles(inode_sb(i), dno, &c1, &c2, "delete_empty_dnode")) return;
+	if (!(dnode = hpfs_map_dnode(inode_sb(i), dno, &qbh))) return;
 	if (le32_to_cpu(dnode->first_free) > 56) goto end;
 	if (le32_to_cpu(dnode->first_free) == 52 || le32_to_cpu(dnode->first_free) == 56) {
 		struct hpfs_dirent *de_end;
@@ -533,12 +548,14 @@ static void delete_empty_dnode(struct inode *i, dnode_secno dno)
 		up = le32_to_cpu(dnode->up);
 		de = dnode_first_de(dnode);
 		down = de->down ? de_down_pointer(de) : 0;
-		if (hpfs_sb(i->i_sb)->sb_chk) if (root && !down) {
-			hpfs_error(i->i_sb, "delete_empty_dnode: root dnode %08x is empty", dno);
+		if (hpfs_sb(inode_sb(i))->sb_chk) if (root && !down) {
+			hpfs_error(inode_sb(i),
+				   "delete_empty_dnode: root dnode %08x is empty",
+				   dno);
 			goto end;
 		}
 		hpfs_brelse4(&qbh);
-		hpfs_free_dnode(i->i_sb, dno);
+		hpfs_free_dnode(inode_sb(i), dno);
 		i->i_size -= 2048;
 		i->i_blocks -= 4;
 		if (root) {
@@ -546,21 +563,21 @@ static void delete_empty_dnode(struct inode *i, dnode_secno dno)
 			struct buffer_head *bh;
 			struct dnode *d1;
 			struct quad_buffer_head qbh1;
-			if (hpfs_sb(i->i_sb)->sb_chk)
+			if (hpfs_sb(inode_sb(i))->sb_chk)
 				if (up != i->i_ino) {
-					hpfs_error(i->i_sb,
+					hpfs_error(inode_sb(i),
 						   "bad pointer to fnode, dnode %08x, pointing to %08x, should be %08lx",
 						   dno, up,
 						   (unsigned long)i->i_ino);
 					return;
 				}
-			if ((d1 = hpfs_map_dnode(i->i_sb, down, &qbh1))) {
+			if ((d1 = hpfs_map_dnode(inode_sb(i), down, &qbh1))) {
 				d1->up = cpu_to_le32(up);
 				d1->root_dnode = 1;
 				hpfs_mark_4buffers_dirty(&qbh1);
 				hpfs_brelse4(&qbh1);
 			}
-			if ((fnode = hpfs_map_fnode(i->i_sb, up, &bh))) {
+			if ((fnode = hpfs_map_fnode(inode_sb(i), up, &bh))) {
 				fnode->u.external[0].disk_secno = cpu_to_le32(down);
 				mark_buffer_dirty(bh);
 				brelse(bh);
@@ -569,12 +586,14 @@ static void delete_empty_dnode(struct inode *i, dnode_secno dno)
 			for_all_poss(i, hpfs_pos_subst, ((loff_t)dno << 4) | 1, (loff_t) 12);
 			return;
 		}
-		if (!(dnode = hpfs_map_dnode(i->i_sb, up, &qbh))) return;
+		if (!(dnode = hpfs_map_dnode(inode_sb(i), up, &qbh))) return;
 		p = 1;
 		de_end = dnode_end_de(dnode);
 		for (de = dnode_first_de(dnode); de < de_end; de = de_next_de(de), p++)
 			if (de->down) if (de_down_pointer(de) == dno) goto fnd;
-		hpfs_error(i->i_sb, "delete_empty_dnode: pointer to dnode %08x not found in dnode %08x", dno, up);
+		hpfs_error(inode_sb(i),
+			   "delete_empty_dnode: pointer to dnode %08x not found in dnode %08x",
+			   dno, up);
 		goto end;
 		fnd:
 		for_all_poss(i, hpfs_pos_subst, ((loff_t)dno << 4) | 1, ((loff_t)up << 4) | p);
@@ -588,14 +607,16 @@ static void delete_empty_dnode(struct inode *i, dnode_secno dno)
 			struct dnode *d1;
 			struct quad_buffer_head qbh1;
 			*(dnode_secno *) ((void *) de + le16_to_cpu(de->length) - 4) = down;
-			if ((d1 = hpfs_map_dnode(i->i_sb, down, &qbh1))) {
+			if ((d1 = hpfs_map_dnode(inode_sb(i), down, &qbh1))) {
 				d1->up = cpu_to_le32(up);
 				hpfs_mark_4buffers_dirty(&qbh1);
 				hpfs_brelse4(&qbh1);
 			}
 		}
 	} else {
-		hpfs_error(i->i_sb, "delete_empty_dnode: dnode %08x, first_free == %03x", dno, le32_to_cpu(dnode->first_free));
+		hpfs_error(inode_sb(i),
+			   "delete_empty_dnode: dnode %08x, first_free == %03x",
+			   dno, le32_to_cpu(dnode->first_free));
 		goto end;
 	}
 
@@ -611,12 +632,12 @@ static void delete_empty_dnode(struct inode *i, dnode_secno dno)
 			goto endm;
 		}
 		memcpy(de_cp, de, le16_to_cpu(de->length));
-		hpfs_delete_de(i->i_sb, dnode, de);
+		hpfs_delete_de(inode_sb(i), dnode, de);
 		hpfs_mark_4buffers_dirty(&qbh);
 		hpfs_brelse4(&qbh);
 		for_all_poss(i, hpfs_pos_subst, ((loff_t)up << 4) | p, 4);
 		for_all_poss(i, hpfs_pos_del, ((loff_t)up << 4) | p, 1);
-		if (de_cp->down) if ((d1 = hpfs_map_dnode(i->i_sb, de_down_pointer(de_cp), &qbh1))) {
+		if (de_cp->down) if ((d1 = hpfs_map_dnode(inode_sb(i), de_down_pointer(de_cp), &qbh1))) {
 			d1->up = cpu_to_le32(ndown);
 			hpfs_mark_4buffers_dirty(&qbh1);
 			hpfs_brelse4(&qbh1);
@@ -634,7 +655,8 @@ static void delete_empty_dnode(struct inode *i, dnode_secno dno)
 		struct quad_buffer_head qbh1;
 		dnode_secno dlp;
 		if (!de_prev) {
-			hpfs_error(i->i_sb, "delete_empty_dnode: empty dnode %08x", up);
+			hpfs_error(inode_sb(i),
+				   "delete_empty_dnode: empty dnode %08x", up);
 			hpfs_mark_4buffers_dirty(&qbh);
 			hpfs_brelse4(&qbh);
 			dno = up;
@@ -642,19 +664,19 @@ static void delete_empty_dnode(struct inode *i, dnode_secno dno)
 		}
 		if (!de_prev->down) goto endm;
 		ndown = de_down_pointer(de_prev);
-		if ((d1 = hpfs_map_dnode(i->i_sb, ndown, &qbh1))) {
+		if ((d1 = hpfs_map_dnode(inode_sb(i), ndown, &qbh1))) {
 			struct hpfs_dirent *del = dnode_last_de(d1);
 			dlp = del->down ? de_down_pointer(del) : 0;
 			if (!dlp && down) {
 				if (le32_to_cpu(d1->first_free) > 2044) {
-					if (hpfs_sb(i->i_sb)->sb_chk >= 2) {
+					if (hpfs_sb(inode_sb(i))->sb_chk >= 2) {
 						pr_err("unbalanced dnode tree, see hpfs.txt 4 more info\n");
 						pr_err("terminating balancing operation\n");
 					}
 					hpfs_brelse4(&qbh1);
 					goto endm;
 				}
-				if (hpfs_sb(i->i_sb)->sb_chk >= 2) {
+				if (hpfs_sb(inode_sb(i))->sb_chk >= 2) {
 					pr_err("unbalanced dnode tree, see hpfs.txt 4 more info\n");
 					pr_err("goin'on\n");
 				}
@@ -677,7 +699,7 @@ static void delete_empty_dnode(struct inode *i, dnode_secno dno)
 		hpfs_mark_4buffers_dirty(&qbh1);
 		hpfs_brelse4(&qbh1);
 		memcpy(de_cp, de_prev, le16_to_cpu(de_prev->length));
-		hpfs_delete_de(i->i_sb, dnode, de_prev);
+		hpfs_delete_de(inode_sb(i), dnode, de_prev);
 		if (!de_prev->down) {
 			le16_add_cpu(&de_prev->length, 4);
 			de_prev->down = 1;
@@ -688,7 +710,7 @@ static void delete_empty_dnode(struct inode *i, dnode_secno dno)
 		hpfs_brelse4(&qbh);
 		for_all_poss(i, hpfs_pos_subst, ((loff_t)up << 4) | (p - 1), 4);
 		for_all_poss(i, hpfs_pos_subst, ((loff_t)up << 4) | p, ((loff_t)up << 4) | (p - 1));
-		if (down) if ((d1 = hpfs_map_dnode(i->i_sb, de_down_pointer(de), &qbh1))) {
+		if (down) if ((d1 = hpfs_map_dnode(inode_sb(i), de_down_pointer(de), &qbh1))) {
 			d1->up = cpu_to_le32(ndown);
 			hpfs_mark_4buffers_dirty(&qbh1);
 			hpfs_brelse4(&qbh1);
@@ -714,19 +736,21 @@ int hpfs_remove_dirent(struct inode *i, dnode_secno dno, struct hpfs_dirent *de,
 	dnode_secno down = 0;
 	loff_t t;
 	if (de->first || de->last) {
-		hpfs_error(i->i_sb, "hpfs_remove_dirent: attempt to delete first or last dirent in dnode %08x", dno);
+		hpfs_error(inode_sb(i),
+			   "hpfs_remove_dirent: attempt to delete first or last dirent in dnode %08x",
+			   dno);
 		hpfs_brelse4(qbh);
 		return 1;
 	}
 	if (de->down) down = de_down_pointer(de);
 	if (depth && (de->down || (de == dnode_first_de(dnode) && de_next_de(de)->last))) {
-		if (hpfs_check_free_dnodes(i->i_sb, FREE_DNODES_DEL)) {
+		if (hpfs_check_free_dnodes(inode_sb(i), FREE_DNODES_DEL)) {
 			hpfs_brelse4(qbh);
 			return 2;
 		}
 	}
 	for_all_poss(i, hpfs_pos_del, (t = get_pos(dnode, de)) + 1, 1);
-	hpfs_delete_de(i->i_sb, dnode, de);
+	hpfs_delete_de(inode_sb(i), dnode, de);
 	hpfs_mark_4buffers_dirty(qbh);
 	hpfs_brelse4(qbh);
 	if (down) {
@@ -856,20 +880,20 @@ struct hpfs_dirent *map_pos_dirent(struct inode *inode, loff_t *posp,
 	pos = *posp;
 	dno = pos >> 6 << 2;
 	pos &= 077;
-	if (!(de = map_nth_dirent(inode->i_sb, dno, pos, qbh, &dnode)))
+	if (!(de = map_nth_dirent(inode_sb(inode), dno, pos, qbh, &dnode)))
 		goto bail;
 
 	/* Going to the next dirent */
 	if ((d = de_next_de(de)) < dnode_end_de(dnode)) {
 		if (!(++*posp & 077)) {
-			hpfs_error(inode->i_sb,
-				"map_pos_dirent: pos crossed dnode boundary; pos = %08llx",
-				(unsigned long long)*posp);
+			hpfs_error(inode_sb(inode),
+				   "map_pos_dirent: pos crossed dnode boundary; pos = %08llx",
+				   (unsigned long long)*posp);
 			goto bail;
 		}
 		/* We're going down the tree */
 		if (d->down) {
-			*posp = ((loff_t) hpfs_de_as_down_as_possible(inode->i_sb, de_down_pointer(d)) << 4) + 1;
+			*posp = ((loff_t) hpfs_de_as_down_as_possible(inode_sb(inode), de_down_pointer(d)) << 4) + 1;
 		}
 	
 		return de;
@@ -878,15 +902,16 @@ struct hpfs_dirent *map_pos_dirent(struct inode *inode, loff_t *posp,
 	/* Going up */
 	if (dnode->root_dnode) goto bail;
 
-	if (!(up_dnode = hpfs_map_dnode(inode->i_sb, le32_to_cpu(dnode->up), &qbh0)))
+	if (!(up_dnode = hpfs_map_dnode(inode_sb(inode), le32_to_cpu(dnode->up), &qbh0)))
 		goto bail;
 
 	end_up_de = dnode_end_de(up_dnode);
 	c = 0;
 	for (up_de = dnode_first_de(up_dnode); up_de < end_up_de;
 	     up_de = de_next_de(up_de)) {
-		if (!(++c & 077)) hpfs_error(inode->i_sb,
-			"map_pos_dirent: pos crossed dnode boundary; dnode = %08x", le32_to_cpu(dnode->up));
+		if (!(++c & 077)) hpfs_error(inode_sb(inode),
+					     "map_pos_dirent: pos crossed dnode boundary; dnode = %08x",
+					     le32_to_cpu(dnode->up));
 		if (up_de->down && de_down_pointer(up_de) == dno) {
 			*posp = ((loff_t) le32_to_cpu(dnode->up) << 4) + c;
 			hpfs_brelse4(&qbh0);
@@ -894,8 +919,9 @@ struct hpfs_dirent *map_pos_dirent(struct inode *inode, loff_t *posp,
 		}
 	}
 	
-	hpfs_error(inode->i_sb, "map_pos_dirent: pointer to dnode %08x not found in parent dnode %08x",
-		dno, le32_to_cpu(dnode->up));
+	hpfs_error(inode_sb(inode),
+		   "map_pos_dirent: pointer to dnode %08x not found in parent dnode %08x",
+		   dno, le32_to_cpu(dnode->up));
 	hpfs_brelse4(&qbh0);
 	
 	bail:
@@ -914,15 +940,17 @@ struct hpfs_dirent *map_dirent(struct inode *inode, dnode_secno dno,
 	struct hpfs_dirent *de_end;
 	int c1, c2 = 0;
 
-	if (!S_ISDIR(inode->i_mode)) hpfs_error(inode->i_sb, "map_dirent: not a directory\n");
+	if (!S_ISDIR(inode->i_mode)) hpfs_error(inode_sb(inode),
+						"map_dirent: not a directory\n");
 	again:
-	if (hpfs_sb(inode->i_sb)->sb_chk)
-		if (hpfs_stop_cycles(inode->i_sb, dno, &c1, &c2, "map_dirent")) return NULL;
-	if (!(dnode = hpfs_map_dnode(inode->i_sb, dno, qbh))) return NULL;
+	if (hpfs_sb(inode_sb(inode))->sb_chk)
+		if (hpfs_stop_cycles(inode_sb(inode), dno, &c1, &c2, "map_dirent")) return NULL;
+	if (!(dnode = hpfs_map_dnode(inode_sb(inode), dno, qbh))) return NULL;
 	
 	de_end = dnode_end_de(dnode);
 	for (de = dnode_first_de(dnode); de < de_end; de = de_next_de(de)) {
-		int t = hpfs_compare_names(inode->i_sb, name, len, de->name, de->namelen, de->last);
+		int t = hpfs_compare_names(inode_sb(inode), name, len,
+					   de->name, de->namelen, de->last);
 		if (!t) {
 			if (dd) *dd = dno;
 			return de;
diff --git a/fs/hpfs/ea.c b/fs/hpfs/ea.c
index 102ba18e561f..4c973239b948 100644
--- a/fs/hpfs/ea.c
+++ b/fs/hpfs/ea.c
@@ -191,7 +191,7 @@ void hpfs_set_ea(struct inode *inode, struct fnode *fnode, const char *key,
 		 const char *data, int size)
 {
 	fnode_secno fno = inode->i_ino;
-	struct super_block *s = inode->i_sb;
+	struct super_block *s = inode_sb(inode);
 	unsigned pos;
 	int ano, len;
 	secno a;
diff --git a/fs/hpfs/file.c b/fs/hpfs/file.c
index 1ecec124e76f..3877807b08f4 100644
--- a/fs/hpfs/file.c
+++ b/fs/hpfs/file.c
@@ -14,9 +14,9 @@
 
 static int hpfs_file_release(struct inode *inode, struct file *file)
 {
-	hpfs_lock(inode->i_sb);
+	hpfs_lock(inode_sb(inode));
 	hpfs_write_if_changed(inode);
-	hpfs_unlock(inode->i_sb);
+	hpfs_unlock(inode_sb(inode));
 	return 0;
 }
 
@@ -28,7 +28,7 @@ int hpfs_file_fsync(struct file *file, loff_t start, loff_t end, int datasync)
 	ret = file_write_and_wait_range(file, start, end);
 	if (ret)
 		return ret;
-	return sync_blockdev(inode->i_sb->s_bdev);
+	return sync_blockdev(inode_sb(inode)->s_bdev);
 }
 
 /*
@@ -48,10 +48,11 @@ static secno hpfs_bmap(struct inode *inode, unsigned file_secno, unsigned *n_sec
 		*n_secs = hpfs_inode->i_n_secs - n;
 		return hpfs_inode->i_disk_sec + n;
 	}
-	if (!(fnode = hpfs_map_fnode(inode->i_sb, inode->i_ino, &bh))) return 0;
-	disk_secno = hpfs_bplus_lookup(inode->i_sb, inode, &fnode->btree, file_secno, bh);
+	if (!(fnode = hpfs_map_fnode(inode_sb(inode), inode->i_ino, &bh))) return 0;
+	disk_secno = hpfs_bplus_lookup(inode_sb(inode), inode, &fnode->btree,
+				       file_secno, bh);
 	if (disk_secno == -1) return 0;
-	if (hpfs_chk_sectors(inode->i_sb, disk_secno, 1, "bmap")) return 0;
+	if (hpfs_chk_sectors(inode_sb(inode), disk_secno, 1, "bmap")) return 0;
 	n = file_secno - hpfs_inode->i_file_sec;
 	if (n < hpfs_inode->i_n_secs) {
 		*n_secs = hpfs_inode->i_n_secs - n;
@@ -64,12 +65,13 @@ static secno hpfs_bmap(struct inode *inode, unsigned file_secno, unsigned *n_sec
 void hpfs_truncate(struct inode *i)
 {
 	if (IS_IMMUTABLE(i)) return /*-EPERM*/;
-	hpfs_lock_assert(i->i_sb);
+	hpfs_lock_assert(inode_sb(i));
 
 	hpfs_i(i)->i_n_secs = 0;
 	i->i_blocks = 1 + ((i->i_size + 511) >> 9);
 	hpfs_i(i)->mmu_private = i->i_size;
-	hpfs_truncate_btree(i->i_sb, i->i_ino, 1, ((i->i_size + 511) >> 9));
+	hpfs_truncate_btree(inode_sb(i), i->i_ino, 1,
+			    ((i->i_size + 511) >> 9));
 	hpfs_write_inode(i);
 	hpfs_i(i)->i_n_secs = 0;
 }
@@ -79,17 +81,18 @@ static int hpfs_get_block(struct inode *inode, sector_t iblock, struct buffer_he
 	int r;
 	secno s;
 	unsigned n_secs;
-	hpfs_lock(inode->i_sb);
+	hpfs_lock(inode_sb(inode));
 	s = hpfs_bmap(inode, iblock, &n_secs);
 	if (s) {
 		if (bh_result->b_size >> 9 < n_secs)
 			n_secs = bh_result->b_size >> 9;
-		n_secs = hpfs_search_hotfix_map_for_range(inode->i_sb, s, n_secs);
+		n_secs = hpfs_search_hotfix_map_for_range(inode_sb(inode), s,
+							  n_secs);
 		if (unlikely(!n_secs)) {
-			s = hpfs_search_hotfix_map(inode->i_sb, s);
+			s = hpfs_search_hotfix_map(inode_sb(inode), s);
 			n_secs = 1;
 		}
-		map_bh(bh_result, inode->i_sb, s);
+		map_bh(bh_result, inode_sb(inode), s);
 		bh_result->b_size = n_secs << 9;
 		goto ret_0;
 	}
@@ -99,19 +102,21 @@ static int hpfs_get_block(struct inode *inode, sector_t iblock, struct buffer_he
 		r = -EIO;
 		goto ret_r;
 	}
-	if ((s = hpfs_add_sector_to_btree(inode->i_sb, inode->i_ino, 1, inode->i_blocks - 1)) == -1) {
-		hpfs_truncate_btree(inode->i_sb, inode->i_ino, 1, inode->i_blocks - 1);
+	if ((s = hpfs_add_sector_to_btree(inode_sb(inode), inode->i_ino, 1, inode->i_blocks - 1)) == -1) {
+		hpfs_truncate_btree(inode_sb(inode), inode->i_ino, 1,
+				    inode->i_blocks - 1);
 		r = -ENOSPC;
 		goto ret_r;
 	}
 	inode->i_blocks++;
 	hpfs_i(inode)->mmu_private += 512;
 	set_buffer_new(bh_result);
-	map_bh(bh_result, inode->i_sb, hpfs_search_hotfix_map(inode->i_sb, s));
+	map_bh(bh_result, inode_sb(inode),
+	       hpfs_search_hotfix_map(inode_sb(inode), s));
 	ret_0:
 	r = 0;
 	ret_r:
-	hpfs_unlock(inode->i_sb);
+	hpfs_unlock(inode_sb(inode));
 	return r;
 }
 
@@ -141,14 +146,14 @@ static void hpfs_write_failed(struct address_space *mapping, loff_t to)
 {
 	struct inode *inode = mapping->host;
 
-	hpfs_lock(inode->i_sb);
+	hpfs_lock(inode_sb(inode));
 
 	if (to > inode->i_size) {
 		truncate_pagecache(inode, inode->i_size);
 		hpfs_truncate(inode);
 	}
 
-	hpfs_unlock(inode->i_sb);
+	hpfs_unlock(inode_sb(inode));
 }
 
 static int hpfs_write_begin(struct file *file, struct address_space *mapping,
@@ -178,9 +183,9 @@ static int hpfs_write_end(struct file *file, struct address_space *mapping,
 		hpfs_write_failed(mapping, pos + len);
 	if (!(err < 0)) {
 		/* make sure we write it on close, if not earlier */
-		hpfs_lock(inode->i_sb);
+		hpfs_lock(inode_sb(inode));
 		hpfs_i(inode)->i_dirty = 1;
-		hpfs_unlock(inode->i_sb);
+		hpfs_unlock(inode_sb(inode));
 	}
 	return err;
 }
diff --git a/fs/hpfs/inode.c b/fs/hpfs/inode.c
index eb8b4baf0f2e..eab8df9daa8c 100644
--- a/fs/hpfs/inode.c
+++ b/fs/hpfs/inode.c
@@ -13,7 +13,7 @@
 
 void hpfs_init_inode(struct inode *i)
 {
-	struct super_block *sb = i->i_sb;
+	struct super_block *sb = inode_sb(i);
 	struct hpfs_inode_info *hpfs_inode = hpfs_i(i);
 
 	i->i_uid = hpfs_sb(sb)->sb_uid;
@@ -45,7 +45,7 @@ void hpfs_read_inode(struct inode *i)
 {
 	struct buffer_head *bh;
 	struct fnode *fnode;
-	struct super_block *sb = i->i_sb;
+	struct super_block *sb = inode_sb(i);
 	struct hpfs_inode_info *hpfs_inode = hpfs_i(i);
 	void *ea;
 	int ea_size;
@@ -59,22 +59,22 @@ void hpfs_read_inode(struct inode *i)
 		make_bad_inode(i);
 		return;
 	}
-	if (hpfs_sb(i->i_sb)->sb_eas) {
-		if ((ea = hpfs_get_ea(i->i_sb, fnode, "UID", &ea_size))) {
+	if (hpfs_sb(inode_sb(i))->sb_eas) {
+		if ((ea = hpfs_get_ea(inode_sb(i), fnode, "UID", &ea_size))) {
 			if (ea_size == 2) {
 				i_uid_write(i, le16_to_cpu(*(__le16*)ea));
 				hpfs_inode->i_ea_uid = 1;
 			}
 			kfree(ea);
 		}
-		if ((ea = hpfs_get_ea(i->i_sb, fnode, "GID", &ea_size))) {
+		if ((ea = hpfs_get_ea(inode_sb(i), fnode, "GID", &ea_size))) {
 			if (ea_size == 2) {
 				i_gid_write(i, le16_to_cpu(*(__le16*)ea));
 				hpfs_inode->i_ea_gid = 1;
 			}
 			kfree(ea);
 		}
-		if ((ea = hpfs_get_ea(i->i_sb, fnode, "SYMLINK", &ea_size))) {
+		if ((ea = hpfs_get_ea(inode_sb(i), fnode, "SYMLINK", &ea_size))) {
 			kfree(ea);
 			i->i_mode = S_IFLNK | 0777;
 			i->i_op = &page_symlink_inode_operations;
@@ -86,7 +86,7 @@ void hpfs_read_inode(struct inode *i)
 			brelse(bh);
 			return;
 		}
-		if ((ea = hpfs_get_ea(i->i_sb, fnode, "MODE", &ea_size))) {
+		if ((ea = hpfs_get_ea(inode_sb(i), fnode, "MODE", &ea_size))) {
 			int rdev = 0;
 			umode_t mode = hpfs_sb(sb)->sb_mode;
 			if (ea_size == 2) {
@@ -96,7 +96,7 @@ void hpfs_read_inode(struct inode *i)
 			kfree(ea);
 			i->i_mode = mode;
 			if (S_ISBLK(mode) || S_ISCHR(mode)) {
-				if ((ea = hpfs_get_ea(i->i_sb, fnode, "DEV", &ea_size))) {
+				if ((ea = hpfs_get_ea(inode_sb(i), fnode, "DEV", &ea_size))) {
 					if (ea_size == 4)
 						rdev = le32_to_cpu(*(__le32*)ea);
 					kfree(ea);
@@ -125,7 +125,8 @@ void hpfs_read_inode(struct inode *i)
 			if (hpfs_map_fnode(sb, hpfs_inode->i_parent_dir, &bh0)) brelse(bh0);
 		}
 		n_dnodes = 0; n_subdirs = 0;
-		hpfs_count_dnodes(i->i_sb, hpfs_inode->i_dno, &n_dnodes, &n_subdirs, NULL);
+		hpfs_count_dnodes(inode_sb(i), hpfs_inode->i_dno, &n_dnodes,
+				  &n_subdirs, NULL);
 		i->i_blocks = 4 * n_dnodes;
 		i->i_size = 2048 * n_dnodes;
 		set_nlink(i, 2 + n_subdirs);
@@ -149,24 +150,24 @@ static void hpfs_write_inode_ea(struct inode *i, struct fnode *fnode)
 	/*if (le32_to_cpu(fnode->acl_size_l) || le16_to_cpu(fnode->acl_size_s)) {
 		   Some unknown structures like ACL may be in fnode,
 		   we'd better not overwrite them
-		hpfs_error(i->i_sb, "fnode %08x has some unknown HPFS386 structures", i->i_ino);
-	} else*/ if (hpfs_sb(i->i_sb)->sb_eas >= 2) {
+		hpfs_error(inode_sb(i), "fnode %08x has some unknown HPFS386 structures", i->i_ino);
+	} else*/ if (hpfs_sb(inode_sb(i))->sb_eas >= 2) {
 		__le32 ea;
-		if (!uid_eq(i->i_uid, hpfs_sb(i->i_sb)->sb_uid) || hpfs_inode->i_ea_uid) {
+		if (!uid_eq(i->i_uid, hpfs_sb(inode_sb(i))->sb_uid) || hpfs_inode->i_ea_uid) {
 			ea = cpu_to_le32(i_uid_read(i));
 			hpfs_set_ea(i, fnode, "UID", (char*)&ea, 2);
 			hpfs_inode->i_ea_uid = 1;
 		}
-		if (!gid_eq(i->i_gid, hpfs_sb(i->i_sb)->sb_gid) || hpfs_inode->i_ea_gid) {
+		if (!gid_eq(i->i_gid, hpfs_sb(inode_sb(i))->sb_gid) || hpfs_inode->i_ea_gid) {
 			ea = cpu_to_le32(i_gid_read(i));
 			hpfs_set_ea(i, fnode, "GID", (char *)&ea, 2);
 			hpfs_inode->i_ea_gid = 1;
 		}
 		if (!S_ISLNK(i->i_mode))
-			if ((i->i_mode != ((hpfs_sb(i->i_sb)->sb_mode & ~(S_ISDIR(i->i_mode) ? 0 : 0111))
-			  | (S_ISDIR(i->i_mode) ? S_IFDIR : S_IFREG))
-			  && i->i_mode != ((hpfs_sb(i->i_sb)->sb_mode & ~(S_ISDIR(i->i_mode) ? 0222 : 0333))
-			  | (S_ISDIR(i->i_mode) ? S_IFDIR : S_IFREG))) || hpfs_inode->i_ea_mode) {
+			if ((i->i_mode != ((hpfs_sb(inode_sb(i))->sb_mode & ~(S_ISDIR(i->i_mode) ? 0 : 0111))
+					   | (S_ISDIR(i->i_mode) ? S_IFDIR : S_IFREG))
+			     && i->i_mode != ((hpfs_sb(inode_sb(i))->sb_mode & ~(S_ISDIR(i->i_mode) ? 0222 : 0333))
+					      | (S_ISDIR(i->i_mode) ? S_IFDIR : S_IFREG))) || hpfs_inode->i_ea_mode) {
 				ea = cpu_to_le32(i->i_mode);
 				/* sick, but legal */
 				hpfs_set_ea(i, fnode, "MODE", (char *)&ea, 2);
@@ -183,7 +184,7 @@ void hpfs_write_inode(struct inode *i)
 {
 	struct hpfs_inode_info *hpfs_inode = hpfs_i(i);
 	struct inode *parent;
-	if (i->i_ino == hpfs_sb(i->i_sb)->sb_root) return;
+	if (i->i_ino == hpfs_sb(inode_sb(i))->sb_root) return;
 	if (hpfs_inode->i_rddir_off && !atomic_read(&i->i_count)) {
 		if (*hpfs_inode->i_rddir_off)
 			pr_err("write_inode: some position still there\n");
@@ -193,7 +194,7 @@ void hpfs_write_inode(struct inode *i)
 	if (!i->i_nlink) {
 		return;
 	}
-	parent = iget_locked(i->i_sb, hpfs_inode->i_parent_dir);
+	parent = iget_locked(inode_sb(i), hpfs_inode->i_parent_dir);
 	if (parent) {
 		hpfs_inode->i_dirty = 0;
 		if (parent->i_state & I_NEW) {
@@ -213,10 +214,10 @@ void hpfs_write_inode_nolock(struct inode *i)
 	struct fnode *fnode;
 	struct quad_buffer_head qbh;
 	struct hpfs_dirent *de;
-	if (i->i_ino == hpfs_sb(i->i_sb)->sb_root) return;
-	if (!(fnode = hpfs_map_fnode(i->i_sb, i->i_ino, &bh))) return;
-	if (i->i_ino != hpfs_sb(i->i_sb)->sb_root && i->i_nlink) {
-		if (!(de = map_fnode_dirent(i->i_sb, i->i_ino, fnode, &qbh))) {
+	if (i->i_ino == hpfs_sb(inode_sb(i))->sb_root) return;
+	if (!(fnode = hpfs_map_fnode(inode_sb(i), i->i_ino, &bh))) return;
+	if (i->i_ino != hpfs_sb(inode_sb(i))->sb_root && i->i_nlink) {
+		if (!(de = map_fnode_dirent(inode_sb(i), i->i_ino, fnode, &qbh))) {
 			brelse(bh);
 			return;
 		}
@@ -230,9 +231,9 @@ void hpfs_write_inode_nolock(struct inode *i)
 	}
 	hpfs_write_inode_ea(i, fnode);
 	if (de) {
-		de->write_date = cpu_to_le32(gmt_to_local(i->i_sb, i->i_mtime.tv_sec));
-		de->read_date = cpu_to_le32(gmt_to_local(i->i_sb, i->i_atime.tv_sec));
-		de->creation_date = cpu_to_le32(gmt_to_local(i->i_sb, i->i_ctime.tv_sec));
+		de->write_date = cpu_to_le32(gmt_to_local(inode_sb(i), i->i_mtime.tv_sec));
+		de->read_date = cpu_to_le32(gmt_to_local(inode_sb(i), i->i_atime.tv_sec));
+		de->creation_date = cpu_to_le32(gmt_to_local(inode_sb(i), i->i_ctime.tv_sec));
 		de->read_only = !(i->i_mode & 0222);
 		de->ea_size = cpu_to_le32(hpfs_inode->i_ea_size);
 		hpfs_mark_4buffers_dirty(&qbh);
@@ -240,18 +241,18 @@ void hpfs_write_inode_nolock(struct inode *i)
 	}
 	if (S_ISDIR(i->i_mode)) {
 		if ((de = map_dirent(i, hpfs_inode->i_dno, "\001\001", 2, NULL, &qbh))) {
-			de->write_date = cpu_to_le32(gmt_to_local(i->i_sb, i->i_mtime.tv_sec));
-			de->read_date = cpu_to_le32(gmt_to_local(i->i_sb, i->i_atime.tv_sec));
-			de->creation_date = cpu_to_le32(gmt_to_local(i->i_sb, i->i_ctime.tv_sec));
+			de->write_date = cpu_to_le32(gmt_to_local(inode_sb(i), i->i_mtime.tv_sec));
+			de->read_date = cpu_to_le32(gmt_to_local(inode_sb(i), i->i_atime.tv_sec));
+			de->creation_date = cpu_to_le32(gmt_to_local(inode_sb(i), i->i_ctime.tv_sec));
 			de->read_only = !(i->i_mode & 0222);
 			de->ea_size = cpu_to_le32(/*hpfs_inode->i_ea_size*/0);
 			de->file_size = cpu_to_le32(0);
 			hpfs_mark_4buffers_dirty(&qbh);
 			hpfs_brelse4(&qbh);
 		} else
-			hpfs_error(i->i_sb,
-				"directory %08lx doesn't have '.' entry",
-				(unsigned long)i->i_ino);
+			hpfs_error(inode_sb(i),
+				   "directory %08lx doesn't have '.' entry",
+				   (unsigned long)i->i_ino);
 	}
 	mark_buffer_dirty(bh);
 	brelse(bh);
@@ -262,8 +263,8 @@ int hpfs_setattr(struct dentry *dentry, struct iattr *attr)
 	struct inode *inode = d_inode(dentry);
 	int error = -EINVAL;
 
-	hpfs_lock(inode->i_sb);
-	if (inode->i_ino == hpfs_sb(inode->i_sb)->sb_root)
+	hpfs_lock(inode_sb(inode));
+	if (inode->i_ino == hpfs_sb(inode_sb(inode))->sb_root)
 		goto out_unlock;
 	if ((attr->ia_valid & ATTR_UID) &&
 	    from_kuid(&init_user_ns, attr->ia_uid) >= 0x10000)
@@ -293,7 +294,7 @@ int hpfs_setattr(struct dentry *dentry, struct iattr *attr)
 	hpfs_write_inode(inode);
 
  out_unlock:
-	hpfs_unlock(inode->i_sb);
+	hpfs_unlock(inode_sb(inode));
 	return error;
 }
 
@@ -310,8 +311,8 @@ void hpfs_evict_inode(struct inode *inode)
 	truncate_inode_pages_final(&inode->i_data);
 	clear_inode(inode);
 	if (!inode->i_nlink) {
-		hpfs_lock(inode->i_sb);
-		hpfs_remove_fnode(inode->i_sb, inode->i_ino);
-		hpfs_unlock(inode->i_sb);
+		hpfs_lock(inode_sb(inode));
+		hpfs_remove_fnode(inode_sb(inode), inode->i_ino);
+		hpfs_unlock(inode_sb(inode));
 	}
 }
diff --git a/fs/hpfs/namei.c b/fs/hpfs/namei.c
index a3615e4c730d..605fe8f2ad9c 100644
--- a/fs/hpfs/namei.c
+++ b/fs/hpfs/namei.c
@@ -36,12 +36,12 @@ static int hpfs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode)
 	struct hpfs_dirent dee;
 	int err;
 	if ((err = hpfs_chk_name(name, &len))) return err==-ENOENT ? -EINVAL : err;
-	hpfs_lock(dir->i_sb);
+	hpfs_lock(inode_sb(dir));
 	err = -ENOSPC;
-	fnode = hpfs_alloc_fnode(dir->i_sb, hpfs_i(dir)->i_dno, &fno, &bh);
+	fnode = hpfs_alloc_fnode(inode_sb(dir), hpfs_i(dir)->i_dno, &fno, &bh);
 	if (!fnode)
 		goto bail;
-	dnode = hpfs_alloc_dnode(dir->i_sb, fno, &dno, &qbh0);
+	dnode = hpfs_alloc_dnode(inode_sb(dir), fno, &dno, &qbh0);
 	if (!dnode)
 		goto bail1;
 	memset(&dee, 0, sizeof dee);
@@ -50,15 +50,16 @@ static int hpfs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode)
 	/*dee.archive = 0;*/
 	dee.hidden = name[0] == '.';
 	dee.fnode = cpu_to_le32(fno);
-	dee.creation_date = dee.write_date = dee.read_date = cpu_to_le32(gmt_to_local(dir->i_sb, get_seconds()));
-	result = new_inode(dir->i_sb);
+	dee.creation_date = dee.write_date = dee.read_date = cpu_to_le32(gmt_to_local(inode_sb(dir), get_seconds()));
+	result = new_inode(inode_sb(dir));
 	if (!result)
 		goto bail2;
 	hpfs_init_inode(result);
 	result->i_ino = fno;
 	hpfs_i(result)->i_parent_dir = dir->i_ino;
 	hpfs_i(result)->i_dno = dno;
-	result->i_ctime.tv_sec = result->i_mtime.tv_sec = result->i_atime.tv_sec = local_to_gmt(dir->i_sb, le32_to_cpu(dee.creation_date));
+	result->i_ctime.tv_sec = result->i_mtime.tv_sec = result->i_atime.tv_sec = local_to_gmt(inode_sb(dir),
+												le32_to_cpu(dee.creation_date));
 	result->i_ctime.tv_nsec = 0; 
 	result->i_mtime.tv_nsec = 0; 
 	result->i_atime.tv_nsec = 0; 
@@ -90,8 +91,8 @@ static int hpfs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode)
 	fnode->u.external[0].file_secno = cpu_to_le32(-1);
 	dnode->root_dnode = 1;
 	dnode->up = cpu_to_le32(fno);
-	de = hpfs_add_de(dir->i_sb, dnode, "\001\001", 2, 0);
-	de->creation_date = de->write_date = de->read_date = cpu_to_le32(gmt_to_local(dir->i_sb, get_seconds()));
+	de = hpfs_add_de(inode_sb(dir), dnode, "\001\001", 2, 0);
+	de->creation_date = de->write_date = de->read_date = cpu_to_le32(gmt_to_local(inode_sb(dir), get_seconds()));
 	if (!(mode & 0222)) de->read_only = 1;
 	de->first = de->directory = 1;
 	/*de->hidden = de->system = 0;*/
@@ -113,18 +114,18 @@ static int hpfs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode)
 	}
 	hpfs_update_directory_times(dir);
 	d_instantiate(dentry, result);
-	hpfs_unlock(dir->i_sb);
+	hpfs_unlock(inode_sb(dir));
 	return 0;
 bail3:
 	iput(result);
 bail2:
 	hpfs_brelse4(&qbh0);
-	hpfs_free_dnode(dir->i_sb, dno);
+	hpfs_free_dnode(inode_sb(dir), dno);
 bail1:
 	brelse(bh);
-	hpfs_free_sectors(dir->i_sb, fno, 1);
+	hpfs_free_sectors(inode_sb(dir), fno, 1);
 bail:
-	hpfs_unlock(dir->i_sb);
+	hpfs_unlock(inode_sb(dir));
 	return err;
 }
 
@@ -141,9 +142,9 @@ static int hpfs_create(struct inode *dir, struct dentry *dentry, umode_t mode, b
 	int err;
 	if ((err = hpfs_chk_name(name, &len)))
 		return err==-ENOENT ? -EINVAL : err;
-	hpfs_lock(dir->i_sb);
+	hpfs_lock(inode_sb(dir));
 	err = -ENOSPC;
-	fnode = hpfs_alloc_fnode(dir->i_sb, hpfs_i(dir)->i_dno, &fno, &bh);
+	fnode = hpfs_alloc_fnode(inode_sb(dir), hpfs_i(dir)->i_dno, &fno, &bh);
 	if (!fnode)
 		goto bail;
 	memset(&dee, 0, sizeof dee);
@@ -151,9 +152,9 @@ static int hpfs_create(struct inode *dir, struct dentry *dentry, umode_t mode, b
 	dee.archive = 1;
 	dee.hidden = name[0] == '.';
 	dee.fnode = cpu_to_le32(fno);
-	dee.creation_date = dee.write_date = dee.read_date = cpu_to_le32(gmt_to_local(dir->i_sb, get_seconds()));
+	dee.creation_date = dee.write_date = dee.read_date = cpu_to_le32(gmt_to_local(inode_sb(dir), get_seconds()));
 
-	result = new_inode(dir->i_sb);
+	result = new_inode(inode_sb(dir));
 	if (!result)
 		goto bail1;
 	
@@ -165,7 +166,8 @@ static int hpfs_create(struct inode *dir, struct dentry *dentry, umode_t mode, b
 	result->i_fop = &hpfs_file_ops;
 	set_nlink(result, 1);
 	hpfs_i(result)->i_parent_dir = dir->i_ino;
-	result->i_ctime.tv_sec = result->i_mtime.tv_sec = result->i_atime.tv_sec = local_to_gmt(dir->i_sb, le32_to_cpu(dee.creation_date));
+	result->i_ctime.tv_sec = result->i_mtime.tv_sec = result->i_atime.tv_sec = local_to_gmt(inode_sb(dir),
+												le32_to_cpu(dee.creation_date));
 	result->i_ctime.tv_nsec = 0;
 	result->i_mtime.tv_nsec = 0;
 	result->i_atime.tv_nsec = 0;
@@ -202,16 +204,16 @@ static int hpfs_create(struct inode *dir, struct dentry *dentry, umode_t mode, b
 	}
 	hpfs_update_directory_times(dir);
 	d_instantiate(dentry, result);
-	hpfs_unlock(dir->i_sb);
+	hpfs_unlock(inode_sb(dir));
 	return 0;
 
 bail2:
 	iput(result);
 bail1:
 	brelse(bh);
-	hpfs_free_sectors(dir->i_sb, fno, 1);
+	hpfs_free_sectors(inode_sb(dir), fno, 1);
 bail:
-	hpfs_unlock(dir->i_sb);
+	hpfs_unlock(inode_sb(dir));
 	return err;
 }
 
@@ -227,10 +229,10 @@ static int hpfs_mknod(struct inode *dir, struct dentry *dentry, umode_t mode, de
 	struct inode *result = NULL;
 	int err;
 	if ((err = hpfs_chk_name(name, &len))) return err==-ENOENT ? -EINVAL : err;
-	if (hpfs_sb(dir->i_sb)->sb_eas < 2) return -EPERM;
-	hpfs_lock(dir->i_sb);
+	if (hpfs_sb(inode_sb(dir))->sb_eas < 2) return -EPERM;
+	hpfs_lock(inode_sb(dir));
 	err = -ENOSPC;
-	fnode = hpfs_alloc_fnode(dir->i_sb, hpfs_i(dir)->i_dno, &fno, &bh);
+	fnode = hpfs_alloc_fnode(inode_sb(dir), hpfs_i(dir)->i_dno, &fno, &bh);
 	if (!fnode)
 		goto bail;
 	memset(&dee, 0, sizeof dee);
@@ -238,16 +240,17 @@ static int hpfs_mknod(struct inode *dir, struct dentry *dentry, umode_t mode, de
 	dee.archive = 1;
 	dee.hidden = name[0] == '.';
 	dee.fnode = cpu_to_le32(fno);
-	dee.creation_date = dee.write_date = dee.read_date = cpu_to_le32(gmt_to_local(dir->i_sb, get_seconds()));
+	dee.creation_date = dee.write_date = dee.read_date = cpu_to_le32(gmt_to_local(inode_sb(dir), get_seconds()));
 
-	result = new_inode(dir->i_sb);
+	result = new_inode(inode_sb(dir));
 	if (!result)
 		goto bail1;
 
 	hpfs_init_inode(result);
 	result->i_ino = fno;
 	hpfs_i(result)->i_parent_dir = dir->i_ino;
-	result->i_ctime.tv_sec = result->i_mtime.tv_sec = result->i_atime.tv_sec = local_to_gmt(dir->i_sb, le32_to_cpu(dee.creation_date));
+	result->i_ctime.tv_sec = result->i_mtime.tv_sec = result->i_atime.tv_sec = local_to_gmt(inode_sb(dir),
+												le32_to_cpu(dee.creation_date));
 	result->i_ctime.tv_nsec = 0;
 	result->i_mtime.tv_nsec = 0;
 	result->i_atime.tv_nsec = 0;
@@ -277,15 +280,15 @@ static int hpfs_mknod(struct inode *dir, struct dentry *dentry, umode_t mode, de
 	hpfs_update_directory_times(dir);
 	d_instantiate(dentry, result);
 	brelse(bh);
-	hpfs_unlock(dir->i_sb);
+	hpfs_unlock(inode_sb(dir));
 	return 0;
 bail2:
 	iput(result);
 bail1:
 	brelse(bh);
-	hpfs_free_sectors(dir->i_sb, fno, 1);
+	hpfs_free_sectors(inode_sb(dir), fno, 1);
 bail:
-	hpfs_unlock(dir->i_sb);
+	hpfs_unlock(inode_sb(dir));
 	return err;
 }
 
@@ -301,28 +304,29 @@ static int hpfs_symlink(struct inode *dir, struct dentry *dentry, const char *sy
 	struct inode *result;
 	int err;
 	if ((err = hpfs_chk_name(name, &len))) return err==-ENOENT ? -EINVAL : err;
-	hpfs_lock(dir->i_sb);
-	if (hpfs_sb(dir->i_sb)->sb_eas < 2) {
-		hpfs_unlock(dir->i_sb);
+	hpfs_lock(inode_sb(dir));
+	if (hpfs_sb(inode_sb(dir))->sb_eas < 2) {
+		hpfs_unlock(inode_sb(dir));
 		return -EPERM;
 	}
 	err = -ENOSPC;
-	fnode = hpfs_alloc_fnode(dir->i_sb, hpfs_i(dir)->i_dno, &fno, &bh);
+	fnode = hpfs_alloc_fnode(inode_sb(dir), hpfs_i(dir)->i_dno, &fno, &bh);
 	if (!fnode)
 		goto bail;
 	memset(&dee, 0, sizeof dee);
 	dee.archive = 1;
 	dee.hidden = name[0] == '.';
 	dee.fnode = cpu_to_le32(fno);
-	dee.creation_date = dee.write_date = dee.read_date = cpu_to_le32(gmt_to_local(dir->i_sb, get_seconds()));
+	dee.creation_date = dee.write_date = dee.read_date = cpu_to_le32(gmt_to_local(inode_sb(dir), get_seconds()));
 
-	result = new_inode(dir->i_sb);
+	result = new_inode(inode_sb(dir));
 	if (!result)
 		goto bail1;
 	result->i_ino = fno;
 	hpfs_init_inode(result);
 	hpfs_i(result)->i_parent_dir = dir->i_ino;
-	result->i_ctime.tv_sec = result->i_mtime.tv_sec = result->i_atime.tv_sec = local_to_gmt(dir->i_sb, le32_to_cpu(dee.creation_date));
+	result->i_ctime.tv_sec = result->i_mtime.tv_sec = result->i_atime.tv_sec = local_to_gmt(inode_sb(dir),
+												le32_to_cpu(dee.creation_date));
 	result->i_ctime.tv_nsec = 0;
 	result->i_mtime.tv_nsec = 0;
 	result->i_atime.tv_nsec = 0;
@@ -356,15 +360,15 @@ static int hpfs_symlink(struct inode *dir, struct dentry *dentry, const char *sy
 	hpfs_write_inode_nolock(result);
 	hpfs_update_directory_times(dir);
 	d_instantiate(dentry, result);
-	hpfs_unlock(dir->i_sb);
+	hpfs_unlock(inode_sb(dir));
 	return 0;
 bail2:
 	iput(result);
 bail1:
 	brelse(bh);
-	hpfs_free_sectors(dir->i_sb, fno, 1);
+	hpfs_free_sectors(inode_sb(dir), fno, 1);
 bail:
-	hpfs_unlock(dir->i_sb);
+	hpfs_unlock(inode_sb(dir));
 	return err;
 }
 
@@ -379,7 +383,7 @@ static int hpfs_unlink(struct inode *dir, struct dentry *dentry)
 	int r;
 	int err;
 
-	hpfs_lock(dir->i_sb);
+	hpfs_lock(inode_sb(dir));
 	hpfs_adjust_length(name, &len);
 
 	err = -ENOENT;
@@ -398,7 +402,8 @@ static int hpfs_unlink(struct inode *dir, struct dentry *dentry)
 	r = hpfs_remove_dirent(dir, dno, de, &qbh, 1);
 	switch (r) {
 	case 1:
-		hpfs_error(dir->i_sb, "there was error when removing dirent");
+		hpfs_error(inode_sb(dir),
+			   "there was error when removing dirent");
 		err = -EFSERROR;
 		break;
 	case 2:		/* no space for deleting */
@@ -415,7 +420,7 @@ static int hpfs_unlink(struct inode *dir, struct dentry *dentry)
 out:
 	if (!err)
 		hpfs_update_directory_times(dir);
-	hpfs_unlock(dir->i_sb);
+	hpfs_unlock(inode_sb(dir));
 	return err;
 }
 
@@ -432,7 +437,7 @@ static int hpfs_rmdir(struct inode *dir, struct dentry *dentry)
 	int r;
 
 	hpfs_adjust_length(name, &len);
-	hpfs_lock(dir->i_sb);
+	hpfs_lock(inode_sb(dir));
 	err = -ENOENT;
 	de = map_dirent(dir, hpfs_i(dir)->i_dno, name, len, &dno, &qbh);
 	if (!de)
@@ -446,7 +451,8 @@ static int hpfs_rmdir(struct inode *dir, struct dentry *dentry)
 	if (!de->directory)
 		goto out1;
 
-	hpfs_count_dnodes(dir->i_sb, hpfs_i(inode)->i_dno, NULL, NULL, &n_items);
+	hpfs_count_dnodes(inode_sb(dir), hpfs_i(inode)->i_dno, NULL, NULL,
+			  &n_items);
 	err = -ENOTEMPTY;
 	if (n_items)
 		goto out1;
@@ -454,7 +460,8 @@ static int hpfs_rmdir(struct inode *dir, struct dentry *dentry)
 	r = hpfs_remove_dirent(dir, dno, de, &qbh, 1);
 	switch (r) {
 	case 1:
-		hpfs_error(dir->i_sb, "there was error when removing dirent");
+		hpfs_error(inode_sb(dir),
+			   "there was error when removing dirent");
 		err = -EFSERROR;
 		break;
 	case 2:
@@ -471,7 +478,7 @@ static int hpfs_rmdir(struct inode *dir, struct dentry *dentry)
 out:
 	if (!err)
 		hpfs_update_directory_times(dir);
-	hpfs_unlock(dir->i_sb);
+	hpfs_unlock(inode_sb(dir));
 	return err;
 }
 
@@ -484,20 +491,20 @@ static int hpfs_symlink_readpage(struct file *file, struct page *page)
 	int err;
 
 	err = -EIO;
-	hpfs_lock(i->i_sb);
-	if (!(fnode = hpfs_map_fnode(i->i_sb, i->i_ino, &bh)))
+	hpfs_lock(inode_sb(i));
+	if (!(fnode = hpfs_map_fnode(inode_sb(i), i->i_ino, &bh)))
 		goto fail;
-	err = hpfs_read_ea(i->i_sb, fnode, "SYMLINK", link, PAGE_SIZE);
+	err = hpfs_read_ea(inode_sb(i), fnode, "SYMLINK", link, PAGE_SIZE);
 	brelse(bh);
 	if (err)
 		goto fail;
-	hpfs_unlock(i->i_sb);
+	hpfs_unlock(inode_sb(i));
 	SetPageUptodate(page);
 	unlock_page(page);
 	return 0;
 
 fail:
-	hpfs_unlock(i->i_sb);
+	hpfs_unlock(inode_sb(i));
 	SetPageError(page);
 	unlock_page(page);
 	return err;
@@ -533,7 +540,7 @@ static int hpfs_rename(struct inode *old_dir, struct dentry *old_dentry,
 	err = 0;
 	hpfs_adjust_length(old_name, &old_len);
 
-	hpfs_lock(i->i_sb);
+	hpfs_lock(inode_sb(i));
 	/* order doesn't matter, due to VFS exclusion */
 	
 	/* Erm? Moving over the empty non-busy directory is perfectly legal */
@@ -543,7 +550,8 @@ static int hpfs_rename(struct inode *old_dir, struct dentry *old_dentry,
 	}
 
 	if (!(dep = map_dirent(old_dir, hpfs_i(old_dir)->i_dno, old_name, old_len, &dno, &qbh))) {
-		hpfs_error(i->i_sb, "lookup succeeded but map dirent failed");
+		hpfs_error(inode_sb(i),
+			   "lookup succeeded but map dirent failed");
 		err = -ENOENT;
 		goto end1;
 	}
@@ -561,7 +569,8 @@ static int hpfs_rename(struct inode *old_dir, struct dentry *old_dentry,
 				hpfs_brelse4(&qbh1);
 				goto end;
 			}
-			hpfs_error(new_dir->i_sb, "hpfs_rename: could not find dirent");
+			hpfs_error(inode_sb(new_dir),
+				   "hpfs_rename: could not find dirent");
 			err = -EFSERROR;
 			goto end1;
 		}
@@ -572,7 +581,8 @@ static int hpfs_rename(struct inode *old_dir, struct dentry *old_dentry,
 	if (new_dir == old_dir) hpfs_brelse4(&qbh);
 
 	if ((r = hpfs_add_dirent(new_dir, new_name, new_len, &de))) {
-		if (r == -1) hpfs_error(new_dir->i_sb, "hpfs_rename: dirent already exists!");
+		if (r == -1) hpfs_error(inode_sb(new_dir),
+					"hpfs_rename: dirent already exists!");
 		err = r == 1 ? -ENOSPC : -EFSERROR;
 		if (new_dir != old_dir) hpfs_brelse4(&qbh);
 		goto end1;
@@ -580,13 +590,15 @@ static int hpfs_rename(struct inode *old_dir, struct dentry *old_dentry,
 	
 	if (new_dir == old_dir)
 		if (!(dep = map_dirent(old_dir, hpfs_i(old_dir)->i_dno, old_name, old_len, &dno, &qbh))) {
-			hpfs_error(i->i_sb, "lookup succeeded but map dirent failed at #2");
+			hpfs_error(inode_sb(i),
+				   "lookup succeeded but map dirent failed at #2");
 			err = -ENOENT;
 			goto end1;
 		}
 
 	if ((r = hpfs_remove_dirent(old_dir, dno, dep, &qbh, 0))) {
-		hpfs_error(i->i_sb, "hpfs_rename: could not remove dirent");
+		hpfs_error(inode_sb(i),
+			   "hpfs_rename: could not remove dirent");
 		err = r == 2 ? -ENOSPC : -EFSERROR;
 		goto end1;
 	}
@@ -597,7 +609,7 @@ static int hpfs_rename(struct inode *old_dir, struct dentry *old_dentry,
 		inc_nlink(new_dir);
 		drop_nlink(old_dir);
 	}
-	if ((fnode = hpfs_map_fnode(i->i_sb, i->i_ino, &bh))) {
+	if ((fnode = hpfs_map_fnode(inode_sb(i), i->i_ino, &bh))) {
 		fnode->up = cpu_to_le32(new_dir->i_ino);
 		fnode->len = new_len;
 		memcpy(fnode->name, new_name, new_len>15?15:new_len);
@@ -610,7 +622,7 @@ static int hpfs_rename(struct inode *old_dir, struct dentry *old_dentry,
 		hpfs_update_directory_times(old_dir);
 		hpfs_update_directory_times(new_dir);
 	}
-	hpfs_unlock(i->i_sb);
+	hpfs_unlock(inode_sb(i));
 	return err;
 }
 
diff --git a/fs/hpfs/super.c b/fs/hpfs/super.c
index f2c3ebcd309c..74351b3ca304 100644
--- a/fs/hpfs/super.c
+++ b/fs/hpfs/super.c
@@ -212,7 +212,11 @@ long hpfs_ioctl(struct file *file, unsigned cmd, unsigned long arg)
 				return -EPERM;
 			if (copy_from_user(&range, (struct fstrim_range __user *)arg, sizeof(range)))
 				return -EFAULT;
-			r = hpfs_trim_fs(file_inode(file)->i_sb, range.start >> 9, (range.start + range.len) >> 9, (range.minlen + 511) >> 9, &n_trimmed);
+			r = hpfs_trim_fs(inode_sb(file_inode(file)),
+					 range.start >> 9,
+					 (range.start + range.len) >> 9,
+					 (range.minlen + 511) >> 9,
+					 &n_trimmed);
 			if (r)
 				return r;
 			range.len = (u64)n_trimmed << 9;
-- 
2.15.1

^ permalink raw reply related	[flat|nested] 88+ messages in thread

* [PATCH 41/76] fs/hugetlbfs: Use inode_sb() helper instead of inode->i_sb
  2018-05-08 18:03 [RFC][PATCH 0/76] vfs: 'views' for filesystems with more than one root Mark Fasheh
                   ` (39 preceding siblings ...)
  2018-05-08 18:04 ` [PATCH 40/76] fs/hpfs: " Mark Fasheh
@ 2018-05-08 18:04 ` Mark Fasheh
  2018-05-08 18:04 ` [PATCH 42/76] fs/isofs: " Mark Fasheh
                   ` (35 subsequent siblings)
  76 siblings, 0 replies; 88+ messages in thread
From: Mark Fasheh @ 2018-05-08 18:04 UTC (permalink / raw)
  To: linux-fsdevel; +Cc: linux-kernel, linux-btrfs, Mark Fasheh

Signed-off-by: Mark Fasheh <mfasheh@suse.de>
---
 fs/hugetlbfs/inode.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c
index b9a254dcc0e7..31d2a6051bea 100644
--- a/fs/hugetlbfs/inode.c
+++ b/fs/hugetlbfs/inode.c
@@ -791,7 +791,7 @@ static int hugetlbfs_mknod(struct inode *dir,
 	struct inode *inode;
 	int error = -ENOSPC;
 
-	inode = hugetlbfs_get_inode(dir->i_sb, dir, mode, dev);
+	inode = hugetlbfs_get_inode(inode_sb(dir), dir, mode, dev);
 	if (inode) {
 		dir->i_ctime = dir->i_mtime = current_time(dir);
 		d_instantiate(dentry, inode);
@@ -820,7 +820,7 @@ static int hugetlbfs_symlink(struct inode *dir,
 	struct inode *inode;
 	int error = -ENOSPC;
 
-	inode = hugetlbfs_get_inode(dir->i_sb, dir, S_IFLNK|S_IRWXUGO, 0);
+	inode = hugetlbfs_get_inode(inode_sb(dir), dir, S_IFLNK|S_IRWXUGO, 0);
 	if (inode) {
 		int l = strlen(symname)+1;
 		error = page_symlink(inode, symname, l);
@@ -1021,7 +1021,7 @@ static void hugetlbfs_i_callback(struct rcu_head *head)
 
 static void hugetlbfs_destroy_inode(struct inode *inode)
 {
-	hugetlbfs_inc_free_inodes(HUGETLBFS_SB(inode->i_sb));
+	hugetlbfs_inc_free_inodes(HUGETLBFS_SB(inode_sb(inode)));
 	mpol_free_shared_policy(&HUGETLBFS_I(inode)->policy);
 	call_rcu(&inode->i_rcu, hugetlbfs_i_callback);
 }
-- 
2.15.1

^ permalink raw reply related	[flat|nested] 88+ messages in thread

* [PATCH 42/76] fs/isofs: Use inode_sb() helper instead of inode->i_sb
  2018-05-08 18:03 [RFC][PATCH 0/76] vfs: 'views' for filesystems with more than one root Mark Fasheh
                   ` (40 preceding siblings ...)
  2018-05-08 18:04 ` [PATCH 41/76] fs/hugetlbfs: " Mark Fasheh
@ 2018-05-08 18:04 ` Mark Fasheh
  2018-05-08 18:04 ` [PATCH 43/76] fs/jbd2: " Mark Fasheh
                   ` (34 subsequent siblings)
  76 siblings, 0 replies; 88+ messages in thread
From: Mark Fasheh @ 2018-05-08 18:04 UTC (permalink / raw)
  To: linux-fsdevel; +Cc: linux-kernel, linux-btrfs, Mark Fasheh

Signed-off-by: Mark Fasheh <mfasheh@suse.de>
---
 fs/isofs/dir.c    |  2 +-
 fs/isofs/export.c |  6 +++---
 fs/isofs/inode.c  | 22 ++++++++++++----------
 fs/isofs/joliet.c |  4 ++--
 fs/isofs/namei.c  |  4 ++--
 fs/isofs/rock.c   | 29 +++++++++++++++--------------
 6 files changed, 35 insertions(+), 32 deletions(-)

diff --git a/fs/isofs/dir.c b/fs/isofs/dir.c
index 947ce22f5b3c..1d3f1d10bea3 100644
--- a/fs/isofs/dir.c
+++ b/fs/isofs/dir.c
@@ -93,7 +93,7 @@ static int do_isofs_readdir(struct inode *inode, struct file *file,
 	int first_de = 1;
 	char *p = NULL;		/* Quiet GCC */
 	struct iso_directory_record *de;
-	struct isofs_sb_info *sbi = ISOFS_SB(inode->i_sb);
+	struct isofs_sb_info *sbi = ISOFS_SB(inode_sb(inode));
 
 	offset = ctx->pos & (bufsize - 1);
 	block = ctx->pos >> bufbits;
diff --git a/fs/isofs/export.c b/fs/isofs/export.c
index 85a9093769a9..2bb64a3c1130 100644
--- a/fs/isofs/export.c
+++ b/fs/isofs/export.c
@@ -75,7 +75,7 @@ static struct dentry *isofs_export_get_parent(struct dentry *child)
 	parent_block = e_child_inode->i_iget5_block;
 
 	/* Get the block in question. */
-	bh = sb_bread(child_inode->i_sb, parent_block);
+	bh = sb_bread(inode_sb(child_inode), parent_block);
 	if (bh == NULL) {
 		rv = ERR_PTR(-EACCES);
 		goto out;
@@ -99,8 +99,8 @@ static struct dentry *isofs_export_get_parent(struct dentry *child)
 	/* Normalize */
 	isofs_normalize_block_and_offset(de, &parent_block, &parent_offset);
 
-	rv = d_obtain_alias(isofs_iget(child_inode->i_sb, parent_block,
-				     parent_offset));
+	rv = d_obtain_alias(isofs_iget(inode_sb(child_inode), parent_block,
+				       parent_offset));
  out:
 	if (bh)
 		brelse(bh);
diff --git a/fs/isofs/inode.c b/fs/isofs/inode.c
index bc258a4402f6..295830250d4b 100644
--- a/fs/isofs/inode.c
+++ b/fs/isofs/inode.c
@@ -1090,7 +1090,7 @@ int isofs_get_blocks(struct inode *inode, sector_t iblock,
 			struct inode *ninode;
 
 			offset += sect_size;
-			ninode = isofs_iget(inode->i_sb, nextblk, nextoff);
+			ninode = isofs_iget(inode_sb(inode), nextblk, nextoff);
 			if (IS_ERR(ninode)) {
 				error = PTR_ERR(ninode);
 				goto abort;
@@ -1113,9 +1113,11 @@ int isofs_get_blocks(struct inode *inode, sector_t iblock,
 		}
 
 		if (*bh) {
-			map_bh(*bh, inode->i_sb, firstext + b_off - offset);
+			map_bh(*bh, inode_sb(inode),
+			       firstext + b_off - offset);
 		} else {
-			*bh = sb_getblk(inode->i_sb, firstext+b_off-offset);
+			*bh = sb_getblk(inode_sb(inode),
+					firstext+b_off-offset);
 			if (!*bh)
 				goto abort;
 		}
@@ -1165,7 +1167,7 @@ struct buffer_head *isofs_bread(struct inode *inode, sector_t block)
 	sector_t blknr = isofs_bmap(inode, block);
 	if (!blknr)
 		return NULL;
-	return sb_bread(inode->i_sb, blknr);
+	return sb_bread(inode_sb(inode), blknr);
 }
 
 static int isofs_readpage(struct file *file, struct page *page)
@@ -1193,7 +1195,7 @@ static const struct address_space_operations isofs_aops = {
 static int isofs_read_level3_size(struct inode *inode)
 {
 	unsigned long bufsize = ISOFS_BUFFER_SIZE(inode);
-	int high_sierra = ISOFS_SB(inode->i_sb)->s_high_sierra;
+	int high_sierra = ISOFS_SB(inode_sb(inode))->s_high_sierra;
 	struct buffer_head *bh = NULL;
 	unsigned long block, offset, block_saved, offset_saved;
 	int i = 0;
@@ -1217,7 +1219,7 @@ static int isofs_read_level3_size(struct inode *inode)
 		unsigned int de_len;
 
 		if (!bh) {
-			bh = sb_bread(inode->i_sb, block);
+			bh = sb_bread(inode_sb(inode), block);
 			if (!bh)
 				goto out_noread;
 		}
@@ -1250,7 +1252,7 @@ static int isofs_read_level3_size(struct inode *inode)
 			brelse(bh);
 			bh = NULL;
 			if (offset) {
-				bh = sb_bread(inode->i_sb, block);
+				bh = sb_bread(inode_sb(inode), block);
 				if (!bh)
 					goto out_noread;
 				memcpy((void *)tmpde+slop, bh->b_data, offset);
@@ -1295,7 +1297,7 @@ static int isofs_read_level3_size(struct inode *inode)
 
 static int isofs_read_inode(struct inode *inode, int relocated)
 {
-	struct super_block *sb = inode->i_sb;
+	struct super_block *sb = inode_sb(inode);
 	struct isofs_sb_info *sbi = ISOFS_SB(sb);
 	unsigned long bufsize = ISOFS_BUFFER_SIZE(inode);
 	unsigned long block;
@@ -1309,7 +1311,7 @@ static int isofs_read_inode(struct inode *inode, int relocated)
 	int ret = -EIO;
 
 	block = ei->i_iget5_block;
-	bh = sb_bread(inode->i_sb, block);
+	bh = sb_bread(inode_sb(inode), block);
 	if (!bh)
 		goto out_badread;
 
@@ -1328,7 +1330,7 @@ static int isofs_read_inode(struct inode *inode, int relocated)
 		}
 		memcpy(tmpde, bh->b_data + offset, frag1);
 		brelse(bh);
-		bh = sb_bread(inode->i_sb, ++block);
+		bh = sb_bread(inode_sb(inode), ++block);
 		if (!bh)
 			goto out_badread;
 		memcpy((char *)tmpde+frag1, bh->b_data, de_len - frag1);
diff --git a/fs/isofs/joliet.c b/fs/isofs/joliet.c
index be8b6a9d0b92..47b0ac950a14 100644
--- a/fs/isofs/joliet.c
+++ b/fs/isofs/joliet.c
@@ -45,8 +45,8 @@ get_joliet_filename(struct iso_directory_record * de, unsigned char *outname, st
 	struct nls_table *nls;
 	unsigned char len = 0;
 
-	utf8 = ISOFS_SB(inode->i_sb)->s_utf8;
-	nls = ISOFS_SB(inode->i_sb)->s_nls_iocharset;
+	utf8 = ISOFS_SB(inode_sb(inode))->s_utf8;
+	nls = ISOFS_SB(inode_sb(inode))->s_nls_iocharset;
 
 	if (utf8) {
 		len = utf16s_to_utf8s((const wchar_t *) de->name,
diff --git a/fs/isofs/namei.c b/fs/isofs/namei.c
index cac468f04820..ae74cba9b3e8 100644
--- a/fs/isofs/namei.c
+++ b/fs/isofs/namei.c
@@ -41,7 +41,7 @@ isofs_find_entry(struct inode *dir, struct dentry *dentry,
 	unsigned char bufbits = ISOFS_BUFFER_BITS(dir);
 	unsigned long block, f_pos, offset, block_saved, offset_saved;
 	struct buffer_head *bh = NULL;
-	struct isofs_sb_info *sbi = ISOFS_SB(dir->i_sb);
+	struct isofs_sb_info *sbi = ISOFS_SB(inode_sb(dir));
 
 	if (!ISOFS_I(dir)->i_first_extent)
 		return 0;
@@ -167,7 +167,7 @@ struct dentry *isofs_lookup(struct inode *dir, struct dentry *dentry, unsigned i
 				1024 + page_address(page));
 	__free_page(page);
 
-	inode = found ? isofs_iget(dir->i_sb, block, offset) : NULL;
+	inode = found ? isofs_iget(inode_sb(dir), block, offset) : NULL;
 
 	return d_splice_alias(inode, dentry);
 }
diff --git a/fs/isofs/rock.c b/fs/isofs/rock.c
index 94ef92fe806c..3f398cd95143 100644
--- a/fs/isofs/rock.c
+++ b/fs/isofs/rock.c
@@ -46,7 +46,7 @@ static int check_sp(struct rock_ridge *rr, struct inode *inode)
 		return -1;
 	if (rr->u.SP.magic[1] != 0xef)
 		return -1;
-	ISOFS_SB(inode->i_sb)->s_rock_offset = rr->u.SP.skip;
+	ISOFS_SB(inode_sb(inode))->s_rock_offset = rr->u.SP.skip;
 	return 0;
 }
 
@@ -61,9 +61,9 @@ static void setup_rock_ridge(struct iso_directory_record *de,
 	if (rs->len < 0)
 		rs->len = 0;
 
-	if (ISOFS_SB(inode->i_sb)->s_rock_offset != -1) {
-		rs->len -= ISOFS_SB(inode->i_sb)->s_rock_offset;
-		rs->chr += ISOFS_SB(inode->i_sb)->s_rock_offset;
+	if (ISOFS_SB(inode_sb(inode))->s_rock_offset != -1) {
+		rs->len -= ISOFS_SB(inode_sb(inode))->s_rock_offset;
+		rs->chr += ISOFS_SB(inode_sb(inode))->s_rock_offset;
 		if (rs->len < 0)
 			rs->len = 0;
 	}
@@ -112,7 +112,7 @@ static int rock_continue(struct rock_state *rs)
 		ret = -EIO;
 		if (++rs->cont_loops >= RR_MAX_CE_ENTRIES)
 			goto out;
-		bh = sb_bread(rs->inode->i_sb, rs->cont_extent);
+		bh = sb_bread(inode_sb(rs->inode), rs->cont_extent);
 		if (bh) {
 			memcpy(rs->buffer, bh->b_data + rs->cont_offset,
 					rs->cont_size);
@@ -207,7 +207,7 @@ int get_rock_ridge_filename(struct iso_directory_record *de,
 	char *p;
 	int len;
 
-	if (!ISOFS_SB(inode->i_sb)->s_rock)
+	if (!ISOFS_SB(inode_sb(inode))->s_rock)
 		return 0;
 	*retname = 0;
 
@@ -318,7 +318,7 @@ parse_rock_ridge_inode_internal(struct iso_directory_record *de,
 	struct rock_state rs;
 	int ret = 0;
 
-	if (!ISOFS_SB(inode->i_sb)->s_rock)
+	if (!ISOFS_SB(inode_sb(inode))->s_rock)
 		return 0;
 
 	init_rock_state(&rs, inode);
@@ -373,7 +373,7 @@ parse_rock_ridge_inode_internal(struct iso_directory_record *de,
 			/* Invalid length of ER tag id? */
 			if (rr->u.ER.len_id + offsetof(struct rock_ridge, u.ER.data) > rr->len)
 				goto out;
-			ISOFS_SB(inode->i_sb)->s_rock = 1;
+			ISOFS_SB(inode_sb(inode))->s_rock = 1;
 			printk(KERN_DEBUG "ISO 9660 Extensions: ");
 			{
 				int p;
@@ -521,7 +521,8 @@ parse_rock_ridge_inode_internal(struct iso_directory_record *de,
 				goto eio;
 			}
 			ISOFS_I(inode)->i_first_extent = reloc_block;
-			reloc = isofs_iget_reloc(inode->i_sb, reloc_block, 0);
+			reloc = isofs_iget_reloc(inode_sb(inode), reloc_block,
+						 0);
 			if (IS_ERR(reloc)) {
 				ret = PTR_ERR(reloc);
 				goto out;
@@ -542,7 +543,7 @@ parse_rock_ridge_inode_internal(struct iso_directory_record *de,
 		case SIG('Z', 'F'): {
 			int algo;
 
-			if (ISOFS_SB(inode->i_sb)->s_nocompress)
+			if (ISOFS_SB(inode_sb(inode))->s_nocompress)
 				break;
 			algo = isonum_721(rr->u.ZF.algorithm);
 			if (algo == SIG('p', 'z')) {
@@ -678,8 +679,8 @@ int parse_rock_ridge_inode(struct iso_directory_record *de, struct inode *inode,
 	 * if rockridge flag was reset and we didn't look for attributes
 	 * behind eventual XA attributes, have a look there
 	 */
-	if ((ISOFS_SB(inode->i_sb)->s_rock_offset == -1)
-	    && (ISOFS_SB(inode->i_sb)->s_rock == 2)) {
+	if ((ISOFS_SB(inode_sb(inode))->s_rock_offset == -1)
+	    && (ISOFS_SB(inode_sb(inode))->s_rock == 2)) {
 		result = parse_rock_ridge_inode_internal(de, inode,
 							 flags | RR_REGARD_XA);
 	}
@@ -694,7 +695,7 @@ static int rock_ridge_symlink_readpage(struct file *file, struct page *page)
 {
 	struct inode *inode = page->mapping->host;
 	struct iso_inode_info *ei = ISOFS_I(inode);
-	struct isofs_sb_info *sbi = ISOFS_SB(inode->i_sb);
+	struct isofs_sb_info *sbi = ISOFS_SB(inode_sb(inode));
 	char *link = page_address(page);
 	unsigned long bufsize = ISOFS_BUFFER_SIZE(inode);
 	struct buffer_head *bh;
@@ -712,7 +713,7 @@ static int rock_ridge_symlink_readpage(struct file *file, struct page *page)
 
 	init_rock_state(&rs, inode);
 	block = ei->i_iget5_block;
-	bh = sb_bread(inode->i_sb, block);
+	bh = sb_bread(inode_sb(inode), block);
 	if (!bh)
 		goto out_noread;
 
-- 
2.15.1

^ permalink raw reply related	[flat|nested] 88+ messages in thread

* [PATCH 43/76] fs/jbd2: Use inode_sb() helper instead of inode->i_sb
  2018-05-08 18:03 [RFC][PATCH 0/76] vfs: 'views' for filesystems with more than one root Mark Fasheh
                   ` (41 preceding siblings ...)
  2018-05-08 18:04 ` [PATCH 42/76] fs/isofs: " Mark Fasheh
@ 2018-05-08 18:04 ` Mark Fasheh
  2018-05-08 18:04 ` [PATCH 44/76] fs/jffs2: " Mark Fasheh
                   ` (33 subsequent siblings)
  76 siblings, 0 replies; 88+ messages in thread
From: Mark Fasheh @ 2018-05-08 18:04 UTC (permalink / raw)
  To: linux-fsdevel; +Cc: linux-kernel, linux-btrfs, Mark Fasheh

Signed-off-by: Mark Fasheh <mfasheh@suse.de>
---
 fs/jbd2/journal.c | 18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)

diff --git a/fs/jbd2/journal.c b/fs/jbd2/journal.c
index 3fbf48ec2188..e1834a69cd41 100644
--- a/fs/jbd2/journal.c
+++ b/fs/jbd2/journal.c
@@ -1262,12 +1262,16 @@ journal_t *jbd2_journal_init_inode(struct inode *inode)
 	}
 
 	jbd_debug(1, "JBD2: inode %s/%ld, size %lld, bits %d, blksize %ld\n",
-		  inode->i_sb->s_id, inode->i_ino, (long long) inode->i_size,
-		  inode->i_sb->s_blocksize_bits, inode->i_sb->s_blocksize);
-
-	journal = journal_init_common(inode->i_sb->s_bdev, inode->i_sb->s_bdev,
-			blocknr, inode->i_size >> inode->i_sb->s_blocksize_bits,
-			inode->i_sb->s_blocksize);
+		  inode_sb(inode)->s_id, inode->i_ino,
+		  (long long) inode->i_size,
+		  inode_sb(inode)->s_blocksize_bits,
+		  inode_sb(inode)->s_blocksize);
+
+	journal = journal_init_common(inode_sb(inode)->s_bdev,
+				      inode_sb(inode)->s_bdev,
+				      blocknr,
+				      inode->i_size >> inode_sb(inode)->s_blocksize_bits,
+				      inode_sb(inode)->s_blocksize);
 	if (!journal)
 		return NULL;
 
@@ -2233,7 +2237,7 @@ void jbd2_journal_ack_err(journal_t *journal)
 
 int jbd2_journal_blocks_per_page(struct inode *inode)
 {
-	return 1 << (PAGE_SHIFT - inode->i_sb->s_blocksize_bits);
+	return 1 << (PAGE_SHIFT - inode_sb(inode)->s_blocksize_bits);
 }
 
 /*
-- 
2.15.1

^ permalink raw reply related	[flat|nested] 88+ messages in thread

* [PATCH 44/76] fs/jffs2: Use inode_sb() helper instead of inode->i_sb
  2018-05-08 18:03 [RFC][PATCH 0/76] vfs: 'views' for filesystems with more than one root Mark Fasheh
                   ` (42 preceding siblings ...)
  2018-05-08 18:04 ` [PATCH 43/76] fs/jbd2: " Mark Fasheh
@ 2018-05-08 18:04 ` Mark Fasheh
  2018-05-08 18:04 ` [PATCH 45/76] fs/jfs: " Mark Fasheh
                   ` (32 subsequent siblings)
  76 siblings, 0 replies; 88+ messages in thread
From: Mark Fasheh @ 2018-05-08 18:04 UTC (permalink / raw)
  To: linux-fsdevel; +Cc: linux-kernel, linux-btrfs, Mark Fasheh

Signed-off-by: Mark Fasheh <mfasheh@suse.de>
---
 fs/jffs2/dir.c   | 16 ++++++++--------
 fs/jffs2/file.c  |  8 ++++----
 fs/jffs2/fs.c    |  8 ++++----
 fs/jffs2/xattr.c |  6 +++---
 4 files changed, 19 insertions(+), 19 deletions(-)

diff --git a/fs/jffs2/dir.c b/fs/jffs2/dir.c
index 0a754f38462e..e539bb4e4687 100644
--- a/fs/jffs2/dir.c
+++ b/fs/jffs2/dir.c
@@ -106,7 +106,7 @@ static struct dentry *jffs2_lookup(struct inode *dir_i, struct dentry *target,
 		ino = fd->ino;
 	mutex_unlock(&dir_f->sem);
 	if (ino) {
-		inode = jffs2_iget(dir_i->i_sb, ino);
+		inode = jffs2_iget(inode_sb(dir_i), ino);
 		if (IS_ERR(inode))
 			pr_warn("iget() failed for ino #%u\n", ino);
 	}
@@ -170,7 +170,7 @@ static int jffs2_create(struct inode *dir_i, struct dentry *dentry,
 	if (!ri)
 		return -ENOMEM;
 
-	c = JFFS2_SB_INFO(dir_i->i_sb);
+	c = JFFS2_SB_INFO(inode_sb(dir_i));
 
 	jffs2_dbg(1, "%s()\n", __func__);
 
@@ -224,7 +224,7 @@ static int jffs2_create(struct inode *dir_i, struct dentry *dentry,
 
 static int jffs2_unlink(struct inode *dir_i, struct dentry *dentry)
 {
-	struct jffs2_sb_info *c = JFFS2_SB_INFO(dir_i->i_sb);
+	struct jffs2_sb_info *c = JFFS2_SB_INFO(inode_sb(dir_i));
 	struct jffs2_inode_info *dir_f = JFFS2_INODE_INFO(dir_i);
 	struct jffs2_inode_info *dead_f = JFFS2_INODE_INFO(d_inode(dentry));
 	int ret;
@@ -300,7 +300,7 @@ static int jffs2_symlink (struct inode *dir_i, struct dentry *dentry, const char
 	if (!ri)
 		return -ENOMEM;
 
-	c = JFFS2_SB_INFO(dir_i->i_sb);
+	c = JFFS2_SB_INFO(inode_sb(dir_i));
 
 	/* Try to reserve enough space for both node and dirent.
 	 * Just the node will do for now, though
@@ -459,7 +459,7 @@ static int jffs2_mkdir (struct inode *dir_i, struct dentry *dentry, umode_t mode
 	if (!ri)
 		return -ENOMEM;
 
-	c = JFFS2_SB_INFO(dir_i->i_sb);
+	c = JFFS2_SB_INFO(inode_sb(dir_i));
 
 	/* Try to reserve enough space for both node and dirent.
 	 * Just the node will do for now, though
@@ -586,7 +586,7 @@ static int jffs2_mkdir (struct inode *dir_i, struct dentry *dentry, umode_t mode
 
 static int jffs2_rmdir (struct inode *dir_i, struct dentry *dentry)
 {
-	struct jffs2_sb_info *c = JFFS2_SB_INFO(dir_i->i_sb);
+	struct jffs2_sb_info *c = JFFS2_SB_INFO(inode_sb(dir_i));
 	struct jffs2_inode_info *dir_f = JFFS2_INODE_INFO(dir_i);
 	struct jffs2_inode_info *f = JFFS2_INODE_INFO(d_inode(dentry));
 	struct jffs2_full_dirent *fd;
@@ -627,7 +627,7 @@ static int jffs2_mknod (struct inode *dir_i, struct dentry *dentry, umode_t mode
 	if (!ri)
 		return -ENOMEM;
 
-	c = JFFS2_SB_INFO(dir_i->i_sb);
+	c = JFFS2_SB_INFO(inode_sb(dir_i));
 
 	if (S_ISBLK(mode) || S_ISCHR(mode))
 		devlen = jffs2_encode_dev(&dev, rdev);
@@ -761,7 +761,7 @@ static int jffs2_rename (struct inode *old_dir_i, struct dentry *old_dentry,
 			 unsigned int flags)
 {
 	int ret;
-	struct jffs2_sb_info *c = JFFS2_SB_INFO(old_dir_i->i_sb);
+	struct jffs2_sb_info *c = JFFS2_SB_INFO(inode_sb(old_dir_i));
 	struct jffs2_inode_info *victim_f = NULL;
 	uint8_t type;
 	uint32_t now;
diff --git a/fs/jffs2/file.c b/fs/jffs2/file.c
index bd0428bebe9b..cfab0b294897 100644
--- a/fs/jffs2/file.c
+++ b/fs/jffs2/file.c
@@ -32,7 +32,7 @@ static int jffs2_readpage (struct file *filp, struct page *pg);
 int jffs2_fsync(struct file *filp, loff_t start, loff_t end, int datasync)
 {
 	struct inode *inode = filp->f_mapping->host;
-	struct jffs2_sb_info *c = JFFS2_SB_INFO(inode->i_sb);
+	struct jffs2_sb_info *c = JFFS2_SB_INFO(inode_sb(inode));
 	int ret;
 
 	ret = file_write_and_wait_range(filp, start, end);
@@ -79,7 +79,7 @@ const struct address_space_operations jffs2_file_address_operations =
 static int jffs2_do_readpage_nolock (struct inode *inode, struct page *pg)
 {
 	struct jffs2_inode_info *f = JFFS2_INODE_INFO(inode);
-	struct jffs2_sb_info *c = JFFS2_SB_INFO(inode->i_sb);
+	struct jffs2_sb_info *c = JFFS2_SB_INFO(inode_sb(inode));
 	unsigned char *pg_buf;
 	int ret;
 
@@ -148,7 +148,7 @@ static int jffs2_write_begin(struct file *filp, struct address_space *mapping,
 
 	if (pageofs > inode->i_size) {
 		/* Make new hole frag from old EOF to new page */
-		struct jffs2_sb_info *c = JFFS2_SB_INFO(inode->i_sb);
+		struct jffs2_sb_info *c = JFFS2_SB_INFO(inode_sb(inode));
 		struct jffs2_raw_inode ri;
 		struct jffs2_full_dnode *fn;
 		uint32_t alloc_len;
@@ -241,7 +241,7 @@ static int jffs2_write_end(struct file *filp, struct address_space *mapping,
 	 */
 	struct inode *inode = mapping->host;
 	struct jffs2_inode_info *f = JFFS2_INODE_INFO(inode);
-	struct jffs2_sb_info *c = JFFS2_SB_INFO(inode->i_sb);
+	struct jffs2_sb_info *c = JFFS2_SB_INFO(inode_sb(inode));
 	struct jffs2_raw_inode *ri;
 	unsigned start = pos & (PAGE_SIZE - 1);
 	unsigned end = start + copied;
diff --git a/fs/jffs2/fs.c b/fs/jffs2/fs.c
index eab04eca95a3..2e03accff2f5 100644
--- a/fs/jffs2/fs.c
+++ b/fs/jffs2/fs.c
@@ -32,7 +32,7 @@ int jffs2_do_setattr (struct inode *inode, struct iattr *iattr)
 {
 	struct jffs2_full_dnode *old_metadata, *new_metadata;
 	struct jffs2_inode_info *f = JFFS2_INODE_INFO(inode);
-	struct jffs2_sb_info *c = JFFS2_SB_INFO(inode->i_sb);
+	struct jffs2_sb_info *c = JFFS2_SB_INFO(inode_sb(inode));
 	struct jffs2_raw_inode *ri;
 	union jffs2_device_node dev;
 	unsigned char *mdata = NULL;
@@ -238,7 +238,7 @@ void jffs2_evict_inode (struct inode *inode)
 	/* We can forget about this inode for now - drop all
 	 *  the nodelists associated with it, etc.
 	 */
-	struct jffs2_sb_info *c = JFFS2_SB_INFO(inode->i_sb);
+	struct jffs2_sb_info *c = JFFS2_SB_INFO(inode_sb(inode));
 	struct jffs2_inode_info *f = JFFS2_INODE_INFO(inode);
 
 	jffs2_dbg(1, "%s(): ino #%lu mode %o\n",
@@ -267,7 +267,7 @@ struct inode *jffs2_iget(struct super_block *sb, unsigned long ino)
 		return inode;
 
 	f = JFFS2_INODE_INFO(inode);
-	c = JFFS2_SB_INFO(inode->i_sb);
+	c = JFFS2_SB_INFO(inode_sb(inode));
 
 	jffs2_init_inode_info(f);
 	mutex_lock(&f->sem);
@@ -420,7 +420,7 @@ int jffs2_do_remount_fs(struct super_block *sb, int *flags, char *data)
 struct inode *jffs2_new_inode (struct inode *dir_i, umode_t mode, struct jffs2_raw_inode *ri)
 {
 	struct inode *inode;
-	struct super_block *sb = dir_i->i_sb;
+	struct super_block *sb = inode_sb(dir_i);
 	struct jffs2_sb_info *c;
 	struct jffs2_inode_info *f;
 	int ret;
diff --git a/fs/jffs2/xattr.c b/fs/jffs2/xattr.c
index da3e18503c65..880c32676ffc 100644
--- a/fs/jffs2/xattr.c
+++ b/fs/jffs2/xattr.c
@@ -962,7 +962,7 @@ ssize_t jffs2_listxattr(struct dentry *dentry, char *buffer, size_t size)
 {
 	struct inode *inode = d_inode(dentry);
 	struct jffs2_inode_info *f = JFFS2_INODE_INFO(inode);
-	struct jffs2_sb_info *c = JFFS2_SB_INFO(inode->i_sb);
+	struct jffs2_sb_info *c = JFFS2_SB_INFO(inode_sb(inode));
 	struct jffs2_inode_cache *ic = f->inocache;
 	struct jffs2_xattr_ref *ref, **pref;
 	struct jffs2_xattr_datum *xd;
@@ -1032,7 +1032,7 @@ int do_jffs2_getxattr(struct inode *inode, int xprefix, const char *xname,
 		      char *buffer, size_t size)
 {
 	struct jffs2_inode_info *f = JFFS2_INODE_INFO(inode);
-	struct jffs2_sb_info *c = JFFS2_SB_INFO(inode->i_sb);
+	struct jffs2_sb_info *c = JFFS2_SB_INFO(inode_sb(inode));
 	struct jffs2_inode_cache *ic = f->inocache;
 	struct jffs2_xattr_datum *xd;
 	struct jffs2_xattr_ref *ref, **pref;
@@ -1094,7 +1094,7 @@ int do_jffs2_setxattr(struct inode *inode, int xprefix, const char *xname,
 		      const char *buffer, size_t size, int flags)
 {
 	struct jffs2_inode_info *f = JFFS2_INODE_INFO(inode);
-	struct jffs2_sb_info *c = JFFS2_SB_INFO(inode->i_sb);
+	struct jffs2_sb_info *c = JFFS2_SB_INFO(inode_sb(inode));
 	struct jffs2_inode_cache *ic = f->inocache;
 	struct jffs2_xattr_datum *xd;
 	struct jffs2_xattr_ref *ref, *newref, **pref;
-- 
2.15.1

^ permalink raw reply related	[flat|nested] 88+ messages in thread

* [PATCH 45/76] fs/jfs: Use inode_sb() helper instead of inode->i_sb
  2018-05-08 18:03 [RFC][PATCH 0/76] vfs: 'views' for filesystems with more than one root Mark Fasheh
                   ` (43 preceding siblings ...)
  2018-05-08 18:04 ` [PATCH 44/76] fs/jffs2: " Mark Fasheh
@ 2018-05-08 18:04 ` Mark Fasheh
  2018-05-08 18:04 ` [PATCH 46/76] fs/kernfs: " Mark Fasheh
                   ` (31 subsequent siblings)
  76 siblings, 0 replies; 88+ messages in thread
From: Mark Fasheh @ 2018-05-08 18:04 UTC (permalink / raw)
  To: linux-fsdevel; +Cc: linux-kernel, linux-btrfs, Mark Fasheh

Signed-off-by: Mark Fasheh <mfasheh@suse.de>
---
 fs/jfs/acl.c          |   2 +-
 fs/jfs/file.c         |   6 +--
 fs/jfs/inode.c        |  14 +++----
 fs/jfs/ioctl.c        |   2 +-
 fs/jfs/jfs_discard.c  |  12 +++---
 fs/jfs/jfs_dmap.c     | 104 +++++++++++++++++++++++++------------------------
 fs/jfs/jfs_dmap.h     |   2 +-
 fs/jfs/jfs_dtree.c    |  30 +++++++--------
 fs/jfs/jfs_dtree.h    |   2 +-
 fs/jfs/jfs_extent.c   |  18 ++++-----
 fs/jfs/jfs_imap.c     | 105 ++++++++++++++++++++++++++------------------------
 fs/jfs/jfs_incore.h   |   2 +-
 fs/jfs/jfs_inode.c    |   2 +-
 fs/jfs/jfs_metapage.c |  20 +++++-----
 fs/jfs/jfs_txnmgr.c   |  12 +++---
 fs/jfs/jfs_xtree.c    |  65 ++++++++++++++++---------------
 fs/jfs/namei.c        |  26 ++++++-------
 fs/jfs/super.c        |   2 +-
 fs/jfs/xattr.c        |   8 ++--
 19 files changed, 222 insertions(+), 212 deletions(-)

diff --git a/fs/jfs/acl.c b/fs/jfs/acl.c
index 2e71b6e7e646..051c24c59ffa 100644
--- a/fs/jfs/acl.c
+++ b/fs/jfs/acl.c
@@ -111,7 +111,7 @@ int jfs_set_acl(struct inode *inode, struct posix_acl *acl, int type)
 	int update_mode = 0;
 	umode_t mode = inode->i_mode;
 
-	tid = txBegin(inode->i_sb, 0);
+	tid = txBegin(inode_sb(inode), 0);
 	mutex_lock(&JFS_IP(inode)->commit_mutex);
 	if (type == ACL_TYPE_ACCESS && acl) {
 		rc = posix_acl_update_mode(inode, &mode, &acl);
diff --git a/fs/jfs/file.c b/fs/jfs/file.c
index 36665fd37095..b4eb55e2b291 100644
--- a/fs/jfs/file.c
+++ b/fs/jfs/file.c
@@ -42,7 +42,7 @@ int jfs_fsync(struct file *file, loff_t start, loff_t end, int datasync)
 	if (!(inode->i_state & I_DIRTY_ALL) ||
 	    (datasync && !(inode->i_state & I_DIRTY_DATASYNC))) {
 		/* Make sure committed changes hit the disk */
-		jfs_flush_journal(JFS_SBI(inode->i_sb)->log, 1);
+		jfs_flush_journal(JFS_SBI(inode_sb(inode))->log, 1);
 		inode_unlock(inode);
 		return rc;
 	}
@@ -74,7 +74,7 @@ static int jfs_open(struct inode *inode, struct file *file)
 		struct jfs_inode_info *ji = JFS_IP(inode);
 		spin_lock_irq(&ji->ag_lock);
 		if (ji->active_ag == -1) {
-			struct jfs_sb_info *jfs_sb = JFS_SBI(inode->i_sb);
+			struct jfs_sb_info *jfs_sb = JFS_SBI(inode_sb(inode));
 			ji->active_ag = BLKTOAG(addressPXD(&ji->ixpxd), jfs_sb);
 			atomic_inc(&jfs_sb->bmap->db_active[ji->active_ag]);
 		}
@@ -89,7 +89,7 @@ static int jfs_release(struct inode *inode, struct file *file)
 
 	spin_lock_irq(&ji->ag_lock);
 	if (ji->active_ag != -1) {
-		struct bmap *bmap = JFS_SBI(inode->i_sb)->bmap;
+		struct bmap *bmap = JFS_SBI(inode_sb(inode))->bmap;
 		atomic_dec(&bmap->db_active[ji->active_ag]);
 		ji->active_ag = -1;
 	}
diff --git a/fs/jfs/inode.c b/fs/jfs/inode.c
index 054cc761b426..6cf6574c235c 100644
--- a/fs/jfs/inode.c
+++ b/fs/jfs/inode.c
@@ -110,7 +110,7 @@ int jfs_commit_inode(struct inode *inode, int wait)
 		return 0;
 	}
 
-	tid = txBegin(inode->i_sb, COMMIT_INODE);
+	tid = txBegin(inode_sb(inode), COMMIT_INODE);
 	mutex_lock(&JFS_IP(inode)->commit_mutex);
 
 	/*
@@ -137,7 +137,7 @@ int jfs_write_inode(struct inode *inode, struct writeback_control *wbc)
 	 */
 	if (!test_cflag(COMMIT_Dirty, inode)) {
 		/* Make sure committed changes hit the disk */
-		jfs_flush_journal(JFS_SBI(inode->i_sb)->log, wait);
+		jfs_flush_journal(JFS_SBI(inode_sb(inode))->log, wait);
 		return 0;
 	}
 
@@ -213,7 +213,7 @@ int jfs_get_block(struct inode *ip, sector_t lblock,
 	else
 		IREAD_LOCK(ip, RDWRLOCK_NORMAL);
 
-	if (((lblock64 << ip->i_sb->s_blocksize_bits) < ip->i_size) &&
+	if (((lblock64 << inode_sb(ip)->s_blocksize_bits) < ip->i_size) &&
 	    (!xtLookup(ip, lblock64, xlen, &xflag, &xaddr, &xlen, 0)) &&
 	    xaddr) {
 		if (xflag & XAD_NOTRECORDED) {
@@ -241,7 +241,7 @@ int jfs_get_block(struct inode *ip, sector_t lblock,
 			set_buffer_new(bh_result);
 		}
 
-		map_bh(bh_result, ip->i_sb, xaddr);
+		map_bh(bh_result, inode_sb(ip), xaddr);
 		bh_result->b_size = xlen << ip->i_blkbits;
 		goto unlock;
 	}
@@ -252,14 +252,14 @@ int jfs_get_block(struct inode *ip, sector_t lblock,
 	 * Allocate a new block
 	 */
 #ifdef _JFS_4K
-	if ((rc = extHint(ip, lblock64 << ip->i_sb->s_blocksize_bits, &xad)))
+	if ((rc = extHint(ip, lblock64 << inode_sb(ip)->s_blocksize_bits, &xad)))
 		goto unlock;
 	rc = extAlloc(ip, xlen, lblock64, &xad, false);
 	if (rc)
 		goto unlock;
 
 	set_buffer_new(bh_result);
-	map_bh(bh_result, ip->i_sb, addressXAD(&xad));
+	map_bh(bh_result, inode_sb(ip), addressXAD(&xad));
 	bh_result->b_size = lengthXAD(&xad) << ip->i_blkbits;
 
 #else				/* _JFS_4K */
@@ -385,7 +385,7 @@ void jfs_truncate_nolock(struct inode *ip, loff_t length)
 	}
 
 	do {
-		tid = txBegin(ip->i_sb, 0);
+		tid = txBegin(inode_sb(ip), 0);
 
 		/*
 		 * The commit_mutex cannot be taken before txBegin.
diff --git a/fs/jfs/ioctl.c b/fs/jfs/ioctl.c
index ba34dae8bd9f..d2130d8ad594 100644
--- a/fs/jfs/ioctl.c
+++ b/fs/jfs/ioctl.c
@@ -129,7 +129,7 @@ long jfs_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
 
 	case FITRIM:
 	{
-		struct super_block *sb = inode->i_sb;
+		struct super_block *sb = inode_sb(inode);
 		struct request_queue *q = bdev_get_queue(sb->s_bdev);
 		struct fstrim_range range;
 		s64 ret = 0;
diff --git a/fs/jfs/jfs_discard.c b/fs/jfs/jfs_discard.c
index f76ff0a46444..b5f80e3426dd 100644
--- a/fs/jfs/jfs_discard.c
+++ b/fs/jfs/jfs_discard.c
@@ -44,7 +44,7 @@
  */
 void jfs_issue_discard(struct inode *ip, u64 blkno, u64 nblocks)
 {
-	struct super_block *sb = ip->i_sb;
+	struct super_block *sb = inode_sb(ip);
 	int r = 0;
 
 	r = sb_issue_discard(sb, blkno, nblocks, GFP_NOFS, 0);
@@ -77,9 +77,9 @@ void jfs_issue_discard(struct inode *ip, u64 blkno, u64 nblocks)
  */
 int jfs_ioc_trim(struct inode *ip, struct fstrim_range *range)
 {
-	struct inode *ipbmap = JFS_SBI(ip->i_sb)->ipbmap;
-	struct bmap *bmp = JFS_SBI(ip->i_sb)->bmap;
-	struct super_block *sb = ipbmap->i_sb;
+	struct inode *ipbmap = JFS_SBI(inode_sb(ip))->ipbmap;
+	struct bmap *bmp = JFS_SBI(inode_sb(ip))->bmap;
+	struct super_block *sb = inode_sb(ipbmap);
 	int agno, agno_end;
 	u64 start, end, minlen;
 	u64 trimmed = 0;
@@ -107,8 +107,8 @@ int jfs_ioc_trim(struct inode *ip, struct fstrim_range *range)
 	/**
 	 * we trim all ag's within the range
 	 */
-	agno = BLKTOAG(start, JFS_SBI(ip->i_sb));
-	agno_end = BLKTOAG(end, JFS_SBI(ip->i_sb));
+	agno = BLKTOAG(start, JFS_SBI(inode_sb(ip)));
+	agno_end = BLKTOAG(end, JFS_SBI(inode_sb(ip)));
 	while (agno <= agno_end) {
 		trimmed += dbDiscardAG(ip, agno, minlen);
 		agno++;
diff --git a/fs/jfs/jfs_dmap.c b/fs/jfs/jfs_dmap.c
index 2d514c7affc2..da343532ed16 100644
--- a/fs/jfs/jfs_dmap.c
+++ b/fs/jfs/jfs_dmap.c
@@ -179,7 +179,7 @@ int dbMount(struct inode *ipbmap)
 
 	/* read the on-disk bmap descriptor. */
 	mp = read_metapage(ipbmap,
-			   BMAPBLKNO << JFS_SBI(ipbmap->i_sb)->l2nbperpage,
+			   BMAPBLKNO << JFS_SBI(inode_sb(ipbmap))->l2nbperpage,
 			   PSIZE, 0);
 	if (mp == NULL) {
 		kfree(bmp);
@@ -210,7 +210,7 @@ int dbMount(struct inode *ipbmap)
 
 	/* bind the bmap inode and the bmap descriptor to each other. */
 	bmp->db_ipbmap = ipbmap;
-	JFS_SBI(ipbmap->i_sb)->bmap = bmp;
+	JFS_SBI(inode_sb(ipbmap))->bmap = bmp;
 
 	memset(bmp->db_active, 0, sizeof(bmp->db_active));
 
@@ -241,7 +241,7 @@ int dbMount(struct inode *ipbmap)
  */
 int dbUnmount(struct inode *ipbmap, int mounterror)
 {
-	struct bmap *bmp = JFS_SBI(ipbmap->i_sb)->bmap;
+	struct bmap *bmp = JFS_SBI(inode_sb(ipbmap))->bmap;
 
 	if (!(mounterror || isReadOnly(ipbmap)))
 		dbSync(ipbmap);
@@ -263,7 +263,7 @@ int dbUnmount(struct inode *ipbmap, int mounterror)
 int dbSync(struct inode *ipbmap)
 {
 	struct dbmap_disk *dbmp_le;
-	struct bmap *bmp = JFS_SBI(ipbmap->i_sb)->bmap;
+	struct bmap *bmp = JFS_SBI(inode_sb(ipbmap))->bmap;
 	struct metapage *mp;
 	int i;
 
@@ -272,7 +272,7 @@ int dbSync(struct inode *ipbmap)
 	 */
 	/* get the buffer for the on-disk bmap descriptor. */
 	mp = read_metapage(ipbmap,
-			   BMAPBLKNO << JFS_SBI(ipbmap->i_sb)->l2nbperpage,
+			   BMAPBLKNO << JFS_SBI(inode_sb(ipbmap))->l2nbperpage,
 			   PSIZE, 0);
 	if (mp == NULL) {
 		jfs_err("dbSync: read_metapage failed!");
@@ -334,9 +334,9 @@ int dbFree(struct inode *ip, s64 blkno, s64 nblocks)
 	struct dmap *dp;
 	int nb, rc;
 	s64 lblkno, rem;
-	struct inode *ipbmap = JFS_SBI(ip->i_sb)->ipbmap;
-	struct bmap *bmp = JFS_SBI(ip->i_sb)->bmap;
-	struct super_block *sb = ipbmap->i_sb;
+	struct inode *ipbmap = JFS_SBI(inode_sb(ip))->ipbmap;
+	struct bmap *bmp = JFS_SBI(inode_sb(ip))->bmap;
+	struct super_block *sb = inode_sb(ipbmap);
 
 	IREAD_LOCK(ipbmap, RDWRLOCK_DMAP);
 
@@ -346,7 +346,8 @@ int dbFree(struct inode *ip, s64 blkno, s64 nblocks)
 		printk(KERN_ERR "blkno = %Lx, nblocks = %Lx\n",
 		       (unsigned long long) blkno,
 		       (unsigned long long) nblocks);
-		jfs_error(ip->i_sb, "block to be freed is outside the map\n");
+		jfs_error(inode_sb(ip),
+			  "block to be freed is outside the map\n");
 		return -EIO;
 	}
 
@@ -383,7 +384,7 @@ int dbFree(struct inode *ip, s64 blkno, s64 nblocks)
 
 		/* free the blocks. */
 		if ((rc = dbFreeDmap(bmp, dp, blkno, nb))) {
-			jfs_error(ip->i_sb, "error in block map\n");
+			jfs_error(inode_sb(ip), "error in block map\n");
 			release_metapage(mp);
 			IREAD_UNLOCK(ipbmap);
 			return (rc);
@@ -426,7 +427,7 @@ dbUpdatePMap(struct inode *ipbmap,
 {
 	int nblks, dbitno, wbitno, rbits;
 	int word, nbits, nwords;
-	struct bmap *bmp = JFS_SBI(ipbmap->i_sb)->bmap;
+	struct bmap *bmp = JFS_SBI(inode_sb(ipbmap))->bmap;
 	s64 lblkno, rem, lastlblkno;
 	u32 mask;
 	struct dmap *dp;
@@ -440,7 +441,7 @@ dbUpdatePMap(struct inode *ipbmap,
 		printk(KERN_ERR "blkno = %Lx, nblocks = %Lx\n",
 		       (unsigned long long) blkno,
 		       (unsigned long long) nblocks);
-		jfs_error(ipbmap->i_sb, "blocks are outside the map\n");
+		jfs_error(inode_sb(ipbmap), "blocks are outside the map\n");
 		return -EIO;
 	}
 
@@ -607,7 +608,7 @@ int dbNextAG(struct inode *ipbmap)
 	s64 hwm = 0;
 	int i;
 	int next_best = -1;
-	struct bmap *bmp = JFS_SBI(ipbmap->i_sb)->bmap;
+	struct bmap *bmp = JFS_SBI(inode_sb(ipbmap))->bmap;
 
 	BMAP_LOCK(bmp);
 
@@ -700,7 +701,7 @@ int dbNextAG(struct inode *ipbmap)
 int dbAlloc(struct inode *ip, s64 hint, s64 nblocks, s64 * results)
 {
 	int rc, agno;
-	struct inode *ipbmap = JFS_SBI(ip->i_sb)->ipbmap;
+	struct inode *ipbmap = JFS_SBI(inode_sb(ip))->ipbmap;
 	struct bmap *bmp;
 	struct metapage *mp;
 	s64 lblkno, blkno;
@@ -718,13 +719,13 @@ int dbAlloc(struct inode *ip, s64 hint, s64 nblocks, s64 * results)
 	 */
 	l2nb = BLKSTOL2(nblocks);
 
-	bmp = JFS_SBI(ip->i_sb)->bmap;
+	bmp = JFS_SBI(inode_sb(ip))->bmap;
 
 	mapSize = bmp->db_mapsize;
 
 	/* the hint should be within the map */
 	if (hint >= mapSize) {
-		jfs_error(ip->i_sb, "the hint is outside the map\n");
+		jfs_error(inode_sb(ip), "the hint is outside the map\n");
 		return -EIO;
 	}
 
@@ -893,8 +894,8 @@ int dbAlloc(struct inode *ip, s64 hint, s64 nblocks, s64 * results)
 int dbAllocExact(struct inode *ip, s64 blkno, int nblocks)
 {
 	int rc;
-	struct inode *ipbmap = JFS_SBI(ip->i_sb)->ipbmap;
-	struct bmap *bmp = JFS_SBI(ip->i_sb)->bmap;
+	struct inode *ipbmap = JFS_SBI(inode_sb(ip))->ipbmap;
+	struct bmap *bmp = JFS_SBI(inode_sb(ip))->bmap;
 	struct dmap *dp;
 	s64 lblkno;
 	struct metapage *mp;
@@ -1025,7 +1026,7 @@ dbReAlloc(struct inode *ip,
  */
 static int dbExtend(struct inode *ip, s64 blkno, s64 nblocks, s64 addnblocks)
 {
-	struct jfs_sb_info *sbi = JFS_SBI(ip->i_sb);
+	struct jfs_sb_info *sbi = JFS_SBI(inode_sb(ip));
 	s64 lblkno, lastblkno, extblkno;
 	uint rel_block;
 	struct metapage *mp;
@@ -1055,7 +1056,8 @@ static int dbExtend(struct inode *ip, s64 blkno, s64 nblocks, s64 addnblocks)
 	bmp = sbi->bmap;
 	if (lastblkno < 0 || lastblkno >= bmp->db_mapsize) {
 		IREAD_UNLOCK(ipbmap);
-		jfs_error(ip->i_sb, "the block is outside the filesystem\n");
+		jfs_error(inode_sb(ip),
+			  "the block is outside the filesystem\n");
 		return -EIO;
 	}
 
@@ -1131,7 +1133,7 @@ static int dbAllocNext(struct bmap * bmp, struct dmap * dp, s64 blkno,
 	u32 mask;
 
 	if (dp->tree.leafidx != cpu_to_le32(LEAFIND)) {
-		jfs_error(bmp->db_ipbmap->i_sb, "Corrupt dmap page\n");
+		jfs_error(inode_sb(bmp->db_ipbmap), "Corrupt dmap page\n");
 		return -EIO;
 	}
 
@@ -1261,7 +1263,7 @@ dbAllocNear(struct bmap * bmp,
 	s8 *leaf;
 
 	if (dp->tree.leafidx != cpu_to_le32(LEAFIND)) {
-		jfs_error(bmp->db_ipbmap->i_sb, "Corrupt dmap page\n");
+		jfs_error(inode_sb(bmp->db_ipbmap), "Corrupt dmap page\n");
 		return -EIO;
 	}
 
@@ -1375,7 +1377,7 @@ dbAllocAG(struct bmap * bmp, int agno, s64 nblocks, int l2nb, s64 * results)
 	 * allocation group size.
 	 */
 	if (l2nb > bmp->db_agl2size) {
-		jfs_error(bmp->db_ipbmap->i_sb,
+		jfs_error(inode_sb(bmp->db_ipbmap),
 			  "allocation request is larger than the allocation group size\n");
 		return -EIO;
 	}
@@ -1410,7 +1412,7 @@ dbAllocAG(struct bmap * bmp, int agno, s64 nblocks, int l2nb, s64 * results)
 			printk(KERN_ERR "blkno = %Lx, blocks = %Lx\n",
 			       (unsigned long long) blkno,
 			       (unsigned long long) nblocks);
-			jfs_error(bmp->db_ipbmap->i_sb,
+			jfs_error(inode_sb(bmp->db_ipbmap),
 				  "dbAllocCtl failed in free AG\n");
 		}
 		return (rc);
@@ -1427,7 +1429,7 @@ dbAllocAG(struct bmap * bmp, int agno, s64 nblocks, int l2nb, s64 * results)
 	budmin = dcp->budmin;
 
 	if (dcp->leafidx != cpu_to_le32(CTLLEAFIND)) {
-		jfs_error(bmp->db_ipbmap->i_sb, "Corrupt dmapctl page\n");
+		jfs_error(inode_sb(bmp->db_ipbmap), "Corrupt dmapctl page\n");
 		release_metapage(mp);
 		return -EIO;
 	}
@@ -1467,7 +1469,7 @@ dbAllocAG(struct bmap * bmp, int agno, s64 nblocks, int l2nb, s64 * results)
 				}
 			}
 			if (n == 4) {
-				jfs_error(bmp->db_ipbmap->i_sb,
+				jfs_error(inode_sb(bmp->db_ipbmap),
 					  "failed descending stree\n");
 				release_metapage(mp);
 				return -EIO;
@@ -1507,7 +1509,7 @@ dbAllocAG(struct bmap * bmp, int agno, s64 nblocks, int l2nb, s64 * results)
 			     dbFindCtl(bmp, l2nb, bmp->db_aglevel - 1,
 				       &blkno))) {
 				if (rc == -ENOSPC) {
-					jfs_error(bmp->db_ipbmap->i_sb,
+					jfs_error(inode_sb(bmp->db_ipbmap),
 						  "control page inconsistent\n");
 					return -EIO;
 				}
@@ -1519,7 +1521,7 @@ dbAllocAG(struct bmap * bmp, int agno, s64 nblocks, int l2nb, s64 * results)
 		 */
 		rc = dbAllocCtl(bmp, nblocks, l2nb, blkno, results);
 		if (rc == -ENOSPC) {
-			jfs_error(bmp->db_ipbmap->i_sb,
+			jfs_error(inode_sb(bmp->db_ipbmap),
 				  "unable to allocate blocks\n");
 			rc = -EIO;
 		}
@@ -1579,7 +1581,8 @@ static int dbAllocAny(struct bmap * bmp, s64 nblocks, int l2nb, s64 * results)
 	 */
 	rc = dbAllocCtl(bmp, nblocks, l2nb, blkno, results);
 	if (rc == -ENOSPC) {
-		jfs_error(bmp->db_ipbmap->i_sb, "unable to allocate blocks\n");
+		jfs_error(inode_sb(bmp->db_ipbmap),
+			  "unable to allocate blocks\n");
 		return -EIO;
 	}
 	return (rc);
@@ -1618,12 +1621,12 @@ static int dbAllocAny(struct bmap * bmp, s64 nblocks, int l2nb, s64 * results)
  */
 s64 dbDiscardAG(struct inode *ip, int agno, s64 minlen)
 {
-	struct inode *ipbmap = JFS_SBI(ip->i_sb)->ipbmap;
-	struct bmap *bmp = JFS_SBI(ip->i_sb)->bmap;
+	struct inode *ipbmap = JFS_SBI(inode_sb(ip))->ipbmap;
+	struct bmap *bmp = JFS_SBI(inode_sb(ip))->bmap;
 	s64 nblocks, blkno;
 	u64 trimmed = 0;
 	int rc, l2nb;
-	struct super_block *sb = ipbmap->i_sb;
+	struct super_block *sb = inode_sb(ipbmap);
 
 	struct range2trim {
 		u64 blkno;
@@ -1643,7 +1646,8 @@ s64 dbDiscardAG(struct inode *ip, int agno, s64 minlen)
 	range_cnt = min_t(u64, max_ranges + 1, 32 * 1024);
 	totrim = kmalloc(sizeof(struct range2trim) * range_cnt, GFP_NOFS);
 	if (totrim == NULL) {
-		jfs_error(bmp->db_ipbmap->i_sb, "no memory for trim array\n");
+		jfs_error(inode_sb(bmp->db_ipbmap),
+			  "no memory for trim array\n");
 		IWRITE_UNLOCK(ipbmap);
 		return 0;
 	}
@@ -1672,7 +1676,7 @@ s64 dbDiscardAG(struct inode *ip, int agno, s64 minlen)
 			nblocks = 1 << l2nb;
 		} else {
 			/* Trim any already allocated blocks */
-			jfs_error(bmp->db_ipbmap->i_sb, "-EIO\n");
+			jfs_error(inode_sb(bmp->db_ipbmap), "-EIO\n");
 			break;
 		}
 
@@ -1749,7 +1753,7 @@ static int dbFindCtl(struct bmap * bmp, int l2nb, int level, s64 * blkno)
 		budmin = dcp->budmin;
 
 		if (dcp->leafidx != cpu_to_le32(CTLLEAFIND)) {
-			jfs_error(bmp->db_ipbmap->i_sb,
+			jfs_error(inode_sb(bmp->db_ipbmap),
 				  "Corrupt dmapctl page\n");
 			release_metapage(mp);
 			return -EIO;
@@ -1770,7 +1774,7 @@ static int dbFindCtl(struct bmap * bmp, int l2nb, int level, s64 * blkno)
 		 */
 		if (rc) {
 			if (lev != level) {
-				jfs_error(bmp->db_ipbmap->i_sb,
+				jfs_error(inode_sb(bmp->db_ipbmap),
 					  "dmap inconsistent\n");
 				return -EIO;
 			}
@@ -1894,7 +1898,7 @@ dbAllocCtl(struct bmap * bmp, s64 nblocks, int l2nb, s64 blkno, s64 * results)
 		 */
 		if (dp->tree.stree[ROOT] != L2BPERDMAP) {
 			release_metapage(mp);
-			jfs_error(bmp->db_ipbmap->i_sb,
+			jfs_error(inode_sb(bmp->db_ipbmap),
 				  "the dmap is not all free\n");
 			rc = -EIO;
 			goto backout;
@@ -1941,7 +1945,7 @@ dbAllocCtl(struct bmap * bmp, s64 nblocks, int l2nb, s64 blkno, s64 * results)
 			/* could not back out.  mark the file system
 			 * to indicate that we have leaked blocks.
 			 */
-			jfs_error(bmp->db_ipbmap->i_sb,
+			jfs_error(inode_sb(bmp->db_ipbmap),
 				  "I/O Error: Block Leakage\n");
 			continue;
 		}
@@ -1954,7 +1958,7 @@ dbAllocCtl(struct bmap * bmp, s64 nblocks, int l2nb, s64 blkno, s64 * results)
 			 * to indicate that we have leaked blocks.
 			 */
 			release_metapage(mp);
-			jfs_error(bmp->db_ipbmap->i_sb, "Block Leakage\n");
+			jfs_error(inode_sb(bmp->db_ipbmap), "Block Leakage\n");
 			continue;
 		}
 
@@ -2250,7 +2254,7 @@ static void dbAllocBits(struct bmap * bmp, struct dmap * dp, s64 blkno,
 			 */
 			for (; nwords > 0; nwords -= nw) {
 				if (leaf[word] < BUDMIN) {
-					jfs_error(bmp->db_ipbmap->i_sb,
+					jfs_error(inode_sb(bmp->db_ipbmap),
 						  "leaf page corrupt\n");
 					break;
 				}
@@ -2524,7 +2528,7 @@ dbAdjCtl(struct bmap * bmp, s64 blkno, int newval, int alloc, int level)
 	dcp = (struct dmapctl *) mp->data;
 
 	if (dcp->leafidx != cpu_to_le32(CTLLEAFIND)) {
-		jfs_error(bmp->db_ipbmap->i_sb, "Corrupt dmapctl page\n");
+		jfs_error(inode_sb(bmp->db_ipbmap), "Corrupt dmapctl page\n");
 		release_metapage(mp);
 		return -EIO;
 	}
@@ -2624,7 +2628,7 @@ dbAdjCtl(struct bmap * bmp, s64 blkno, int newval, int alloc, int level)
 			 */
 			assert(level == bmp->db_maxlevel);
 			if (bmp->db_maxfreebud != oldroot) {
-				jfs_error(bmp->db_ipbmap->i_sb,
+				jfs_error(inode_sb(bmp->db_ipbmap),
 					  "the maximum free buddy is not the old root\n");
 			}
 			bmp->db_maxfreebud = dcp->stree[ROOT];
@@ -3211,8 +3215,8 @@ int dbAllocBottomUp(struct inode *ip, s64 blkno, s64 nblocks)
 	struct dmap *dp;
 	int nb, rc;
 	s64 lblkno, rem;
-	struct inode *ipbmap = JFS_SBI(ip->i_sb)->ipbmap;
-	struct bmap *bmp = JFS_SBI(ip->i_sb)->bmap;
+	struct inode *ipbmap = JFS_SBI(inode_sb(ip))->ipbmap;
+	struct bmap *bmp = JFS_SBI(inode_sb(ip))->bmap;
 
 	IREAD_LOCK(ipbmap, RDWRLOCK_DMAP);
 
@@ -3383,7 +3387,7 @@ static int dbAllocDmapBU(struct bmap * bmp, struct dmap * dp, s64 blkno,
  */
 int dbExtendFS(struct inode *ipbmap, s64 blkno,	s64 nblocks)
 {
-	struct jfs_sb_info *sbi = JFS_SBI(ipbmap->i_sb);
+	struct jfs_sb_info *sbi = JFS_SBI(inode_sb(ipbmap));
 	int nbperpage = sbi->nbperpage;
 	int i, i0 = true, j, j0 = true, k, n;
 	s64 newsize;
@@ -3467,7 +3471,7 @@ int dbExtendFS(struct inode *ipbmap, s64 blkno,	s64 nblocks)
 	p = BMAPBLKNO + nbperpage;	/* L2 page */
 	l2mp = read_metapage(ipbmap, p, PSIZE, 0);
 	if (!l2mp) {
-		jfs_error(ipbmap->i_sb, "L2 page could not be read\n");
+		jfs_error(inode_sb(ipbmap), "L2 page could not be read\n");
 		return -EIO;
 	}
 	l2dcp = (struct dmapctl *) l2mp->data;
@@ -3632,7 +3636,7 @@ int dbExtendFS(struct inode *ipbmap, s64 blkno,	s64 nblocks)
 		}
 	}			/* for each L1 in a L2 */
 
-	jfs_error(ipbmap->i_sb, "function has not returned as expected\n");
+	jfs_error(inode_sb(ipbmap), "function has not returned as expected\n");
 errout:
 	if (l0mp)
 		release_metapage(l0mp);
@@ -3655,7 +3659,7 @@ int dbExtendFS(struct inode *ipbmap, s64 blkno,	s64 nblocks)
  */
 void dbFinalizeBmap(struct inode *ipbmap)
 {
-	struct bmap *bmp = JFS_SBI(ipbmap->i_sb)->bmap;
+	struct bmap *bmp = JFS_SBI(inode_sb(ipbmap))->bmap;
 	int actags, inactags, l2nl;
 	s64 ag_rem, actfree, inactfree, avgfree;
 	int i, n;
@@ -3701,7 +3705,7 @@ void dbFinalizeBmap(struct inode *ipbmap)
 				break;
 		}
 		if (bmp->db_agpref >= bmp->db_numag) {
-			jfs_error(ipbmap->i_sb,
+			jfs_error(inode_sb(ipbmap),
 				  "cannot find ag with average freespace\n");
 		}
 	}
@@ -4051,7 +4055,7 @@ static int dbGetL2AGSize(s64 nblocks)
 
 s64 dbMapFileSizeToMapSize(struct inode * ipbmap)
 {
-	struct super_block *sb = ipbmap->i_sb;
+	struct super_block *sb = inode_sb(ipbmap);
 	s64 nblocks;
 	s64 npages, ndmaps;
 	int level, i;
diff --git a/fs/jfs/jfs_dmap.h b/fs/jfs/jfs_dmap.h
index 562b9a7e4311..656bb54da901 100644
--- a/fs/jfs/jfs_dmap.h
+++ b/fs/jfs/jfs_dmap.h
@@ -137,7 +137,7 @@ static inline signed char TREEMAX(signed char *cp)
  * number.
  */
 #define AGTOBLK(a,ip)	\
-	((s64)(a) << (JFS_SBI((ip)->i_sb)->bmap->db_agl2size))
+	((s64)(a) << (JFS_SBI(inode_sb((ip)))->bmap->db_agl2size))
 
 /*
  *	dmap summary tree
diff --git a/fs/jfs/jfs_dtree.c b/fs/jfs/jfs_dtree.c
index de2bcb36e079..0126d32c76d9 100644
--- a/fs/jfs/jfs_dtree.c
+++ b/fs/jfs/jfs_dtree.c
@@ -132,7 +132,7 @@ do {									\
 		     (((BN) == 0) ? DTROOTMAXSLOT : (P)->header.maxslot)) || \
 		    ((BN) && ((P)->header.maxslot > DTPAGEMAXSLOT))) {	\
 			BT_PUTPAGE(MP);					\
-			jfs_error((IP)->i_sb,				\
+			jfs_error(inode_sb((IP)),				\
 				  "DT_GETPAGE: dtree page corrupt\n");	\
 			MP = NULL;					\
 			RC = -EIO;					\
@@ -279,7 +279,7 @@ static struct dir_table_slot *find_index(struct inode *ip, u32 index,
 		offset = (index - 2) * sizeof(struct dir_table_slot);
 		page_offset = offset & (PSIZE - 1);
 		blkno = ((offset + 1) >> L2PSIZE) <<
-		    JFS_SBI(ip->i_sb)->l2nbperpage;
+		    JFS_SBI(inode_sb(ip))->l2nbperpage;
 
 		if (*mp && (*lblock != blkno)) {
 			release_metapage(*mp);
@@ -333,7 +333,7 @@ static inline void lock_index(tid_t tid, struct inode *ip, struct metapage * mp,
  */
 static u32 add_index(tid_t tid, struct inode *ip, s64 bn, int slot)
 {
-	struct super_block *sb = ip->i_sb;
+	struct super_block *sb = inode_sb(ip);
 	struct jfs_sb_info *sbi = JFS_SBI(sb);
 	struct jfs_inode_info *jfs_ip = JFS_IP(ip);
 	u64 blkno;
@@ -592,7 +592,7 @@ int dtSearch(struct inode *ip, struct component_name * key, ino_t * data,
 	int psize = 288;	/* initial in-line directory */
 	ino_t inumber;
 	struct component_name ciKey;
-	struct super_block *sb = ip->i_sb;
+	struct super_block *sb = inode_sb(ip);
 
 	ciKey.name = kmalloc((JFS_NAME_MAX + 1) * sizeof(wchar_t), GFP_NOFS);
 	if (!ciKey.name) {
@@ -789,7 +789,7 @@ int dtSearch(struct inode *ip, struct component_name * key, ino_t * data,
 		/* get the child page block number */
 		pxd = (pxd_t *) & p->slot[stbl[index]];
 		bn = addressPXD(pxd);
-		psize = lengthPXD(pxd) << JFS_SBI(ip->i_sb)->l2bsize;
+		psize = lengthPXD(pxd) << JFS_SBI(inode_sb(ip))->l2bsize;
 
 		/* unpin the parent page */
 		DT_PUTPAGE(mp);
@@ -930,7 +930,7 @@ int dtInsert(tid_t tid, struct inode *ip,
 static int dtSplitUp(tid_t tid,
 	  struct inode *ip, struct dtsplit * split, struct btstack * btstack)
 {
-	struct jfs_sb_info *sbi = JFS_SBI(ip->i_sb);
+	struct jfs_sb_info *sbi = JFS_SBI(inode_sb(ip));
 	int rc = 0;
 	struct metapage *smp;
 	dtpage_t *sp;		/* split page */
@@ -1642,7 +1642,7 @@ static int dtSplitPage(tid_t tid, struct inode *ip, struct dtsplit * split,
 static int dtExtendPage(tid_t tid,
 	     struct inode *ip, struct dtsplit * split, struct btstack * btstack)
 {
-	struct super_block *sb = ip->i_sb;
+	struct super_block *sb = inode_sb(ip);
 	int rc;
 	struct metapage *smp, *pmp, *mp;
 	dtpage_t *sp, *pp;
@@ -1875,7 +1875,7 @@ static int dtExtendPage(tid_t tid,
 static int dtSplitRoot(tid_t tid,
 	    struct inode *ip, struct dtsplit * split, struct metapage ** rmpp)
 {
-	struct super_block *sb = ip->i_sb;
+	struct super_block *sb = inode_sb(ip);
 	struct metapage *smp;
 	dtroot_t *sp;
 	struct metapage *rmp;
@@ -2577,7 +2577,7 @@ int dtRelocate(tid_t tid, struct inode *ip, s64 lmxaddr, pxd_t * opxd,
 	dtlck->index++;
 
 	/* update the buffer extent descriptor of the dtpage */
-	xsize = xlen << JFS_SBI(ip->i_sb)->l2bsize;
+	xsize = xlen << JFS_SBI(inode_sb(ip))->l2bsize;
 
 	/* unpin the relocated page */
 	DT_PUTPAGE(mp);
@@ -2688,7 +2688,7 @@ static int dtSearchNode(struct inode *ip, s64 lmxaddr, pxd_t * kpxd,
 
 		/* get the child page block address */
 		bn = addressPXD(pxd);
-		psize = lengthPXD(pxd) << JFS_SBI(ip->i_sb)->l2bsize;
+		psize = lengthPXD(pxd) << JFS_SBI(inode_sb(ip))->l2bsize;
 		/* unpin the parent page */
 		DT_PUTPAGE(mp);
 	}
@@ -2929,7 +2929,7 @@ static void add_missing_indices(struct inode *inode, s64 bn)
 	tid_t tid;
 	struct tlock *tlck;
 
-	tid = txBegin(inode->i_sb, 0);
+	tid = txBegin(inode_sb(inode), 0);
 
 	DT_GETPAGE(inode, bn, mp, PSIZE, p, rc);
 
@@ -3005,7 +3005,7 @@ static inline struct jfs_dirent *next_jfs_dirent(struct jfs_dirent *dirent)
 int jfs_readdir(struct file *file, struct dir_context *ctx)
 {
 	struct inode *ip = file_inode(file);
-	struct nls_table *codepage = JFS_SBI(ip->i_sb)->nls_tab;
+	struct nls_table *codepage = JFS_SBI(inode_sb(ip))->nls_tab;
 	int rc = 0;
 	loff_t dtpos;	/* legacy OS/2 style position */
 	struct dtoffset {
@@ -3259,7 +3259,7 @@ int jfs_readdir(struct file *file, struct dir_context *ctx)
 				d_namleft -= len;
 				/* Sanity Check */
 				if (d_namleft == 0) {
-					jfs_error(ip->i_sb,
+					jfs_error(inode_sb(ip),
 						  "JFS:Dtree error: ino = %ld, bn=%lld, index = %d\n",
 						  (long)ip->i_ino,
 						  (long long)bn,
@@ -3380,7 +3380,7 @@ static int dtReadFirst(struct inode *ip, struct btstack * btstack)
 		 */
 		if (BT_STACK_FULL(btstack)) {
 			DT_PUTPAGE(mp);
-			jfs_error(ip->i_sb, "btstack overrun\n");
+			jfs_error(inode_sb(ip), "btstack overrun\n");
 			BT_STACK_DUMP(btstack);
 			return -EIO;
 		}
@@ -3393,7 +3393,7 @@ static int dtReadFirst(struct inode *ip, struct btstack * btstack)
 
 		/* get the child page block address */
 		bn = addressPXD(xd);
-		psize = lengthPXD(xd) << JFS_SBI(ip->i_sb)->l2bsize;
+		psize = lengthPXD(xd) << JFS_SBI(inode_sb(ip))->l2bsize;
 
 		/* unpin the parent page */
 		DT_PUTPAGE(mp);
diff --git a/fs/jfs/jfs_dtree.h b/fs/jfs/jfs_dtree.h
index fd4169e6e698..815a8280717e 100644
--- a/fs/jfs/jfs_dtree.h
+++ b/fs/jfs/jfs_dtree.h
@@ -101,7 +101,7 @@ struct ldtentry {
 /*
  * Keep persistent index for directory entries
  */
-#define DO_INDEX(INODE) (JFS_SBI((INODE)->i_sb)->mntflag & JFS_DIR_INDEX)
+#define DO_INDEX(INODE) (JFS_SBI(inode_sb((INODE)))->mntflag & JFS_DIR_INDEX)
 
 /*
  * Maximum entry in inline directory table
diff --git a/fs/jfs/jfs_extent.c b/fs/jfs/jfs_extent.c
index 2ae7d59ab10a..bbe40021b5fd 100644
--- a/fs/jfs/jfs_extent.c
+++ b/fs/jfs/jfs_extent.c
@@ -85,13 +85,13 @@ static s64 extRoundDown(s64 nb);
 int
 extAlloc(struct inode *ip, s64 xlen, s64 pno, xad_t * xp, bool abnr)
 {
-	struct jfs_sb_info *sbi = JFS_SBI(ip->i_sb);
+	struct jfs_sb_info *sbi = JFS_SBI(inode_sb(ip));
 	s64 nxlen, nxaddr, xoff, hint, xaddr = 0;
 	int rc;
 	int xflag;
 
 	/* This blocks if we are low on resources */
-	txBeginAnon(ip->i_sb);
+	txBeginAnon(inode_sb(ip));
 
 	/* Avoid race with jfs_commit_inode() */
 	mutex_lock(&JFS_IP(ip)->commit_mutex);
@@ -214,14 +214,14 @@ extAlloc(struct inode *ip, s64 xlen, s64 pno, xad_t * xp, bool abnr)
  */
 int extRealloc(struct inode *ip, s64 nxlen, xad_t * xp, bool abnr)
 {
-	struct super_block *sb = ip->i_sb;
+	struct super_block *sb = inode_sb(ip);
 	s64 xaddr, xlen, nxaddr, delta, xoff;
 	s64 ntail, nextend, ninsert;
 	int rc, nbperpage = JFS_SBI(sb)->nbperpage;
 	int xflag;
 
 	/* This blocks if we are low on resources */
-	txBeginAnon(ip->i_sb);
+	txBeginAnon(inode_sb(ip));
 
 	mutex_lock(&JFS_IP(ip)->commit_mutex);
 	/* validate extent length */
@@ -363,7 +363,7 @@ int extRealloc(struct inode *ip, s64 nxlen, xad_t * xp, bool abnr)
  */
 int extHint(struct inode *ip, s64 offset, xad_t * xp)
 {
-	struct super_block *sb = ip->i_sb;
+	struct super_block *sb = inode_sb(ip);
 	int nbperpage = JFS_SBI(sb)->nbperpage;
 	s64 prev;
 	int rc = 0;
@@ -388,7 +388,7 @@ int extHint(struct inode *ip, s64 offset, xad_t * xp)
 
 	if ((rc == 0) && xlen) {
 		if (xlen != nbperpage) {
-			jfs_error(ip->i_sb, "corrupt xtree\n");
+			jfs_error(inode_sb(ip), "corrupt xtree\n");
 			rc = -EIO;
 		}
 		XADaddress(xp, xaddr);
@@ -425,7 +425,7 @@ int extRecord(struct inode *ip, xad_t * xp)
 {
 	int rc;
 
-	txBeginAnon(ip->i_sb);
+	txBeginAnon(inode_sb(ip));
 
 	mutex_lock(&JFS_IP(ip)->commit_mutex);
 
@@ -455,7 +455,7 @@ int extRecord(struct inode *ip, xad_t * xp)
  */
 int extFill(struct inode *ip, xad_t * xp)
 {
-	int rc, nbperpage = JFS_SBI(ip->i_sb)->nbperpage;
+	int rc, nbperpage = JFS_SBI(inode_sb(ip))->nbperpage;
 	s64 blkno = offsetXAD(xp) >> ip->i_blkbits;
 
 //	assert(ISSPARSE(ip));
@@ -509,7 +509,7 @@ static int
 extBalloc(struct inode *ip, s64 hint, s64 * nblocks, s64 * blkno)
 {
 	struct jfs_inode_info *ji = JFS_IP(ip);
-	struct jfs_sb_info *sbi = JFS_SBI(ip->i_sb);
+	struct jfs_sb_info *sbi = JFS_SBI(inode_sb(ip));
 	s64 nb, nblks, daddr, max;
 	int rc, nbperpage = sbi->nbperpage;
 	struct bmap *bmp = sbi->bmap;
diff --git a/fs/jfs/jfs_imap.c b/fs/jfs/jfs_imap.c
index f36ef68905a7..28873d804bd9 100644
--- a/fs/jfs/jfs_imap.c
+++ b/fs/jfs/jfs_imap.c
@@ -124,7 +124,7 @@ int diMount(struct inode *ipimap)
 	/* read the on-disk inode map control structure. */
 
 	mp = read_metapage(ipimap,
-			   IMAPBLKNO << JFS_SBI(ipimap->i_sb)->l2nbperpage,
+			   IMAPBLKNO << JFS_SBI(inode_sb(ipimap))->l2nbperpage,
 			   PSIZE, 0);
 	if (mp == NULL) {
 		kfree(imap);
@@ -228,7 +228,7 @@ int diSync(struct inode *ipimap)
 	 */
 	/* read the on-disk inode map control structure */
 	mp = get_metapage(ipimap,
-			  IMAPBLKNO << JFS_SBI(ipimap->i_sb)->l2nbperpage,
+			  IMAPBLKNO << JFS_SBI(inode_sb(ipimap))->l2nbperpage,
 			  PSIZE, 0);
 	if (mp == NULL) {
 		jfs_err("diSync: get_metapage failed!");
@@ -303,7 +303,7 @@ int diSync(struct inode *ipimap)
  */
 int diRead(struct inode *ip)
 {
-	struct jfs_sb_info *sbi = JFS_SBI(ip->i_sb);
+	struct jfs_sb_info *sbi = JFS_SBI(inode_sb(ip));
 	int iagno, ino, extno, rc;
 	struct inode *ipimap;
 	struct dinode *dp;
@@ -386,7 +386,7 @@ int diRead(struct inode *ip)
 	dp += rel_inode;
 
 	if (ip->i_ino != le32_to_cpu(dp->di_number)) {
-		jfs_error(ip->i_sb, "i_ino != di_number\n");
+		jfs_error(inode_sb(ip), "i_ino != di_number\n");
 		rc = -EIO;
 	} else if (le32_to_cpu(dp->di_nlink) == 0)
 		rc = -ESTALE;
@@ -516,7 +516,7 @@ struct inode *diReadSpecial(struct super_block *sb, ino_t inum, int secondary)
 
 void diWriteSpecial(struct inode *ip, int secondary)
 {
-	struct jfs_sb_info *sbi = JFS_SBI(ip->i_sb);
+	struct jfs_sb_info *sbi = JFS_SBI(inode_sb(ip));
 	uint address;
 	struct dinode *dp;
 	ino_t inum = ip->i_ino;
@@ -597,7 +597,7 @@ void diFreeSpecial(struct inode *ip)
  */
 int diWrite(tid_t tid, struct inode *ip)
 {
-	struct jfs_sb_info *sbi = JFS_SBI(ip->i_sb);
+	struct jfs_sb_info *sbi = JFS_SBI(inode_sb(ip));
 	struct jfs_inode_info *jfs_ip = JFS_IP(ip);
 	int rc = 0;
 	s32 ino;
@@ -624,7 +624,7 @@ int diWrite(tid_t tid, struct inode *ip)
 	if (!addressPXD(&(jfs_ip->ixpxd)) ||
 	    (lengthPXD(&(jfs_ip->ixpxd)) !=
 	     JFS_IP(ipimap)->i_imap->im_nbperiext)) {
-		jfs_error(ip->i_sb, "ixpxd invalid\n");
+		jfs_error(inode_sb(ip), "ixpxd invalid\n");
 		return -EIO;
 	}
 
@@ -868,7 +868,7 @@ int diFree(struct inode *ip)
 	int iagno, ino, extno, bitno, sword, agno;
 	int back, fwd;
 	u32 bitmap, mask;
-	struct inode *ipimap = JFS_SBI(ip->i_sb)->ipimap;
+	struct inode *ipimap = JFS_SBI(inode_sb(ip))->ipimap;
 	struct inomap *imap = JFS_IP(ipimap)->i_imap;
 	pxd_t freepxd;
 	tid_t tid;
@@ -892,14 +892,15 @@ int diFree(struct inode *ip)
 	if (iagno >= imap->im_nextiag) {
 		print_hex_dump(KERN_ERR, "imap: ", DUMP_PREFIX_ADDRESS, 16, 4,
 			       imap, 32, 0);
-		jfs_error(ip->i_sb, "inum = %d, iagno = %d, nextiag = %d\n",
+		jfs_error(inode_sb(ip),
+			  "inum = %d, iagno = %d, nextiag = %d\n",
 			  (uint) inum, iagno, imap->im_nextiag);
 		return -EIO;
 	}
 
 	/* get the allocation group for this ino.
 	 */
-	agno = BLKTOAG(JFS_IP(ip)->agstart, JFS_SBI(ip->i_sb));
+	agno = BLKTOAG(JFS_IP(ip)->agstart, JFS_SBI(inode_sb(ip)));
 
 	/* Lock the AG specific inode map information
 	 */
@@ -928,14 +929,14 @@ int diFree(struct inode *ip)
 	mask = HIGHORDER >> bitno;
 
 	if (!(le32_to_cpu(iagp->wmap[extno]) & mask)) {
-		jfs_error(ip->i_sb, "wmap shows inode already free\n");
+		jfs_error(inode_sb(ip), "wmap shows inode already free\n");
 	}
 
 	if (!addressPXD(&iagp->inoext[extno])) {
 		release_metapage(mp);
 		IREAD_UNLOCK(ipimap);
 		AG_UNLOCK(imap, agno);
-		jfs_error(ip->i_sb, "invalid inoext\n");
+		jfs_error(inode_sb(ip), "invalid inoext\n");
 		return -EIO;
 	}
 
@@ -947,7 +948,7 @@ int diFree(struct inode *ip)
 		release_metapage(mp);
 		IREAD_UNLOCK(ipimap);
 		AG_UNLOCK(imap, agno);
-		jfs_error(ip->i_sb, "numfree > numinos\n");
+		jfs_error(inode_sb(ip), "numfree > numinos\n");
 		return -EIO;
 	}
 	/*
@@ -1196,7 +1197,7 @@ int diFree(struct inode *ip)
 	 * for the inode being freed.
 	 */
 	if (iagp->pmap[extno] != 0) {
-		jfs_error(ip->i_sb, "the pmap does not show inode free\n");
+		jfs_error(inode_sb(ip), "the pmap does not show inode free\n");
 	}
 	iagp->wmap[extno] = 0;
 	PXDlength(&iagp->inoext[extno], 0);
@@ -1245,7 +1246,7 @@ int diFree(struct inode *ip)
 	 * BUT with new/different backing inode extent from the extent
 	 * to be freed by the transaction;
 	 */
-	tid = txBegin(ipimap->i_sb, COMMIT_FORCE);
+	tid = txBegin(inode_sb(ipimap), COMMIT_FORCE);
 	mutex_lock(&JFS_IP(ipimap)->commit_mutex);
 
 	/* acquire tlock of the iag page of the freed ixad
@@ -1351,7 +1352,7 @@ int diAlloc(struct inode *pip, bool dir, struct inode *ip)
 	/* get the pointers to the inode map inode and the
 	 * corresponding imap control structure.
 	 */
-	ipimap = JFS_SBI(pip->i_sb)->ipimap;
+	ipimap = JFS_SBI(inode_sb(pip))->ipimap;
 	imap = JFS_IP(ipimap)->i_imap;
 	JFS_IP(ip)->ipimap = ipimap;
 	JFS_IP(ip)->fileset = FILESYSTEM_I;
@@ -1360,7 +1361,7 @@ int diAlloc(struct inode *pip, bool dir, struct inode *ip)
 	 * at the ag level using the preferred ag.
 	 */
 	if (dir) {
-		agno = dbNextAG(JFS_SBI(pip->i_sb)->ipbmap);
+		agno = dbNextAG(JFS_SBI(inode_sb(pip))->ipbmap);
 		AG_LOCK(imap, agno);
 		goto tryag;
 	}
@@ -1375,15 +1376,15 @@ int diAlloc(struct inode *pip, bool dir, struct inode *ip)
 	 */
 
 	/* get the ag number of this iag */
-	agno = BLKTOAG(JFS_IP(pip)->agstart, JFS_SBI(pip->i_sb));
+	agno = BLKTOAG(JFS_IP(pip)->agstart, JFS_SBI(inode_sb(pip)));
 
-	if (atomic_read(&JFS_SBI(pip->i_sb)->bmap->db_active[agno])) {
+	if (atomic_read(&JFS_SBI(inode_sb(pip))->bmap->db_active[agno])) {
 		/*
 		 * There is an open file actively growing.  We want to
 		 * allocate new inodes from a different ag to avoid
 		 * fragmentation problems.
 		 */
-		agno = dbNextAG(JFS_SBI(pip->i_sb)->ipbmap);
+		agno = dbNextAG(JFS_SBI(inode_sb(pip))->ipbmap);
 		AG_LOCK(imap, agno);
 		goto tryag;
 	}
@@ -1514,7 +1515,7 @@ int diAlloc(struct inode *pip, bool dir, struct inode *ip)
 					IREAD_UNLOCK(ipimap);
 					release_metapage(mp);
 					AG_UNLOCK(imap, agno);
-					jfs_error(ip->i_sb,
+					jfs_error(inode_sb(ip),
 						  "can't find free bit in wmap\n");
 					return -EIO;
 				}
@@ -1656,7 +1657,7 @@ diAllocAG(struct inomap * imap, int agno, bool dir, struct inode *ip)
 	numinos = imap->im_agctl[agno].numinos;
 
 	if (numfree > numinos) {
-		jfs_error(ip->i_sb, "numfree > numinos\n");
+		jfs_error(inode_sb(ip), "numfree > numinos\n");
 		return -EIO;
 	}
 
@@ -1718,7 +1719,7 @@ static int
 diAllocAny(struct inomap * imap, int agno, bool dir, struct inode *ip)
 {
 	int ag, rc;
-	int maxag = JFS_SBI(imap->im_ipimap->i_sb)->bmap->db_maxag;
+	int maxag = JFS_SBI(inode_sb(imap->im_ipimap))->bmap->db_maxag;
 
 
 	/* try to allocate from the ags following agno up to
@@ -1807,7 +1808,8 @@ static int diAllocIno(struct inomap * imap, int agno, struct inode *ip)
 	if (!iagp->nfreeinos) {
 		IREAD_UNLOCK(imap->im_ipimap);
 		release_metapage(mp);
-		jfs_error(ip->i_sb, "nfreeinos = 0, but iag on freelist\n");
+		jfs_error(inode_sb(ip),
+			  "nfreeinos = 0, but iag on freelist\n");
 		return -EIO;
 	}
 
@@ -1818,7 +1820,7 @@ static int diAllocIno(struct inomap * imap, int agno, struct inode *ip)
 		if (sword >= SMAPSZ) {
 			IREAD_UNLOCK(imap->im_ipimap);
 			release_metapage(mp);
-			jfs_error(ip->i_sb,
+			jfs_error(inode_sb(ip),
 				  "free inode not found in summary map\n");
 			return -EIO;
 		}
@@ -1834,7 +1836,7 @@ static int diAllocIno(struct inomap * imap, int agno, struct inode *ip)
 	if (rem >= EXTSPERSUM) {
 		IREAD_UNLOCK(imap->im_ipimap);
 		release_metapage(mp);
-		jfs_error(ip->i_sb, "no free extent found\n");
+		jfs_error(inode_sb(ip), "no free extent found\n");
 		return -EIO;
 	}
 	extno = (sword << L2EXTSPERSUM) + rem;
@@ -1845,7 +1847,7 @@ static int diAllocIno(struct inomap * imap, int agno, struct inode *ip)
 	if (rem >= INOSPEREXT) {
 		IREAD_UNLOCK(imap->im_ipimap);
 		release_metapage(mp);
-		jfs_error(ip->i_sb, "free inode not found\n");
+		jfs_error(inode_sb(ip), "free inode not found\n");
 		return -EIO;
 	}
 
@@ -1931,7 +1933,7 @@ static int diAllocExt(struct inomap * imap, int agno, struct inode *ip)
 		IREAD_LOCK(imap->im_ipimap, RDWRLOCK_IMAP);
 		if ((rc = diIAGRead(imap, iagno, &mp))) {
 			IREAD_UNLOCK(imap->im_ipimap);
-			jfs_error(ip->i_sb, "error reading iag\n");
+			jfs_error(inode_sb(ip), "error reading iag\n");
 			return rc;
 		}
 		iagp = (struct iag *) mp->data;
@@ -1943,7 +1945,8 @@ static int diAllocExt(struct inomap * imap, int agno, struct inode *ip)
 		if (sword >= SMAPSZ) {
 			release_metapage(mp);
 			IREAD_UNLOCK(imap->im_ipimap);
-			jfs_error(ip->i_sb, "free ext summary map not found\n");
+			jfs_error(inode_sb(ip),
+				  "free ext summary map not found\n");
 			return -EIO;
 		}
 		if (~iagp->extsmap[sword])
@@ -1956,7 +1959,7 @@ static int diAllocExt(struct inomap * imap, int agno, struct inode *ip)
 	if (rem >= EXTSPERSUM) {
 		release_metapage(mp);
 		IREAD_UNLOCK(imap->im_ipimap);
-		jfs_error(ip->i_sb, "free extent not found\n");
+		jfs_error(inode_sb(ip), "free extent not found\n");
 		return -EIO;
 	}
 	extno = (sword << L2EXTSPERSUM) + rem;
@@ -2057,7 +2060,8 @@ static int diAllocBit(struct inomap * imap, struct iag * iagp, int ino)
 	/* get the ag number, extent number, inode number within
 	 * the extent.
 	 */
-	agno = BLKTOAG(le64_to_cpu(iagp->agstart), JFS_SBI(imap->im_ipimap->i_sb));
+	agno = BLKTOAG(le64_to_cpu(iagp->agstart),
+		       JFS_SBI(inode_sb(imap->im_ipimap)));
 	extno = ino >> L2INOSPEREXT;
 	bitno = ino & (INOSPEREXT - 1);
 
@@ -2075,7 +2079,7 @@ static int diAllocBit(struct inomap * imap, struct iag * iagp, int ino)
 		if (bmp)
 			release_metapage(bmp);
 
-		jfs_error(imap->im_ipimap->i_sb, "iag inconsistent\n");
+		jfs_error(inode_sb(imap->im_ipimap), "iag inconsistent\n");
 		return -EIO;
 	}
 
@@ -2182,14 +2186,14 @@ static int diNewExt(struct inomap * imap, struct iag * iagp, int extno)
 	/* better have free extents.
 	 */
 	if (!iagp->nfreeexts) {
-		jfs_error(imap->im_ipimap->i_sb, "no free extents\n");
+		jfs_error(inode_sb(imap->im_ipimap), "no free extents\n");
 		return -EIO;
 	}
 
 	/* get the inode map inode.
 	 */
 	ipimap = imap->im_ipimap;
-	sbi = JFS_SBI(ipimap->i_sb);
+	sbi = JFS_SBI(inode_sb(ipimap));
 
 	amp = bmp = cmp = NULL;
 
@@ -2253,7 +2257,7 @@ static int diNewExt(struct inomap * imap, struct iag * iagp, int extno)
 				ciagp = (struct iag *) cmp->data;
 			}
 			if (ciagp == NULL) {
-				jfs_error(imap->im_ipimap->i_sb,
+				jfs_error(inode_sb(imap->im_ipimap),
 					  "ciagp == NULL\n");
 				rc = -EIO;
 				goto error_out;
@@ -2464,7 +2468,7 @@ diNewIAG(struct inomap * imap, int *iagnop, int agno, struct metapage ** mpp)
 
 	/* pick up pointers to the inode map and mount inodes */
 	ipimap = imap->im_ipimap;
-	sb = ipimap->i_sb;
+	sb = inode_sb(ipimap);
 	sbi = JFS_SBI(sb);
 
 	/* acquire the free iag lock */
@@ -2490,7 +2494,7 @@ diNewIAG(struct inomap * imap, int *iagnop, int agno, struct metapage ** mpp)
 		if (ipimap->i_size >> L2PSIZE != imap->im_nextiag + 1) {
 			IWRITE_UNLOCK(ipimap);
 			IAGFREE_UNLOCK(imap);
-			jfs_error(imap->im_ipimap->i_sb,
+			jfs_error(inode_sb(imap->im_ipimap),
 				  "ipimap->i_size is wrong\n");
 			return -EIO;
 		}
@@ -2677,7 +2681,7 @@ static int diIAGRead(struct inomap * imap, int iagno, struct metapage ** mpp)
 	s64 blkno;
 
 	/* compute the logical block number of the iag. */
-	blkno = IAGTOLBLK(iagno, JFS_SBI(ipimap->i_sb)->l2nbperpage);
+	blkno = IAGTOLBLK(iagno, JFS_SBI(inode_sb(ipimap))->l2nbperpage);
 
 	/* read the iag. */
 	*mpp = read_metapage(ipimap, blkno, PSIZE, 0);
@@ -2751,7 +2755,7 @@ diUpdatePMap(struct inode *ipimap,
 	iagno = INOTOIAG(inum);
 	/* make sure that the iag is contained within the map */
 	if (iagno >= imap->im_nextiag) {
-		jfs_error(ipimap->i_sb, "the iag is outside the map\n");
+		jfs_error(inode_sb(ipimap), "the iag is outside the map\n");
 		return -EIO;
 	}
 	/* read the iag */
@@ -2779,12 +2783,12 @@ diUpdatePMap(struct inode *ipimap,
 		 * of last reference release;
 		 */
 		if (!(le32_to_cpu(iagp->wmap[extno]) & mask)) {
-			jfs_error(ipimap->i_sb,
+			jfs_error(inode_sb(ipimap),
 				  "inode %ld not marked as allocated in wmap!\n",
 				  inum);
 		}
 		if (!(le32_to_cpu(iagp->pmap[extno]) & mask)) {
-			jfs_error(ipimap->i_sb,
+			jfs_error(inode_sb(ipimap),
 				  "inode %ld not marked as allocated in pmap!\n",
 				  inum);
 		}
@@ -2800,13 +2804,13 @@ diUpdatePMap(struct inode *ipimap,
 		 */
 		if (!(le32_to_cpu(iagp->wmap[extno]) & mask)) {
 			release_metapage(mp);
-			jfs_error(ipimap->i_sb,
+			jfs_error(inode_sb(ipimap),
 				  "the inode is not allocated in the working map\n");
 			return -EIO;
 		}
 		if ((le32_to_cpu(iagp->pmap[extno]) & mask) != 0) {
 			release_metapage(mp);
-			jfs_error(ipimap->i_sb,
+			jfs_error(inode_sb(ipimap),
 				  "the inode is not free in the persistent map\n");
 			return -EIO;
 		}
@@ -2860,7 +2864,7 @@ int diExtendFS(struct inode *ipimap, struct inode *ipbmap)
 	int rc, rcx = 0;
 	struct inomap *imap = JFS_IP(ipimap)->i_imap;
 	struct iag *iagp = NULL, *hiagp = NULL;
-	struct bmap *mp = JFS_SBI(ipbmap->i_sb)->bmap;
+	struct bmap *mp = JFS_SBI(inode_sb(ipbmap))->bmap;
 	struct metapage *bp, *hbp;
 	int i, n, head;
 	int numinos, xnuminos = 0, xnumfree = 0;
@@ -2899,7 +2903,8 @@ int diExtendFS(struct inode *ipimap, struct inode *ipbmap)
 		iagp = (struct iag *) bp->data;
 		if (le32_to_cpu(iagp->iagnum) != i) {
 			release_metapage(bp);
-			jfs_error(ipimap->i_sb, "unexpected value of iagnum\n");
+			jfs_error(inode_sb(ipimap),
+				  "unexpected value of iagnum\n");
 			return -EIO;
 		}
 
@@ -2975,7 +2980,7 @@ int diExtendFS(struct inode *ipimap, struct inode *ipbmap)
 
 	if (xnuminos != atomic_read(&imap->im_numinos) ||
 	    xnumfree != atomic_read(&imap->im_numfree)) {
-		jfs_error(ipimap->i_sb, "numinos or numfree incorrect\n");
+		jfs_error(inode_sb(ipimap), "numinos or numfree incorrect\n");
 		return -EIO;
 	}
 
@@ -3045,7 +3050,7 @@ static void duplicateIXtree(struct super_block *sb, s64 blkno,
 static int copy_from_dinode(struct dinode * dip, struct inode *ip)
 {
 	struct jfs_inode_info *jfs_ip = JFS_IP(ip);
-	struct jfs_sb_info *sbi = JFS_SBI(ip->i_sb);
+	struct jfs_sb_info *sbi = JFS_SBI(inode_sb(ip));
 
 	jfs_ip->fileset = le32_to_cpu(dip->di_fileset);
 	jfs_ip->mode2 = le32_to_cpu(dip->di_mode);
@@ -3087,7 +3092,7 @@ static int copy_from_dinode(struct dinode * dip, struct inode *ip)
 	ip->i_mtime.tv_nsec = le32_to_cpu(dip->di_mtime.tv_nsec);
 	ip->i_ctime.tv_sec = le32_to_cpu(dip->di_ctime.tv_sec);
 	ip->i_ctime.tv_nsec = le32_to_cpu(dip->di_ctime.tv_nsec);
-	ip->i_blocks = LBLK2PBLK(ip->i_sb, le64_to_cpu(dip->di_nblocks));
+	ip->i_blocks = LBLK2PBLK(inode_sb(ip), le64_to_cpu(dip->di_nblocks));
 	ip->i_generation = le32_to_cpu(dip->di_gen);
 
 	jfs_ip->ixpxd = dip->di_ixpxd;	/* in-memory pxd's are little-endian */
@@ -3129,14 +3134,14 @@ static int copy_from_dinode(struct dinode * dip, struct inode *ip)
 static void copy_to_dinode(struct dinode * dip, struct inode *ip)
 {
 	struct jfs_inode_info *jfs_ip = JFS_IP(ip);
-	struct jfs_sb_info *sbi = JFS_SBI(ip->i_sb);
+	struct jfs_sb_info *sbi = JFS_SBI(inode_sb(ip));
 
 	dip->di_fileset = cpu_to_le32(jfs_ip->fileset);
 	dip->di_inostamp = cpu_to_le32(sbi->inostamp);
 	dip->di_number = cpu_to_le32(ip->i_ino);
 	dip->di_gen = cpu_to_le32(ip->i_generation);
 	dip->di_size = cpu_to_le64(ip->i_size);
-	dip->di_nblocks = cpu_to_le64(PBLK2LBLK(ip->i_sb, ip->i_blocks));
+	dip->di_nblocks = cpu_to_le64(PBLK2LBLK(inode_sb(ip), ip->i_blocks));
 	dip->di_nlink = cpu_to_le32(ip->i_nlink);
 	if (!uid_valid(sbi->uid))
 		dip->di_uid = cpu_to_le32(i_uid_read(ip));
diff --git a/fs/jfs/jfs_incore.h b/fs/jfs/jfs_incore.h
index 1f26d1910409..b41b26ab850e 100644
--- a/fs/jfs/jfs_incore.h
+++ b/fs/jfs/jfs_incore.h
@@ -221,7 +221,7 @@ static inline struct jfs_sb_info *JFS_SBI(struct super_block *sb)
 
 static inline int isReadOnly(struct inode *inode)
 {
-	if (JFS_SBI(inode->i_sb)->log)
+	if (JFS_SBI(inode_sb(inode))->log)
 		return 0;
 	return 1;
 }
diff --git a/fs/jfs/jfs_inode.c b/fs/jfs/jfs_inode.c
index 5e9b7bb3aabf..4d80820a38a5 100644
--- a/fs/jfs/jfs_inode.c
+++ b/fs/jfs/jfs_inode.c
@@ -53,7 +53,7 @@ void jfs_set_inode_flags(struct inode *inode)
  */
 struct inode *ialloc(struct inode *parent, umode_t mode)
 {
-	struct super_block *sb = parent->i_sb;
+	struct super_block *sb = inode_sb(parent);
 	struct inode *inode;
 	struct jfs_inode_info *jfs_inode;
 	int rc;
diff --git a/fs/jfs/jfs_metapage.c b/fs/jfs/jfs_metapage.c
index 1a3b0cc22ad3..76ada7bf5680 100644
--- a/fs/jfs/jfs_metapage.c
+++ b/fs/jfs/jfs_metapage.c
@@ -250,7 +250,7 @@ static sector_t metapage_get_blocks(struct inode *inode, sector_t lblock,
 	int rc = 0;
 	int xflag;
 	s64 xaddr;
-	sector_t file_blocks = (inode->i_size + inode->i_sb->s_blocksize - 1) >>
+	sector_t file_blocks = (inode->i_size + inode_sb(inode)->s_blocksize - 1) >>
 			       inode->i_blkbits;
 
 	if (lblock >= file_blocks)
@@ -350,7 +350,7 @@ static int metapage_writepage(struct page *page, struct writeback_control *wbc)
 	struct bio *bio = NULL;
 	int block_offset;	/* block offset of mp within page */
 	struct inode *inode = page->mapping->host;
-	int blocks_per_mp = JFS_SBI(inode->i_sb)->nbperpage;
+	int blocks_per_mp = JFS_SBI(inode_sb(inode))->nbperpage;
 	int len;
 	int xlen;
 	struct metapage *mp;
@@ -427,10 +427,10 @@ static int metapage_writepage(struct page *page, struct writeback_control *wbc)
 			bad_blocks++;
 			continue;
 		}
-		len = min(xlen, (int)JFS_SBI(inode->i_sb)->nbperpage);
+		len = min(xlen, (int)JFS_SBI(inode_sb(inode))->nbperpage);
 
 		bio = bio_alloc(GFP_NOFS, 1);
-		bio_set_dev(bio, inode->i_sb->s_bdev);
+		bio_set_dev(bio, inode_sb(inode)->s_bdev);
 		bio->bi_iter.bi_sector = pblock << (inode->i_blkbits - 9);
 		bio->bi_end_io = metapage_write_end_io;
 		bio->bi_private = page;
@@ -510,7 +510,7 @@ static int metapage_readpage(struct file *fp, struct page *page)
 				submit_bio(bio);
 
 			bio = bio_alloc(GFP_NOFS, 1);
-			bio_set_dev(bio, inode->i_sb->s_bdev);
+			bio_set_dev(bio, inode_sb(inode)->s_bdev);
 			bio->bi_iter.bi_sector =
 				pblock << (inode->i_blkbits - 9);
 			bio->bi_end_io = metapage_read_end_io;
@@ -611,7 +611,7 @@ struct metapage *__get_metapage(struct inode *inode, unsigned long lblock,
 		return NULL;
 	}
 	if (absolute)
-		mapping = JFS_SBI(inode->i_sb)->direct_inode->i_mapping;
+		mapping = JFS_SBI(inode_sb(inode))->direct_inode->i_mapping;
 	else {
 		/*
 		 * If an nfs client tries to read an inode that is larger
@@ -642,7 +642,7 @@ struct metapage *__get_metapage(struct inode *inode, unsigned long lblock,
 	mp = page_to_mp(page, page_offset);
 	if (mp) {
 		if (mp->logical_size != size) {
-			jfs_error(inode->i_sb,
+			jfs_error(inode_sb(inode),
 				  "get_mp->logical_size != size\n");
 			jfs_err("logical_size = %d, size = %d",
 				mp->logical_size, size);
@@ -653,7 +653,7 @@ struct metapage *__get_metapage(struct inode *inode, unsigned long lblock,
 		lock_metapage(mp);
 		if (test_bit(META_discard, &mp->flag)) {
 			if (!new) {
-				jfs_error(inode->i_sb,
+				jfs_error(inode_sb(inode),
 					  "using a discarded metapage\n");
 				discard_metapage(mp);
 				goto unlock;
@@ -666,7 +666,7 @@ struct metapage *__get_metapage(struct inode *inode, unsigned long lblock,
 		if (!mp)
 			goto unlock;
 		mp->page = page;
-		mp->sb = inode->i_sb;
+		mp->sb = inode_sb(inode);
 		mp->flag = 0;
 		mp->xflag = COMMIT_PAGE;
 		mp->count = 1;
@@ -781,7 +781,7 @@ void __invalidate_metapages(struct inode *ip, s64 addr, int len)
 	int BlocksPerPage = 1 << l2BlocksPerPage;
 	/* All callers are interested in block device's mapping */
 	struct address_space *mapping =
-		JFS_SBI(ip->i_sb)->direct_inode->i_mapping;
+		JFS_SBI(inode_sb(ip))->direct_inode->i_mapping;
 	struct metapage *mp;
 	struct page *page;
 	unsigned int offset;
diff --git a/fs/jfs/jfs_txnmgr.c b/fs/jfs/jfs_txnmgr.c
index 4d973524c887..ca16cecc7949 100644
--- a/fs/jfs/jfs_txnmgr.c
+++ b/fs/jfs/jfs_txnmgr.c
@@ -1155,7 +1155,7 @@ int txCommit(tid_t tid,		/* transaction identifier */
 		goto TheEnd;
 	}
 
-	sb = cd.sb = iplist[0]->i_sb;
+	sb = cd.sb = inode_sb(iplist[0]);
 	cd.tid = tid;
 
 	if (tid == 0)
@@ -1396,7 +1396,7 @@ static int txLog(struct jfs_log * log, struct tblock * tblk, struct commit * cd)
 
 		/* initialize lrd common */
 		ip = tlck->ip;
-		lrd->aggregate = cpu_to_le32(JFS_SBI(ip->i_sb)->aggregate);
+		lrd->aggregate = cpu_to_le32(JFS_SBI(inode_sb(ip))->aggregate);
 		lrd->log.redopage.fileset = cpu_to_le32(JFS_IP(ip)->fileset);
 		lrd->log.redopage.inode = cpu_to_le32(ip->i_ino);
 
@@ -2437,7 +2437,7 @@ static void txUpdateMap(struct tblock * tblk)
 static void txAllocPMap(struct inode *ip, struct maplock * maplock,
 			struct tblock * tblk)
 {
-	struct inode *ipbmap = JFS_SBI(ip->i_sb)->ipbmap;
+	struct inode *ipbmap = JFS_SBI(inode_sb(ip))->ipbmap;
 	struct xdlistlock *xadlistlock;
 	xad_t *xad;
 	s64 xaddr;
@@ -2495,7 +2495,7 @@ static void txAllocPMap(struct inode *ip, struct maplock * maplock,
 void txFreeMap(struct inode *ip,
 	       struct maplock * maplock, struct tblock * tblk, int maptype)
 {
-	struct inode *ipbmap = JFS_SBI(ip->i_sb)->ipbmap;
+	struct inode *ipbmap = JFS_SBI(inode_sb(ip))->ipbmap;
 	struct xdlistlock *xadlistlock;
 	xad_t *xad;
 	s64 xaddr;
@@ -2875,7 +2875,7 @@ void txQuiesce(struct super_block *sb)
 		 * when it is committed
 		 */
 		TXN_UNLOCK();
-		tid = txBegin(ip->i_sb, COMMIT_INODE | COMMIT_FORCE);
+		tid = txBegin(inode_sb(ip), COMMIT_INODE | COMMIT_FORCE);
 		mutex_lock(&jfs_ip->commit_mutex);
 		txCommit(tid, 1, &ip, 0);
 		txEnd(tid);
@@ -2952,7 +2952,7 @@ int jfs_sync(void *arg)
 				 * when it is committed
 				 */
 				TXN_UNLOCK();
-				tid = txBegin(ip->i_sb, COMMIT_INODE);
+				tid = txBegin(inode_sb(ip), COMMIT_INODE);
 				txCommit(tid, 1, &ip, 0);
 				txEnd(tid);
 				mutex_unlock(&jfs_ip->commit_mutex);
diff --git a/fs/jfs/jfs_xtree.c b/fs/jfs/jfs_xtree.c
index 5cde6d2fcfca..e2495b369fba 100644
--- a/fs/jfs/jfs_xtree.c
+++ b/fs/jfs/jfs_xtree.c
@@ -73,7 +73,7 @@ do {									\
 		     le16_to_cpu((P)->header.maxentry)) ||		\
 		    (le16_to_cpu((P)->header.maxentry) >		\
 		     (((BN) == 0) ? XTROOTMAXSLOT : PSIZE >> L2XTSLOTSIZE))) { \
-			jfs_error((IP)->i_sb,				\
+			jfs_error(inode_sb((IP)),				\
 				  "XT_GETPAGE: xtree page corrupt\n");	\
 			BT_PUTPAGE(MP);					\
 			MP = NULL;					\
@@ -163,8 +163,8 @@ int xtLookup(struct inode *ip, s64 lstart,
 
 	if (!no_check) {
 		/* is lookup offset beyond eof ? */
-		size = ((u64) ip->i_size + (JFS_SBI(ip->i_sb)->bsize - 1)) >>
-		    JFS_SBI(ip->i_sb)->l2bsize;
+		size = ((u64) ip->i_size + (JFS_SBI(inode_sb(ip))->bsize - 1)) >>
+		    JFS_SBI(inode_sb(ip))->l2bsize;
 		if (lstart >= size)
 			return 0;
 	}
@@ -500,7 +500,7 @@ static int xtSearch(struct inode *ip, s64 xoff,	s64 *nextp,
 
 		/* push (bn, index) of the parent page/entry */
 		if (BT_STACK_FULL(btstack)) {
-			jfs_error(ip->i_sb, "stack overrun!\n");
+			jfs_error(inode_sb(ip), "stack overrun!\n");
 			XT_PUTPAGE(mp);
 			return -EIO;
 		}
@@ -764,7 +764,7 @@ xtSplitUp(tid_t tid,
 		split->pxdlist = &pxdlist;
 		pxdlist.maxnpxd = pxdlist.npxd = 0;
 		pxd = &pxdlist.pxd[0];
-		xlen = JFS_SBI(ip->i_sb)->nbperpage;
+		xlen = JFS_SBI(inode_sb(ip))->nbperpage;
 		for (; nsplit > 0; nsplit--, pxd++) {
 			if ((rc = dbAlloc(ip, (s64) 0, (s64) xlen, &xaddr))
 			    == 0) {
@@ -856,7 +856,7 @@ xtSplitUp(tid_t tid,
 			split->index = skip;	/* index at insert */
 			split->flag = XAD_NEW;
 			split->off = offsetXAD(&rcp->xad[XTENTRYSTART]);
-			split->len = JFS_SBI(ip->i_sb)->nbperpage;
+			split->len = JFS_SBI(inode_sb(ip))->nbperpage;
 			split->addr = rcbn;
 
 			/* unpin previous right child page */
@@ -904,7 +904,7 @@ xtSplitUp(tid_t tid,
 			xad = &sp->xad[skip];
 			XT_PUTENTRY(xad, XAD_NEW,
 				    offsetXAD(&rcp->xad[XTENTRYSTART]),
-				    JFS_SBI(ip->i_sb)->nbperpage, rcbn);
+				    JFS_SBI(inode_sb(ip))->nbperpage, rcbn);
 
 			/* advance next available entry index. */
 			le16_add_cpu(&sp->header.nextindex, 1);
@@ -1325,7 +1325,7 @@ xtSplitRoot(tid_t tid,
 	BT_MARK_DIRTY(split->mp, ip);
 
 	xad = &sp->xad[XTENTRYSTART];
-	XT_PUTENTRY(xad, XAD_NEW, 0, JFS_SBI(ip->i_sb)->nbperpage, rbn);
+	XT_PUTENTRY(xad, XAD_NEW, 0, JFS_SBI(inode_sb(ip))->nbperpage, rbn);
 
 	/* update page header of root */
 	sp->header.flag &= ~BT_LEAF;
@@ -1386,7 +1386,7 @@ int xtExtend(tid_t tid,		/* transaction id */
 
 	if (cmp != 0) {
 		XT_PUTPAGE(mp);
-		jfs_error(ip->i_sb, "xtSearch did not find extent\n");
+		jfs_error(inode_sb(ip), "xtSearch did not find extent\n");
 		return -EIO;
 	}
 
@@ -1394,7 +1394,7 @@ int xtExtend(tid_t tid,		/* transaction id */
 	xad = &p->xad[index];
 	if ((offsetXAD(xad) + lengthXAD(xad)) != xoff) {
 		XT_PUTPAGE(mp);
-		jfs_error(ip->i_sb, "extension is not contiguous\n");
+		jfs_error(inode_sb(ip), "extension is not contiguous\n");
 		return -EIO;
 	}
 
@@ -1553,7 +1553,7 @@ printf("xtTailgate: nxoff:0x%lx nxlen:0x%x nxaddr:0x%lx\n",
 
 	if (cmp != 0) {
 		XT_PUTPAGE(mp);
-		jfs_error(ip->i_sb, "couldn't find extent\n");
+		jfs_error(inode_sb(ip), "couldn't find extent\n");
 		return -EIO;
 	}
 
@@ -1561,7 +1561,8 @@ printf("xtTailgate: nxoff:0x%lx nxlen:0x%x nxaddr:0x%lx\n",
 	nextindex = le16_to_cpu(p->header.nextindex);
 	if (index != nextindex - 1) {
 		XT_PUTPAGE(mp);
-		jfs_error(ip->i_sb, "the entry found is not the last entry\n");
+		jfs_error(inode_sb(ip),
+			  "the entry found is not the last entry\n");
 		return -EIO;
 	}
 
@@ -1734,7 +1735,7 @@ int xtUpdate(tid_t tid, struct inode *ip, xad_t * nxad)
 
 	if (cmp != 0) {
 		XT_PUTPAGE(mp);
-		jfs_error(ip->i_sb, "Could not find extent\n");
+		jfs_error(inode_sb(ip), "Could not find extent\n");
 		return -EIO;
 	}
 
@@ -1757,7 +1758,7 @@ int xtUpdate(tid_t tid, struct inode *ip, xad_t * nxad)
 	if ((xoff > nxoff) ||
 	    (nxoff + nxlen > xoff + xlen)) {
 		XT_PUTPAGE(mp);
-		jfs_error(ip->i_sb,
+		jfs_error(inode_sb(ip),
 			  "nXAD in not completely contained within XAD\n");
 		return -EIO;
 	}
@@ -1907,7 +1908,7 @@ int xtUpdate(tid_t tid, struct inode *ip, xad_t * nxad)
 
 	if (xoff >= nxoff) {
 		XT_PUTPAGE(mp);
-		jfs_error(ip->i_sb, "xoff >= nxoff\n");
+		jfs_error(inode_sb(ip), "xoff >= nxoff\n");
 		return -EIO;
 	}
 /* #endif _JFS_WIP_COALESCE */
@@ -2048,13 +2049,13 @@ int xtUpdate(tid_t tid, struct inode *ip, xad_t * nxad)
 
 		if (cmp != 0) {
 			XT_PUTPAGE(mp);
-			jfs_error(ip->i_sb, "xtSearch failed\n");
+			jfs_error(inode_sb(ip), "xtSearch failed\n");
 			return -EIO;
 		}
 
 		if (index0 != index) {
 			XT_PUTPAGE(mp);
-			jfs_error(ip->i_sb, "unexpected value of index\n");
+			jfs_error(inode_sb(ip), "unexpected value of index\n");
 			return -EIO;
 		}
 	}
@@ -2237,7 +2238,7 @@ int xtAppend(tid_t tid,		/* transaction id */
 	split.pxdlist = &pxdlist;
 	pxdlist.maxnpxd = pxdlist.npxd = 0;
 	pxd = &pxdlist.pxd[0];
-	nblocks = JFS_SBI(ip->i_sb)->nbperpage;
+	nblocks = JFS_SBI(inode_sb(ip))->nbperpage;
 	for (; nsplit > 0; nsplit--, pxd++, xaddr += nblocks, maxblocks -= nblocks) {
 		if ((rc = dbAllocBottomUp(ip, xaddr, (s64) nblocks)) == 0) {
 			PXDaddress(pxd, xaddr);
@@ -2493,7 +2494,7 @@ xtDeleteUp(tid_t tid, struct inode *ip,
 				xaddr = addressPXD(&p->header.self);
 				/* free the page extent */
 				dbFree(ip, xaddr,
-				       (s64) JFS_SBI(ip->i_sb)->nbperpage);
+				       (s64) JFS_SBI(inode_sb(ip))->nbperpage);
 
 				/* unpin/free the buffer page */
 				discard_metapage(mp);
@@ -2587,7 +2588,7 @@ xtRelocate(tid_t tid, struct inode * ip, xad_t * oxad,	/* old XAD */
 	xlen = lengthXAD(oxad);
 
 	/* validate extent offset */
-	offset = xoff << JFS_SBI(ip->i_sb)->l2bsize;
+	offset = xoff << JFS_SBI(inode_sb(ip))->l2bsize;
 	if (offset >= ip->i_size)
 		return -ESTALE;	/* stale extent */
 
@@ -2669,9 +2670,9 @@ xtRelocate(tid_t tid, struct inode * ip, xad_t * oxad,	/* old XAD */
 		 * it is a good strategy because it may disrupt cache
 		 * policy to keep the pages in memory afterwards.
 		 */
-		offset = xoff << JFS_SBI(ip->i_sb)->l2bsize;
+		offset = xoff << JFS_SBI(inode_sb(ip))->l2bsize;
 		assert((offset & CM_OFFSET) == 0);
-		nbytes = xlen << JFS_SBI(ip->i_sb)->l2bsize;
+		nbytes = xlen << JFS_SBI(inode_sb(ip))->l2bsize;
 		pno = offset >> CM_L2BSIZE;
 		npages = (nbytes + (CM_BSIZE - 1)) >> CM_L2BSIZE;
 /*
@@ -2695,7 +2696,7 @@ xtRelocate(tid_t tid, struct inode * ip, xad_t * oxad,	/* old XAD */
 			assert(!cp->cm_modified);
 
 			/* bind buffer with the new extent address */
-			nblks = nb >> JFS_IP(ip->i_sb)->l2bsize;
+			nblks = nb >> JFS_IP(inode_sb(ip))->l2bsize;
 			cmSetXD(ip, cp, pno, dxaddr, nblks);
 
 			/* release the cbuf, mark it as modified */
@@ -2803,7 +2804,7 @@ xtRelocate(tid_t tid, struct inode * ip, xad_t * oxad,	/* old XAD */
 		    le16_to_cpu(p->header.nextindex) - xtlck->lwm.offset;
 
 		/* update the buffer extent descriptor of target xtpage */
-		xsize = xlen << JFS_SBI(ip->i_sb)->l2bsize;
+		xsize = xlen << JFS_SBI(inode_sb(ip))->l2bsize;
 		bmSetXD(mp, nxaddr, xsize);
 
 		/* unpin the target page to new homeward bound */
@@ -3225,8 +3226,8 @@ s64 xtTruncate(tid_t tid, struct inode *ip, s64 newsize, int flag)
 	 * (this will allow continued access of data/index of
 	 * temporary file (zerolink count file truncated to zero-length)).
 	 */
-	teof = (newsize + (JFS_SBI(ip->i_sb)->bsize - 1)) >>
-	    JFS_SBI(ip->i_sb)->l2bsize;
+	teof = (newsize + (JFS_SBI(inode_sb(ip))->bsize - 1)) >>
+	    JFS_SBI(inode_sb(ip))->l2bsize;
 
 	/* clear stack */
 	BT_CLR(&btstack);
@@ -3291,7 +3292,7 @@ s64 xtTruncate(tid_t tid, struct inode *ip, s64 newsize, int flag)
 			 * to avoid exhausting pagecache & tlocks
 			 */
 			XT_PUTPAGE(mp);
-			newsize = (xoff + xlen) << JFS_SBI(ip->i_sb)->l2bsize;
+			newsize = (xoff + xlen) << JFS_SBI(inode_sb(ip))->l2bsize;
 			goto getParent;
 		}
 		tlck = txLock(tid, ip, mp, tlckXTREE);
@@ -3649,7 +3650,7 @@ s64 xtTruncate(tid_t tid, struct inode *ip, s64 newsize, int flag)
       getChild:
 	/* save current parent entry for the child page */
 	if (BT_STACK_FULL(&btstack)) {
-		jfs_error(ip->i_sb, "stack overrun!\n");
+		jfs_error(inode_sb(ip), "stack overrun!\n");
 		XT_PUTPAGE(mp);
 		return -EIO;
 	}
@@ -3741,7 +3742,7 @@ s64 xtTruncate_pmap(tid_t tid, struct inode *ip, s64 committed_size)
 	BT_CLR(&btstack);
 
 	if (committed_size) {
-		xoff = (committed_size >> JFS_SBI(ip->i_sb)->l2bsize) - 1;
+		xoff = (committed_size >> JFS_SBI(inode_sb(ip))->l2bsize) - 1;
 		rc = xtSearch(ip, xoff, NULL, &cmp, &btstack, 0);
 		if (rc)
 			return rc;
@@ -3750,7 +3751,7 @@ s64 xtTruncate_pmap(tid_t tid, struct inode *ip, s64 committed_size)
 
 		if (cmp != 0) {
 			XT_PUTPAGE(mp);
-			jfs_error(ip->i_sb, "did not find extent\n");
+			jfs_error(inode_sb(ip), "did not find extent\n");
 			return -EIO;
 		}
 	} else {
@@ -3789,7 +3790,7 @@ s64 xtTruncate_pmap(tid_t tid, struct inode *ip, s64 committed_size)
 		xoff = offsetXAD(xad);
 		xlen = lengthXAD(xad);
 		XT_PUTPAGE(mp);
-		return (xoff + xlen) << JFS_SBI(ip->i_sb)->l2bsize;
+		return (xoff + xlen) << JFS_SBI(inode_sb(ip))->l2bsize;
 	}
 	tlck = txLock(tid, ip, mp, tlckXTREE);
 	tlck->type = tlckXTREE | tlckFREE;
@@ -3849,7 +3850,7 @@ s64 xtTruncate_pmap(tid_t tid, struct inode *ip, s64 committed_size)
       getChild:
 	/* save current parent entry for the child page */
 	if (BT_STACK_FULL(&btstack)) {
-		jfs_error(ip->i_sb, "stack overrun!\n");
+		jfs_error(inode_sb(ip), "stack overrun!\n");
 		XT_PUTPAGE(mp);
 		return -EIO;
 	}
diff --git a/fs/jfs/namei.c b/fs/jfs/namei.c
index b41596d71858..fd14fb2879b2 100644
--- a/fs/jfs/namei.c
+++ b/fs/jfs/namei.c
@@ -108,7 +108,7 @@ static int jfs_create(struct inode *dip, struct dentry *dentry, umode_t mode,
 		goto out2;
 	}
 
-	tid = txBegin(dip->i_sb, 0);
+	tid = txBegin(inode_sb(dip), 0);
 
 	mutex_lock_nested(&JFS_IP(dip)->commit_mutex, COMMIT_MUTEX_PARENT);
 	mutex_lock_nested(&JFS_IP(ip)->commit_mutex, COMMIT_MUTEX_CHILD);
@@ -242,7 +242,7 @@ static int jfs_mkdir(struct inode *dip, struct dentry *dentry, umode_t mode)
 		goto out2;
 	}
 
-	tid = txBegin(dip->i_sb, 0);
+	tid = txBegin(inode_sb(dip), 0);
 
 	mutex_lock_nested(&JFS_IP(dip)->commit_mutex, COMMIT_MUTEX_PARENT);
 	mutex_lock_nested(&JFS_IP(ip)->commit_mutex, COMMIT_MUTEX_CHILD);
@@ -376,7 +376,7 @@ static int jfs_rmdir(struct inode *dip, struct dentry *dentry)
 		goto out;
 	}
 
-	tid = txBegin(dip->i_sb, 0);
+	tid = txBegin(inode_sb(dip), 0);
 
 	mutex_lock_nested(&JFS_IP(dip)->commit_mutex, COMMIT_MUTEX_PARENT);
 	mutex_lock_nested(&JFS_IP(ip)->commit_mutex, COMMIT_MUTEX_CHILD);
@@ -503,7 +503,7 @@ static int jfs_unlink(struct inode *dip, struct dentry *dentry)
 
 	IWRITE_LOCK(ip, RDWRLOCK_NORMAL);
 
-	tid = txBegin(dip->i_sb, 0);
+	tid = txBegin(inode_sb(dip), 0);
 
 	mutex_lock_nested(&JFS_IP(dip)->commit_mutex, COMMIT_MUTEX_PARENT);
 	mutex_lock_nested(&JFS_IP(ip)->commit_mutex, COMMIT_MUTEX_CHILD);
@@ -576,7 +576,7 @@ static int jfs_unlink(struct inode *dip, struct dentry *dentry)
 	mutex_unlock(&JFS_IP(dip)->commit_mutex);
 
 	while (new_size && (rc == 0)) {
-		tid = txBegin(dip->i_sb, 0);
+		tid = txBegin(inode_sb(dip), 0);
 		mutex_lock(&JFS_IP(ip)->commit_mutex);
 		new_size = xtTruncate_pmap(tid, ip, new_size);
 		if (new_size < 0) {
@@ -815,7 +815,7 @@ static int jfs_link(struct dentry *old_dentry,
 	if (rc)
 		goto out;
 
-	tid = txBegin(ip->i_sb, 0);
+	tid = txBegin(inode_sb(ip), 0);
 
 	mutex_lock_nested(&JFS_IP(dir)->commit_mutex, COMMIT_MUTEX_PARENT);
 	mutex_lock_nested(&JFS_IP(ip)->commit_mutex, COMMIT_MUTEX_CHILD);
@@ -930,7 +930,7 @@ static int jfs_symlink(struct inode *dip, struct dentry *dentry,
 		goto out2;
 	}
 
-	tid = txBegin(dip->i_sb, 0);
+	tid = txBegin(inode_sb(dip), 0);
 
 	mutex_lock_nested(&JFS_IP(dip)->commit_mutex, COMMIT_MUTEX_PARENT);
 	mutex_lock_nested(&JFS_IP(ip)->commit_mutex, COMMIT_MUTEX_CHILD);
@@ -991,7 +991,7 @@ static int jfs_symlink(struct inode *dip, struct dentry *dentry,
 		 * path name) is treated as non-journaled user data,
 		 * it is read/written thru buffer cache for performance.
 		 */
-		sb = ip->i_sb;
+		sb = inode_sb(ip);
 		bmask = JFS_SBI(sb)->bsize - 1;
 		xsize = (ssize + bmask) & ~bmask;
 		xaddr = 0;
@@ -1163,7 +1163,7 @@ static int jfs_rename(struct inode *old_dir, struct dentry *old_dentry,
 	/*
 	 * The real work starts here
 	 */
-	tid = txBegin(new_dir->i_sb, 0);
+	tid = txBegin(inode_sb(new_dir), 0);
 
 	/*
 	 * How do we know the locking is safe from deadlocks?
@@ -1199,7 +1199,7 @@ static int jfs_rename(struct inode *old_dir, struct dentry *old_dentry,
 				mutex_unlock(&JFS_IP(new_dir)->commit_mutex);
 				if (!S_ISDIR(old_ip->i_mode) && new_ip)
 					IWRITE_UNLOCK(new_ip);
-				jfs_error(new_ip->i_sb,
+				jfs_error(inode_sb(new_ip),
 					  "new_ip->i_nlink != 0\n");
 				return -EIO;
 			}
@@ -1322,7 +1322,7 @@ static int jfs_rename(struct inode *old_dir, struct dentry *old_dentry,
 	mutex_unlock(&JFS_IP(new_dir)->commit_mutex);
 
 	while (new_size && (rc == 0)) {
-		tid = txBegin(new_ip->i_sb, 0);
+		tid = txBegin(inode_sb(new_ip), 0);
 		mutex_lock(&JFS_IP(new_ip)->commit_mutex);
 		new_size = xtTruncate_pmap(tid, new_ip, new_size);
 		if (new_size < 0) {
@@ -1392,7 +1392,7 @@ static int jfs_mknod(struct inode *dir, struct dentry *dentry,
 	}
 	jfs_ip = JFS_IP(ip);
 
-	tid = txBegin(dir->i_sb, 0);
+	tid = txBegin(inode_sb(dir), 0);
 
 	mutex_lock_nested(&JFS_IP(dir)->commit_mutex, COMMIT_MUTEX_PARENT);
 	mutex_lock_nested(&JFS_IP(ip)->commit_mutex, COMMIT_MUTEX_CHILD);
@@ -1479,7 +1479,7 @@ static struct dentry *jfs_lookup(struct inode *dip, struct dentry *dentry, unsig
 		jfs_err("jfs_lookup: dtSearch returned %d", rc);
 		ip = ERR_PTR(rc);
 	} else {
-		ip = jfs_iget(dip->i_sb, inum);
+		ip = jfs_iget(inode_sb(dip), inum);
 		if (IS_ERR(ip))
 			jfs_err("jfs_lookup: iget failed on inum %d", (uint)inum);
 	}
diff --git a/fs/jfs/super.c b/fs/jfs/super.c
index 1b9264fd54b6..2a49d6d31b42 100644
--- a/fs/jfs/super.c
+++ b/fs/jfs/super.c
@@ -139,7 +139,7 @@ static void jfs_destroy_inode(struct inode *inode)
 
 	spin_lock_irq(&ji->ag_lock);
 	if (ji->active_ag != -1) {
-		struct bmap *bmap = JFS_SBI(inode->i_sb)->bmap;
+		struct bmap *bmap = JFS_SBI(inode_sb(inode))->bmap;
 		atomic_dec(&bmap->db_active[ji->active_ag]);
 		ji->active_ag = -1;
 	}
diff --git a/fs/jfs/xattr.c b/fs/jfs/xattr.c
index c60f3d32ee91..323de7df3334 100644
--- a/fs/jfs/xattr.c
+++ b/fs/jfs/xattr.c
@@ -214,7 +214,7 @@ static int ea_write_inline(struct inode *ip, struct jfs_ea_list *ealist,
 static int ea_write(struct inode *ip, struct jfs_ea_list *ealist, int size,
 		       dxd_t * ea)
 {
-	struct super_block *sb = ip->i_sb;
+	struct super_block *sb = inode_sb(ip);
 	struct jfs_inode_info *ji = JFS_IP(ip);
 	struct jfs_sb_info *sbi = JFS_SBI(sb);
 	int nblocks;
@@ -363,7 +363,7 @@ static int ea_read_inline(struct inode *ip, struct jfs_ea_list *ealist)
  */
 static int ea_read(struct inode *ip, struct jfs_ea_list *ealist)
 {
-	struct super_block *sb = ip->i_sb;
+	struct super_block *sb = inode_sb(ip);
 	struct jfs_inode_info *ji = JFS_IP(ip);
 	struct jfs_sb_info *sbi = JFS_SBI(sb);
 	int nblocks;
@@ -439,7 +439,7 @@ static int ea_read(struct inode *ip, struct jfs_ea_list *ealist)
 static int ea_get(struct inode *inode, struct ea_buffer *ea_buf, int min_size)
 {
 	struct jfs_inode_info *ji = JFS_IP(inode);
-	struct super_block *sb = inode->i_sb;
+	struct super_block *sb = inode_sb(inode);
 	int size;
 	int ea_size = sizeDXD(&ji->ea);
 	int blocks_needed, current_blocks;
@@ -923,7 +923,7 @@ static int __jfs_xattr_set(struct inode *inode, const char *name,
 	tid_t tid;
 	int rc;
 
-	tid = txBegin(inode->i_sb, 0);
+	tid = txBegin(inode_sb(inode), 0);
 	mutex_lock(&ji->commit_mutex);
 	rc = __jfs_setxattr(tid, inode, name, value, size, flags);
 	if (!rc)
-- 
2.15.1

^ permalink raw reply related	[flat|nested] 88+ messages in thread

* [PATCH 46/76] fs/kernfs: Use inode_sb() helper instead of inode->i_sb
  2018-05-08 18:03 [RFC][PATCH 0/76] vfs: 'views' for filesystems with more than one root Mark Fasheh
                   ` (44 preceding siblings ...)
  2018-05-08 18:04 ` [PATCH 45/76] fs/jfs: " Mark Fasheh
@ 2018-05-08 18:04 ` Mark Fasheh
  2018-05-08 18:04 ` [PATCH 47/76] fs/lockd: " Mark Fasheh
                   ` (30 subsequent siblings)
  76 siblings, 0 replies; 88+ messages in thread
From: Mark Fasheh @ 2018-05-08 18:04 UTC (permalink / raw)
  To: linux-fsdevel; +Cc: linux-kernel, linux-btrfs, Mark Fasheh

Signed-off-by: Mark Fasheh <mfasheh@suse.de>
---
 fs/kernfs/dir.c   | 4 ++--
 fs/kernfs/inode.c | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/fs/kernfs/dir.c b/fs/kernfs/dir.c
index 89d1dc19340b..1239244e826a 100644
--- a/fs/kernfs/dir.c
+++ b/fs/kernfs/dir.c
@@ -1059,7 +1059,7 @@ static struct dentry *kernfs_iop_lookup(struct inode *dir,
 	mutex_lock(&kernfs_mutex);
 
 	if (kernfs_ns_enabled(parent))
-		ns = kernfs_info(dir->i_sb)->ns;
+		ns = kernfs_info(inode_sb(dir))->ns;
 
 	kn = kernfs_find_ns(parent, dentry->d_name.name, ns);
 
@@ -1070,7 +1070,7 @@ static struct dentry *kernfs_iop_lookup(struct inode *dir,
 	}
 
 	/* attach dentry and inode */
-	inode = kernfs_get_inode(dir->i_sb, kn);
+	inode = kernfs_get_inode(inode_sb(dir), kn);
 	if (!inode) {
 		ret = ERR_PTR(-ENOMEM);
 		goto out_unlock;
diff --git a/fs/kernfs/inode.c b/fs/kernfs/inode.c
index a34303981deb..7b005800d815 100644
--- a/fs/kernfs/inode.c
+++ b/fs/kernfs/inode.c
@@ -173,7 +173,7 @@ static inline void set_default_inode_attr(struct inode *inode, umode_t mode)
 
 static inline void set_inode_attr(struct inode *inode, struct iattr *iattr)
 {
-	struct super_block *sb = inode->i_sb;
+	struct super_block *sb = inode_sb(inode);
 	inode->i_uid = iattr->ia_uid;
 	inode->i_gid = iattr->ia_gid;
 	inode->i_atime = timespec_trunc(iattr->ia_atime, sb->s_time_gran);
-- 
2.15.1

^ permalink raw reply related	[flat|nested] 88+ messages in thread

* [PATCH 47/76] fs/lockd: Use inode_sb() helper instead of inode->i_sb
  2018-05-08 18:03 [RFC][PATCH 0/76] vfs: 'views' for filesystems with more than one root Mark Fasheh
                   ` (45 preceding siblings ...)
  2018-05-08 18:04 ` [PATCH 46/76] fs/kernfs: " Mark Fasheh
@ 2018-05-08 18:04 ` Mark Fasheh
  2018-05-08 18:04 ` [PATCH 48/76] fs/minix: " Mark Fasheh
                   ` (29 subsequent siblings)
  76 siblings, 0 replies; 88+ messages in thread
From: Mark Fasheh @ 2018-05-08 18:04 UTC (permalink / raw)
  To: linux-fsdevel; +Cc: linux-kernel, linux-btrfs, Mark Fasheh

Signed-off-by: Mark Fasheh <mfasheh@suse.de>
---
 fs/lockd/svclock.c | 8 ++++----
 fs/lockd/svcsubs.c | 4 ++--
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/fs/lockd/svclock.c b/fs/lockd/svclock.c
index 3701bccab478..d13892c7bd89 100644
--- a/fs/lockd/svclock.c
+++ b/fs/lockd/svclock.c
@@ -405,7 +405,7 @@ nlmsvc_lock(struct svc_rqst *rqstp, struct nlm_file *file,
 	__be32			ret;
 
 	dprintk("lockd: nlmsvc_lock(%s/%ld, ty=%d, pi=%d, %Ld-%Ld, bl=%d)\n",
-				file_inode(file->f_file)->i_sb->s_id,
+				inode_sb(file_inode(file->f_file))->s_id,
 				file_inode(file->f_file)->i_ino,
 				lock->fl.fl_type, lock->fl.fl_pid,
 				(long long)lock->fl.fl_start,
@@ -511,7 +511,7 @@ nlmsvc_testlock(struct svc_rqst *rqstp, struct nlm_file *file,
 	__be32			ret;
 
 	dprintk("lockd: nlmsvc_testlock(%s/%ld, ty=%d, %Ld-%Ld)\n",
-				file_inode(file->f_file)->i_sb->s_id,
+				inode_sb(file_inode(file->f_file))->s_id,
 				file_inode(file->f_file)->i_ino,
 				lock->fl.fl_type,
 				(long long)lock->fl.fl_start,
@@ -566,7 +566,7 @@ nlmsvc_unlock(struct net *net, struct nlm_file *file, struct nlm_lock *lock)
 	int	error;
 
 	dprintk("lockd: nlmsvc_unlock(%s/%ld, pi=%d, %Ld-%Ld)\n",
-				file_inode(file->f_file)->i_sb->s_id,
+				inode_sb(file_inode(file->f_file))->s_id,
 				file_inode(file->f_file)->i_ino,
 				lock->fl.fl_pid,
 				(long long)lock->fl.fl_start,
@@ -595,7 +595,7 @@ nlmsvc_cancel_blocked(struct net *net, struct nlm_file *file, struct nlm_lock *l
 	int status = 0;
 
 	dprintk("lockd: nlmsvc_cancel(%s/%ld, pi=%d, %Ld-%Ld)\n",
-				file_inode(file->f_file)->i_sb->s_id,
+				inode_sb(file_inode(file->f_file))->s_id,
 				file_inode(file->f_file)->i_ino,
 				lock->fl.fl_pid,
 				(long long)lock->fl.fl_start,
diff --git a/fs/lockd/svcsubs.c b/fs/lockd/svcsubs.c
index 4ec3d6e03e76..d29444c19cdc 100644
--- a/fs/lockd/svcsubs.c
+++ b/fs/lockd/svcsubs.c
@@ -47,7 +47,7 @@ static inline void nlm_debug_print_file(char *msg, struct nlm_file *file)
 	struct inode *inode = file_inode(file->f_file);
 
 	dprintk("lockd: %s %s/%ld\n",
-		msg, inode->i_sb->s_id, inode->i_ino);
+		msg, inode_sb(inode)->s_id, inode->i_ino);
 }
 #else
 static inline void nlm_debug_print_fh(char *msg, struct nfs_fh *f)
@@ -414,7 +414,7 @@ nlmsvc_match_sb(void *datap, struct nlm_file *file)
 {
 	struct super_block *sb = datap;
 
-	return sb == file_inode(file->f_file)->i_sb;
+	return sb == inode_sb(file_inode(file->f_file));
 }
 
 /**
-- 
2.15.1

^ permalink raw reply related	[flat|nested] 88+ messages in thread

* [PATCH 48/76] fs/minix: Use inode_sb() helper instead of inode->i_sb
  2018-05-08 18:03 [RFC][PATCH 0/76] vfs: 'views' for filesystems with more than one root Mark Fasheh
                   ` (46 preceding siblings ...)
  2018-05-08 18:04 ` [PATCH 47/76] fs/lockd: " Mark Fasheh
@ 2018-05-08 18:04 ` Mark Fasheh
  2018-05-08 18:04 ` [PATCH 49/76] fs/nfsd: " Mark Fasheh
                   ` (28 subsequent siblings)
  76 siblings, 0 replies; 88+ messages in thread
From: Mark Fasheh @ 2018-05-08 18:04 UTC (permalink / raw)
  To: linux-fsdevel; +Cc: linux-kernel, linux-btrfs, Mark Fasheh

Signed-off-by: Mark Fasheh <mfasheh@suse.de>
---
 fs/minix/bitmap.c       | 18 ++++++++++--------
 fs/minix/dir.c          | 18 +++++++++---------
 fs/minix/inode.c        | 10 +++++-----
 fs/minix/itree_common.c | 10 +++++-----
 fs/minix/itree_v1.c     |  6 +++---
 fs/minix/itree_v2.c     |  2 +-
 fs/minix/minix.h        |  2 +-
 fs/minix/namei.c        |  6 +++---
 8 files changed, 37 insertions(+), 35 deletions(-)

diff --git a/fs/minix/bitmap.c b/fs/minix/bitmap.c
index f4e5e5181a14..c432f181e006 100644
--- a/fs/minix/bitmap.c
+++ b/fs/minix/bitmap.c
@@ -41,7 +41,7 @@ static __u32 count_free(struct buffer_head *map[], unsigned blocksize, __u32 num
 
 void minix_free_block(struct inode *inode, unsigned long block)
 {
-	struct super_block *sb = inode->i_sb;
+	struct super_block *sb = inode_sb(inode);
 	struct minix_sb_info *sbi = minix_sb(sb);
 	struct buffer_head *bh;
 	int k = sb->s_blocksize_bits + 3;
@@ -70,8 +70,8 @@ void minix_free_block(struct inode *inode, unsigned long block)
 
 int minix_new_block(struct inode * inode)
 {
-	struct minix_sb_info *sbi = minix_sb(inode->i_sb);
-	int bits_per_zone = 8 * inode->i_sb->s_blocksize;
+	struct minix_sb_info *sbi = minix_sb(inode_sb(inode));
+	int bits_per_zone = 8 * inode_sb(inode)->s_blocksize;
 	int i;
 
 	for (i = 0; i < sbi->s_zmap_blocks; i++) {
@@ -161,14 +161,16 @@ static void minix_clear_inode(struct inode *inode)
 
 	if (INODE_VERSION(inode) == MINIX_V1) {
 		struct minix_inode *raw_inode;
-		raw_inode = minix_V1_raw_inode(inode->i_sb, inode->i_ino, &bh);
+		raw_inode = minix_V1_raw_inode(inode_sb(inode), inode->i_ino,
+					       &bh);
 		if (raw_inode) {
 			raw_inode->i_nlinks = 0;
 			raw_inode->i_mode = 0;
 		}
 	} else {
 		struct minix2_inode *raw_inode;
-		raw_inode = minix_V2_raw_inode(inode->i_sb, inode->i_ino, &bh);
+		raw_inode = minix_V2_raw_inode(inode_sb(inode), inode->i_ino,
+					       &bh);
 		if (raw_inode) {
 			raw_inode->i_nlinks = 0;
 			raw_inode->i_mode = 0;
@@ -182,8 +184,8 @@ static void minix_clear_inode(struct inode *inode)
 
 void minix_free_inode(struct inode * inode)
 {
-	struct super_block *sb = inode->i_sb;
-	struct minix_sb_info *sbi = minix_sb(inode->i_sb);
+	struct super_block *sb = inode_sb(inode);
+	struct minix_sb_info *sbi = minix_sb(inode_sb(inode));
 	struct buffer_head *bh;
 	int k = sb->s_blocksize_bits + 3;
 	unsigned long ino, bit;
@@ -212,7 +214,7 @@ void minix_free_inode(struct inode * inode)
 
 struct inode *minix_new_inode(const struct inode *dir, umode_t mode, int *error)
 {
-	struct super_block *sb = dir->i_sb;
+	struct super_block *sb = inode_sb(dir);
 	struct minix_sb_info *sbi = minix_sb(sb);
 	struct inode *inode = new_inode(sb);
 	struct buffer_head * bh;
diff --git a/fs/minix/dir.c b/fs/minix/dir.c
index dcfe5b25378b..ea70fc396293 100644
--- a/fs/minix/dir.c
+++ b/fs/minix/dir.c
@@ -81,7 +81,7 @@ static inline void *minix_next_entry(void *de, struct minix_sb_info *sbi)
 static int minix_readdir(struct file *file, struct dir_context *ctx)
 {
 	struct inode *inode = file_inode(file);
-	struct super_block *sb = inode->i_sb;
+	struct super_block *sb = inode_sb(inode);
 	struct minix_sb_info *sbi = minix_sb(sb);
 	unsigned chunk_size = sbi->s_dirsize;
 	unsigned long npages = dir_pages(inode);
@@ -153,7 +153,7 @@ minix_dirent *minix_find_entry(struct dentry *dentry, struct page **res_page)
 	const char * name = dentry->d_name.name;
 	int namelen = dentry->d_name.len;
 	struct inode * dir = d_inode(dentry->d_parent);
-	struct super_block * sb = dir->i_sb;
+	struct super_block * sb = inode_sb(dir);
 	struct minix_sb_info * sbi = minix_sb(sb);
 	unsigned long n;
 	unsigned long npages = dir_pages(dir);
@@ -202,7 +202,7 @@ int minix_add_link(struct dentry *dentry, struct inode *inode)
 	struct inode *dir = d_inode(dentry->d_parent);
 	const char * name = dentry->d_name.name;
 	int namelen = dentry->d_name.len;
-	struct super_block * sb = dir->i_sb;
+	struct super_block * sb = inode_sb(dir);
 	struct minix_sb_info * sbi = minix_sb(sb);
 	struct page *page = NULL;
 	unsigned long npages = dir_pages(dir);
@@ -291,7 +291,7 @@ int minix_delete_entry(struct minix_dir_entry *de, struct page *page)
 	struct inode *inode = page->mapping->host;
 	char *kaddr = page_address(page);
 	loff_t pos = page_offset(page) + (char*)de - kaddr;
-	struct minix_sb_info *sbi = minix_sb(inode->i_sb);
+	struct minix_sb_info *sbi = minix_sb(inode_sb(inode));
 	unsigned len = sbi->s_dirsize;
 	int err;
 
@@ -315,7 +315,7 @@ int minix_delete_entry(struct minix_dir_entry *de, struct page *page)
 int minix_make_empty(struct inode *inode, struct inode *dir)
 {
 	struct page *page = grab_cache_page(inode->i_mapping, 0);
-	struct minix_sb_info *sbi = minix_sb(inode->i_sb);
+	struct minix_sb_info *sbi = minix_sb(inode_sb(inode));
 	char *kaddr;
 	int err;
 
@@ -362,7 +362,7 @@ int minix_empty_dir(struct inode * inode)
 {
 	struct page *page = NULL;
 	unsigned long i, npages = dir_pages(inode);
-	struct minix_sb_info *sbi = minix_sb(inode->i_sb);
+	struct minix_sb_info *sbi = minix_sb(inode_sb(inode));
 	char *name;
 	__u32 inumber;
 
@@ -413,7 +413,7 @@ void minix_set_link(struct minix_dir_entry *de, struct page *page,
 	struct inode *inode)
 {
 	struct inode *dir = page->mapping->host;
-	struct minix_sb_info *sbi = minix_sb(dir->i_sb);
+	struct minix_sb_info *sbi = minix_sb(inode_sb(dir));
 	loff_t pos = page_offset(page) +
 			(char *)de-(char*)page_address(page);
 	int err;
@@ -438,7 +438,7 @@ void minix_set_link(struct minix_dir_entry *de, struct page *page,
 struct minix_dir_entry * minix_dotdot (struct inode *dir, struct page **p)
 {
 	struct page *page = dir_get_page(dir, 0);
-	struct minix_sb_info *sbi = minix_sb(dir->i_sb);
+	struct minix_sb_info *sbi = minix_sb(inode_sb(dir));
 	struct minix_dir_entry *de = NULL;
 
 	if (!IS_ERR(page)) {
@@ -457,7 +457,7 @@ ino_t minix_inode_by_name(struct dentry *dentry)
 	if (de) {
 		struct address_space *mapping = page->mapping;
 		struct inode *inode = mapping->host;
-		struct minix_sb_info *sbi = minix_sb(inode->i_sb);
+		struct minix_sb_info *sbi = minix_sb(inode_sb(inode));
 
 		if (sbi->s_version == MINIX_V3)
 			res = ((minix3_dirent *) de)->inode;
diff --git a/fs/minix/inode.c b/fs/minix/inode.c
index 72e308c3e66b..c8fd742baa16 100644
--- a/fs/minix/inode.c
+++ b/fs/minix/inode.c
@@ -466,7 +466,7 @@ static struct inode *V1_minix_iget(struct inode *inode)
 	struct minix_inode_info *minix_inode = minix_i(inode);
 	int i;
 
-	raw_inode = minix_V1_raw_inode(inode->i_sb, inode->i_ino, &bh);
+	raw_inode = minix_V1_raw_inode(inode_sb(inode), inode->i_ino, &bh);
 	if (!raw_inode) {
 		iget_failed(inode);
 		return ERR_PTR(-EIO);
@@ -499,7 +499,7 @@ static struct inode *V2_minix_iget(struct inode *inode)
 	struct minix_inode_info *minix_inode = minix_i(inode);
 	int i;
 
-	raw_inode = minix_V2_raw_inode(inode->i_sb, inode->i_ino, &bh);
+	raw_inode = minix_V2_raw_inode(inode_sb(inode), inode->i_ino, &bh);
 	if (!raw_inode) {
 		iget_failed(inode);
 		return ERR_PTR(-EIO);
@@ -553,7 +553,7 @@ static struct buffer_head * V1_minix_update_inode(struct inode * inode)
 	struct minix_inode_info *minix_inode = minix_i(inode);
 	int i;
 
-	raw_inode = minix_V1_raw_inode(inode->i_sb, inode->i_ino, &bh);
+	raw_inode = minix_V1_raw_inode(inode_sb(inode), inode->i_ino, &bh);
 	if (!raw_inode)
 		return NULL;
 	raw_inode->i_mode = inode->i_mode;
@@ -580,7 +580,7 @@ static struct buffer_head * V2_minix_update_inode(struct inode * inode)
 	struct minix_inode_info *minix_inode = minix_i(inode);
 	int i;
 
-	raw_inode = minix_V2_raw_inode(inode->i_sb, inode->i_ino, &bh);
+	raw_inode = minix_V2_raw_inode(inode_sb(inode), inode->i_ino, &bh);
 	if (!raw_inode)
 		return NULL;
 	raw_inode->i_mode = inode->i_mode;
@@ -614,7 +614,7 @@ static int minix_write_inode(struct inode *inode, struct writeback_control *wbc)
 		sync_dirty_buffer(bh);
 		if (buffer_req(bh) && !buffer_uptodate(bh)) {
 			printk("IO error syncing minix inode [%s:%08lx]\n",
-				inode->i_sb->s_id, inode->i_ino);
+				inode_sb(inode)->s_id, inode->i_ino);
 			err = -EIO;
 		}
 	}
diff --git a/fs/minix/itree_common.c b/fs/minix/itree_common.c
index 043c3fdbc8e7..97441f82e84d 100644
--- a/fs/minix/itree_common.c
+++ b/fs/minix/itree_common.c
@@ -33,7 +33,7 @@ static inline Indirect *get_branch(struct inode *inode,
 					Indirect chain[DEPTH],
 					int *err)
 {
-	struct super_block *sb = inode->i_sb;
+	struct super_block *sb = inode_sb(inode);
 	Indirect *p = chain;
 	struct buffer_head *bh;
 
@@ -84,7 +84,7 @@ static int alloc_branch(struct inode *inode,
 		if (!nr)
 			break;
 		branch[n].key = cpu_to_block(nr);
-		bh = sb_getblk(inode->i_sb, parent);
+		bh = sb_getblk(inode_sb(inode), parent);
 		lock_buffer(bh);
 		memset(bh->b_data, 0, bh->b_size);
 		branch[n].bh = bh;
@@ -162,7 +162,7 @@ static int get_block(struct inode * inode, sector_t block,
 	/* Simplest case - block found, no allocation needed */
 	if (!partial) {
 got_it:
-		map_bh(bh, inode->i_sb, block_to_cpu(chain[depth-1].key));
+		map_bh(bh, inode_sb(inode), block_to_cpu(chain[depth-1].key));
 		/* Clean up and exit */
 		partial = chain+depth-1; /* the whole chain */
 		goto cleanup;
@@ -278,7 +278,7 @@ static void free_branches(struct inode *inode, block_t *p, block_t *q, int depth
 			if (!nr)
 				continue;
 			*p = 0;
-			bh = sb_bread(inode->i_sb, nr);
+			bh = sb_bread(inode_sb(inode), nr);
 			if (!bh)
 				continue;
 			free_branches(inode, (block_t*)bh->b_data,
@@ -293,7 +293,7 @@ static void free_branches(struct inode *inode, block_t *p, block_t *q, int depth
 
 static inline void truncate (struct inode * inode)
 {
-	struct super_block *sb = inode->i_sb;
+	struct super_block *sb = inode_sb(inode);
 	block_t *idata = i_data(inode);
 	int offsets[DEPTH];
 	Indirect chain[DEPTH];
diff --git a/fs/minix/itree_v1.c b/fs/minix/itree_v1.c
index 046cc96ee7ad..dd1a33de552e 100644
--- a/fs/minix/itree_v1.c
+++ b/fs/minix/itree_v1.c
@@ -28,12 +28,12 @@ static int block_to_path(struct inode * inode, long block, int offsets[DEPTH])
 
 	if (block < 0) {
 		printk("MINIX-fs: block_to_path: block %ld < 0 on dev %pg\n",
-			block, inode->i_sb->s_bdev);
-	} else if (block >= (minix_sb(inode->i_sb)->s_max_size/BLOCK_SIZE)) {
+			block, inode_sb(inode)->s_bdev);
+	} else if (block >= (minix_sb(inode_sb(inode))->s_max_size/BLOCK_SIZE)) {
 		if (printk_ratelimit())
 			printk("MINIX-fs: block_to_path: "
 			       "block %ld too big on dev %pg\n",
-				block, inode->i_sb->s_bdev);
+				block, inode_sb(inode)->s_bdev);
 	} else if (block < 7) {
 		offsets[n++] = block;
 	} else if ((block -= 7) < 512) {
diff --git a/fs/minix/itree_v2.c b/fs/minix/itree_v2.c
index f7fc7ecccccc..7e457d58c06f 100644
--- a/fs/minix/itree_v2.c
+++ b/fs/minix/itree_v2.c
@@ -27,7 +27,7 @@ static inline block_t *i_data(struct inode *inode)
 static int block_to_path(struct inode * inode, long block, int offsets[DEPTH])
 {
 	int n = 0;
-	struct super_block *sb = inode->i_sb;
+	struct super_block *sb = inode_sb(inode);
 
 	if (block < 0) {
 		printk("MINIX-fs: block_to_path: block %ld < 0 on dev %pg\n",
diff --git a/fs/minix/minix.h b/fs/minix/minix.h
index df081e8afcc3..3ba7f4a41473 100644
--- a/fs/minix/minix.h
+++ b/fs/minix/minix.h
@@ -6,7 +6,7 @@
 #include <linux/pagemap.h>
 #include <linux/minix_fs.h>
 
-#define INODE_VERSION(inode)	minix_sb(inode->i_sb)->s_version
+#define INODE_VERSION(inode)	minix_sb(inode_sb(inode))->s_version
 #define MINIX_V1		0x0001		/* original minix fs */
 #define MINIX_V2		0x0002		/* minix V2 fs */
 #define MINIX_V3		0x0003		/* minix V3 fs */
diff --git a/fs/minix/namei.c b/fs/minix/namei.c
index ccf0f00030bf..6df2738bcdc3 100644
--- a/fs/minix/namei.c
+++ b/fs/minix/namei.c
@@ -24,12 +24,12 @@ static struct dentry *minix_lookup(struct inode * dir, struct dentry *dentry, un
 	struct inode * inode = NULL;
 	ino_t ino;
 
-	if (dentry->d_name.len > minix_sb(dir->i_sb)->s_namelen)
+	if (dentry->d_name.len > minix_sb(inode_sb(dir))->s_namelen)
 		return ERR_PTR(-ENAMETOOLONG);
 
 	ino = minix_inode_by_name(dentry);
 	if (ino) {
-		inode = minix_iget(dir->i_sb, ino);
+		inode = minix_iget(inode_sb(dir), ino);
 		if (IS_ERR(inode))
 			return ERR_CAST(inode);
 	}
@@ -80,7 +80,7 @@ static int minix_symlink(struct inode * dir, struct dentry *dentry,
 	int i = strlen(symname)+1;
 	struct inode * inode;
 
-	if (i > dir->i_sb->s_blocksize)
+	if (i > inode_sb(dir)->s_blocksize)
 		goto out;
 
 	inode = minix_new_inode(dir, S_IFLNK | 0777, &err);
-- 
2.15.1

^ permalink raw reply related	[flat|nested] 88+ messages in thread

* [PATCH 49/76] fs/nfsd: Use inode_sb() helper instead of inode->i_sb
  2018-05-08 18:03 [RFC][PATCH 0/76] vfs: 'views' for filesystems with more than one root Mark Fasheh
                   ` (47 preceding siblings ...)
  2018-05-08 18:04 ` [PATCH 48/76] fs/minix: " Mark Fasheh
@ 2018-05-08 18:04 ` Mark Fasheh
  2018-05-08 18:04 ` [PATCH 50/76] fs/nfs: " Mark Fasheh
                   ` (27 subsequent siblings)
  76 siblings, 0 replies; 88+ messages in thread
From: Mark Fasheh @ 2018-05-08 18:04 UTC (permalink / raw)
  To: linux-fsdevel; +Cc: linux-kernel, linux-btrfs, Mark Fasheh

Signed-off-by: Mark Fasheh <mfasheh@suse.de>
---
 fs/nfsd/blocklayout.c | 4 ++--
 fs/nfsd/export.c      | 8 ++++----
 fs/nfsd/nfs4recover.c | 2 +-
 fs/nfsd/nfsctl.c      | 4 ++--
 fs/nfsd/nfssvc.c      | 5 +++--
 fs/nfsd/vfs.c         | 8 ++++----
 6 files changed, 16 insertions(+), 15 deletions(-)

diff --git a/fs/nfsd/blocklayout.c b/fs/nfsd/blocklayout.c
index 70b8bf781fce..66fe95fc7966 100644
--- a/fs/nfsd/blocklayout.c
+++ b/fs/nfsd/blocklayout.c
@@ -24,7 +24,7 @@ nfsd4_block_proc_layoutget(struct inode *inode, const struct svc_fh *fhp,
 		struct nfsd4_layoutget *args)
 {
 	struct nfsd4_layout_seg *seg = &args->lg_seg;
-	struct super_block *sb = inode->i_sb;
+	struct super_block *sb = inode_sb(inode);
 	u32 block_size = i_blocksize(inode);
 	struct pnfs_block_extent *bex;
 	struct iomap iomap;
@@ -134,7 +134,7 @@ nfsd4_block_commit_blocks(struct inode *inode, struct nfsd4_layoutcommit *lcp,
 		iattr.ia_size = new_size;
 	}
 
-	error = inode->i_sb->s_export_op->commit_blocks(inode, iomaps,
+	error = inode_sb(inode)->s_export_op->commit_blocks(inode, iomaps,
 			nr_iomaps, &iattr);
 	kfree(iomaps);
 	return nfserrno(error);
diff --git a/fs/nfsd/export.c b/fs/nfsd/export.c
index 8ceb25a10ea0..bd554e880415 100644
--- a/fs/nfsd/export.c
+++ b/fs/nfsd/export.c
@@ -366,15 +366,15 @@ static int check_export(struct inode *inode, int *flags, unsigned char *uuid)
 	 * 2:  We must be able to find an inode from a filehandle.
 	 *       This means that s_export_op must be set.
 	 */
-	if (!(inode->i_sb->s_type->fs_flags & FS_REQUIRES_DEV) &&
+	if (!(inode_sb(inode)->s_type->fs_flags & FS_REQUIRES_DEV) &&
 	    !(*flags & NFSEXP_FSID) &&
 	    uuid == NULL) {
 		dprintk("exp_export: export of non-dev fs without fsid\n");
 		return -EINVAL;
 	}
 
-	if (!inode->i_sb->s_export_op ||
-	    !inode->i_sb->s_export_op->fh_to_dentry) {
+	if (!inode_sb(inode)->s_export_op ||
+	    !inode_sb(inode)->s_export_op->fh_to_dentry) {
 		dprintk("exp_export: export of invalid fs type.\n");
 		return -EINVAL;
 	}
@@ -895,7 +895,7 @@ exp_rootfh(struct net *net, struct auth_domain *clp, char *name,
 
 	dprintk("nfsd: exp_rootfh(%s [%p] %s:%s/%ld)\n",
 		 name, path.dentry, clp->name,
-		 inode->i_sb->s_id, inode->i_ino);
+		 inode_sb(inode)->s_id, inode->i_ino);
 	exp = exp_parent(cd, clp, &path);
 	if (IS_ERR(exp)) {
 		err = PTR_ERR(exp);
diff --git a/fs/nfsd/nfs4recover.c b/fs/nfsd/nfs4recover.c
index 66eaeb1e8c2c..11d6aeb74bc1 100644
--- a/fs/nfsd/nfs4recover.c
+++ b/fs/nfsd/nfs4recover.c
@@ -716,7 +716,7 @@ cld_pipe_downcall(struct file *filp, const char __user *src, size_t mlen)
 	struct cld_upcall *tmp, *cup;
 	struct cld_msg __user *cmsg = (struct cld_msg __user *)src;
 	uint32_t xid;
-	struct nfsd_net *nn = net_generic(file_inode(filp)->i_sb->s_fs_info,
+	struct nfsd_net *nn = net_generic(inode_sb(file_inode(filp))->s_fs_info,
 						nfsd_net_id);
 	struct cld_net *cn = nn->cld_net;
 
diff --git a/fs/nfsd/nfsctl.c b/fs/nfsd/nfsctl.c
index d107b4426f7e..4b7473141f2d 100644
--- a/fs/nfsd/nfsctl.c
+++ b/fs/nfsd/nfsctl.c
@@ -162,7 +162,7 @@ static const struct file_operations exports_proc_operations = {
 
 static int exports_nfsd_open(struct inode *inode, struct file *file)
 {
-	return exports_net_open(inode->i_sb->s_fs_info, file);
+	return exports_net_open(inode_sb(inode)->s_fs_info, file);
 }
 
 static const struct file_operations exports_nfsd_operations = {
@@ -231,7 +231,7 @@ static const struct file_operations reply_cache_stats_operations = {
 
 static inline struct net *netns(struct file *file)
 {
-	return file_inode(file)->i_sb->s_fs_info;
+	return inode_sb(file_inode(file))->s_fs_info;
 }
 
 /**
diff --git a/fs/nfsd/nfssvc.c b/fs/nfsd/nfssvc.c
index 89cb484f1cfb..742755f6356a 100644
--- a/fs/nfsd/nfssvc.c
+++ b/fs/nfsd/nfssvc.c
@@ -866,7 +866,8 @@ nfsd_dispatch(struct svc_rqst *rqstp, __be32 *statp)
 int nfsd_pool_stats_open(struct inode *inode, struct file *file)
 {
 	int ret;
-	struct nfsd_net *nn = net_generic(inode->i_sb->s_fs_info, nfsd_net_id);
+	struct nfsd_net *nn = net_generic(inode_sb(inode)->s_fs_info,
+					  nfsd_net_id);
 
 	mutex_lock(&nfsd_mutex);
 	if (nn->nfsd_serv == NULL) {
@@ -883,7 +884,7 @@ int nfsd_pool_stats_open(struct inode *inode, struct file *file)
 int nfsd_pool_stats_release(struct inode *inode, struct file *file)
 {
 	int ret = seq_release(inode, file);
-	struct net *net = inode->i_sb->s_fs_info;
+	struct net *net = inode_sb(inode)->s_fs_info;
 
 	mutex_lock(&nfsd_mutex);
 	/* this function really, really should have been called svc_put() */
diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c
index a3c9bfa77def..393159739b95 100644
--- a/fs/nfsd/vfs.c
+++ b/fs/nfsd/vfs.c
@@ -310,7 +310,7 @@ static int
 commit_metadata(struct svc_fh *fhp)
 {
 	struct inode *inode = d_inode(fhp->fh_dentry);
-	const struct export_operations *export_ops = inode->i_sb->s_export_op;
+	const struct export_operations *export_ops = inode_sb(inode)->s_export_op;
 
 	if (!EX_ISSYNC(fhp->fh_export))
 		return 0;
@@ -786,7 +786,7 @@ struct raparms *
 nfsd_init_raparms(struct file *file)
 {
 	struct inode *inode = file_inode(file);
-	dev_t dev = inode->i_sb->s_dev;
+	dev_t dev = inode_sb(inode)->s_dev;
 	ino_t ino = inode->i_ino;
 	struct raparms	*ra, **rap, **frap = NULL;
 	int depth = 0;
@@ -943,7 +943,7 @@ static int wait_for_concurrent_writes(struct file *file)
 	int err = 0;
 
 	if (atomic_read(&inode->i_writecount) > 1
-	    || (last_ino == inode->i_ino && last_dev == inode->i_sb->s_dev)) {
+	    || (last_ino == inode->i_ino && last_dev == inode_sb(inode)->s_dev)) {
 		dprintk("nfsd: write defer %d\n", task_pid_nr(current));
 		msleep(10);
 		dprintk("nfsd: write resume %d\n", task_pid_nr(current));
@@ -954,7 +954,7 @@ static int wait_for_concurrent_writes(struct file *file)
 		err = vfs_fsync(file, 0);
 	}
 	last_ino = inode->i_ino;
-	last_dev = inode->i_sb->s_dev;
+	last_dev = inode_sb(inode)->s_dev;
 	return err;
 }
 
-- 
2.15.1

^ permalink raw reply related	[flat|nested] 88+ messages in thread

* [PATCH 50/76] fs/nfs: Use inode_sb() helper instead of inode->i_sb
  2018-05-08 18:03 [RFC][PATCH 0/76] vfs: 'views' for filesystems with more than one root Mark Fasheh
                   ` (48 preceding siblings ...)
  2018-05-08 18:04 ` [PATCH 49/76] fs/nfsd: " Mark Fasheh
@ 2018-05-08 18:04 ` Mark Fasheh
  2018-05-08 18:04 ` [PATCH 51/76] fs/nilfs2: " Mark Fasheh
                   ` (26 subsequent siblings)
  76 siblings, 0 replies; 88+ messages in thread
From: Mark Fasheh @ 2018-05-08 18:04 UTC (permalink / raw)
  To: linux-fsdevel; +Cc: linux-kernel, linux-btrfs, Mark Fasheh

Signed-off-by: Mark Fasheh <mfasheh@suse.de>
---
 fs/nfs/blocklayout/rpc_pipefs.c        |  2 +-
 fs/nfs/callback_proc.c                 |  4 ++--
 fs/nfs/dir.c                           | 22 +++++++++---------
 fs/nfs/export.c                        |  2 +-
 fs/nfs/file.c                          |  4 ++--
 fs/nfs/filelayout/filelayout.c         |  4 ++--
 fs/nfs/flexfilelayout/flexfilelayout.c |  6 ++---
 fs/nfs/fscache.c                       |  2 +-
 fs/nfs/inode.c                         | 20 ++++++++--------
 fs/nfs/internal.h                      |  4 ++--
 fs/nfs/nfs42proc.c                     |  2 +-
 fs/nfs/nfs4proc.c                      |  4 ++--
 fs/nfs/nfs4trace.h                     | 36 ++++++++++++++---------------
 fs/nfs/nfstrace.h                      | 42 +++++++++++++++++-----------------
 fs/nfs/pagelist.c                      |  2 +-
 fs/nfs/pnfs.c                          |  2 +-
 fs/nfs/read.c                          |  4 ++--
 fs/nfs/unlink.c                        |  6 ++---
 18 files changed, 84 insertions(+), 84 deletions(-)

diff --git a/fs/nfs/blocklayout/rpc_pipefs.c b/fs/nfs/blocklayout/rpc_pipefs.c
index 9fb067a6f7e0..68a6176a4287 100644
--- a/fs/nfs/blocklayout/rpc_pipefs.c
+++ b/fs/nfs/blocklayout/rpc_pipefs.c
@@ -112,7 +112,7 @@ bl_resolve_deviceid(struct nfs_server *server, struct pnfs_block_volume *b,
 static ssize_t bl_pipe_downcall(struct file *filp, const char __user *src,
 			 size_t mlen)
 {
-	struct nfs_net *nn = net_generic(file_inode(filp)->i_sb->s_fs_info,
+	struct nfs_net *nn = net_generic(inode_sb(file_inode(filp))->s_fs_info,
 					 nfs_net_id);
 
 	if (mlen != sizeof (struct bl_dev_msg))
diff --git a/fs/nfs/callback_proc.c b/fs/nfs/callback_proc.c
index a50d7813e3ea..73c5a7baf8a4 100644
--- a/fs/nfs/callback_proc.c
+++ b/fs/nfs/callback_proc.c
@@ -133,7 +133,7 @@ static struct inode *nfs_layout_find_inode_by_stateid(struct nfs_client *clp,
 			inode = igrab(lo->plh_inode);
 			if (!inode)
 				continue;
-			if (!nfs_sb_active(inode->i_sb)) {
+			if (!nfs_sb_active(inode_sb(inode))) {
 				rcu_read_unlock();
 				spin_unlock(&clp->cl_lock);
 				iput(inode);
@@ -173,7 +173,7 @@ static struct inode *nfs_layout_find_inode_by_fh(struct nfs_client *clp,
 			inode = igrab(lo->plh_inode);
 			if (!inode)
 				continue;
-			if (!nfs_sb_active(inode->i_sb)) {
+			if (!nfs_sb_active(inode_sb(inode))) {
 				rcu_read_unlock();
 				spin_unlock(&clp->cl_lock);
 				iput(inode);
diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c
index 2f3f86726f5b..3d150fa56e4f 100644
--- a/fs/nfs/dir.c
+++ b/fs/nfs/dir.c
@@ -1449,7 +1449,7 @@ int nfs_atomic_open(struct inode *dir, struct dentry *dentry,
 	BUG_ON(d_inode(dentry));
 
 	dfprintk(VFS, "NFS: atomic_open(%s/%lu), %pd\n",
-			dir->i_sb->s_id, dir->i_ino, dentry);
+			inode_sb(dir)->s_id, dir->i_ino, dentry);
 
 	err = nfs_check_flags(open_flags);
 	if (err)
@@ -1671,7 +1671,7 @@ int nfs_create(struct inode *dir, struct dentry *dentry,
 	int error;
 
 	dfprintk(VFS, "NFS: create(%s/%lu), %pd\n",
-			dir->i_sb->s_id, dir->i_ino, dentry);
+			inode_sb(dir)->s_id, dir->i_ino, dentry);
 
 	attr.ia_mode = mode;
 	attr.ia_valid = ATTR_MODE;
@@ -1698,7 +1698,7 @@ nfs_mknod(struct inode *dir, struct dentry *dentry, umode_t mode, dev_t rdev)
 	int status;
 
 	dfprintk(VFS, "NFS: mknod(%s/%lu), %pd\n",
-			dir->i_sb->s_id, dir->i_ino, dentry);
+			inode_sb(dir)->s_id, dir->i_ino, dentry);
 
 	attr.ia_mode = mode;
 	attr.ia_valid = ATTR_MODE;
@@ -1724,7 +1724,7 @@ int nfs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode)
 	int error;
 
 	dfprintk(VFS, "NFS: mkdir(%s/%lu), %pd\n",
-			dir->i_sb->s_id, dir->i_ino, dentry);
+			inode_sb(dir)->s_id, dir->i_ino, dentry);
 
 	attr.ia_valid = ATTR_MODE;
 	attr.ia_mode = mode | S_IFDIR;
@@ -1752,7 +1752,7 @@ int nfs_rmdir(struct inode *dir, struct dentry *dentry)
 	int error;
 
 	dfprintk(VFS, "NFS: rmdir(%s/%lu), %pd\n",
-			dir->i_sb->s_id, dir->i_ino, dentry);
+			inode_sb(dir)->s_id, dir->i_ino, dentry);
 
 	trace_nfs_rmdir_enter(dir, dentry);
 	if (d_really_is_positive(dentry)) {
@@ -1821,8 +1821,8 @@ int nfs_unlink(struct inode *dir, struct dentry *dentry)
 	int error;
 	int need_rehash = 0;
 
-	dfprintk(VFS, "NFS: unlink(%s/%lu, %pd)\n", dir->i_sb->s_id,
-		dir->i_ino, dentry);
+	dfprintk(VFS, "NFS: unlink(%s/%lu, %pd)\n", inode_sb(dir)->s_id,
+		 dir->i_ino, dentry);
 
 	trace_nfs_unlink_enter(dir, dentry);
 	spin_lock(&dentry->d_lock);
@@ -1872,8 +1872,8 @@ int nfs_symlink(struct inode *dir, struct dentry *dentry, const char *symname)
 	unsigned int pathlen = strlen(symname);
 	int error;
 
-	dfprintk(VFS, "NFS: symlink(%s/%lu, %pd, %s)\n", dir->i_sb->s_id,
-		dir->i_ino, dentry, symname);
+	dfprintk(VFS, "NFS: symlink(%s/%lu, %pd, %s)\n", inode_sb(dir)->s_id,
+		 dir->i_ino, dentry, symname);
 
 	if (pathlen > PAGE_SIZE)
 		return -ENAMETOOLONG;
@@ -1895,7 +1895,7 @@ int nfs_symlink(struct inode *dir, struct dentry *dentry, const char *symname)
 	trace_nfs_symlink_exit(dir, dentry, error);
 	if (error != 0) {
 		dfprintk(VFS, "NFS: symlink(%s/%lu, %pd, %s) error %d\n",
-			dir->i_sb->s_id, dir->i_ino,
+			inode_sb(dir)->s_id, dir->i_ino,
 			dentry, symname, error);
 		d_drop(dentry);
 		__free_page(page);
@@ -2540,7 +2540,7 @@ int nfs_permission(struct inode *inode, int mask)
 		res = nfs_execute_ok(inode, mask);
 
 	dfprintk(VFS, "NFS: permission(%s/%lu), mask=0x%x, res=%d\n",
-		inode->i_sb->s_id, inode->i_ino, mask, res);
+		inode_sb(inode)->s_id, inode->i_ino, mask, res);
 	return res;
 out_notsup:
 	if (mask & MAY_NOT_BLOCK)
diff --git a/fs/nfs/export.c b/fs/nfs/export.c
index ab5de3246c5c..de16a94dab82 100644
--- a/fs/nfs/export.c
+++ b/fs/nfs/export.c
@@ -127,7 +127,7 @@ nfs_get_parent(struct dentry *dentry)
 {
 	int ret;
 	struct inode *inode = d_inode(dentry), *pinode;
-	struct super_block *sb = inode->i_sb;
+	struct super_block *sb = inode_sb(inode);
 	struct nfs_server *server = NFS_SB(sb);
 	struct nfs_fattr *fattr = NULL;
 	struct nfs4_label *label = NULL;
diff --git a/fs/nfs/file.c b/fs/nfs/file.c
index 81cca49a8375..5997bd7ea978 100644
--- a/fs/nfs/file.c
+++ b/fs/nfs/file.c
@@ -545,7 +545,7 @@ static int nfs_vm_page_mkwrite(struct vm_fault *vmf)
 		filp, filp->f_mapping->host->i_ino,
 		(long long)page_offset(page));
 
-	sb_start_pagefault(inode->i_sb);
+	sb_start_pagefault(inode_sb(inode));
 
 	/* make sure the cache has finished storing the page */
 	nfs_fscache_wait_on_page_write(NFS_I(inode), page);
@@ -573,7 +573,7 @@ static int nfs_vm_page_mkwrite(struct vm_fault *vmf)
 out_unlock:
 	unlock_page(page);
 out:
-	sb_end_pagefault(inode->i_sb);
+	sb_end_pagefault(inode_sb(inode));
 	return ret;
 }
 
diff --git a/fs/nfs/filelayout/filelayout.c b/fs/nfs/filelayout/filelayout.c
index d175724ff566..5c4945503b67 100644
--- a/fs/nfs/filelayout/filelayout.c
+++ b/fs/nfs/filelayout/filelayout.c
@@ -93,7 +93,7 @@ static void filelayout_reset_write(struct nfs_pgio_header *hdr)
 		dprintk("%s Reset task %5u for i/o through MDS "
 			"(req %s/%llu, %u bytes @ offset %llu)\n", __func__,
 			hdr->task.tk_pid,
-			hdr->inode->i_sb->s_id,
+			inode_sb(hdr->inode)->s_id,
 			(unsigned long long)NFS_FILEID(hdr->inode),
 			hdr->args.count,
 			(unsigned long long)hdr->args.offset);
@@ -110,7 +110,7 @@ static void filelayout_reset_read(struct nfs_pgio_header *hdr)
 		dprintk("%s Reset task %5u for i/o through MDS "
 			"(req %s/%llu, %u bytes @ offset %llu)\n", __func__,
 			hdr->task.tk_pid,
-			hdr->inode->i_sb->s_id,
+			inode_sb(hdr->inode)->s_id,
 			(unsigned long long)NFS_FILEID(hdr->inode),
 			hdr->args.count,
 			(unsigned long long)hdr->args.offset);
diff --git a/fs/nfs/flexfilelayout/flexfilelayout.c b/fs/nfs/flexfilelayout/flexfilelayout.c
index c75ad982bcfc..89383069dd95 100644
--- a/fs/nfs/flexfilelayout/flexfilelayout.c
+++ b/fs/nfs/flexfilelayout/flexfilelayout.c
@@ -1001,7 +1001,7 @@ static void ff_layout_reset_write(struct nfs_pgio_header *hdr, bool retry_pnfs)
 		dprintk("%s Reset task %5u for i/o through pNFS "
 			"(req %s/%llu, %u bytes @ offset %llu)\n", __func__,
 			hdr->task.tk_pid,
-			hdr->inode->i_sb->s_id,
+			inode_sb(hdr->inode)->s_id,
 			(unsigned long long)NFS_FILEID(hdr->inode),
 			hdr->args.count,
 			(unsigned long long)hdr->args.offset);
@@ -1014,7 +1014,7 @@ static void ff_layout_reset_write(struct nfs_pgio_header *hdr, bool retry_pnfs)
 		dprintk("%s Reset task %5u for i/o through MDS "
 			"(req %s/%llu, %u bytes @ offset %llu)\n", __func__,
 			hdr->task.tk_pid,
-			hdr->inode->i_sb->s_id,
+			inode_sb(hdr->inode)->s_id,
 			(unsigned long long)NFS_FILEID(hdr->inode),
 			hdr->args.count,
 			(unsigned long long)hdr->args.offset);
@@ -1033,7 +1033,7 @@ static void ff_layout_reset_read(struct nfs_pgio_header *hdr)
 		dprintk("%s Reset task %5u for i/o through MDS "
 			"(req %s/%llu, %u bytes @ offset %llu)\n", __func__,
 			hdr->task.tk_pid,
-			hdr->inode->i_sb->s_id,
+			inode_sb(hdr->inode)->s_id,
 			(unsigned long long)NFS_FILEID(hdr->inode),
 			hdr->args.count,
 			(unsigned long long)hdr->args.offset);
diff --git a/fs/nfs/fscache.c b/fs/nfs/fscache.c
index d63bea8bbfbb..25dce99edd64 100644
--- a/fs/nfs/fscache.c
+++ b/fs/nfs/fscache.c
@@ -185,7 +185,7 @@ void nfs_fscache_init_inode(struct inode *inode)
 	nfsi->fscache = NULL;
 	if (!S_ISREG(inode->i_mode))
 		return;
-	nfsi->fscache = fscache_acquire_cookie(NFS_SB(inode->i_sb)->fscache,
+	nfsi->fscache = fscache_acquire_cookie(NFS_SB(inode_sb(inode))->fscache,
 					       &nfs_fscache_inode_object_def,
 					       nfsi, false);
 }
diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c
index 7d893543cf3b..52d3bc16099a 100644
--- a/fs/nfs/inode.c
+++ b/fs/nfs/inode.c
@@ -556,7 +556,7 @@ nfs_fhget(struct super_block *sb, struct nfs_fh *fh, struct nfs_fattr *fattr, st
 		}
 	}
 	dprintk("NFS: nfs_fhget(%s/%Lu fh_crc=0x%08x ct=%d)\n",
-		inode->i_sb->s_id,
+		inode_sb(inode)->s_id,
 		(unsigned long long)NFS_FILEID(inode),
 		nfs_display_fhandle_hash(fh),
 		atomic_read(&inode->i_count));
@@ -1074,7 +1074,7 @@ __nfs_revalidate_inode(struct nfs_server *server, struct inode *inode)
 	struct nfs_inode *nfsi = NFS_I(inode);
 
 	dfprintk(PAGECACHE, "NFS: revalidating (%s/%Lu)\n",
-		inode->i_sb->s_id, (unsigned long long)NFS_FILEID(inode));
+		inode_sb(inode)->s_id, (unsigned long long)NFS_FILEID(inode));
 
 	trace_nfs_revalidate_inode_enter(inode);
 
@@ -1106,7 +1106,7 @@ __nfs_revalidate_inode(struct nfs_server *server, struct inode *inode)
 	status = NFS_PROTO(inode)->getattr(server, NFS_FH(inode), fattr, label);
 	if (status != 0) {
 		dfprintk(PAGECACHE, "nfs_revalidate_inode: (%s/%Lu) getattr failed, error=%d\n",
-			 inode->i_sb->s_id,
+			 inode_sb(inode)->s_id,
 			 (unsigned long long)NFS_FILEID(inode), status);
 		if (status == -ESTALE) {
 			nfs_zap_caches(inode);
@@ -1119,7 +1119,7 @@ __nfs_revalidate_inode(struct nfs_server *server, struct inode *inode)
 	status = nfs_refresh_inode(inode, fattr);
 	if (status) {
 		dfprintk(PAGECACHE, "nfs_revalidate_inode: (%s/%Lu) refresh failed, error=%d\n",
-			 inode->i_sb->s_id,
+			 inode_sb(inode)->s_id,
 			 (unsigned long long)NFS_FILEID(inode), status);
 		goto err_out;
 	}
@@ -1130,7 +1130,7 @@ __nfs_revalidate_inode(struct nfs_server *server, struct inode *inode)
 	nfs_setsecurity(inode, fattr, label);
 
 	dfprintk(PAGECACHE, "NFS: (%s/%Lu) revalidation complete\n",
-		inode->i_sb->s_id,
+		inode_sb(inode)->s_id,
 		(unsigned long long)NFS_FILEID(inode));
 
 err_out:
@@ -1187,7 +1187,7 @@ static int nfs_invalidate_mapping(struct inode *inode, struct address_space *map
 	nfs_fscache_wait_on_invalidate(inode);
 
 	dfprintk(PAGECACHE, "NFS: (%s/%Lu) data cache invalidated\n",
-			inode->i_sb->s_id,
+			inode_sb(inode)->s_id,
 			(unsigned long long)NFS_FILEID(inode));
 	return 0;
 }
@@ -1750,7 +1750,7 @@ static int nfs_update_inode(struct inode *inode, struct nfs_fattr *fattr)
 	bool cache_revalidated = true;
 
 	dfprintk(VFS, "NFS: %s(%s/%lu fh_crc=0x%08x ct=%d info=0x%x)\n",
-			__func__, inode->i_sb->s_id, inode->i_ino,
+			__func__, inode_sb(inode)->s_id, inode->i_ino,
 			nfs_display_fhandle_hash(NFS_FH(inode)),
 			atomic_read(&inode->i_count), fattr->valid);
 
@@ -1758,7 +1758,7 @@ static int nfs_update_inode(struct inode *inode, struct nfs_fattr *fattr)
 		printk(KERN_ERR "NFS: server %s error: fileid changed\n"
 			"fsid %s: expected fileid 0x%Lx, got 0x%Lx\n",
 			NFS_SERVER(inode)->nfs_client->cl_hostname,
-			inode->i_sb->s_id, (long long)nfsi->fileid,
+			inode_sb(inode)->s_id, (long long)nfsi->fileid,
 			(long long)fattr->fileid);
 		goto out_err;
 	}
@@ -1805,7 +1805,7 @@ static int nfs_update_inode(struct inode *inode, struct nfs_fattr *fattr)
 	if (fattr->valid & NFS_ATTR_FATTR_CHANGE) {
 		if (!inode_eq_iversion_raw(inode, fattr->change_attr)) {
 			dprintk("NFS: change_attr change on server for file %s/%ld\n",
-					inode->i_sb->s_id, inode->i_ino);
+					inode_sb(inode)->s_id, inode->i_ino);
 			/* Could it be a race with writeback? */
 			if (!have_writers) {
 				invalid |= NFS_INO_INVALID_ATTR
@@ -1854,7 +1854,7 @@ static int nfs_update_inode(struct inode *inode, struct nfs_fattr *fattr)
 			}
 			dprintk("NFS: isize change on server for file %s/%ld "
 					"(%Ld to %Ld)\n",
-					inode->i_sb->s_id,
+					inode_sb(inode)->s_id,
 					inode->i_ino,
 					(long long)cur_isize,
 					(long long)new_isize);
diff --git a/fs/nfs/internal.h b/fs/nfs/internal.h
index 8357ff69962f..7234e76d9025 100644
--- a/fs/nfs/internal.h
+++ b/fs/nfs/internal.h
@@ -576,7 +576,7 @@ extern int nfs4_test_session_trunk(struct rpc_clnt *,
 static inline struct inode *nfs_igrab_and_active(struct inode *inode)
 {
 	inode = igrab(inode);
-	if (inode != NULL && !nfs_sb_active(inode->i_sb)) {
+	if (inode != NULL && !nfs_sb_active(inode_sb(inode))) {
 		iput(inode);
 		inode = NULL;
 	}
@@ -586,7 +586,7 @@ static inline struct inode *nfs_igrab_and_active(struct inode *inode)
 static inline void nfs_iput_and_deactive(struct inode *inode)
 {
 	if (inode != NULL) {
-		struct super_block *sb = inode->i_sb;
+		struct super_block *sb = inode_sb(inode);
 
 		iput(inode);
 		nfs_sb_deactive(sb);
diff --git a/fs/nfs/nfs42proc.c b/fs/nfs/nfs42proc.c
index 9c374441f660..f423ced401e3 100644
--- a/fs/nfs/nfs42proc.c
+++ b/fs/nfs/nfs42proc.c
@@ -303,7 +303,7 @@ static loff_t _nfs42_proc_llseek(struct file *filep,
 	if (status)
 		return status;
 
-	return vfs_setpos(filep, res.sr_offset, inode->i_sb->s_maxbytes);
+	return vfs_setpos(filep, res.sr_offset, inode_sb(inode)->s_maxbytes);
 }
 
 loff_t nfs42_proc_llseek(struct file *filep, loff_t offset, int whence)
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index 47f3c273245e..c066bc148f05 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -3136,7 +3136,7 @@ static void nfs4_free_closedata(void *data)
 {
 	struct nfs4_closedata *calldata = data;
 	struct nfs4_state_owner *sp = calldata->state->owner;
-	struct super_block *sb = calldata->state->inode->i_sb;
+	struct super_block *sb = inode_sb(calldata->state->inode);
 
 	if (calldata->lr.roc)
 		pnfs_roc_release(&calldata->lr.arg, &calldata->lr.res,
@@ -3393,7 +3393,7 @@ int nfs4_do_close(struct nfs4_state *state, gfp_t gfp_mask, int wait)
 		calldata->arg.lr_args = &calldata->lr.arg;
 		calldata->res.lr_res = &calldata->lr.res;
 	}
-	nfs_sb_active(calldata->inode->i_sb);
+	nfs_sb_active(inode_sb(calldata->inode));
 
 	msg.rpc_argp = &calldata->arg;
 	msg.rpc_resp = &calldata->res;
diff --git a/fs/nfs/nfs4trace.h b/fs/nfs/nfs4trace.h
index a275fba93170..517f3194b055 100644
--- a/fs/nfs/nfs4trace.h
+++ b/fs/nfs/nfs4trace.h
@@ -488,7 +488,7 @@ TRACE_EVENT(nfs4_cached_open,
 		TP_fast_assign(
 			const struct inode *inode = state->inode;
 
-			__entry->dev = inode->i_sb->s_dev;
+			__entry->dev = inode_sb(inode)->s_dev;
 			__entry->fileid = NFS_FILEID(inode);
 			__entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
 			__entry->fmode = (__force unsigned int)state->state;
@@ -533,7 +533,7 @@ TRACE_EVENT(nfs4_close,
 		TP_fast_assign(
 			const struct inode *inode = state->inode;
 
-			__entry->dev = inode->i_sb->s_dev;
+			__entry->dev = inode_sb(inode)->s_dev;
 			__entry->fileid = NFS_FILEID(inode);
 			__entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
 			__entry->fmode = (__force unsigned int)state->state;
@@ -600,7 +600,7 @@ DECLARE_EVENT_CLASS(nfs4_lock_event,
 			__entry->type = request->fl_type;
 			__entry->start = request->fl_start;
 			__entry->end = request->fl_end;
-			__entry->dev = inode->i_sb->s_dev;
+			__entry->dev = inode_sb(inode)->s_dev;
 			__entry->fileid = NFS_FILEID(inode);
 			__entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
 			__entry->stateid_seq =
@@ -672,7 +672,7 @@ TRACE_EVENT(nfs4_set_lock,
 			__entry->type = request->fl_type;
 			__entry->start = request->fl_start;
 			__entry->end = request->fl_end;
-			__entry->dev = inode->i_sb->s_dev;
+			__entry->dev = inode_sb(inode)->s_dev;
 			__entry->fileid = NFS_FILEID(inode);
 			__entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
 			__entry->stateid_seq =
@@ -719,7 +719,7 @@ DECLARE_EVENT_CLASS(nfs4_set_delegation_event,
 		),
 
 		TP_fast_assign(
-			__entry->dev = inode->i_sb->s_dev;
+			__entry->dev = inode_sb(inode)->s_dev;
 			__entry->fileid = NFS_FILEID(inode);
 			__entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
 			__entry->fmode = (__force unsigned int)fmode;
@@ -804,7 +804,7 @@ DECLARE_EVENT_CLASS(nfs4_test_stateid_event,
 			const struct inode *inode = state->inode;
 
 			__entry->error = error;
-			__entry->dev = inode->i_sb->s_dev;
+			__entry->dev = inode_sb(inode)->s_dev;
 			__entry->fileid = NFS_FILEID(inode);
 			__entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
 			__entry->stateid_seq =
@@ -855,7 +855,7 @@ DECLARE_EVENT_CLASS(nfs4_lookup_event,
 		),
 
 		TP_fast_assign(
-			__entry->dev = dir->i_sb->s_dev;
+			__entry->dev = inode_sb(dir)->s_dev;
 			__entry->dir = NFS_FILEID(dir);
 			__entry->error = error;
 			__assign_str(name, name->name);
@@ -903,7 +903,7 @@ TRACE_EVENT(nfs4_lookupp,
 		),
 
 		TP_fast_assign(
-			__entry->dev = inode->i_sb->s_dev;
+			__entry->dev = inode_sb(inode)->s_dev;
 			__entry->ino = NFS_FILEID(inode);
 			__entry->error = error;
 		),
@@ -938,7 +938,7 @@ TRACE_EVENT(nfs4_rename,
 		),
 
 		TP_fast_assign(
-			__entry->dev = olddir->i_sb->s_dev;
+			__entry->dev = inode_sb(olddir)->s_dev;
 			__entry->olddir = NFS_FILEID(olddir);
 			__entry->newdir = NFS_FILEID(newdir);
 			__entry->error = error;
@@ -976,7 +976,7 @@ DECLARE_EVENT_CLASS(nfs4_inode_event,
 		),
 
 		TP_fast_assign(
-			__entry->dev = inode->i_sb->s_dev;
+			__entry->dev = inode_sb(inode)->s_dev;
 			__entry->fileid = NFS_FILEID(inode);
 			__entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
 			__entry->error = error;
@@ -1029,7 +1029,7 @@ DECLARE_EVENT_CLASS(nfs4_inode_stateid_event,
 		),
 
 		TP_fast_assign(
-			__entry->dev = inode->i_sb->s_dev;
+			__entry->dev = inode_sb(inode)->s_dev;
 			__entry->fileid = NFS_FILEID(inode);
 			__entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
 			__entry->error = error;
@@ -1139,7 +1139,7 @@ DECLARE_EVENT_CLASS(nfs4_inode_callback_event,
 			__entry->fhandle = nfs_fhandle_hash(fhandle);
 			if (inode != NULL) {
 				__entry->fileid = NFS_FILEID(inode);
-				__entry->dev = inode->i_sb->s_dev;
+				__entry->dev = inode_sb(inode)->s_dev;
 			} else {
 				__entry->fileid = 0;
 				__entry->dev = 0;
@@ -1196,7 +1196,7 @@ DECLARE_EVENT_CLASS(nfs4_inode_stateid_callback_event,
 			__entry->fhandle = nfs_fhandle_hash(fhandle);
 			if (inode != NULL) {
 				__entry->fileid = NFS_FILEID(inode);
-				__entry->dev = inode->i_sb->s_dev;
+				__entry->dev = inode_sb(inode)->s_dev;
 			} else {
 				__entry->fileid = 0;
 				__entry->dev = 0;
@@ -1303,7 +1303,7 @@ DECLARE_EVENT_CLASS(nfs4_read_event,
 			const struct inode *inode = hdr->inode;
 			const struct nfs4_state *state =
 				hdr->args.context->state;
-			__entry->dev = inode->i_sb->s_dev;
+			__entry->dev = inode_sb(inode)->s_dev;
 			__entry->fileid = NFS_FILEID(inode);
 			__entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
 			__entry->offset = hdr->args.offset;
@@ -1363,7 +1363,7 @@ DECLARE_EVENT_CLASS(nfs4_write_event,
 			const struct inode *inode = hdr->inode;
 			const struct nfs4_state *state =
 				hdr->args.context->state;
-			__entry->dev = inode->i_sb->s_dev;
+			__entry->dev = inode_sb(inode)->s_dev;
 			__entry->fileid = NFS_FILEID(inode);
 			__entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
 			__entry->offset = hdr->args.offset;
@@ -1420,7 +1420,7 @@ DECLARE_EVENT_CLASS(nfs4_commit_event,
 
 		TP_fast_assign(
 			const struct inode *inode = data->inode;
-			__entry->dev = inode->i_sb->s_dev;
+			__entry->dev = inode_sb(inode)->s_dev;
 			__entry->fileid = NFS_FILEID(inode);
 			__entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
 			__entry->offset = data->args.offset;
@@ -1485,7 +1485,7 @@ TRACE_EVENT(nfs4_layoutget,
 		TP_fast_assign(
 			const struct inode *inode = d_inode(ctx->dentry);
 			const struct nfs4_state *state = ctx->state;
-			__entry->dev = inode->i_sb->s_dev;
+			__entry->dev = inode_sb(inode)->s_dev;
 			__entry->fileid = NFS_FILEID(inode);
 			__entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
 			__entry->iomode = args->iomode;
@@ -1567,7 +1567,7 @@ TRACE_EVENT(pnfs_update_layout,
 			__field(enum pnfs_update_layout_reason, reason)
 		),
 		TP_fast_assign(
-			__entry->dev = inode->i_sb->s_dev;
+			__entry->dev = inode_sb(inode)->s_dev;
 			__entry->fileid = NFS_FILEID(inode);
 			__entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
 			__entry->pos = pos;
diff --git a/fs/nfs/nfstrace.h b/fs/nfs/nfstrace.h
index bd60f8d1e181..aeacf2b86260 100644
--- a/fs/nfs/nfstrace.h
+++ b/fs/nfs/nfstrace.h
@@ -59,7 +59,7 @@ DECLARE_EVENT_CLASS(nfs_inode_event,
 
 		TP_fast_assign(
 			const struct nfs_inode *nfsi = NFS_I(inode);
-			__entry->dev = inode->i_sb->s_dev;
+			__entry->dev = inode_sb(inode)->s_dev;
 			__entry->fileid = nfsi->fileid;
 			__entry->fhandle = nfs_fhandle_hash(&nfsi->fh);
 			__entry->version = inode_peek_iversion_raw(inode);
@@ -97,7 +97,7 @@ DECLARE_EVENT_CLASS(nfs_inode_event_done,
 		TP_fast_assign(
 			const struct nfs_inode *nfsi = NFS_I(inode);
 			__entry->error = error;
-			__entry->dev = inode->i_sb->s_dev;
+			__entry->dev = inode_sb(inode)->s_dev;
 			__entry->fileid = nfsi->fileid;
 			__entry->fhandle = nfs_fhandle_hash(&nfsi->fh);
 			__entry->type = nfs_umode_to_dtype(inode->i_mode);
@@ -183,7 +183,7 @@ DECLARE_EVENT_CLASS(nfs_lookup_event,
 		),
 
 		TP_fast_assign(
-			__entry->dev = dir->i_sb->s_dev;
+			__entry->dev = inode_sb(dir)->s_dev;
 			__entry->dir = NFS_FILEID(dir);
 			__entry->flags = flags;
 			__assign_str(name, dentry->d_name.name);
@@ -227,7 +227,7 @@ DECLARE_EVENT_CLASS(nfs_lookup_event_done,
 		),
 
 		TP_fast_assign(
-			__entry->dev = dir->i_sb->s_dev;
+			__entry->dev = inode_sb(dir)->s_dev;
 			__entry->dir = NFS_FILEID(dir);
 			__entry->error = error;
 			__entry->flags = flags;
@@ -294,7 +294,7 @@ TRACE_EVENT(nfs_atomic_open_enter,
 		),
 
 		TP_fast_assign(
-			__entry->dev = dir->i_sb->s_dev;
+			__entry->dev = inode_sb(dir)->s_dev;
 			__entry->dir = NFS_FILEID(dir);
 			__entry->flags = flags;
 			__entry->fmode = (__force unsigned int)ctx->mode;
@@ -333,7 +333,7 @@ TRACE_EVENT(nfs_atomic_open_exit,
 
 		TP_fast_assign(
 			__entry->error = error;
-			__entry->dev = dir->i_sb->s_dev;
+			__entry->dev = inode_sb(dir)->s_dev;
 			__entry->dir = NFS_FILEID(dir);
 			__entry->flags = flags;
 			__entry->fmode = (__force unsigned int)ctx->mode;
@@ -370,7 +370,7 @@ TRACE_EVENT(nfs_create_enter,
 		),
 
 		TP_fast_assign(
-			__entry->dev = dir->i_sb->s_dev;
+			__entry->dev = inode_sb(dir)->s_dev;
 			__entry->dir = NFS_FILEID(dir);
 			__entry->flags = flags;
 			__assign_str(name, dentry->d_name.name);
@@ -406,7 +406,7 @@ TRACE_EVENT(nfs_create_exit,
 
 		TP_fast_assign(
 			__entry->error = error;
-			__entry->dev = dir->i_sb->s_dev;
+			__entry->dev = inode_sb(dir)->s_dev;
 			__entry->dir = NFS_FILEID(dir);
 			__entry->flags = flags;
 			__assign_str(name, dentry->d_name.name);
@@ -438,7 +438,7 @@ DECLARE_EVENT_CLASS(nfs_directory_event,
 		),
 
 		TP_fast_assign(
-			__entry->dev = dir->i_sb->s_dev;
+			__entry->dev = inode_sb(dir)->s_dev;
 			__entry->dir = NFS_FILEID(dir);
 			__assign_str(name, dentry->d_name.name);
 		),
@@ -476,7 +476,7 @@ DECLARE_EVENT_CLASS(nfs_directory_event_done,
 		),
 
 		TP_fast_assign(
-			__entry->dev = dir->i_sb->s_dev;
+			__entry->dev = inode_sb(dir)->s_dev;
 			__entry->dir = NFS_FILEID(dir);
 			__entry->error = error;
 			__assign_str(name, dentry->d_name.name);
@@ -530,7 +530,7 @@ TRACE_EVENT(nfs_link_enter,
 		),
 
 		TP_fast_assign(
-			__entry->dev = inode->i_sb->s_dev;
+			__entry->dev = inode_sb(inode)->s_dev;
 			__entry->fileid = NFS_FILEID(inode);
 			__entry->dir = NFS_FILEID(dir);
 			__assign_str(name, dentry->d_name.name);
@@ -565,7 +565,7 @@ TRACE_EVENT(nfs_link_exit,
 		),
 
 		TP_fast_assign(
-			__entry->dev = inode->i_sb->s_dev;
+			__entry->dev = inode_sb(inode)->s_dev;
 			__entry->fileid = NFS_FILEID(inode);
 			__entry->dir = NFS_FILEID(dir);
 			__entry->error = error;
@@ -602,7 +602,7 @@ DECLARE_EVENT_CLASS(nfs_rename_event,
 		),
 
 		TP_fast_assign(
-			__entry->dev = old_dir->i_sb->s_dev;
+			__entry->dev = inode_sb(old_dir)->s_dev;
 			__entry->old_dir = NFS_FILEID(old_dir);
 			__entry->new_dir = NFS_FILEID(new_dir);
 			__assign_str(old_name, old_dentry->d_name.name);
@@ -650,7 +650,7 @@ DECLARE_EVENT_CLASS(nfs_rename_event_done,
 		),
 
 		TP_fast_assign(
-			__entry->dev = old_dir->i_sb->s_dev;
+			__entry->dev = inode_sb(old_dir)->s_dev;
 			__entry->old_dir = NFS_FILEID(old_dir);
 			__entry->new_dir = NFS_FILEID(new_dir);
 			__entry->error = error;
@@ -705,7 +705,7 @@ TRACE_EVENT(nfs_sillyrename_unlink,
 		TP_fast_assign(
 			struct inode *dir = d_inode(data->dentry->d_parent);
 			size_t len = data->args.name.len;
-			__entry->dev = dir->i_sb->s_dev;
+			__entry->dev = inode_sb(dir)->s_dev;
 			__entry->dir = NFS_FILEID(dir);
 			__entry->error = error;
 			memcpy(__get_str(name),
@@ -743,7 +743,7 @@ TRACE_EVENT(nfs_initiate_read,
 
 			__entry->offset = offset;
 			__entry->count = count;
-			__entry->dev = inode->i_sb->s_dev;
+			__entry->dev = inode_sb(inode)->s_dev;
 			__entry->fileid = nfsi->fileid;
 			__entry->fhandle = nfs_fhandle_hash(&nfsi->fh);
 		),
@@ -781,7 +781,7 @@ TRACE_EVENT(nfs_readpage_done,
 			__entry->status = status;
 			__entry->offset = offset;
 			__entry->eof = eof;
-			__entry->dev = inode->i_sb->s_dev;
+			__entry->dev = inode_sb(inode)->s_dev;
 			__entry->fileid = nfsi->fileid;
 			__entry->fhandle = nfs_fhandle_hash(&nfsi->fh);
 		),
@@ -831,7 +831,7 @@ TRACE_EVENT(nfs_initiate_write,
 			__entry->offset = offset;
 			__entry->count = count;
 			__entry->stable = stable;
-			__entry->dev = inode->i_sb->s_dev;
+			__entry->dev = inode_sb(inode)->s_dev;
 			__entry->fileid = nfsi->fileid;
 			__entry->fhandle = nfs_fhandle_hash(&nfsi->fh);
 		),
@@ -875,7 +875,7 @@ TRACE_EVENT(nfs_writeback_done,
 			__entry->stable = writeverf->committed;
 			memcpy(&__entry->verifier, &writeverf->verifier,
 			       sizeof(__entry->verifier));
-			__entry->dev = inode->i_sb->s_dev;
+			__entry->dev = inode_sb(inode)->s_dev;
 			__entry->fileid = nfsi->fileid;
 			__entry->fhandle = nfs_fhandle_hash(&nfsi->fh);
 		),
@@ -914,7 +914,7 @@ TRACE_EVENT(nfs_initiate_commit,
 
 			__entry->offset = data->args.offset;
 			__entry->count = data->args.count;
-			__entry->dev = inode->i_sb->s_dev;
+			__entry->dev = inode_sb(inode)->s_dev;
 			__entry->fileid = nfsi->fileid;
 			__entry->fhandle = nfs_fhandle_hash(&nfsi->fh);
 		),
@@ -953,7 +953,7 @@ TRACE_EVENT(nfs_commit_done,
 			__entry->offset = data->args.offset;
 			memcpy(&__entry->verifier, &data->verf.verifier,
 			       sizeof(__entry->verifier));
-			__entry->dev = inode->i_sb->s_dev;
+			__entry->dev = inode_sb(inode)->s_dev;
 			__entry->fileid = nfsi->fileid;
 			__entry->fhandle = nfs_fhandle_hash(&nfsi->fh);
 		),
diff --git a/fs/nfs/pagelist.c b/fs/nfs/pagelist.c
index 18a7626ac638..39dedd4ee92b 100644
--- a/fs/nfs/pagelist.c
+++ b/fs/nfs/pagelist.c
@@ -611,7 +611,7 @@ int nfs_initiate_pgio(struct rpc_clnt *clnt, struct nfs_pgio_header *hdr,
 
 	dprintk("NFS: initiated pgio call "
 		"(req %s/%llu, %u bytes @ offset %llu)\n",
-		hdr->inode->i_sb->s_id,
+		inode_sb(hdr->inode)->s_id,
 		(unsigned long long)NFS_FILEID(hdr->inode),
 		hdr->args.count,
 		(unsigned long long)hdr->args.offset);
diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c
index ee723aa153a3..b0226fe6b7b9 100644
--- a/fs/nfs/pnfs.c
+++ b/fs/nfs/pnfs.c
@@ -1886,7 +1886,7 @@ pnfs_update_layout(struct inode *ino,
 out:
 	dprintk("%s: inode %s/%llu pNFS layout segment %s for "
 			"(%s, offset: %llu, length: %llu)\n",
-			__func__, ino->i_sb->s_id,
+			__func__, inode_sb(ino)->s_id,
 			(unsigned long long)NFS_FILEID(ino),
 			IS_ERR_OR_NULL(lseg) ? "not found" : "found",
 			iomode==IOMODE_RW ?  "read/write" : "read-only",
diff --git a/fs/nfs/read.c b/fs/nfs/read.c
index 48d7277c60a9..d559e54d71c4 100644
--- a/fs/nfs/read.c
+++ b/fs/nfs/read.c
@@ -94,7 +94,7 @@ static void nfs_readpage_release(struct nfs_page *req)
 {
 	struct inode *inode = d_inode(req->wb_context->dentry);
 
-	dprintk("NFS: read done (%s/%llu %d@%lld)\n", inode->i_sb->s_id,
+	dprintk("NFS: read done (%s/%llu %d@%lld)\n", inode_sb(inode)->s_id,
 		(unsigned long long)NFS_FILEID(inode), req->wb_bytes,
 		(long long)req_offset(req));
 
@@ -398,7 +398,7 @@ int nfs_readpages(struct file *filp, struct address_space *mapping,
 	int ret = -ESTALE;
 
 	dprintk("NFS: nfs_readpages (%s/%Lu %d)\n",
-			inode->i_sb->s_id,
+			inode_sb(inode)->s_id,
 			(unsigned long long)NFS_FILEID(inode),
 			nr_pages);
 	nfs_inc_stats(inode, NFSIOS_VFSREADPAGES);
diff --git a/fs/nfs/unlink.c b/fs/nfs/unlink.c
index 630b4a3c1a93..b565fa768255 100644
--- a/fs/nfs/unlink.c
+++ b/fs/nfs/unlink.c
@@ -101,7 +101,7 @@ static void nfs_do_call_unlink(struct nfs_unlinkdata *data)
 	};
 	struct rpc_task *task;
 	struct inode *dir = d_inode(data->dentry->d_parent);
-	nfs_sb_active(dir->i_sb);
+	nfs_sb_active(inode_sb(dir));
 	data->args.fh = NFS_FH(dir);
 	nfs_fattr_init(data->res.dir_attr);
 
@@ -284,7 +284,7 @@ static void nfs_async_rename_done(struct rpc_task *task, void *calldata)
 static void nfs_async_rename_release(void *calldata)
 {
 	struct nfs_renamedata	*data = calldata;
-	struct super_block *sb = data->old_dir->i_sb;
+	struct super_block *sb = inode_sb(data->old_dir);
 
 	if (d_really_is_positive(data->old_dentry))
 		nfs_mark_for_revalidate(d_inode(data->old_dentry));
@@ -384,7 +384,7 @@ nfs_async_rename(struct inode *old_dir, struct inode *new_dir,
 	data->res.old_fattr = &data->old_fattr;
 	data->res.new_fattr = &data->new_fattr;
 
-	nfs_sb_active(old_dir->i_sb);
+	nfs_sb_active(inode_sb(old_dir));
 
 	NFS_PROTO(data->old_dir)->rename_setup(&msg, old_dir);
 
-- 
2.15.1

^ permalink raw reply related	[flat|nested] 88+ messages in thread

* [PATCH 51/76] fs/nilfs2: Use inode_sb() helper instead of inode->i_sb
  2018-05-08 18:03 [RFC][PATCH 0/76] vfs: 'views' for filesystems with more than one root Mark Fasheh
                   ` (49 preceding siblings ...)
  2018-05-08 18:04 ` [PATCH 50/76] fs/nfs: " Mark Fasheh
@ 2018-05-08 18:04 ` Mark Fasheh
  2018-05-08 18:04 ` [PATCH 52/76] fs/notify: " Mark Fasheh
                   ` (25 subsequent siblings)
  76 siblings, 0 replies; 88+ messages in thread
From: Mark Fasheh @ 2018-05-08 18:04 UTC (permalink / raw)
  To: linux-fsdevel; +Cc: linux-kernel, linux-btrfs, Mark Fasheh

Signed-off-by: Mark Fasheh <mfasheh@suse.de>
---
 fs/nilfs2/alloc.c   | 10 ++++-----
 fs/nilfs2/bmap.c    |  4 ++--
 fs/nilfs2/btnode.c  |  6 +++---
 fs/nilfs2/btree.c   | 12 +++++------
 fs/nilfs2/cpfile.c  |  6 +++---
 fs/nilfs2/dat.c     |  2 +-
 fs/nilfs2/dir.c     | 24 ++++++++++-----------
 fs/nilfs2/direct.c  |  4 ++--
 fs/nilfs2/file.c    | 19 ++++++++--------
 fs/nilfs2/gcinode.c |  6 +++---
 fs/nilfs2/ifile.c   |  2 +-
 fs/nilfs2/inode.c   | 62 ++++++++++++++++++++++++++---------------------------
 fs/nilfs2/ioctl.c   | 60 +++++++++++++++++++++++++--------------------------
 fs/nilfs2/mdt.c     | 10 ++++-----
 fs/nilfs2/mdt.h     |  2 +-
 fs/nilfs2/namei.c   | 54 +++++++++++++++++++++++-----------------------
 fs/nilfs2/page.c    |  2 +-
 fs/nilfs2/sufile.c  | 20 ++++++++---------
 fs/nilfs2/sufile.h  |  2 +-
 19 files changed, 154 insertions(+), 153 deletions(-)

diff --git a/fs/nilfs2/alloc.c b/fs/nilfs2/alloc.c
index 03b8ba933eb2..3b3af2e7b2fb 100644
--- a/fs/nilfs2/alloc.c
+++ b/fs/nilfs2/alloc.c
@@ -622,7 +622,7 @@ void nilfs_palloc_commit_free_entry(struct inode *inode,
 	lock = nilfs_mdt_bgl_lock(inode, group);
 
 	if (!nilfs_clear_bit_atomic(lock, group_offset, bitmap))
-		nilfs_msg(inode->i_sb, KERN_WARNING,
+		nilfs_msg(inode_sb(inode), KERN_WARNING,
 			  "%s (ino=%lu): entry number %llu already freed",
 			  __func__, inode->i_ino,
 			  (unsigned long long)req->pr_entry_nr);
@@ -663,7 +663,7 @@ void nilfs_palloc_abort_alloc_entry(struct inode *inode,
 	lock = nilfs_mdt_bgl_lock(inode, group);
 
 	if (!nilfs_clear_bit_atomic(lock, group_offset, bitmap))
-		nilfs_msg(inode->i_sb, KERN_WARNING,
+		nilfs_msg(inode_sb(inode), KERN_WARNING,
 			  "%s (ino=%lu): entry number %llu already freed",
 			  __func__, inode->i_ino,
 			  (unsigned long long)req->pr_entry_nr);
@@ -772,7 +772,7 @@ int nilfs_palloc_freev(struct inode *inode, __u64 *entry_nrs, size_t nitems)
 		do {
 			if (!nilfs_clear_bit_atomic(lock, group_offset,
 						    bitmap)) {
-				nilfs_msg(inode->i_sb, KERN_WARNING,
+				nilfs_msg(inode_sb(inode), KERN_WARNING,
 					  "%s (ino=%lu): entry number %llu already freed",
 					  __func__, inode->i_ino,
 					  (unsigned long long)entry_nrs[j]);
@@ -817,7 +817,7 @@ int nilfs_palloc_freev(struct inode *inode, __u64 *entry_nrs, size_t nitems)
 			ret = nilfs_palloc_delete_entry_block(inode,
 							      last_nrs[k]);
 			if (ret && ret != -ENOENT)
-				nilfs_msg(inode->i_sb, KERN_WARNING,
+				nilfs_msg(inode_sb(inode), KERN_WARNING,
 					  "error %d deleting block that object (entry=%llu, ino=%lu) belongs to",
 					  ret, (unsigned long long)last_nrs[k],
 					  inode->i_ino);
@@ -835,7 +835,7 @@ int nilfs_palloc_freev(struct inode *inode, __u64 *entry_nrs, size_t nitems)
 		if (nfree == nilfs_palloc_entries_per_group(inode)) {
 			ret = nilfs_palloc_delete_bitmap_block(inode, group);
 			if (ret && ret != -ENOENT)
-				nilfs_msg(inode->i_sb, KERN_WARNING,
+				nilfs_msg(inode_sb(inode), KERN_WARNING,
 					  "error %d deleting bitmap block of group=%lu, ino=%lu",
 					  ret, group, inode->i_ino);
 		}
diff --git a/fs/nilfs2/bmap.c b/fs/nilfs2/bmap.c
index 01fb1831ca25..9d466fb6e65f 100644
--- a/fs/nilfs2/bmap.c
+++ b/fs/nilfs2/bmap.c
@@ -30,7 +30,7 @@
 
 struct inode *nilfs_bmap_get_dat(const struct nilfs_bmap *bmap)
 {
-	struct the_nilfs *nilfs = bmap->b_inode->i_sb->s_fs_info;
+	struct the_nilfs *nilfs = inode_sb(bmap->b_inode)->s_fs_info;
 
 	return nilfs->ns_dat;
 }
@@ -41,7 +41,7 @@ static int nilfs_bmap_convert_error(struct nilfs_bmap *bmap,
 	struct inode *inode = bmap->b_inode;
 
 	if (err == -EINVAL) {
-		__nilfs_error(inode->i_sb, fname,
+		__nilfs_error(inode_sb(inode), fname,
 			      "broken bmap (inode number=%lu)", inode->i_ino);
 		err = -EIO;
 	}
diff --git a/fs/nilfs2/btnode.c b/fs/nilfs2/btnode.c
index c21e0b4454a6..87bc94f23271 100644
--- a/fs/nilfs2/btnode.c
+++ b/fs/nilfs2/btnode.c
@@ -51,7 +51,7 @@ nilfs_btnode_create_block(struct address_space *btnc, __u64 blocknr)
 		BUG();
 	}
 	memset(bh->b_data, 0, i_blocksize(inode));
-	bh->b_bdev = inode->i_sb->s_bdev;
+	bh->b_bdev = inode_sb(inode)->s_bdev;
 	bh->b_blocknr = blocknr;
 	set_buffer_mapped(bh);
 	set_buffer_uptodate(bh);
@@ -83,7 +83,7 @@ int nilfs_btnode_submit_block(struct address_space *btnc, __u64 blocknr,
 	if (pblocknr == 0) {
 		pblocknr = blocknr;
 		if (inode->i_ino != NILFS_DAT_INO) {
-			struct the_nilfs *nilfs = inode->i_sb->s_fs_info;
+			struct the_nilfs *nilfs = inode_sb(inode)->s_fs_info;
 
 			/* blocknr is a virtual block number */
 			err = nilfs_dat_translate(nilfs->ns_dat, blocknr,
@@ -110,7 +110,7 @@ int nilfs_btnode_submit_block(struct address_space *btnc, __u64 blocknr,
 		goto found;
 	}
 	set_buffer_mapped(bh);
-	bh->b_bdev = inode->i_sb->s_bdev;
+	bh->b_bdev = inode_sb(inode)->s_bdev;
 	bh->b_blocknr = pblocknr; /* set block address for read */
 	bh->b_end_io = end_buffer_read_sync;
 	get_bh(bh);
diff --git a/fs/nilfs2/btree.c b/fs/nilfs2/btree.c
index 16a7a67a11c9..e8c90e0b3f1f 100644
--- a/fs/nilfs2/btree.c
+++ b/fs/nilfs2/btree.c
@@ -360,7 +360,7 @@ static int nilfs_btree_node_broken(const struct nilfs_btree_node *node,
 		     (flags & NILFS_BTREE_NODE_ROOT) ||
 		     nchildren < 0 ||
 		     nchildren > NILFS_BTREE_NODE_NCHILDREN_MAX(size))) {
-		nilfs_msg(inode->i_sb, KERN_CRIT,
+		nilfs_msg(inode_sb(inode), KERN_CRIT,
 			  "bad btree node (ino=%lu, blocknr=%llu): level = %d, flags = 0x%x, nchildren = %d",
 			  inode->i_ino, (unsigned long long)blocknr, level,
 			  flags, nchildren);
@@ -390,7 +390,7 @@ static int nilfs_btree_root_broken(const struct nilfs_btree_node *node,
 		     level >= NILFS_BTREE_LEVEL_MAX ||
 		     nchildren < 0 ||
 		     nchildren > NILFS_BTREE_ROOT_NCHILDREN_MAX)) {
-		nilfs_msg(inode->i_sb, KERN_CRIT,
+		nilfs_msg(inode_sb(inode), KERN_CRIT,
 			  "bad btree root (ino=%lu): level = %d, flags = 0x%x, nchildren = %d",
 			  inode->i_ino, level, flags, nchildren);
 		ret = 1;
@@ -459,7 +459,7 @@ static int nilfs_btree_bad_node(const struct nilfs_bmap *btree,
 {
 	if (unlikely(nilfs_btree_node_get_level(node) != level)) {
 		dump_stack();
-		nilfs_msg(btree->b_inode->i_sb, KERN_CRIT,
+		nilfs_msg(inode_sb(btree->b_inode), KERN_CRIT,
 			  "btree level mismatch (ino=%lu): %d != %d",
 			  btree->b_inode->i_ino,
 			  nilfs_btree_node_get_level(node), level);
@@ -517,7 +517,7 @@ static int __nilfs_btree_get_block(const struct nilfs_bmap *btree, __u64 ptr,
 
  out_no_wait:
 	if (!buffer_uptodate(bh)) {
-		nilfs_msg(btree->b_inode->i_sb, KERN_ERR,
+		nilfs_msg(inode_sb(btree->b_inode), KERN_ERR,
 			  "I/O error reading b-tree node block (ino=%lu, blocknr=%llu)",
 			  btree->b_inode->i_ino, (unsigned long long)ptr);
 		brelse(bh);
@@ -2083,7 +2083,7 @@ static int nilfs_btree_propagate(struct nilfs_bmap *btree,
 	ret = nilfs_btree_do_lookup(btree, path, key, NULL, level + 1, 0);
 	if (ret < 0) {
 		if (unlikely(ret == -ENOENT))
-			nilfs_msg(btree->b_inode->i_sb, KERN_CRIT,
+			nilfs_msg(inode_sb(btree->b_inode), KERN_CRIT,
 				  "writing node/leaf block does not appear in b-tree (ino=%lu) at key=%llu, level=%d",
 				  btree->b_inode->i_ino,
 				  (unsigned long long)key, level);
@@ -2123,7 +2123,7 @@ static void nilfs_btree_add_dirty_buffer(struct nilfs_bmap *btree,
 	if (level < NILFS_BTREE_LEVEL_NODE_MIN ||
 	    level >= NILFS_BTREE_LEVEL_MAX) {
 		dump_stack();
-		nilfs_msg(btree->b_inode->i_sb, KERN_WARNING,
+		nilfs_msg(inode_sb(btree->b_inode), KERN_WARNING,
 			  "invalid btree level: %d (key=%llu, ino=%lu, blocknr=%llu)",
 			  level, (unsigned long long)key,
 			  btree->b_inode->i_ino,
diff --git a/fs/nilfs2/cpfile.c b/fs/nilfs2/cpfile.c
index a15a1601e931..c63985f7955e 100644
--- a/fs/nilfs2/cpfile.c
+++ b/fs/nilfs2/cpfile.c
@@ -331,7 +331,7 @@ int nilfs_cpfile_delete_checkpoints(struct inode *cpfile,
 	int ret, ncps, nicps, nss, count, i;
 
 	if (unlikely(start == 0 || start > end)) {
-		nilfs_msg(cpfile->i_sb, KERN_ERR,
+		nilfs_msg(inode_sb(cpfile), KERN_ERR,
 			  "cannot delete checkpoints: invalid range [%llu, %llu)",
 			  (unsigned long long)start, (unsigned long long)end);
 		return -EINVAL;
@@ -385,7 +385,7 @@ int nilfs_cpfile_delete_checkpoints(struct inode *cpfile,
 								   cpfile, cno);
 					if (ret == 0)
 						continue;
-					nilfs_msg(cpfile->i_sb, KERN_ERR,
+					nilfs_msg(inode_sb(cpfile), KERN_ERR,
 						  "error %d deleting checkpoint block",
 						  ret);
 					break;
@@ -918,7 +918,7 @@ int nilfs_cpfile_change_cpmode(struct inode *cpfile, __u64 cno, int mode)
 
 	switch (mode) {
 	case NILFS_CHECKPOINT:
-		if (nilfs_checkpoint_is_mounted(cpfile->i_sb, cno))
+		if (nilfs_checkpoint_is_mounted(inode_sb(cpfile), cno))
 			/*
 			 * Current implementation does not have to protect
 			 * plain read-only mounts since they are exclusive
diff --git a/fs/nilfs2/dat.c b/fs/nilfs2/dat.c
index dffedb2f8817..7f90bce3750b 100644
--- a/fs/nilfs2/dat.c
+++ b/fs/nilfs2/dat.c
@@ -349,7 +349,7 @@ int nilfs_dat_move(struct inode *dat, __u64 vblocknr, sector_t blocknr)
 	kaddr = kmap_atomic(entry_bh->b_page);
 	entry = nilfs_palloc_block_get_entry(dat, vblocknr, entry_bh, kaddr);
 	if (unlikely(entry->de_blocknr == cpu_to_le64(0))) {
-		nilfs_msg(dat->i_sb, KERN_CRIT,
+		nilfs_msg(inode_sb(dat), KERN_CRIT,
 			  "%s: invalid vblocknr = %llu, [%llu, %llu)",
 			  __func__, (unsigned long long)vblocknr,
 			  (unsigned long long)le64_to_cpu(entry->de_start),
diff --git a/fs/nilfs2/dir.c b/fs/nilfs2/dir.c
index 582831ab3eb9..c805564d6893 100644
--- a/fs/nilfs2/dir.c
+++ b/fs/nilfs2/dir.c
@@ -70,7 +70,7 @@ static inline __le16 nilfs_rec_len_to_disk(unsigned int len)
  */
 static inline unsigned int nilfs_chunk_size(struct inode *inode)
 {
-	return inode->i_sb->s_blocksize;
+	return inode_sb(inode)->s_blocksize;
 }
 
 static inline void nilfs_put_page(struct page *page)
@@ -125,7 +125,7 @@ static void nilfs_commit_chunk(struct page *page,
 static bool nilfs_check_page(struct page *page)
 {
 	struct inode *dir = page->mapping->host;
-	struct super_block *sb = dir->i_sb;
+	struct super_block *sb = inode_sb(dir);
 	unsigned int chunk_size = nilfs_chunk_size(dir);
 	char *kaddr = page_address(page);
 	unsigned int offs, rec_len;
@@ -273,7 +273,7 @@ static int nilfs_readdir(struct file *file, struct dir_context *ctx)
 {
 	loff_t pos = ctx->pos;
 	struct inode *inode = file_inode(file);
-	struct super_block *sb = inode->i_sb;
+	struct super_block *sb = inode_sb(inode);
 	unsigned int offset = pos & ~PAGE_MASK;
 	unsigned long n = pos >> PAGE_SHIFT;
 	unsigned long npages = dir_pages(inode);
@@ -363,8 +363,8 @@ nilfs_find_entry(struct inode *dir, const struct qstr *qstr,
 			kaddr += nilfs_last_byte(dir, n) - reclen;
 			while ((char *) de <= kaddr) {
 				if (de->rec_len == 0) {
-					nilfs_error(dir->i_sb,
-						"zero-length directory entry");
+					nilfs_error(inode_sb(dir),
+						    "zero-length directory entry");
 					nilfs_put_page(page);
 					goto out;
 				}
@@ -378,10 +378,10 @@ nilfs_find_entry(struct inode *dir, const struct qstr *qstr,
 			n = 0;
 		/* next page is past the blocks we've got */
 		if (unlikely(n > (dir->i_blocks >> (PAGE_SHIFT - 9)))) {
-			nilfs_error(dir->i_sb,
-			       "dir %lu size %lld exceeds block count %llu",
-			       dir->i_ino, dir->i_size,
-			       (unsigned long long)dir->i_blocks);
+			nilfs_error(inode_sb(dir),
+				    "dir %lu size %lld exceeds block count %llu",
+				    dir->i_ino, dir->i_size,
+				    (unsigned long long)dir->i_blocks);
 			goto out;
 		}
 	} while (n != start);
@@ -487,7 +487,7 @@ int nilfs_add_link(struct dentry *dentry, struct inode *inode)
 				goto got_it;
 			}
 			if (de->rec_len == 0) {
-				nilfs_error(dir->i_sb,
+				nilfs_error(inode_sb(dir),
 					    "zero-length directory entry");
 				err = -EIO;
 				goto out_unlock;
@@ -559,7 +559,7 @@ int nilfs_delete_entry(struct nilfs_dir_entry *dir, struct page *page)
 
 	while ((char *)de < (char *)dir) {
 		if (de->rec_len == 0) {
-			nilfs_error(inode->i_sb,
+			nilfs_error(inode_sb(inode),
 				    "zero-length directory entry");
 			err = -EIO;
 			goto out;
@@ -646,7 +646,7 @@ int nilfs_empty_dir(struct inode *inode)
 
 		while ((char *)de <= kaddr) {
 			if (de->rec_len == 0) {
-				nilfs_error(inode->i_sb,
+				nilfs_error(inode_sb(inode),
 					    "zero-length directory entry (kaddr=%p, de=%p)",
 					    kaddr, de);
 				goto not_empty;
diff --git a/fs/nilfs2/direct.c b/fs/nilfs2/direct.c
index 96e3ed0d9652..5feca9aa47f4 100644
--- a/fs/nilfs2/direct.c
+++ b/fs/nilfs2/direct.c
@@ -337,14 +337,14 @@ static int nilfs_direct_assign(struct nilfs_bmap *bmap,
 
 	key = nilfs_bmap_data_get_key(bmap, *bh);
 	if (unlikely(key > NILFS_DIRECT_KEY_MAX)) {
-		nilfs_msg(bmap->b_inode->i_sb, KERN_CRIT,
+		nilfs_msg(inode_sb(bmap->b_inode), KERN_CRIT,
 			  "%s (ino=%lu): invalid key: %llu", __func__,
 			  bmap->b_inode->i_ino, (unsigned long long)key);
 		return -EINVAL;
 	}
 	ptr = nilfs_direct_get_ptr(bmap, key);
 	if (unlikely(ptr == NILFS_BMAP_INVALID_PTR)) {
-		nilfs_msg(bmap->b_inode->i_sb, KERN_CRIT,
+		nilfs_msg(inode_sb(bmap->b_inode), KERN_CRIT,
 			  "%s (ino=%lu): invalid pointer: %llu", __func__,
 			  bmap->b_inode->i_ino, (unsigned long long)ptr);
 		return -EINVAL;
diff --git a/fs/nilfs2/file.c b/fs/nilfs2/file.c
index c5fa3dee72fc..a4f813024483 100644
--- a/fs/nilfs2/file.c
+++ b/fs/nilfs2/file.c
@@ -38,13 +38,14 @@ int nilfs_sync_file(struct file *file, loff_t start, loff_t end, int datasync)
 
 	if (nilfs_inode_dirty(inode)) {
 		if (datasync)
-			err = nilfs_construct_dsync_segment(inode->i_sb, inode,
+			err = nilfs_construct_dsync_segment(inode_sb(inode),
+							    inode,
 							    start, end);
 		else
-			err = nilfs_construct_segment(inode->i_sb);
+			err = nilfs_construct_segment(inode_sb(inode));
 	}
 
-	nilfs = inode->i_sb->s_fs_info;
+	nilfs = inode_sb(inode)->s_fs_info;
 	if (!err)
 		err = nilfs_flush_device(nilfs);
 
@@ -59,10 +60,10 @@ static int nilfs_page_mkwrite(struct vm_fault *vmf)
 	struct nilfs_transaction_info ti;
 	int ret = 0;
 
-	if (unlikely(nilfs_near_disk_full(inode->i_sb->s_fs_info)))
+	if (unlikely(nilfs_near_disk_full(inode_sb(inode)->s_fs_info)))
 		return VM_FAULT_SIGBUS; /* -ENOSPC */
 
-	sb_start_pagefault(inode->i_sb);
+	sb_start_pagefault(inode_sb(inode));
 	lock_page(page);
 	if (page->mapping != inode->i_mapping ||
 	    page_offset(page) >= i_size_read(inode) || !PageUptodate(page)) {
@@ -99,7 +100,7 @@ static int nilfs_page_mkwrite(struct vm_fault *vmf)
 	/*
 	 * fill hole blocks
 	 */
-	ret = nilfs_transaction_begin(inode->i_sb, &ti, 1);
+	ret = nilfs_transaction_begin(inode_sb(inode), &ti, 1);
 	/* never returns -ENOMEM, but may return -ENOSPC */
 	if (unlikely(ret))
 		goto out;
@@ -107,16 +108,16 @@ static int nilfs_page_mkwrite(struct vm_fault *vmf)
 	file_update_time(vma->vm_file);
 	ret = block_page_mkwrite(vma, vmf, nilfs_get_block);
 	if (ret) {
-		nilfs_transaction_abort(inode->i_sb);
+		nilfs_transaction_abort(inode_sb(inode));
 		goto out;
 	}
 	nilfs_set_file_dirty(inode, 1 << (PAGE_SHIFT - inode->i_blkbits));
-	nilfs_transaction_commit(inode->i_sb);
+	nilfs_transaction_commit(inode_sb(inode));
 
  mapped:
 	wait_for_stable_page(page);
  out:
-	sb_end_pagefault(inode->i_sb);
+	sb_end_pagefault(inode_sb(inode));
 	return block_page_mkwrite_return(ret);
 }
 
diff --git a/fs/nilfs2/gcinode.c b/fs/nilfs2/gcinode.c
index 853a831dcde0..af751dd4fa54 100644
--- a/fs/nilfs2/gcinode.c
+++ b/fs/nilfs2/gcinode.c
@@ -79,7 +79,7 @@ int nilfs_gccache_submit_read_data(struct inode *inode, sector_t blkoff,
 		goto out;
 
 	if (pbn == 0) {
-		struct the_nilfs *nilfs = inode->i_sb->s_fs_info;
+		struct the_nilfs *nilfs = inode_sb(inode)->s_fs_info;
 
 		err = nilfs_dat_translate(nilfs->ns_dat, vbn, &pbn);
 		if (unlikely(err)) { /* -EIO, -ENOMEM, -ENOENT */
@@ -95,7 +95,7 @@ int nilfs_gccache_submit_read_data(struct inode *inode, sector_t blkoff,
 	}
 
 	if (!buffer_mapped(bh)) {
-		bh->b_bdev = inode->i_sb->s_bdev;
+		bh->b_bdev = inode_sb(inode)->s_bdev;
 		set_buffer_mapped(bh);
 	}
 	bh->b_blocknr = pbn;
@@ -151,7 +151,7 @@ int nilfs_gccache_wait_and_mark_dirty(struct buffer_head *bh)
 	if (!buffer_uptodate(bh)) {
 		struct inode *inode = bh->b_page->mapping->host;
 
-		nilfs_msg(inode->i_sb, KERN_ERR,
+		nilfs_msg(inode_sb(inode), KERN_ERR,
 			  "I/O error reading %s block for GC (ino=%lu, vblocknr=%llu)",
 			  buffer_nilfs_node(bh) ? "node" : "data",
 			  inode->i_ino, (unsigned long long)bh->b_blocknr);
diff --git a/fs/nilfs2/ifile.c b/fs/nilfs2/ifile.c
index b8fa45c20c63..841f7f6c5e29 100644
--- a/fs/nilfs2/ifile.c
+++ b/fs/nilfs2/ifile.c
@@ -141,7 +141,7 @@ int nilfs_ifile_delete_inode(struct inode *ifile, ino_t ino)
 int nilfs_ifile_get_inode_block(struct inode *ifile, ino_t ino,
 				struct buffer_head **out_bh)
 {
-	struct super_block *sb = ifile->i_sb;
+	struct super_block *sb = inode_sb(ifile);
 	int err;
 
 	if (unlikely(!NILFS_VALID_INODE(sb, ino))) {
diff --git a/fs/nilfs2/inode.c b/fs/nilfs2/inode.c
index 6a612d832e7d..88f590eccdaa 100644
--- a/fs/nilfs2/inode.c
+++ b/fs/nilfs2/inode.c
@@ -80,7 +80,7 @@ int nilfs_get_block(struct inode *inode, sector_t blkoff,
 		    struct buffer_head *bh_result, int create)
 {
 	struct nilfs_inode_info *ii = NILFS_I(inode);
-	struct the_nilfs *nilfs = inode->i_sb->s_fs_info;
+	struct the_nilfs *nilfs = inode_sb(inode)->s_fs_info;
 	__u64 blknum = 0;
 	int err = 0, ret;
 	unsigned int maxblocks = bh_result->b_size >> inode->i_blkbits;
@@ -89,7 +89,7 @@ int nilfs_get_block(struct inode *inode, sector_t blkoff,
 	ret = nilfs_bmap_lookup_contig(ii->i_bmap, blkoff, &blknum, maxblocks);
 	up_read(&NILFS_MDT(nilfs->ns_dat)->mi_sem);
 	if (ret >= 0) {	/* found */
-		map_bh(bh_result, inode->i_sb, blknum);
+		map_bh(bh_result, inode_sb(inode), blknum);
 		if (ret > 0)
 			bh_result->b_size = (ret << inode->i_blkbits);
 		goto out;
@@ -99,7 +99,7 @@ int nilfs_get_block(struct inode *inode, sector_t blkoff,
 		struct nilfs_transaction_info ti;
 
 		bh_result->b_blocknr = 0;
-		err = nilfs_transaction_begin(inode->i_sb, &ti, 1);
+		err = nilfs_transaction_begin(inode_sb(inode), &ti, 1);
 		if (unlikely(err))
 			goto out;
 		err = nilfs_bmap_insert(ii->i_bmap, blkoff,
@@ -112,21 +112,21 @@ int nilfs_get_block(struct inode *inode, sector_t blkoff,
 				 * However, the page having this block must
 				 * be locked in this case.
 				 */
-				nilfs_msg(inode->i_sb, KERN_WARNING,
+				nilfs_msg(inode_sb(inode), KERN_WARNING,
 					  "%s (ino=%lu): a race condition while inserting a data block at offset=%llu",
 					  __func__, inode->i_ino,
 					  (unsigned long long)blkoff);
 				err = 0;
 			}
-			nilfs_transaction_abort(inode->i_sb);
+			nilfs_transaction_abort(inode_sb(inode));
 			goto out;
 		}
 		nilfs_mark_inode_dirty_sync(inode);
-		nilfs_transaction_commit(inode->i_sb); /* never fails */
+		nilfs_transaction_commit(inode_sb(inode)); /* never fails */
 		/* Error handling should be detailed */
 		set_buffer_new(bh_result);
 		set_buffer_delay(bh_result);
-		map_bh(bh_result, inode->i_sb, 0);
+		map_bh(bh_result, inode_sb(inode), 0);
 		/* Disk block number must be changed to proper value */
 
 	} else if (ret == -ENOENT) {
@@ -174,13 +174,13 @@ static int nilfs_writepages(struct address_space *mapping,
 	struct inode *inode = mapping->host;
 	int err = 0;
 
-	if (sb_rdonly(inode->i_sb)) {
+	if (sb_rdonly(inode_sb(inode))) {
 		nilfs_clear_dirty_pages(mapping, false);
 		return -EROFS;
 	}
 
 	if (wbc->sync_mode == WB_SYNC_ALL)
-		err = nilfs_construct_dsync_segment(inode->i_sb, inode,
+		err = nilfs_construct_dsync_segment(inode_sb(inode), inode,
 						    wbc->range_start,
 						    wbc->range_end);
 	return err;
@@ -191,7 +191,7 @@ static int nilfs_writepage(struct page *page, struct writeback_control *wbc)
 	struct inode *inode = page->mapping->host;
 	int err;
 
-	if (sb_rdonly(inode->i_sb)) {
+	if (sb_rdonly(inode_sb(inode))) {
 		/*
 		 * It means that filesystem was remounted in read-only
 		 * mode because of error or metadata corruption. But we
@@ -207,11 +207,11 @@ static int nilfs_writepage(struct page *page, struct writeback_control *wbc)
 	unlock_page(page);
 
 	if (wbc->sync_mode == WB_SYNC_ALL) {
-		err = nilfs_construct_segment(inode->i_sb);
+		err = nilfs_construct_segment(inode_sb(inode));
 		if (unlikely(err))
 			return err;
 	} else if (wbc->for_reclaim)
-		nilfs_flush_segment(inode->i_sb, inode->i_ino);
+		nilfs_flush_segment(inode_sb(inode), inode->i_ino);
 
 	return 0;
 }
@@ -268,7 +268,7 @@ static int nilfs_write_begin(struct file *file, struct address_space *mapping,
 
 {
 	struct inode *inode = mapping->host;
-	int err = nilfs_transaction_begin(inode->i_sb, NULL, 1);
+	int err = nilfs_transaction_begin(inode_sb(inode), NULL, 1);
 
 	if (unlikely(err))
 		return err;
@@ -277,7 +277,7 @@ static int nilfs_write_begin(struct file *file, struct address_space *mapping,
 				nilfs_get_block);
 	if (unlikely(err)) {
 		nilfs_write_failed(mapping, pos + len);
-		nilfs_transaction_abort(inode->i_sb);
+		nilfs_transaction_abort(inode_sb(inode));
 	}
 	return err;
 }
@@ -296,7 +296,7 @@ static int nilfs_write_end(struct file *file, struct address_space *mapping,
 	copied = generic_write_end(file, mapping, pos, len, copied, page,
 				   fsdata);
 	nilfs_set_file_dirty(inode, nr_dirty);
-	err = nilfs_transaction_commit(inode->i_sb);
+	err = nilfs_transaction_commit(inode_sb(inode));
 	return err ? : copied;
 }
 
@@ -339,7 +339,7 @@ static int nilfs_insert_inode_locked(struct inode *inode,
 
 struct inode *nilfs_new_inode(struct inode *dir, umode_t mode)
 {
-	struct super_block *sb = dir->i_sb;
+	struct super_block *sb = inode_sb(dir);
 	struct the_nilfs *nilfs = sb->s_fs_info;
 	struct inode *inode;
 	struct nilfs_inode_info *ii;
@@ -651,7 +651,7 @@ void nilfs_write_inode_common(struct inode *inode,
 	raw_inode->i_generation = cpu_to_le32(inode->i_generation);
 
 	if (NILFS_ROOT_METADATA_FILE(inode->i_ino)) {
-		struct the_nilfs *nilfs = inode->i_sb->s_fs_info;
+		struct the_nilfs *nilfs = inode_sb(inode)->s_fs_info;
 
 		/* zero-fill unused portion in the case of super root block */
 		raw_inode->i_xattr = 0;
@@ -717,13 +717,13 @@ static void nilfs_truncate_bmap(struct nilfs_inode_info *ii,
 
 	b -= min_t(__u64, NILFS_MAX_TRUNCATE_BLOCKS, b - from);
 	ret = nilfs_bmap_truncate(ii->i_bmap, b);
-	nilfs_relax_pressure_in_lock(ii->vfs_inode.i_sb);
+	nilfs_relax_pressure_in_lock(inode_sb(&ii->vfs_inode));
 	if (!ret || (ret == -ENOMEM &&
 		     nilfs_bmap_truncate(ii->i_bmap, b) == 0))
 		goto repeat;
 
 failed:
-	nilfs_msg(ii->vfs_inode.i_sb, KERN_WARNING,
+	nilfs_msg(inode_sb(&ii->vfs_inode), KERN_WARNING,
 		  "error %d truncating bmap (ino=%lu)", ret,
 		  ii->vfs_inode.i_ino);
 }
@@ -733,7 +733,7 @@ void nilfs_truncate(struct inode *inode)
 	unsigned long blkoff;
 	unsigned int blocksize;
 	struct nilfs_transaction_info ti;
-	struct super_block *sb = inode->i_sb;
+	struct super_block *sb = inode_sb(inode);
 	struct nilfs_inode_info *ii = NILFS_I(inode);
 
 	if (!test_bit(NILFS_I_BMAP, &ii->i_state))
@@ -788,7 +788,7 @@ static void nilfs_clear_inode(struct inode *inode)
 void nilfs_evict_inode(struct inode *inode)
 {
 	struct nilfs_transaction_info ti;
-	struct super_block *sb = inode->i_sb;
+	struct super_block *sb = inode_sb(inode);
 	struct nilfs_inode_info *ii = NILFS_I(inode);
 	int ret;
 
@@ -826,7 +826,7 @@ int nilfs_setattr(struct dentry *dentry, struct iattr *iattr)
 {
 	struct nilfs_transaction_info ti;
 	struct inode *inode = d_inode(dentry);
-	struct super_block *sb = inode->i_sb;
+	struct super_block *sb = inode_sb(inode);
 	int err;
 
 	err = setattr_prepare(dentry, iattr);
@@ -873,7 +873,7 @@ int nilfs_permission(struct inode *inode, int mask)
 
 int nilfs_load_inode_block(struct inode *inode, struct buffer_head **pbh)
 {
-	struct the_nilfs *nilfs = inode->i_sb->s_fs_info;
+	struct the_nilfs *nilfs = inode_sb(inode)->s_fs_info;
 	struct nilfs_inode_info *ii = NILFS_I(inode);
 	int err;
 
@@ -902,7 +902,7 @@ int nilfs_load_inode_block(struct inode *inode, struct buffer_head **pbh)
 int nilfs_inode_dirty(struct inode *inode)
 {
 	struct nilfs_inode_info *ii = NILFS_I(inode);
-	struct the_nilfs *nilfs = inode->i_sb->s_fs_info;
+	struct the_nilfs *nilfs = inode_sb(inode)->s_fs_info;
 	int ret = 0;
 
 	if (!list_empty(&ii->i_dirty)) {
@@ -917,7 +917,7 @@ int nilfs_inode_dirty(struct inode *inode)
 int nilfs_set_file_dirty(struct inode *inode, unsigned int nr_dirty)
 {
 	struct nilfs_inode_info *ii = NILFS_I(inode);
-	struct the_nilfs *nilfs = inode->i_sb->s_fs_info;
+	struct the_nilfs *nilfs = inode_sb(inode)->s_fs_info;
 
 	atomic_add(nr_dirty, &nilfs->ns_ndirtyblks);
 
@@ -936,7 +936,7 @@ int nilfs_set_file_dirty(struct inode *inode, unsigned int nr_dirty)
 			 * This will happen when somebody is freeing
 			 * this inode.
 			 */
-			nilfs_msg(inode->i_sb, KERN_WARNING,
+			nilfs_msg(inode_sb(inode), KERN_WARNING,
 				  "cannot set file dirty (ino=%lu): the file is being freed",
 				  inode->i_ino);
 			spin_unlock(&nilfs->ns_inode_lock);
@@ -959,7 +959,7 @@ int __nilfs_mark_inode_dirty(struct inode *inode, int flags)
 
 	err = nilfs_load_inode_block(inode, &ibh);
 	if (unlikely(err)) {
-		nilfs_msg(inode->i_sb, KERN_WARNING,
+		nilfs_msg(inode_sb(inode), KERN_WARNING,
 			  "cannot mark inode dirty (ino=%lu): error %d loading inode block",
 			  inode->i_ino, err);
 		return err;
@@ -987,7 +987,7 @@ void nilfs_dirty_inode(struct inode *inode, int flags)
 	struct nilfs_mdt_info *mdi = NILFS_MDT(inode);
 
 	if (is_bad_inode(inode)) {
-		nilfs_msg(inode->i_sb, KERN_WARNING,
+		nilfs_msg(inode_sb(inode), KERN_WARNING,
 			  "tried to mark bad_inode dirty. ignored.");
 		dump_stack();
 		return;
@@ -996,15 +996,15 @@ void nilfs_dirty_inode(struct inode *inode, int flags)
 		nilfs_mdt_mark_dirty(inode);
 		return;
 	}
-	nilfs_transaction_begin(inode->i_sb, &ti, 0);
+	nilfs_transaction_begin(inode_sb(inode), &ti, 0);
 	__nilfs_mark_inode_dirty(inode, flags);
-	nilfs_transaction_commit(inode->i_sb); /* never fails */
+	nilfs_transaction_commit(inode_sb(inode)); /* never fails */
 }
 
 int nilfs_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo,
 		 __u64 start, __u64 len)
 {
-	struct the_nilfs *nilfs = inode->i_sb->s_fs_info;
+	struct the_nilfs *nilfs = inode_sb(inode)->s_fs_info;
 	__u64 logical = 0, phys = 0, size = 0;
 	__u32 flags = 0;
 	loff_t isize;
diff --git a/fs/nilfs2/ioctl.c b/fs/nilfs2/ioctl.c
index 1d2c3d7711fe..7f1877f959d7 100644
--- a/fs/nilfs2/ioctl.c
+++ b/fs/nilfs2/ioctl.c
@@ -166,7 +166,7 @@ static int nilfs_ioctl_setflags(struct inode *inode, struct file *filp,
 	    !capable(CAP_LINUX_IMMUTABLE))
 		goto out;
 
-	ret = nilfs_transaction_begin(inode->i_sb, &ti, 0);
+	ret = nilfs_transaction_begin(inode_sb(inode), &ti, 0);
 	if (ret)
 		goto out;
 
@@ -179,7 +179,7 @@ static int nilfs_ioctl_setflags(struct inode *inode, struct file *filp,
 		nilfs_set_transaction_flag(NILFS_TI_SYNC);
 
 	nilfs_mark_inode_dirty(inode);
-	ret = nilfs_transaction_commit(inode->i_sb);
+	ret = nilfs_transaction_commit(inode_sb(inode));
 out:
 	inode_unlock(inode);
 	mnt_drop_write_file(filp);
@@ -216,7 +216,7 @@ static int nilfs_ioctl_getversion(struct inode *inode, void __user *argp)
 static int nilfs_ioctl_change_cpmode(struct inode *inode, struct file *filp,
 				     unsigned int cmd, void __user *argp)
 {
-	struct the_nilfs *nilfs = inode->i_sb->s_fs_info;
+	struct the_nilfs *nilfs = inode_sb(inode)->s_fs_info;
 	struct nilfs_transaction_info ti;
 	struct nilfs_cpmode cpmode;
 	int ret;
@@ -234,13 +234,13 @@ static int nilfs_ioctl_change_cpmode(struct inode *inode, struct file *filp,
 
 	mutex_lock(&nilfs->ns_snapshot_mount_mutex);
 
-	nilfs_transaction_begin(inode->i_sb, &ti, 0);
+	nilfs_transaction_begin(inode_sb(inode), &ti, 0);
 	ret = nilfs_cpfile_change_cpmode(
 		nilfs->ns_cpfile, cpmode.cm_cno, cpmode.cm_mode);
 	if (unlikely(ret < 0))
-		nilfs_transaction_abort(inode->i_sb);
+		nilfs_transaction_abort(inode_sb(inode));
 	else
-		nilfs_transaction_commit(inode->i_sb); /* never fails */
+		nilfs_transaction_commit(inode_sb(inode)); /* never fails */
 
 	mutex_unlock(&nilfs->ns_snapshot_mount_mutex);
 out:
@@ -271,7 +271,7 @@ static int
 nilfs_ioctl_delete_checkpoint(struct inode *inode, struct file *filp,
 			      unsigned int cmd, void __user *argp)
 {
-	struct the_nilfs *nilfs = inode->i_sb->s_fs_info;
+	struct the_nilfs *nilfs = inode_sb(inode)->s_fs_info;
 	struct nilfs_transaction_info ti;
 	__u64 cno;
 	int ret;
@@ -287,12 +287,12 @@ nilfs_ioctl_delete_checkpoint(struct inode *inode, struct file *filp,
 	if (copy_from_user(&cno, argp, sizeof(cno)))
 		goto out;
 
-	nilfs_transaction_begin(inode->i_sb, &ti, 0);
+	nilfs_transaction_begin(inode_sb(inode), &ti, 0);
 	ret = nilfs_cpfile_delete_checkpoint(nilfs->ns_cpfile, cno);
 	if (unlikely(ret < 0))
-		nilfs_transaction_abort(inode->i_sb);
+		nilfs_transaction_abort(inode_sb(inode));
 	else
-		nilfs_transaction_commit(inode->i_sb); /* never fails */
+		nilfs_transaction_commit(inode_sb(inode)); /* never fails */
 out:
 	mnt_drop_write_file(filp);
 	return ret;
@@ -350,7 +350,7 @@ nilfs_ioctl_do_get_cpinfo(struct the_nilfs *nilfs, __u64 *posp, int flags,
 static int nilfs_ioctl_get_cpstat(struct inode *inode, struct file *filp,
 				  unsigned int cmd, void __user *argp)
 {
-	struct the_nilfs *nilfs = inode->i_sb->s_fs_info;
+	struct the_nilfs *nilfs = inode_sb(inode)->s_fs_info;
 	struct nilfs_cpstat cpstat;
 	int ret;
 
@@ -417,7 +417,7 @@ nilfs_ioctl_do_get_suinfo(struct the_nilfs *nilfs, __u64 *posp, int flags,
 static int nilfs_ioctl_get_sustat(struct inode *inode, struct file *filp,
 				  unsigned int cmd, void __user *argp)
 {
-	struct the_nilfs *nilfs = inode->i_sb->s_fs_info;
+	struct the_nilfs *nilfs = inode_sb(inode)->s_fs_info;
 	struct nilfs_sustat sustat;
 	int ret;
 
@@ -526,7 +526,7 @@ nilfs_ioctl_do_get_bdescs(struct the_nilfs *nilfs, __u64 *posp, int flags,
 static int nilfs_ioctl_get_bdescs(struct inode *inode, struct file *filp,
 				  unsigned int cmd, void __user *argp)
 {
-	struct the_nilfs *nilfs = inode->i_sb->s_fs_info;
+	struct the_nilfs *nilfs = inode_sb(inode)->s_fs_info;
 	struct nilfs_argv argv;
 	int ret;
 
@@ -583,7 +583,7 @@ static int nilfs_ioctl_move_inode_block(struct inode *inode,
 
 	if (unlikely(ret < 0)) {
 		if (ret == -ENOENT)
-			nilfs_msg(inode->i_sb, KERN_CRIT,
+			nilfs_msg(inode_sb(inode), KERN_CRIT,
 				  "%s: invalid virtual block address (%s): ino=%llu, cno=%llu, offset=%llu, blocknr=%llu, vblocknr=%llu",
 				  __func__, vdesc->vd_flags ? "node" : "data",
 				  (unsigned long long)vdesc->vd_ino,
@@ -594,7 +594,7 @@ static int nilfs_ioctl_move_inode_block(struct inode *inode,
 		return ret;
 	}
 	if (unlikely(!list_empty(&bh->b_assoc_buffers))) {
-		nilfs_msg(inode->i_sb, KERN_CRIT,
+		nilfs_msg(inode_sb(inode), KERN_CRIT,
 			  "%s: conflicting %s buffer: ino=%llu, cno=%llu, offset=%llu, blocknr=%llu, vblocknr=%llu",
 			  __func__, vdesc->vd_flags ? "node" : "data",
 			  (unsigned long long)vdesc->vd_ino,
@@ -916,7 +916,7 @@ static int nilfs_ioctl_clean_segments(struct inode *inode, struct file *filp,
 		ret = PTR_ERR(kbufs[4]);
 		goto out;
 	}
-	nilfs = inode->i_sb->s_fs_info;
+	nilfs = inode_sb(inode)->s_fs_info;
 
 	for (n = 0; n < 4; n++) {
 		ret = -EINVAL;
@@ -959,15 +959,15 @@ static int nilfs_ioctl_clean_segments(struct inode *inode, struct file *filp,
 		goto out_free;
 	}
 
-	ret = nilfs_ioctl_move_blocks(inode->i_sb, &argv[0], kbufs[0]);
+	ret = nilfs_ioctl_move_blocks(inode_sb(inode), &argv[0], kbufs[0]);
 	if (ret < 0) {
-		nilfs_msg(inode->i_sb, KERN_ERR,
+		nilfs_msg(inode_sb(inode), KERN_ERR,
 			  "error %d preparing GC: cannot read source blocks",
 			  ret);
 	} else {
 		if (nilfs_sb_need_update(nilfs))
 			set_nilfs_discontinued(nilfs);
-		ret = nilfs_clean_segments(inode->i_sb, argv, kbufs);
+		ret = nilfs_clean_segments(inode_sb(inode), argv, kbufs);
 	}
 
 	nilfs_remove_all_gcinodes(nilfs);
@@ -1016,11 +1016,11 @@ static int nilfs_ioctl_sync(struct inode *inode, struct file *filp,
 	int ret;
 	struct the_nilfs *nilfs;
 
-	ret = nilfs_construct_segment(inode->i_sb);
+	ret = nilfs_construct_segment(inode_sb(inode));
 	if (ret < 0)
 		return ret;
 
-	nilfs = inode->i_sb->s_fs_info;
+	nilfs = inode_sb(inode)->s_fs_info;
 	ret = nilfs_flush_device(nilfs);
 	if (ret < 0)
 		return ret;
@@ -1060,7 +1060,7 @@ static int nilfs_ioctl_resize(struct inode *inode, struct file *filp,
 	if (copy_from_user(&newsize, argp, sizeof(newsize)))
 		goto out_drop_write;
 
-	ret = nilfs_resize_fs(inode->i_sb, newsize);
+	ret = nilfs_resize_fs(inode_sb(inode), newsize);
 
 out_drop_write:
 	mnt_drop_write_file(filp);
@@ -1081,7 +1081,7 @@ static int nilfs_ioctl_resize(struct inode *inode, struct file *filp,
  */
 static int nilfs_ioctl_trim_fs(struct inode *inode, void __user *argp)
 {
-	struct the_nilfs *nilfs = inode->i_sb->s_fs_info;
+	struct the_nilfs *nilfs = inode_sb(inode)->s_fs_info;
 	struct request_queue *q = bdev_get_queue(nilfs->ns_bdev);
 	struct fstrim_range range;
 	int ret;
@@ -1123,7 +1123,7 @@ static int nilfs_ioctl_trim_fs(struct inode *inode, void __user *argp)
  */
 static int nilfs_ioctl_set_alloc_range(struct inode *inode, void __user *argp)
 {
-	struct the_nilfs *nilfs = inode->i_sb->s_fs_info;
+	struct the_nilfs *nilfs = inode_sb(inode)->s_fs_info;
 	__u64 range[2];
 	__u64 minseg, maxseg;
 	unsigned long segbytes;
@@ -1137,7 +1137,7 @@ static int nilfs_ioctl_set_alloc_range(struct inode *inode, void __user *argp)
 		goto out;
 
 	ret = -ERANGE;
-	if (range[1] > i_size_read(inode->i_sb->s_bdev->bd_inode))
+	if (range[1] > i_size_read(inode_sb(inode)->s_bdev->bd_inode))
 		goto out;
 
 	segbytes = nilfs->ns_blocks_per_segment * nilfs->ns_blocksize;
@@ -1183,7 +1183,7 @@ static int nilfs_ioctl_get_info(struct inode *inode, struct file *filp,
 						  void *, size_t, size_t))
 
 {
-	struct the_nilfs *nilfs = inode->i_sb->s_fs_info;
+	struct the_nilfs *nilfs = inode_sb(inode)->s_fs_info;
 	struct nilfs_argv argv;
 	int ret;
 
@@ -1229,7 +1229,7 @@ static int nilfs_ioctl_get_info(struct inode *inode, struct file *filp,
 static int nilfs_ioctl_set_suinfo(struct inode *inode, struct file *filp,
 				unsigned int cmd, void __user *argp)
 {
-	struct the_nilfs *nilfs = inode->i_sb->s_fs_info;
+	struct the_nilfs *nilfs = inode_sb(inode)->s_fs_info;
 	struct nilfs_transaction_info ti;
 	struct nilfs_argv argv;
 	size_t len;
@@ -1276,13 +1276,13 @@ static int nilfs_ioctl_set_suinfo(struct inode *inode, struct file *filp,
 		goto out_free;
 	}
 
-	nilfs_transaction_begin(inode->i_sb, &ti, 0);
+	nilfs_transaction_begin(inode_sb(inode), &ti, 0);
 	ret = nilfs_sufile_set_suinfo(nilfs->ns_sufile, kbuf, argv.v_size,
 			argv.v_nmembs);
 	if (unlikely(ret < 0))
-		nilfs_transaction_abort(inode->i_sb);
+		nilfs_transaction_abort(inode_sb(inode));
 	else
-		nilfs_transaction_commit(inode->i_sb); /* never fails */
+		nilfs_transaction_commit(inode_sb(inode)); /* never fails */
 
 out_free:
 	vfree(kbuf);
diff --git a/fs/nilfs2/mdt.c b/fs/nilfs2/mdt.c
index c6bc1033e7d2..d208de0e8fd4 100644
--- a/fs/nilfs2/mdt.c
+++ b/fs/nilfs2/mdt.c
@@ -78,7 +78,7 @@ static int nilfs_mdt_create_block(struct inode *inode, unsigned long block,
 						     struct buffer_head *,
 						     void *))
 {
-	struct super_block *sb = inode->i_sb;
+	struct super_block *sb = inode_sb(inode);
 	struct nilfs_transaction_info ti;
 	struct buffer_head *bh;
 	int err;
@@ -153,7 +153,7 @@ nilfs_mdt_submit_block(struct inode *inode, unsigned long blkoff,
 		unlock_buffer(bh);
 		goto failed_bh;
 	}
-	map_bh(bh, inode->i_sb, (sector_t)blknum);
+	map_bh(bh, inode_sb(inode), (sector_t)blknum);
 
 	bh->b_end_io = end_buffer_read_sync;
 	get_bh(bh);
@@ -208,7 +208,7 @@ static int nilfs_mdt_read_block(struct inode *inode, unsigned long block,
  out_no_wait:
 	err = -EIO;
 	if (!buffer_uptodate(first_bh)) {
-		nilfs_msg(inode->i_sb, KERN_ERR,
+		nilfs_msg(inode_sb(inode), KERN_ERR,
 			  "I/O error reading meta-data file (ino=%lu, block-offset=%lu)",
 			  inode->i_ino, block);
 		goto failed_bh;
@@ -413,7 +413,7 @@ nilfs_mdt_write_page(struct page *page, struct writeback_control *wbc)
 	struct super_block *sb;
 	int err = 0;
 
-	if (inode && sb_rdonly(inode->i_sb)) {
+	if (inode && sb_rdonly(inode_sb(inode))) {
 		/*
 		 * It means that filesystem was remounted in read-only
 		 * mode because of error or metadata corruption. But we
@@ -431,7 +431,7 @@ nilfs_mdt_write_page(struct page *page, struct writeback_control *wbc)
 	if (!inode)
 		return 0;
 
-	sb = inode->i_sb;
+	sb = inode_sb(inode);
 
 	if (wbc->sync_mode == WB_SYNC_ALL)
 		err = nilfs_construct_segment(sb);
diff --git a/fs/nilfs2/mdt.h b/fs/nilfs2/mdt.h
index 3f67f3932097..cf9f18dd0b66 100644
--- a/fs/nilfs2/mdt.h
+++ b/fs/nilfs2/mdt.h
@@ -114,7 +114,7 @@ static inline void nilfs_mdt_clear_dirty(struct inode *inode)
 
 static inline __u64 nilfs_mdt_cno(struct inode *inode)
 {
-	return ((struct the_nilfs *)inode->i_sb->s_fs_info)->ns_cno;
+	return ((struct the_nilfs *) inode_sb(inode)->s_fs_info)->ns_cno;
 }
 
 static inline spinlock_t *
diff --git a/fs/nilfs2/namei.c b/fs/nilfs2/namei.c
index 1a2894aa0194..a66c98a508be 100644
--- a/fs/nilfs2/namei.c
+++ b/fs/nilfs2/namei.c
@@ -70,7 +70,7 @@ nilfs_lookup(struct inode *dir, struct dentry *dentry, unsigned int flags)
 		return ERR_PTR(-ENAMETOOLONG);
 
 	ino = nilfs_inode_by_name(dir, &dentry->d_name);
-	inode = ino ? nilfs_iget(dir->i_sb, NILFS_I(dir)->i_root, ino) : NULL;
+	inode = ino ? nilfs_iget(inode_sb(dir), NILFS_I(dir)->i_root, ino) : NULL;
 	return d_splice_alias(inode, dentry);
 }
 
@@ -89,7 +89,7 @@ static int nilfs_create(struct inode *dir, struct dentry *dentry, umode_t mode,
 	struct nilfs_transaction_info ti;
 	int err;
 
-	err = nilfs_transaction_begin(dir->i_sb, &ti, 1);
+	err = nilfs_transaction_begin(inode_sb(dir), &ti, 1);
 	if (err)
 		return err;
 	inode = nilfs_new_inode(dir, mode);
@@ -102,9 +102,9 @@ static int nilfs_create(struct inode *dir, struct dentry *dentry, umode_t mode,
 		err = nilfs_add_nondir(dentry, inode);
 	}
 	if (!err)
-		err = nilfs_transaction_commit(dir->i_sb);
+		err = nilfs_transaction_commit(inode_sb(dir));
 	else
-		nilfs_transaction_abort(dir->i_sb);
+		nilfs_transaction_abort(inode_sb(dir));
 
 	return err;
 }
@@ -116,7 +116,7 @@ nilfs_mknod(struct inode *dir, struct dentry *dentry, umode_t mode, dev_t rdev)
 	struct nilfs_transaction_info ti;
 	int err;
 
-	err = nilfs_transaction_begin(dir->i_sb, &ti, 1);
+	err = nilfs_transaction_begin(inode_sb(dir), &ti, 1);
 	if (err)
 		return err;
 	inode = nilfs_new_inode(dir, mode);
@@ -127,9 +127,9 @@ nilfs_mknod(struct inode *dir, struct dentry *dentry, umode_t mode, dev_t rdev)
 		err = nilfs_add_nondir(dentry, inode);
 	}
 	if (!err)
-		err = nilfs_transaction_commit(dir->i_sb);
+		err = nilfs_transaction_commit(inode_sb(dir));
 	else
-		nilfs_transaction_abort(dir->i_sb);
+		nilfs_transaction_abort(inode_sb(dir));
 
 	return err;
 }
@@ -138,7 +138,7 @@ static int nilfs_symlink(struct inode *dir, struct dentry *dentry,
 			 const char *symname)
 {
 	struct nilfs_transaction_info ti;
-	struct super_block *sb = dir->i_sb;
+	struct super_block *sb = inode_sb(dir);
 	unsigned int l = strlen(symname) + 1;
 	struct inode *inode;
 	int err;
@@ -146,7 +146,7 @@ static int nilfs_symlink(struct inode *dir, struct dentry *dentry,
 	if (l > sb->s_blocksize)
 		return -ENAMETOOLONG;
 
-	err = nilfs_transaction_begin(dir->i_sb, &ti, 1);
+	err = nilfs_transaction_begin(inode_sb(dir), &ti, 1);
 	if (err)
 		return err;
 
@@ -169,9 +169,9 @@ static int nilfs_symlink(struct inode *dir, struct dentry *dentry,
 	err = nilfs_add_nondir(dentry, inode);
 out:
 	if (!err)
-		err = nilfs_transaction_commit(dir->i_sb);
+		err = nilfs_transaction_commit(inode_sb(dir));
 	else
-		nilfs_transaction_abort(dir->i_sb);
+		nilfs_transaction_abort(inode_sb(dir));
 
 	return err;
 
@@ -190,7 +190,7 @@ static int nilfs_link(struct dentry *old_dentry, struct inode *dir,
 	struct nilfs_transaction_info ti;
 	int err;
 
-	err = nilfs_transaction_begin(dir->i_sb, &ti, 1);
+	err = nilfs_transaction_begin(inode_sb(dir), &ti, 1);
 	if (err)
 		return err;
 
@@ -201,11 +201,11 @@ static int nilfs_link(struct dentry *old_dentry, struct inode *dir,
 	err = nilfs_add_link(dentry, inode);
 	if (!err) {
 		d_instantiate(dentry, inode);
-		err = nilfs_transaction_commit(dir->i_sb);
+		err = nilfs_transaction_commit(inode_sb(dir));
 	} else {
 		inode_dec_link_count(inode);
 		iput(inode);
-		nilfs_transaction_abort(dir->i_sb);
+		nilfs_transaction_abort(inode_sb(dir));
 	}
 
 	return err;
@@ -217,7 +217,7 @@ static int nilfs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode)
 	struct nilfs_transaction_info ti;
 	int err;
 
-	err = nilfs_transaction_begin(dir->i_sb, &ti, 1);
+	err = nilfs_transaction_begin(inode_sb(dir), &ti, 1);
 	if (err)
 		return err;
 
@@ -247,9 +247,9 @@ static int nilfs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode)
 	unlock_new_inode(inode);
 out:
 	if (!err)
-		err = nilfs_transaction_commit(dir->i_sb);
+		err = nilfs_transaction_commit(inode_sb(dir));
 	else
-		nilfs_transaction_abort(dir->i_sb);
+		nilfs_transaction_abort(inode_sb(dir));
 
 	return err;
 
@@ -283,7 +283,7 @@ static int nilfs_do_unlink(struct inode *dir, struct dentry *dentry)
 		goto out;
 
 	if (!inode->i_nlink) {
-		nilfs_msg(inode->i_sb, KERN_WARNING,
+		nilfs_msg(inode_sb(inode), KERN_WARNING,
 			  "deleting nonexistent file (ino=%lu), %d",
 			  inode->i_ino, inode->i_nlink);
 		set_nlink(inode, 1);
@@ -304,7 +304,7 @@ static int nilfs_unlink(struct inode *dir, struct dentry *dentry)
 	struct nilfs_transaction_info ti;
 	int err;
 
-	err = nilfs_transaction_begin(dir->i_sb, &ti, 0);
+	err = nilfs_transaction_begin(inode_sb(dir), &ti, 0);
 	if (err)
 		return err;
 
@@ -313,9 +313,9 @@ static int nilfs_unlink(struct inode *dir, struct dentry *dentry)
 	if (!err) {
 		nilfs_mark_inode_dirty(dir);
 		nilfs_mark_inode_dirty(d_inode(dentry));
-		err = nilfs_transaction_commit(dir->i_sb);
+		err = nilfs_transaction_commit(inode_sb(dir));
 	} else
-		nilfs_transaction_abort(dir->i_sb);
+		nilfs_transaction_abort(inode_sb(dir));
 
 	return err;
 }
@@ -326,7 +326,7 @@ static int nilfs_rmdir(struct inode *dir, struct dentry *dentry)
 	struct nilfs_transaction_info ti;
 	int err;
 
-	err = nilfs_transaction_begin(dir->i_sb, &ti, 0);
+	err = nilfs_transaction_begin(inode_sb(dir), &ti, 0);
 	if (err)
 		return err;
 
@@ -342,9 +342,9 @@ static int nilfs_rmdir(struct inode *dir, struct dentry *dentry)
 		}
 	}
 	if (!err)
-		err = nilfs_transaction_commit(dir->i_sb);
+		err = nilfs_transaction_commit(inode_sb(dir));
 	else
-		nilfs_transaction_abort(dir->i_sb);
+		nilfs_transaction_abort(inode_sb(dir));
 
 	return err;
 }
@@ -365,7 +365,7 @@ static int nilfs_rename(struct inode *old_dir, struct dentry *old_dentry,
 	if (flags & ~RENAME_NOREPLACE)
 		return -EINVAL;
 
-	err = nilfs_transaction_begin(old_dir->i_sb, &ti, 1);
+	err = nilfs_transaction_begin(inode_sb(old_dir), &ti, 1);
 	if (unlikely(err))
 		return err;
 
@@ -425,7 +425,7 @@ static int nilfs_rename(struct inode *old_dir, struct dentry *old_dentry,
 	nilfs_mark_inode_dirty(old_dir);
 	nilfs_mark_inode_dirty(old_inode);
 
-	err = nilfs_transaction_commit(old_dir->i_sb);
+	err = nilfs_transaction_commit(inode_sb(old_dir));
 	return err;
 
 out_dir:
@@ -437,7 +437,7 @@ static int nilfs_rename(struct inode *old_dir, struct dentry *old_dentry,
 	kunmap(old_page);
 	put_page(old_page);
 out:
-	nilfs_transaction_abort(old_dir->i_sb);
+	nilfs_transaction_abort(inode_sb(old_dir));
 	return err;
 }
 
diff --git a/fs/nilfs2/page.c b/fs/nilfs2/page.c
index 68241512d7c1..2c0a5bd69d72 100644
--- a/fs/nilfs2/page.c
+++ b/fs/nilfs2/page.c
@@ -397,7 +397,7 @@ void nilfs_clear_dirty_pages(struct address_space *mapping, bool silent)
 void nilfs_clear_dirty_page(struct page *page, bool silent)
 {
 	struct inode *inode = page->mapping->host;
-	struct super_block *sb = inode->i_sb;
+	struct super_block *sb = inode_sb(inode);
 
 	BUG_ON(!PageLocked(page));
 
diff --git a/fs/nilfs2/sufile.c b/fs/nilfs2/sufile.c
index c7fa139d50e8..c280be52cea3 100644
--- a/fs/nilfs2/sufile.c
+++ b/fs/nilfs2/sufile.c
@@ -180,7 +180,7 @@ int nilfs_sufile_updatev(struct inode *sufile, __u64 *segnumv, size_t nsegs,
 	down_write(&NILFS_MDT(sufile)->mi_sem);
 	for (seg = segnumv; seg < segnumv + nsegs; seg++) {
 		if (unlikely(*seg >= nilfs_sufile_get_nsegments(sufile))) {
-			nilfs_msg(sufile->i_sb, KERN_WARNING,
+			nilfs_msg(inode_sb(sufile), KERN_WARNING,
 				  "%s: invalid segment number: %llu",
 				  __func__, (unsigned long long)*seg);
 			nerr++;
@@ -239,7 +239,7 @@ int nilfs_sufile_update(struct inode *sufile, __u64 segnum, int create,
 	int ret;
 
 	if (unlikely(segnum >= nilfs_sufile_get_nsegments(sufile))) {
-		nilfs_msg(sufile->i_sb, KERN_WARNING,
+		nilfs_msg(inode_sb(sufile), KERN_WARNING,
 			  "%s: invalid segment number: %llu",
 			  __func__, (unsigned long long)segnum);
 		return -EINVAL;
@@ -419,7 +419,7 @@ void nilfs_sufile_do_cancel_free(struct inode *sufile, __u64 segnum,
 	kaddr = kmap_atomic(su_bh->b_page);
 	su = nilfs_sufile_block_get_segment_usage(sufile, segnum, su_bh, kaddr);
 	if (unlikely(!nilfs_segment_usage_clean(su))) {
-		nilfs_msg(sufile->i_sb, KERN_WARNING,
+		nilfs_msg(inode_sb(sufile), KERN_WARNING,
 			  "%s: segment %llu must be clean", __func__,
 			  (unsigned long long)segnum);
 		kunmap_atomic(kaddr);
@@ -477,7 +477,7 @@ void nilfs_sufile_do_free(struct inode *sufile, __u64 segnum,
 	kaddr = kmap_atomic(su_bh->b_page);
 	su = nilfs_sufile_block_get_segment_usage(sufile, segnum, su_bh, kaddr);
 	if (nilfs_segment_usage_clean(su)) {
-		nilfs_msg(sufile->i_sb, KERN_WARNING,
+		nilfs_msg(inode_sb(sufile), KERN_WARNING,
 			  "%s: segment %llu is already clean",
 			  __func__, (unsigned long long)segnum);
 		kunmap_atomic(kaddr);
@@ -575,7 +575,7 @@ int nilfs_sufile_get_stat(struct inode *sufile, struct nilfs_sustat *sustat)
 {
 	struct buffer_head *header_bh;
 	struct nilfs_sufile_header *header;
-	struct the_nilfs *nilfs = sufile->i_sb->s_fs_info;
+	struct the_nilfs *nilfs = inode_sb(sufile)->s_fs_info;
 	void *kaddr;
 	int ret;
 
@@ -649,7 +649,7 @@ void nilfs_sufile_do_set_error(struct inode *sufile, __u64 segnum,
 static int nilfs_sufile_truncate_range(struct inode *sufile,
 				       __u64 start, __u64 end)
 {
-	struct the_nilfs *nilfs = sufile->i_sb->s_fs_info;
+	struct the_nilfs *nilfs = inode_sb(sufile)->s_fs_info;
 	struct buffer_head *header_bh;
 	struct buffer_head *su_bh;
 	struct nilfs_segment_usage *su, *su2;
@@ -752,7 +752,7 @@ static int nilfs_sufile_truncate_range(struct inode *sufile,
  */
 int nilfs_sufile_resize(struct inode *sufile, __u64 newnsegs)
 {
-	struct the_nilfs *nilfs = sufile->i_sb->s_fs_info;
+	struct the_nilfs *nilfs = inode_sb(sufile)->s_fs_info;
 	struct buffer_head *header_bh;
 	struct nilfs_sufile_header *header;
 	struct nilfs_sufile_info *sui = NILFS_SUI(sufile);
@@ -825,7 +825,7 @@ ssize_t nilfs_sufile_get_suinfo(struct inode *sufile, __u64 segnum, void *buf,
 	struct nilfs_segment_usage *su;
 	struct nilfs_suinfo *si = buf;
 	size_t susz = NILFS_MDT(sufile)->mi_entry_size;
-	struct the_nilfs *nilfs = sufile->i_sb->s_fs_info;
+	struct the_nilfs *nilfs = inode_sb(sufile)->s_fs_info;
 	void *kaddr;
 	unsigned long nsegs, segusages_per_block;
 	ssize_t n;
@@ -899,7 +899,7 @@ ssize_t nilfs_sufile_get_suinfo(struct inode *sufile, __u64 segnum, void *buf,
 ssize_t nilfs_sufile_set_suinfo(struct inode *sufile, void *buf,
 				unsigned int supsz, size_t nsup)
 {
-	struct the_nilfs *nilfs = sufile->i_sb->s_fs_info;
+	struct the_nilfs *nilfs = inode_sb(sufile)->s_fs_info;
 	struct buffer_head *header_bh, *bh;
 	struct nilfs_suinfo_update *sup, *supend = buf + supsz * nsup;
 	struct nilfs_segment_usage *su;
@@ -1025,7 +1025,7 @@ ssize_t nilfs_sufile_set_suinfo(struct inode *sufile, void *buf,
  */
 int nilfs_sufile_trim_fs(struct inode *sufile, struct fstrim_range *range)
 {
-	struct the_nilfs *nilfs = sufile->i_sb->s_fs_info;
+	struct the_nilfs *nilfs = inode_sb(sufile)->s_fs_info;
 	struct buffer_head *su_bh;
 	struct nilfs_segment_usage *su;
 	void *kaddr;
diff --git a/fs/nilfs2/sufile.h b/fs/nilfs2/sufile.h
index 673a891350f4..0ed86ae80b32 100644
--- a/fs/nilfs2/sufile.h
+++ b/fs/nilfs2/sufile.h
@@ -26,7 +26,7 @@
 
 static inline unsigned long nilfs_sufile_get_nsegments(struct inode *sufile)
 {
-	return ((struct the_nilfs *)sufile->i_sb->s_fs_info)->ns_nsegments;
+	return ((struct the_nilfs *) inode_sb(sufile)->s_fs_info)->ns_nsegments;
 }
 
 unsigned long nilfs_sufile_get_ncleansegs(struct inode *sufile);
-- 
2.15.1

^ permalink raw reply related	[flat|nested] 88+ messages in thread

* [PATCH 52/76] fs/notify: Use inode_sb() helper instead of inode->i_sb
  2018-05-08 18:03 [RFC][PATCH 0/76] vfs: 'views' for filesystems with more than one root Mark Fasheh
                   ` (50 preceding siblings ...)
  2018-05-08 18:04 ` [PATCH 51/76] fs/nilfs2: " Mark Fasheh
@ 2018-05-08 18:04 ` Mark Fasheh
  2018-05-08 18:04 ` [PATCH 53/76] fs/ntfs: " Mark Fasheh
                   ` (24 subsequent siblings)
  76 siblings, 0 replies; 88+ messages in thread
From: Mark Fasheh @ 2018-05-08 18:04 UTC (permalink / raw)
  To: linux-fsdevel; +Cc: linux-kernel, linux-btrfs, Mark Fasheh

Signed-off-by: Mark Fasheh <mfasheh@suse.de>
---
 fs/notify/fdinfo.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/fs/notify/fdinfo.c b/fs/notify/fdinfo.c
index d478629c728b..857df5ce27ac 100644
--- a/fs/notify/fdinfo.c
+++ b/fs/notify/fdinfo.c
@@ -91,7 +91,8 @@ static void inotify_fdinfo(struct seq_file *m, struct fsnotify_mark *mark)
 		 */
 		u32 mask = mark->mask & IN_ALL_EVENTS;
 		seq_printf(m, "inotify wd:%x ino:%lx sdev:%x mask:%x ignored_mask:%x ",
-			   inode_mark->wd, inode->i_ino, inode->i_sb->s_dev,
+			   inode_mark->wd, inode->i_ino,
+			   inode_sb(inode)->s_dev,
 			   mask, mark->ignored_mask);
 		show_mark_fhandle(m, inode);
 		seq_putc(m, '\n');
@@ -121,7 +122,7 @@ static void fanotify_fdinfo(struct seq_file *m, struct fsnotify_mark *mark)
 		if (!inode)
 			return;
 		seq_printf(m, "fanotify ino:%lx sdev:%x mflags:%x mask:%x ignored_mask:%x ",
-			   inode->i_ino, inode->i_sb->s_dev,
+			   inode->i_ino, inode_sb(inode)->s_dev,
 			   mflags, mark->mask, mark->ignored_mask);
 		show_mark_fhandle(m, inode);
 		seq_putc(m, '\n');
-- 
2.15.1

^ permalink raw reply related	[flat|nested] 88+ messages in thread

* [PATCH 53/76] fs/ntfs: Use inode_sb() helper instead of inode->i_sb
  2018-05-08 18:03 [RFC][PATCH 0/76] vfs: 'views' for filesystems with more than one root Mark Fasheh
                   ` (51 preceding siblings ...)
  2018-05-08 18:04 ` [PATCH 52/76] fs/notify: " Mark Fasheh
@ 2018-05-08 18:04 ` Mark Fasheh
  2018-05-08 18:04 ` [PATCH 54/76] fs/ocfs2: " Mark Fasheh
                   ` (23 subsequent siblings)
  76 siblings, 0 replies; 88+ messages in thread
From: Mark Fasheh @ 2018-05-08 18:04 UTC (permalink / raw)
  To: linux-fsdevel; +Cc: linux-kernel, linux-btrfs, Mark Fasheh

Signed-off-by: Mark Fasheh <mfasheh@suse.de>
---
 fs/ntfs/aops.c    |  16 ++--
 fs/ntfs/bitmap.c  |  11 ++-
 fs/ntfs/dir.c     |  10 ++-
 fs/ntfs/file.c    |  30 ++++---
 fs/ntfs/inode.c   | 231 +++++++++++++++++++++++++++++++++---------------------
 fs/ntfs/inode.h   |   2 +-
 fs/ntfs/logfile.c |  46 ++++++-----
 fs/ntfs/namei.c   |   7 +-
 8 files changed, 214 insertions(+), 139 deletions(-)

diff --git a/fs/ntfs/aops.c b/fs/ntfs/aops.c
index 3a2e509c77c5..f8817dfdc2b8 100644
--- a/fs/ntfs/aops.c
+++ b/fs/ntfs/aops.c
@@ -1400,14 +1400,16 @@ static int ntfs_writepage(struct page *page, struct writeback_control *wbc)
 			// TODO: Implement and replace this with
 			// return ntfs_write_compressed_block(page);
 			unlock_page(page);
-			ntfs_error(vi->i_sb, "Writing to compressed files is "
+			ntfs_error(inode_sb(vi),
+					"Writing to compressed files is "
 					"not supported yet.  Sorry.");
 			return -EOPNOTSUPP;
 		}
 		// TODO: Implement and remove this check.
 		if (NInoNonResident(ni) && NInoSparse(ni)) {
 			unlock_page(page);
-			ntfs_error(vi->i_sb, "Writing to sparse files is not "
+			ntfs_error(inode_sb(vi),
+					"Writing to sparse files is not "
 					"supported yet.  Sorry.");
 			return -EOPNOTSUPP;
 		}
@@ -1437,7 +1439,7 @@ static int ntfs_writepage(struct page *page, struct writeback_control *wbc)
 	BUG_ON(page_has_buffers(page));
 	BUG_ON(!PageUptodate(page));
 	if (unlikely(page->index > 0)) {
-		ntfs_error(vi->i_sb, "BUG()! page->index (0x%lx) > 0.  "
+		ntfs_error(inode_sb(vi), "BUG()! page->index (0x%lx) > 0.  "
 				"Aborting write.", page->index);
 		BUG_ON(PageWriteback(page));
 		set_page_writeback(page);
@@ -1514,7 +1516,8 @@ static int ntfs_writepage(struct page *page, struct writeback_control *wbc)
 	return 0;
 err_out:
 	if (err == -ENOMEM) {
-		ntfs_warning(vi->i_sb, "Error allocating memory. Redirtying "
+		ntfs_warning(inode_sb(vi),
+				"Error allocating memory. Redirtying "
 				"page so we try again later.");
 		/*
 		 * Put the page back on mapping->dirty_pages, but leave its
@@ -1523,7 +1526,8 @@ static int ntfs_writepage(struct page *page, struct writeback_control *wbc)
 		redirty_page_for_writepage(wbc, page);
 		err = 0;
 	} else {
-		ntfs_error(vi->i_sb, "Resident attribute write failed with "
+		ntfs_error(inode_sb(vi),
+				"Resident attribute write failed with "
 				"error %i.", err);
 		SetPageError(page);
 		NVolSetErrors(ni->vol);
@@ -1735,7 +1739,7 @@ void mark_ntfs_record_dirty(struct page *page, const unsigned int ofs) {
 
 	BUG_ON(!PageUptodate(page));
 	end = ofs + ni->itype.index.block_size;
-	bh_size = VFS_I(ni)->i_sb->s_blocksize;
+	bh_size = inode_sb(VFS_I(ni))->s_blocksize;
 	spin_lock(&mapping->private_lock);
 	if (unlikely(!page_has_buffers(page))) {
 		spin_unlock(&mapping->private_lock);
diff --git a/fs/ntfs/bitmap.c b/fs/ntfs/bitmap.c
index ec130c588d2b..7584c413bdb5 100644
--- a/fs/ntfs/bitmap.c
+++ b/fs/ntfs/bitmap.c
@@ -75,7 +75,8 @@ int __ntfs_bitmap_set_bits_in_run(struct inode *vi, const s64 start_bit,
 	page = ntfs_map_page(mapping, index);
 	if (IS_ERR(page)) {
 		if (!is_rollback)
-			ntfs_error(vi->i_sb, "Failed to map first page (error "
+			ntfs_error(inode_sb(vi),
+					"Failed to map first page (error "
 					"%li), aborting.", PTR_ERR(page));
 		return PTR_ERR(page);
 	}
@@ -177,15 +178,17 @@ int __ntfs_bitmap_set_bits_in_run(struct inode *vi, const s64 start_bit,
 		pos = 0;
 	if (!pos) {
 		/* Rollback was successful. */
-		ntfs_error(vi->i_sb, "Failed to map subsequent page (error "
+		ntfs_error(inode_sb(vi),
+				"Failed to map subsequent page (error "
 				"%li), aborting.", PTR_ERR(page));
 	} else {
 		/* Rollback failed. */
-		ntfs_error(vi->i_sb, "Failed to map subsequent page (error "
+		ntfs_error(inode_sb(vi),
+				"Failed to map subsequent page (error "
 				"%li) and rollback failed (error %i).  "
 				"Aborting and leaving inconsistent metadata.  "
 				"Unmount and run chkdsk.", PTR_ERR(page), pos);
-		NVolSetErrors(NTFS_SB(vi->i_sb));
+		NVolSetErrors(NTFS_SB(inode_sb(vi)));
 	}
 	return PTR_ERR(page);
 }
diff --git a/fs/ntfs/dir.c b/fs/ntfs/dir.c
index 1a24be9e8405..27505db99278 100644
--- a/fs/ntfs/dir.c
+++ b/fs/ntfs/dir.c
@@ -1101,7 +1101,7 @@ static int ntfs_readdir(struct file *file, struct dir_context *actor)
 	s64 ia_pos, ia_start, prev_ia_pos, bmp_pos;
 	loff_t i_size;
 	struct inode *bmp_vi, *vdir = file_inode(file);
-	struct super_block *sb = vdir->i_sb;
+	struct super_block *sb = inode_sb(vdir);
 	ntfs_inode *ndir = NTFS_I(vdir);
 	ntfs_volume *vol = NTFS_SB(sb);
 	MFT_RECORD *m;
@@ -1517,20 +1517,22 @@ static int ntfs_dir_fsync(struct file *filp, loff_t start, loff_t end,
 	na.type = AT_BITMAP;
 	na.name = I30;
 	na.name_len = 4;
-	bmp_vi = ilookup5(vi->i_sb, vi->i_ino, (test_t)ntfs_test_inode, &na);
+	bmp_vi = ilookup5(inode_sb(vi), vi->i_ino, (test_t)ntfs_test_inode,
+			  &na);
 	if (bmp_vi) {
  		write_inode_now(bmp_vi, !datasync);
 		iput(bmp_vi);
 	}
 	ret = __ntfs_write_inode(vi, 1);
 	write_inode_now(vi, !datasync);
-	err = sync_blockdev(vi->i_sb->s_bdev);
+	err = sync_blockdev(inode_sb(vi)->s_bdev);
 	if (unlikely(err && !ret))
 		ret = err;
 	if (likely(!ret))
 		ntfs_debug("Done.");
 	else
-		ntfs_warning(vi->i_sb, "Failed to f%ssync inode 0x%lx.  Error "
+		ntfs_warning(inode_sb(vi),
+				"Failed to f%ssync inode 0x%lx.  Error "
 				"%u.", datasync ? "data" : "", vi->i_ino, -ret);
 	inode_unlock(vi);
 	return ret;
diff --git a/fs/ntfs/file.c b/fs/ntfs/file.c
index 331910fa8442..8955ab0c2869 100644
--- a/fs/ntfs/file.c
+++ b/fs/ntfs/file.c
@@ -374,7 +374,7 @@ static ssize_t ntfs_prepare_file_for_write(struct kiocb *iocb,
 		 * compression kick in.  This is in contrast to encrypted files
 		 * (see above).
 		 */
-		ntfs_error(vi->i_sb, "Writing to compressed files is not "
+		ntfs_error(inode_sb(vi), "Writing to compressed files is not "
 				"implemented yet.  Sorry.");
 		err = -EOPNOTSUPP;
 		goto out;
@@ -439,7 +439,8 @@ static ssize_t ntfs_prepare_file_for_write(struct kiocb *iocb,
 				iov_iter_truncate(from, ll - pos);
 			} else {
 				if (err != -ENOSPC)
-					ntfs_error(vi->i_sb, "Cannot perform "
+					ntfs_error(inode_sb(vi),
+							"Cannot perform "
 							"write to inode "
 							"0x%lx, attribute "
 							"type 0x%x, because "
@@ -479,7 +480,8 @@ static ssize_t ntfs_prepare_file_for_write(struct kiocb *iocb,
 		inode_dio_wait(vi);
 		err = ntfs_attr_extend_initialized(ni, pos);
 		if (unlikely(err < 0))
-			ntfs_error(vi->i_sb, "Cannot perform write to inode "
+			ntfs_error(inode_sb(vi),
+					"Cannot perform write to inode "
 					"0x%lx, attribute type 0x%x, because "
 					"extending the initialized size "
 					"failed (error %d).", vi->i_ino,
@@ -1412,7 +1414,7 @@ static inline int ntfs_commit_pages_after_non_resident_write(
 
 	vi = pages[0]->mapping->host;
 	ni = NTFS_I(vi);
-	blocksize = vi->i_sb->s_blocksize;
+	blocksize = inode_sb(vi)->s_blocksize;
 	end = pos + bytes;
 	u = 0;
 	do {
@@ -1507,7 +1509,8 @@ static inline int ntfs_commit_pages_after_non_resident_write(
 		ntfs_attr_put_search_ctx(ctx);
 	if (m)
 		unmap_mft_record(base_ni);
-	ntfs_error(vi->i_sb, "Failed to update initialized_size/i_size (error "
+	ntfs_error(inode_sb(vi),
+			"Failed to update initialized_size/i_size (error "
 			"code %i).", err);
 	if (err != -ENOMEM)
 		NVolSetErrors(ni->vol);
@@ -1664,10 +1667,12 @@ static int ntfs_commit_pages_after_write(struct page **pages,
 	return 0;
 err_out:
 	if (err == -ENOMEM) {
-		ntfs_warning(vi->i_sb, "Error allocating memory required to "
+		ntfs_warning(inode_sb(vi),
+				"Error allocating memory required to "
 				"commit the write.");
 		if (PageUptodate(page)) {
-			ntfs_warning(vi->i_sb, "Page is uptodate, setting "
+			ntfs_warning(inode_sb(vi),
+					"Page is uptodate, setting "
 					"dirty so the write will be retried "
 					"later on by the VM.");
 			/*
@@ -1677,10 +1682,12 @@ static int ntfs_commit_pages_after_write(struct page **pages,
 			__set_page_dirty_nobuffers(page);
 			err = 0;
 		} else
-			ntfs_error(vi->i_sb, "Page is not uptodate.  Written "
+			ntfs_error(inode_sb(vi),
+					"Page is not uptodate.  Written "
 					"data has been lost.");
 	} else {
-		ntfs_error(vi->i_sb, "Resident attribute commit write failed "
+		ntfs_error(inode_sb(vi),
+				"Resident attribute commit write failed "
 				"with error %i.", err);
 		NVolSetErrors(ni->vol);
 	}
@@ -2003,13 +2010,14 @@ static int ntfs_file_fsync(struct file *filp, loff_t start, loff_t end,
 	 * fs/buffer.c) for dirty blocks then we could optimize the below to be
 	 * sync_mapping_buffers(vi->i_mapping).
 	 */
-	err = sync_blockdev(vi->i_sb->s_bdev);
+	err = sync_blockdev(inode_sb(vi)->s_bdev);
 	if (unlikely(err && !ret))
 		ret = err;
 	if (likely(!ret))
 		ntfs_debug("Done.");
 	else
-		ntfs_warning(vi->i_sb, "Failed to f%ssync inode 0x%lx.  Error "
+		ntfs_warning(inode_sb(vi),
+				"Failed to f%ssync inode 0x%lx.  Error "
 				"%u.", datasync ? "data" : "", vi->i_ino, -ret);
 	inode_unlock(vi);
 	return ret;
diff --git a/fs/ntfs/inode.c b/fs/ntfs/inode.c
index 1c1ee489284b..cde6853c99ac 100644
--- a/fs/ntfs/inode.c
+++ b/fs/ntfs/inode.c
@@ -239,8 +239,9 @@ struct inode *ntfs_attr_iget(struct inode *base_vi, ATTR_TYPE type,
 	na.name = name;
 	na.name_len = name_len;
 
-	vi = iget5_locked(base_vi->i_sb, na.mft_no, (test_t)ntfs_test_inode,
-			(set_t)ntfs_init_locked_inode, &na);
+	vi = iget5_locked(inode_sb(base_vi), na.mft_no,
+			  (test_t)ntfs_test_inode,
+			  (set_t)ntfs_init_locked_inode, &na);
 	if (unlikely(!vi))
 		return ERR_PTR(-ENOMEM);
 
@@ -294,8 +295,9 @@ struct inode *ntfs_index_iget(struct inode *base_vi, ntfschar *name,
 	na.name = name;
 	na.name_len = name_len;
 
-	vi = iget5_locked(base_vi->i_sb, na.mft_no, (test_t)ntfs_test_inode,
-			(set_t)ntfs_init_locked_inode, &na);
+	vi = iget5_locked(inode_sb(base_vi), na.mft_no,
+			  (test_t)ntfs_test_inode,
+			  (set_t)ntfs_init_locked_inode, &na);
 	if (unlikely(!vi))
 		return ERR_PTR(-ENOMEM);
 
@@ -548,7 +550,7 @@ static int ntfs_is_extended_system_file(ntfs_attr_search_ctx *ctx)
  */
 static int ntfs_read_locked_inode(struct inode *vi)
 {
-	ntfs_volume *vol = NTFS_SB(vi->i_sb);
+	ntfs_volume *vol = NTFS_SB(inode_sb(vi));
 	ntfs_inode *ni;
 	struct inode *bvi;
 	MFT_RECORD *m;
@@ -584,11 +586,11 @@ static int ntfs_read_locked_inode(struct inode *vi)
 	}
 
 	if (!(m->flags & MFT_RECORD_IN_USE)) {
-		ntfs_error(vi->i_sb, "Inode is not in use!");
+		ntfs_error(inode_sb(vi), "Inode is not in use!");
 		goto unm_err_out;
 	}
 	if (m->base_mft_record) {
-		ntfs_error(vi->i_sb, "Inode is an extent inode!");
+		ntfs_error(inode_sb(vi), "Inode is an extent inode!");
 		goto unm_err_out;
 	}
 
@@ -647,7 +649,8 @@ static int ntfs_read_locked_inode(struct inode *vi)
 			 * recover mount option is set) by creating a new
 			 * attribute.
 			 */
-			ntfs_error(vi->i_sb, "$STANDARD_INFORMATION attribute "
+			ntfs_error(inode_sb(vi),
+					"$STANDARD_INFORMATION attribute "
 					"is missing.");
 		}
 		goto unm_err_out;
@@ -685,7 +688,8 @@ static int ntfs_read_locked_inode(struct inode *vi)
 	err = ntfs_attr_lookup(AT_ATTRIBUTE_LIST, NULL, 0, 0, 0, NULL, 0, ctx);
 	if (err) {
 		if (unlikely(err != -ENOENT)) {
-			ntfs_error(vi->i_sb, "Failed to lookup attribute list "
+			ntfs_error(inode_sb(vi),
+					"Failed to lookup attribute list "
 					"attribute.");
 			goto unm_err_out;
 		}
@@ -696,19 +700,21 @@ static int ntfs_read_locked_inode(struct inode *vi)
 		NInoSetAttrList(ni);
 		a = ctx->attr;
 		if (a->flags & ATTR_COMPRESSION_MASK) {
-			ntfs_error(vi->i_sb, "Attribute list attribute is "
+			ntfs_error(inode_sb(vi),
+					"Attribute list attribute is "
 					"compressed.");
 			goto unm_err_out;
 		}
 		if (a->flags & ATTR_IS_ENCRYPTED ||
 				a->flags & ATTR_IS_SPARSE) {
 			if (a->non_resident) {
-				ntfs_error(vi->i_sb, "Non-resident attribute "
+				ntfs_error(inode_sb(vi),
+						"Non-resident attribute "
 						"list attribute is encrypted/"
 						"sparse.");
 				goto unm_err_out;
 			}
-			ntfs_warning(vi->i_sb, "Resident attribute list "
+			ntfs_warning(inode_sb(vi), "Resident attribute list "
 					"attribute in inode 0x%lx is marked "
 					"encrypted/sparse which is not true.  "
 					"However, Windows allows this and "
@@ -721,7 +727,8 @@ static int ntfs_read_locked_inode(struct inode *vi)
 		ni->attr_list_size = (u32)ntfs_attr_size(a);
 		ni->attr_list = ntfs_malloc_nofs(ni->attr_list_size);
 		if (!ni->attr_list) {
-			ntfs_error(vi->i_sb, "Not enough memory to allocate "
+			ntfs_error(inode_sb(vi),
+					"Not enough memory to allocate "
 					"buffer for attribute list.");
 			err = -ENOMEM;
 			goto unm_err_out;
@@ -729,7 +736,8 @@ static int ntfs_read_locked_inode(struct inode *vi)
 		if (a->non_resident) {
 			NInoSetAttrListNonResident(ni);
 			if (a->data.non_resident.lowest_vcn) {
-				ntfs_error(vi->i_sb, "Attribute list has non "
+				ntfs_error(inode_sb(vi),
+						"Attribute list has non "
 						"zero lowest_vcn.");
 				goto unm_err_out;
 			}
@@ -742,7 +750,7 @@ static int ntfs_read_locked_inode(struct inode *vi)
 			if (IS_ERR(ni->attr_list_rl.rl)) {
 				err = PTR_ERR(ni->attr_list_rl.rl);
 				ni->attr_list_rl.rl = NULL;
-				ntfs_error(vi->i_sb, "Mapping pairs "
+				ntfs_error(inode_sb(vi), "Mapping pairs "
 						"decompression failed.");
 				goto unm_err_out;
 			}
@@ -751,7 +759,7 @@ static int ntfs_read_locked_inode(struct inode *vi)
 					ni->attr_list, ni->attr_list_size,
 					sle64_to_cpu(a->data.non_resident.
 					initialized_size)))) {
-				ntfs_error(vi->i_sb, "Failed to load "
+				ntfs_error(inode_sb(vi), "Failed to load "
 						"attribute list attribute.");
 				goto unm_err_out;
 			}
@@ -760,7 +768,8 @@ static int ntfs_read_locked_inode(struct inode *vi)
 					+ le32_to_cpu(
 					a->data.resident.value_length) >
 					(u8*)ctx->mrec + vol->mft_record_size) {
-				ntfs_error(vi->i_sb, "Corrupt attribute list "
+				ntfs_error(inode_sb(vi),
+						"Corrupt attribute list "
 						"in inode.");
 				goto unm_err_out;
 			}
@@ -791,7 +800,8 @@ static int ntfs_read_locked_inode(struct inode *vi)
 				// FIXME: File is corrupt! Hot-fix with empty
 				// index root attribute if recovery option is
 				// set.
-				ntfs_error(vi->i_sb, "$INDEX_ROOT attribute "
+				ntfs_error(inode_sb(vi),
+						"$INDEX_ROOT attribute "
 						"is missing.");
 			}
 			goto unm_err_out;
@@ -820,7 +830,8 @@ static int ntfs_read_locked_inode(struct inode *vi)
 			NInoSetCompressed(ni);
 		if (a->flags & ATTR_IS_ENCRYPTED) {
 			if (a->flags & ATTR_COMPRESSION_MASK) {
-				ntfs_error(vi->i_sb, "Found encrypted and "
+				ntfs_error(inode_sb(vi),
+						"Found encrypted and "
 						"compressed attribute.");
 				goto unm_err_out;
 			}
@@ -832,23 +843,25 @@ static int ntfs_read_locked_inode(struct inode *vi)
 				le16_to_cpu(a->data.resident.value_offset));
 		ir_end = (u8*)ir + le32_to_cpu(a->data.resident.value_length);
 		if (ir_end > (u8*)ctx->mrec + vol->mft_record_size) {
-			ntfs_error(vi->i_sb, "$INDEX_ROOT attribute is "
+			ntfs_error(inode_sb(vi), "$INDEX_ROOT attribute is "
 					"corrupt.");
 			goto unm_err_out;
 		}
 		index_end = (u8*)&ir->index +
 				le32_to_cpu(ir->index.index_length);
 		if (index_end > ir_end) {
-			ntfs_error(vi->i_sb, "Directory index is corrupt.");
+			ntfs_error(inode_sb(vi),
+				   "Directory index is corrupt.");
 			goto unm_err_out;
 		}
 		if (ir->type != AT_FILE_NAME) {
-			ntfs_error(vi->i_sb, "Indexed attribute is not "
+			ntfs_error(inode_sb(vi), "Indexed attribute is not "
 					"$FILE_NAME.");
 			goto unm_err_out;
 		}
 		if (ir->collation_rule != COLLATION_FILE_NAME) {
-			ntfs_error(vi->i_sb, "Index collation rule is not "
+			ntfs_error(inode_sb(vi),
+					"Index collation rule is not "
 					"COLLATION_FILE_NAME.");
 			goto unm_err_out;
 		}
@@ -856,13 +869,14 @@ static int ntfs_read_locked_inode(struct inode *vi)
 		ni->itype.index.block_size = le32_to_cpu(ir->index_block_size);
 		if (ni->itype.index.block_size &
 				(ni->itype.index.block_size - 1)) {
-			ntfs_error(vi->i_sb, "Index block size (%u) is not a "
+			ntfs_error(inode_sb(vi),
+					"Index block size (%u) is not a "
 					"power of two.",
 					ni->itype.index.block_size);
 			goto unm_err_out;
 		}
 		if (ni->itype.index.block_size > PAGE_SIZE) {
-			ntfs_error(vi->i_sb, "Index block size (%u) > "
+			ntfs_error(inode_sb(vi), "Index block size (%u) > "
 					"PAGE_SIZE (%ld) is not "
 					"supported.  Sorry.",
 					ni->itype.index.block_size,
@@ -871,7 +885,7 @@ static int ntfs_read_locked_inode(struct inode *vi)
 			goto unm_err_out;
 		}
 		if (ni->itype.index.block_size < NTFS_BLOCK_SIZE) {
-			ntfs_error(vi->i_sb, "Index block size (%u) < "
+			ntfs_error(inode_sb(vi), "Index block size (%u) < "
 					"NTFS_BLOCK_SIZE (%i) is not "
 					"supported.  Sorry.",
 					ni->itype.index.block_size,
@@ -914,18 +928,19 @@ static int ntfs_read_locked_inode(struct inode *vi)
 				CASE_SENSITIVE, 0, NULL, 0, ctx);
 		if (unlikely(err)) {
 			if (err == -ENOENT)
-				ntfs_error(vi->i_sb, "$INDEX_ALLOCATION "
+				ntfs_error(inode_sb(vi), "$INDEX_ALLOCATION "
 						"attribute is not present but "
 						"$INDEX_ROOT indicated it is.");
 			else
-				ntfs_error(vi->i_sb, "Failed to lookup "
+				ntfs_error(inode_sb(vi), "Failed to lookup "
 						"$INDEX_ALLOCATION "
 						"attribute.");
 			goto unm_err_out;
 		}
 		a = ctx->attr;
 		if (!a->non_resident) {
-			ntfs_error(vi->i_sb, "$INDEX_ALLOCATION attribute "
+			ntfs_error(inode_sb(vi),
+					"$INDEX_ALLOCATION attribute "
 					"is resident.");
 			goto unm_err_out;
 		}
@@ -942,22 +957,25 @@ static int ntfs_read_locked_inode(struct inode *vi)
 			goto unm_err_out;
 		}
 		if (a->flags & ATTR_IS_ENCRYPTED) {
-			ntfs_error(vi->i_sb, "$INDEX_ALLOCATION attribute "
+			ntfs_error(inode_sb(vi),
+					"$INDEX_ALLOCATION attribute "
 					"is encrypted.");
 			goto unm_err_out;
 		}
 		if (a->flags & ATTR_IS_SPARSE) {
-			ntfs_error(vi->i_sb, "$INDEX_ALLOCATION attribute "
+			ntfs_error(inode_sb(vi),
+					"$INDEX_ALLOCATION attribute "
 					"is sparse.");
 			goto unm_err_out;
 		}
 		if (a->flags & ATTR_COMPRESSION_MASK) {
-			ntfs_error(vi->i_sb, "$INDEX_ALLOCATION attribute "
+			ntfs_error(inode_sb(vi),
+					"$INDEX_ALLOCATION attribute "
 					"is compressed.");
 			goto unm_err_out;
 		}
 		if (a->data.non_resident.lowest_vcn) {
-			ntfs_error(vi->i_sb, "First extent of "
+			ntfs_error(inode_sb(vi), "First extent of "
 					"$INDEX_ALLOCATION attribute has non "
 					"zero lowest_vcn.");
 			goto unm_err_out;
@@ -978,14 +996,16 @@ static int ntfs_read_locked_inode(struct inode *vi)
 		/* Get the index bitmap attribute inode. */
 		bvi = ntfs_attr_iget(vi, AT_BITMAP, I30, 4);
 		if (IS_ERR(bvi)) {
-			ntfs_error(vi->i_sb, "Failed to get bitmap attribute.");
+			ntfs_error(inode_sb(vi),
+				   "Failed to get bitmap attribute.");
 			err = PTR_ERR(bvi);
 			goto unm_err_out;
 		}
 		bni = NTFS_I(bvi);
 		if (NInoCompressed(bni) || NInoEncrypted(bni) ||
 				NInoSparse(bni)) {
-			ntfs_error(vi->i_sb, "$BITMAP attribute is compressed "
+			ntfs_error(inode_sb(vi),
+					"$BITMAP attribute is compressed "
 					"and/or encrypted and/or sparse.");
 			goto iput_unm_err_out;
 		}
@@ -993,7 +1013,8 @@ static int ntfs_read_locked_inode(struct inode *vi)
 		bvi_size = i_size_read(bvi);
 		if ((bvi_size << 3) < (vi->i_size >>
 				ni->itype.index.block_size_bits)) {
-			ntfs_error(vi->i_sb, "Index bitmap too small (0x%llx) "
+			ntfs_error(inode_sb(vi),
+					"Index bitmap too small (0x%llx) "
 					"for index allocation (0x%llx).",
 					bvi_size << 3, vi->i_size);
 			goto iput_unm_err_out;
@@ -1020,7 +1041,8 @@ static int ntfs_read_locked_inode(struct inode *vi)
 			vi->i_size = ni->initialized_size =
 					ni->allocated_size = 0;
 			if (err != -ENOENT) {
-				ntfs_error(vi->i_sb, "Failed to lookup $DATA "
+				ntfs_error(inode_sb(vi),
+						"Failed to lookup $DATA "
 						"attribute.");
 				goto unm_err_out;
 			}
@@ -1043,7 +1065,8 @@ static int ntfs_read_locked_inode(struct inode *vi)
 				goto no_data_attr_special_case;
 			// FIXME: File is corrupt! Hot-fix with empty data
 			// attribute if recovery option is set.
-			ntfs_error(vi->i_sb, "$DATA attribute is missing.");
+			ntfs_error(inode_sb(vi),
+				   "$DATA attribute is missing.");
 			goto unm_err_out;
 		}
 		a = ctx->attr;
@@ -1052,7 +1075,7 @@ static int ntfs_read_locked_inode(struct inode *vi)
 			if (a->flags & ATTR_COMPRESSION_MASK) {
 				NInoSetCompressed(ni);
 				if (vol->cluster_size > 4096) {
-					ntfs_error(vi->i_sb, "Found "
+					ntfs_error(inode_sb(vi), "Found "
 							"compressed data but "
 							"compression is "
 							"disabled due to "
@@ -1063,7 +1086,8 @@ static int ntfs_read_locked_inode(struct inode *vi)
 				}
 				if ((a->flags & ATTR_COMPRESSION_MASK)
 						!= ATTR_IS_COMPRESSED) {
-					ntfs_error(vi->i_sb, "Found unknown "
+					ntfs_error(inode_sb(vi),
+							"Found unknown "
 							"compression method "
 							"or corrupt file.");
 					goto unm_err_out;
@@ -1074,7 +1098,8 @@ static int ntfs_read_locked_inode(struct inode *vi)
 		}
 		if (a->flags & ATTR_IS_ENCRYPTED) {
 			if (NInoCompressed(ni)) {
-				ntfs_error(vi->i_sb, "Found encrypted and "
+				ntfs_error(inode_sb(vi),
+						"Found encrypted and "
 						"compressed data.");
 				goto unm_err_out;
 			}
@@ -1085,7 +1110,7 @@ static int ntfs_read_locked_inode(struct inode *vi)
 			if (NInoCompressed(ni) || NInoSparse(ni)) {
 				if (NInoCompressed(ni) && a->data.non_resident.
 						compression_unit != 4) {
-					ntfs_error(vi->i_sb, "Found "
+					ntfs_error(inode_sb(vi), "Found "
 							"non-standard "
 							"compression unit (%u "
 							"instead of 4).  "
@@ -1120,7 +1145,8 @@ static int ntfs_read_locked_inode(struct inode *vi)
 						compressed_size);
 			}
 			if (a->data.non_resident.lowest_vcn) {
-				ntfs_error(vi->i_sb, "First extent of $DATA "
+				ntfs_error(inode_sb(vi),
+						"First extent of $DATA "
 						"attribute has non zero "
 						"lowest_vcn.");
 				goto unm_err_out;
@@ -1138,7 +1164,8 @@ static int ntfs_read_locked_inode(struct inode *vi)
 					le16_to_cpu(
 					a->data.resident.value_offset);
 			if (vi->i_size > ni->allocated_size) {
-				ntfs_error(vi->i_sb, "Resident data attribute "
+				ntfs_error(inode_sb(vi),
+						"Resident data attribute "
 						"is corrupt (size exceeds "
 						"allocation).");
 				goto unm_err_out;
@@ -1218,7 +1245,7 @@ static int ntfs_read_locked_inode(struct inode *vi)
  */
 static int ntfs_read_locked_attr_inode(struct inode *base_vi, struct inode *vi)
 {
-	ntfs_volume *vol = NTFS_SB(vi->i_sb);
+	ntfs_volume *vol = NTFS_SB(inode_sb(vi));
 	ntfs_inode *ni, *base_ni;
 	MFT_RECORD *m;
 	ATTR_RECORD *a;
@@ -1265,7 +1292,7 @@ static int ntfs_read_locked_attr_inode(struct inode *base_vi, struct inode *vi)
 			NInoSetCompressed(ni);
 			if ((ni->type != AT_DATA) || (ni->type == AT_DATA &&
 					ni->name_len)) {
-				ntfs_error(vi->i_sb, "Found compressed "
+				ntfs_error(inode_sb(vi), "Found compressed "
 						"non-data or named data "
 						"attribute.  Please report "
 						"you saw this message to "
@@ -1274,7 +1301,7 @@ static int ntfs_read_locked_attr_inode(struct inode *base_vi, struct inode *vi)
 				goto unm_err_out;
 			}
 			if (vol->cluster_size > 4096) {
-				ntfs_error(vi->i_sb, "Found compressed "
+				ntfs_error(inode_sb(vi), "Found compressed "
 						"attribute but compression is "
 						"disabled due to cluster size "
 						"(%i) > 4kiB.",
@@ -1283,7 +1310,7 @@ static int ntfs_read_locked_attr_inode(struct inode *base_vi, struct inode *vi)
 			}
 			if ((a->flags & ATTR_COMPRESSION_MASK) !=
 					ATTR_IS_COMPRESSED) {
-				ntfs_error(vi->i_sb, "Found unknown "
+				ntfs_error(inode_sb(vi), "Found unknown "
 						"compression method.");
 				goto unm_err_out;
 			}
@@ -1293,7 +1320,8 @@ static int ntfs_read_locked_attr_inode(struct inode *base_vi, struct inode *vi)
 		 * to compress all files.
 		 */
 		if (NInoMstProtected(ni) && ni->type != AT_INDEX_ROOT) {
-			ntfs_error(vi->i_sb, "Found mst protected attribute "
+			ntfs_error(inode_sb(vi),
+					"Found mst protected attribute "
 					"but the attribute is %s.  Please "
 					"report you saw this message to "
 					"linux-ntfs-dev@lists.sourceforge.net",
@@ -1306,7 +1334,8 @@ static int ntfs_read_locked_attr_inode(struct inode *base_vi, struct inode *vi)
 	}
 	if (a->flags & ATTR_IS_ENCRYPTED) {
 		if (NInoCompressed(ni)) {
-			ntfs_error(vi->i_sb, "Found encrypted and compressed "
+			ntfs_error(inode_sb(vi),
+					"Found encrypted and compressed "
 					"data.");
 			goto unm_err_out;
 		}
@@ -1315,7 +1344,8 @@ static int ntfs_read_locked_attr_inode(struct inode *base_vi, struct inode *vi)
 		 * encrypt all files.
 		 */
 		if (NInoMstProtected(ni) && ni->type != AT_INDEX_ROOT) {
-			ntfs_error(vi->i_sb, "Found mst protected attribute "
+			ntfs_error(inode_sb(vi),
+					"Found mst protected attribute "
 					"but the attribute is encrypted.  "
 					"Please report you saw this message "
 					"to linux-ntfs-dev@lists.sourceforge."
@@ -1323,7 +1353,7 @@ static int ntfs_read_locked_attr_inode(struct inode *base_vi, struct inode *vi)
 			goto unm_err_out;
 		}
 		if (ni->type != AT_DATA) {
-			ntfs_error(vi->i_sb, "Found encrypted non-data "
+			ntfs_error(inode_sb(vi), "Found encrypted non-data "
 					"attribute.");
 			goto unm_err_out;
 		}
@@ -1338,7 +1368,8 @@ static int ntfs_read_locked_attr_inode(struct inode *base_vi, struct inode *vi)
 			goto unm_err_out;
 		}
 		if (NInoMstProtected(ni)) {
-			ntfs_error(vi->i_sb, "Found mst protected attribute "
+			ntfs_error(inode_sb(vi),
+					"Found mst protected attribute "
 					"but the attribute is resident.  "
 					"Please report you saw this message to "
 					"linux-ntfs-dev@lists.sourceforge.net");
@@ -1349,7 +1380,8 @@ static int ntfs_read_locked_attr_inode(struct inode *base_vi, struct inode *vi)
 		ni->allocated_size = le32_to_cpu(a->length) -
 				le16_to_cpu(a->data.resident.value_offset);
 		if (vi->i_size > ni->allocated_size) {
-			ntfs_error(vi->i_sb, "Resident attribute is corrupt "
+			ntfs_error(inode_sb(vi),
+					"Resident attribute is corrupt "
 					"(size exceeds allocation).");
 			goto unm_err_out;
 		}
@@ -1369,7 +1401,7 @@ static int ntfs_read_locked_attr_inode(struct inode *base_vi, struct inode *vi)
 		if (NInoCompressed(ni) || NInoSparse(ni)) {
 			if (NInoCompressed(ni) && a->data.non_resident.
 					compression_unit != 4) {
-				ntfs_error(vi->i_sb, "Found non-standard "
+				ntfs_error(inode_sb(vi), "Found non-standard "
 						"compression unit (%u instead "
 						"of 4).  Cannot handle this.",
 						a->data.non_resident.
@@ -1397,7 +1429,8 @@ static int ntfs_read_locked_attr_inode(struct inode *base_vi, struct inode *vi)
 					a->data.non_resident.compressed_size);
 		}
 		if (a->data.non_resident.lowest_vcn) {
-			ntfs_error(vi->i_sb, "First extent of attribute has "
+			ntfs_error(inode_sb(vi),
+					"First extent of attribute has "
 					"non-zero lowest_vcn.");
 			goto unm_err_out;
 		}
@@ -1484,7 +1517,7 @@ static int ntfs_read_locked_attr_inode(struct inode *base_vi, struct inode *vi)
 static int ntfs_read_locked_index_inode(struct inode *base_vi, struct inode *vi)
 {
 	loff_t bvi_size;
-	ntfs_volume *vol = NTFS_SB(vi->i_sb);
+	ntfs_volume *vol = NTFS_SB(inode_sb(vi));
 	ntfs_inode *ni, *base_ni, *bni;
 	struct inode *bvi;
 	MFT_RECORD *m;
@@ -1524,7 +1557,7 @@ static int ntfs_read_locked_index_inode(struct inode *base_vi, struct inode *vi)
 			CASE_SENSITIVE, 0, NULL, 0, ctx);
 	if (unlikely(err)) {
 		if (err == -ENOENT)
-			ntfs_error(vi->i_sb, "$INDEX_ROOT attribute is "
+			ntfs_error(inode_sb(vi), "$INDEX_ROOT attribute is "
 					"missing.");
 		goto unm_err_out;
 	}
@@ -1547,23 +1580,25 @@ static int ntfs_read_locked_index_inode(struct inode *base_vi, struct inode *vi)
 	 */
 	if (a->flags & (ATTR_COMPRESSION_MASK | ATTR_IS_ENCRYPTED |
 			ATTR_IS_SPARSE)) {
-		ntfs_error(vi->i_sb, "Found compressed/encrypted/sparse index "
+		ntfs_error(inode_sb(vi),
+				"Found compressed/encrypted/sparse index "
 				"root attribute.");
 		goto unm_err_out;
 	}
 	ir = (INDEX_ROOT*)((u8*)a + le16_to_cpu(a->data.resident.value_offset));
 	ir_end = (u8*)ir + le32_to_cpu(a->data.resident.value_length);
 	if (ir_end > (u8*)ctx->mrec + vol->mft_record_size) {
-		ntfs_error(vi->i_sb, "$INDEX_ROOT attribute is corrupt.");
+		ntfs_error(inode_sb(vi), "$INDEX_ROOT attribute is corrupt.");
 		goto unm_err_out;
 	}
 	index_end = (u8*)&ir->index + le32_to_cpu(ir->index.index_length);
 	if (index_end > ir_end) {
-		ntfs_error(vi->i_sb, "Index is corrupt.");
+		ntfs_error(inode_sb(vi), "Index is corrupt.");
 		goto unm_err_out;
 	}
 	if (ir->type) {
-		ntfs_error(vi->i_sb, "Index type is not 0 (type is 0x%x).",
+		ntfs_error(inode_sb(vi),
+				"Index type is not 0 (type is 0x%x).",
 				le32_to_cpu(ir->type));
 		goto unm_err_out;
 	}
@@ -1572,19 +1607,21 @@ static int ntfs_read_locked_index_inode(struct inode *base_vi, struct inode *vi)
 			le32_to_cpu(ir->collation_rule));
 	ni->itype.index.block_size = le32_to_cpu(ir->index_block_size);
 	if (!is_power_of_2(ni->itype.index.block_size)) {
-		ntfs_error(vi->i_sb, "Index block size (%u) is not a power of "
+		ntfs_error(inode_sb(vi),
+				"Index block size (%u) is not a power of "
 				"two.", ni->itype.index.block_size);
 		goto unm_err_out;
 	}
 	if (ni->itype.index.block_size > PAGE_SIZE) {
-		ntfs_error(vi->i_sb, "Index block size (%u) > PAGE_SIZE "
+		ntfs_error(inode_sb(vi), "Index block size (%u) > PAGE_SIZE "
 				"(%ld) is not supported.  Sorry.",
 				ni->itype.index.block_size, PAGE_SIZE);
 		err = -EOPNOTSUPP;
 		goto unm_err_out;
 	}
 	if (ni->itype.index.block_size < NTFS_BLOCK_SIZE) {
-		ntfs_error(vi->i_sb, "Index block size (%u) < NTFS_BLOCK_SIZE "
+		ntfs_error(inode_sb(vi),
+				"Index block size (%u) < NTFS_BLOCK_SIZE "
 				"(%i) is not supported.  Sorry.",
 				ni->itype.index.block_size, NTFS_BLOCK_SIZE);
 		err = -EOPNOTSUPP;
@@ -1617,17 +1654,18 @@ static int ntfs_read_locked_index_inode(struct inode *base_vi, struct inode *vi)
 			CASE_SENSITIVE, 0, NULL, 0, ctx);
 	if (unlikely(err)) {
 		if (err == -ENOENT)
-			ntfs_error(vi->i_sb, "$INDEX_ALLOCATION attribute is "
+			ntfs_error(inode_sb(vi),
+					"$INDEX_ALLOCATION attribute is "
 					"not present but $INDEX_ROOT "
 					"indicated it is.");
 		else
-			ntfs_error(vi->i_sb, "Failed to lookup "
+			ntfs_error(inode_sb(vi), "Failed to lookup "
 					"$INDEX_ALLOCATION attribute.");
 		goto unm_err_out;
 	}
 	a = ctx->attr;
 	if (!a->non_resident) {
-		ntfs_error(vi->i_sb, "$INDEX_ALLOCATION attribute is "
+		ntfs_error(inode_sb(vi), "$INDEX_ALLOCATION attribute is "
 				"resident.");
 		goto unm_err_out;
 	}
@@ -1642,21 +1680,22 @@ static int ntfs_read_locked_index_inode(struct inode *base_vi, struct inode *vi)
 		goto unm_err_out;
 	}
 	if (a->flags & ATTR_IS_ENCRYPTED) {
-		ntfs_error(vi->i_sb, "$INDEX_ALLOCATION attribute is "
+		ntfs_error(inode_sb(vi), "$INDEX_ALLOCATION attribute is "
 				"encrypted.");
 		goto unm_err_out;
 	}
 	if (a->flags & ATTR_IS_SPARSE) {
-		ntfs_error(vi->i_sb, "$INDEX_ALLOCATION attribute is sparse.");
+		ntfs_error(inode_sb(vi),
+			   "$INDEX_ALLOCATION attribute is sparse.");
 		goto unm_err_out;
 	}
 	if (a->flags & ATTR_COMPRESSION_MASK) {
-		ntfs_error(vi->i_sb, "$INDEX_ALLOCATION attribute is "
+		ntfs_error(inode_sb(vi), "$INDEX_ALLOCATION attribute is "
 				"compressed.");
 		goto unm_err_out;
 	}
 	if (a->data.non_resident.lowest_vcn) {
-		ntfs_error(vi->i_sb, "First extent of $INDEX_ALLOCATION "
+		ntfs_error(inode_sb(vi), "First extent of $INDEX_ALLOCATION "
 				"attribute has non zero lowest_vcn.");
 		goto unm_err_out;
 	}
@@ -1675,21 +1714,23 @@ static int ntfs_read_locked_index_inode(struct inode *base_vi, struct inode *vi)
 	/* Get the index bitmap attribute inode. */
 	bvi = ntfs_attr_iget(base_vi, AT_BITMAP, ni->name, ni->name_len);
 	if (IS_ERR(bvi)) {
-		ntfs_error(vi->i_sb, "Failed to get bitmap attribute.");
+		ntfs_error(inode_sb(vi), "Failed to get bitmap attribute.");
 		err = PTR_ERR(bvi);
 		goto unm_err_out;
 	}
 	bni = NTFS_I(bvi);
 	if (NInoCompressed(bni) || NInoEncrypted(bni) ||
 			NInoSparse(bni)) {
-		ntfs_error(vi->i_sb, "$BITMAP attribute is compressed and/or "
+		ntfs_error(inode_sb(vi),
+				"$BITMAP attribute is compressed and/or "
 				"encrypted and/or sparse.");
 		goto iput_unm_err_out;
 	}
 	/* Consistency check bitmap size vs. index allocation size. */
 	bvi_size = i_size_read(bvi);
 	if ((bvi_size << 3) < (vi->i_size >> ni->itype.index.block_size_bits)) {
-		ntfs_error(vi->i_sb, "Index bitmap too small (0x%llx) for "
+		ntfs_error(inode_sb(vi),
+				"Index bitmap too small (0x%llx) for "
 				"index allocation (0x%llx).", bvi_size << 3,
 				vi->i_size);
 		goto iput_unm_err_out;
@@ -1719,7 +1760,8 @@ static int ntfs_read_locked_index_inode(struct inode *base_vi, struct inode *vi)
 	if (m)
 		unmap_mft_record(base_ni);
 err_out:
-	ntfs_error(vi->i_sb, "Failed with error code %i while reading index "
+	ntfs_error(inode_sb(vi),
+			"Failed with error code %i while reading index "
 			"inode (mft_no 0x%lx, name_len %i.", err, vi->i_ino,
 			ni->name_len);
 	make_bad_inode(vi);
@@ -1767,7 +1809,7 @@ int ntfs_read_inode_mount(struct inode *vi)
 {
 	VCN next_vcn, last_vcn, highest_vcn;
 	s64 block;
-	struct super_block *sb = vi->i_sb;
+	struct super_block *sb = inode_sb(vi);
 	ntfs_volume *vol = NTFS_SB(sb);
 	struct buffer_head *bh;
 	ntfs_inode *ni;
@@ -2261,7 +2303,8 @@ void ntfs_evict_big_inode(struct inode *vi)
 		ntfs_commit_inode(vi);
 
 		if (!was_bad && (is_bad_inode(vi) || NInoDirty(ni))) {
-			ntfs_error(vi->i_sb, "Failed to commit dirty inode "
+			ntfs_error(inode_sb(vi),
+					"Failed to commit dirty inode "
 					"0x%lx.  Losing data!", vi->i_ino);
 			// FIXME:  Do something!!!
 		}
@@ -2383,7 +2426,8 @@ int ntfs_truncate(struct inode *vi)
 	m = map_mft_record(base_ni);
 	if (IS_ERR(m)) {
 		err = PTR_ERR(m);
-		ntfs_error(vi->i_sb, "Failed to map mft record for inode 0x%lx "
+		ntfs_error(inode_sb(vi),
+				"Failed to map mft record for inode 0x%lx "
 				"(error code %d).%s", vi->i_ino, err, te);
 		ctx = NULL;
 		m = NULL;
@@ -2391,7 +2435,8 @@ int ntfs_truncate(struct inode *vi)
 	}
 	ctx = ntfs_attr_get_search_ctx(base_ni, m);
 	if (unlikely(!ctx)) {
-		ntfs_error(vi->i_sb, "Failed to allocate a search context for "
+		ntfs_error(inode_sb(vi),
+				"Failed to allocate a search context for "
 				"inode 0x%lx (not enough memory).%s",
 				vi->i_ino, te);
 		err = -ENOMEM;
@@ -2401,12 +2446,14 @@ int ntfs_truncate(struct inode *vi)
 			CASE_SENSITIVE, 0, NULL, 0, ctx);
 	if (unlikely(err)) {
 		if (err == -ENOENT) {
-			ntfs_error(vi->i_sb, "Open attribute is missing from "
+			ntfs_error(inode_sb(vi),
+					"Open attribute is missing from "
 					"mft record.  Inode 0x%lx is corrupt.  "
 					"Run chkdsk.%s", vi->i_ino, te);
 			err = -EIO;
 		} else
-			ntfs_error(vi->i_sb, "Failed to lookup attribute in "
+			ntfs_error(inode_sb(vi),
+					"Failed to lookup attribute in "
 					"inode 0x%lx (error code %d).%s",
 					vi->i_ino, err, te);
 		goto old_bad_out;
@@ -2480,7 +2527,7 @@ int ntfs_truncate(struct inode *vi)
 		}
 	}
 	if (NInoCompressed(ni) || NInoEncrypted(ni)) {
-		ntfs_warning(vi->i_sb, "Changes in inode size are not "
+		ntfs_warning(inode_sb(vi), "Changes in inode size are not "
 				"supported yet for %s files, ignoring.",
 				NInoCompressed(ni) ? "compressed" :
 				"encrypted");
@@ -2889,7 +2936,8 @@ int ntfs_setattr(struct dentry *dentry, struct iattr *attr)
 		goto out;
 	/* We do not support NTFS ACLs yet. */
 	if (ia_valid & (ATTR_UID | ATTR_GID | ATTR_MODE)) {
-		ntfs_warning(vi->i_sb, "Changes in user/group/mode are not "
+		ntfs_warning(inode_sb(vi),
+				"Changes in user/group/mode are not "
 				"supported yet, ignoring.");
 		err = -EOPNOTSUPP;
 		goto out;
@@ -2902,7 +2950,8 @@ int ntfs_setattr(struct dentry *dentry, struct iattr *attr)
 			 * compressed or encrypted files yet.
 			 */
 			if (NInoCompressed(ni) || NInoEncrypted(ni)) {
-				ntfs_warning(vi->i_sb, "Changes in inode size "
+				ntfs_warning(inode_sb(vi),
+						"Changes in inode size "
 						"are not supported yet for "
 						"%s files, ignoring.",
 						NInoCompressed(ni) ?
@@ -2924,13 +2973,13 @@ int ntfs_setattr(struct dentry *dentry, struct iattr *attr)
 	}
 	if (ia_valid & ATTR_ATIME)
 		vi->i_atime = timespec_trunc(attr->ia_atime,
-				vi->i_sb->s_time_gran);
+				inode_sb(vi)->s_time_gran);
 	if (ia_valid & ATTR_MTIME)
 		vi->i_mtime = timespec_trunc(attr->ia_mtime,
-				vi->i_sb->s_time_gran);
+				inode_sb(vi)->s_time_gran);
 	if (ia_valid & ATTR_CTIME)
 		vi->i_ctime = timespec_trunc(attr->ia_ctime,
-				vi->i_sb->s_time_gran);
+				inode_sb(vi)->s_time_gran);
 	mark_inode_dirty(vi);
 out:
 	return err;
@@ -3088,12 +3137,14 @@ int __ntfs_write_inode(struct inode *vi, int sync)
 	unmap_mft_record(ni);
 err_out:
 	if (err == -ENOMEM) {
-		ntfs_warning(vi->i_sb, "Not enough memory to write inode.  "
+		ntfs_warning(inode_sb(vi),
+				"Not enough memory to write inode.  "
 				"Marking the inode dirty again, so the VFS "
 				"retries later.");
 		mark_inode_dirty(vi);
 	} else {
-		ntfs_error(vi->i_sb, "Failed (error %i):  Run chkdsk.", -err);
+		ntfs_error(inode_sb(vi), "Failed (error %i):  Run chkdsk.",
+			   -err);
 		NVolSetErrors(ni->vol);
 	}
 	return err;
diff --git a/fs/ntfs/inode.h b/fs/ntfs/inode.h
index b3c3469de6cb..d22743c94763 100644
--- a/fs/ntfs/inode.h
+++ b/fs/ntfs/inode.h
@@ -288,7 +288,7 @@ static inline void ntfs_init_big_inode(struct inode *vi)
 	ntfs_inode *ni = NTFS_I(vi);
 
 	ntfs_debug("Entering.");
-	__ntfs_init_inode(vi->i_sb, ni);
+	__ntfs_init_inode(inode_sb(vi), ni);
 	ni->mft_no = vi->i_ino;
 }
 
diff --git a/fs/ntfs/logfile.c b/fs/ntfs/logfile.c
index 353379ff6057..2cc0cac18ac5 100644
--- a/fs/ntfs/logfile.c
+++ b/fs/ntfs/logfile.c
@@ -68,7 +68,8 @@ static bool ntfs_check_restart_page_header(struct inode *vi,
 			logfile_system_page_size &
 			(logfile_system_page_size - 1) ||
 			!is_power_of_2(logfile_log_page_size)) {
-		ntfs_error(vi->i_sb, "$LogFile uses unsupported page size.");
+		ntfs_error(inode_sb(vi),
+			   "$LogFile uses unsupported page size.");
 		return false;
 	}
 	/*
@@ -76,14 +77,14 @@ static bool ntfs_check_restart_page_header(struct inode *vi,
 	 * size (2nd restart page).
 	 */
 	if (pos && pos != logfile_system_page_size) {
-		ntfs_error(vi->i_sb, "Found restart area in incorrect "
+		ntfs_error(inode_sb(vi), "Found restart area in incorrect "
 				"position in $LogFile.");
 		return false;
 	}
 	/* We only know how to handle version 1.1. */
 	if (sle16_to_cpu(rp->major_ver) != 1 ||
 			sle16_to_cpu(rp->minor_ver) != 1) {
-		ntfs_error(vi->i_sb, "$LogFile version %i.%i is not "
+		ntfs_error(inode_sb(vi), "$LogFile version %i.%i is not "
 				"supported.  (This driver supports version "
 				"1.1 only.)", (int)sle16_to_cpu(rp->major_ver),
 				(int)sle16_to_cpu(rp->minor_ver));
@@ -100,7 +101,7 @@ static bool ntfs_check_restart_page_header(struct inode *vi,
 	/* Verify the size of the update sequence array. */
 	usa_count = 1 + (logfile_system_page_size >> NTFS_BLOCK_SIZE_BITS);
 	if (usa_count != le16_to_cpu(rp->usa_count)) {
-		ntfs_error(vi->i_sb, "$LogFile restart page specifies "
+		ntfs_error(inode_sb(vi), "$LogFile restart page specifies "
 				"inconsistent update sequence array count.");
 		return false;
 	}
@@ -109,7 +110,7 @@ static bool ntfs_check_restart_page_header(struct inode *vi,
 	usa_end = usa_ofs + usa_count * sizeof(u16);
 	if (usa_ofs < sizeof(RESTART_PAGE_HEADER) ||
 			usa_end > NTFS_BLOCK_SIZE - sizeof(u16)) {
-		ntfs_error(vi->i_sb, "$LogFile restart page specifies "
+		ntfs_error(inode_sb(vi), "$LogFile restart page specifies "
 				"inconsistent update sequence array offset.");
 		return false;
 	}
@@ -124,7 +125,7 @@ static bool ntfs_check_restart_page_header(struct inode *vi,
 	if (ra_ofs & 7 || (have_usa ? ra_ofs < usa_end :
 			ra_ofs < sizeof(RESTART_PAGE_HEADER)) ||
 			ra_ofs > logfile_system_page_size) {
-		ntfs_error(vi->i_sb, "$LogFile restart page specifies "
+		ntfs_error(inode_sb(vi), "$LogFile restart page specifies "
 				"inconsistent restart area offset.");
 		return false;
 	}
@@ -133,7 +134,8 @@ static bool ntfs_check_restart_page_header(struct inode *vi,
 	 * set.
 	 */
 	if (!ntfs_is_chkd_record(rp->magic) && sle64_to_cpu(rp->chkdsk_lsn)) {
-		ntfs_error(vi->i_sb, "$LogFile restart page is not modified "
+		ntfs_error(inode_sb(vi),
+				"$LogFile restart page is not modified "
 				"by chkdsk but a chkdsk LSN is specified.");
 		return false;
 	}
@@ -172,7 +174,7 @@ static bool ntfs_check_restart_area(struct inode *vi, RESTART_PAGE_HEADER *rp)
 	 */
 	if (ra_ofs + offsetof(RESTART_AREA, file_size) >
 			NTFS_BLOCK_SIZE - sizeof(u16)) {
-		ntfs_error(vi->i_sb, "$LogFile restart area specifies "
+		ntfs_error(inode_sb(vi), "$LogFile restart area specifies "
 				"inconsistent file offset.");
 		return false;
 	}
@@ -186,7 +188,7 @@ static bool ntfs_check_restart_area(struct inode *vi, RESTART_PAGE_HEADER *rp)
 	ca_ofs = le16_to_cpu(ra->client_array_offset);
 	if (((ca_ofs + 7) & ~7) != ca_ofs ||
 			ra_ofs + ca_ofs > NTFS_BLOCK_SIZE - sizeof(u16)) {
-		ntfs_error(vi->i_sb, "$LogFile restart area specifies "
+		ntfs_error(inode_sb(vi), "$LogFile restart area specifies "
 				"inconsistent client array offset.");
 		return false;
 	}
@@ -201,7 +203,8 @@ static bool ntfs_check_restart_area(struct inode *vi, RESTART_PAGE_HEADER *rp)
 			ra_ofs + le16_to_cpu(ra->restart_area_length) >
 			le32_to_cpu(rp->system_page_size) ||
 			ra_len > le16_to_cpu(ra->restart_area_length)) {
-		ntfs_error(vi->i_sb, "$LogFile restart area is out of bounds "
+		ntfs_error(inode_sb(vi),
+				"$LogFile restart area is out of bounds "
 				"of the system page size specified by the "
 				"restart page header and/or the specified "
 				"restart area length is inconsistent.");
@@ -218,7 +221,7 @@ static bool ntfs_check_restart_area(struct inode *vi, RESTART_PAGE_HEADER *rp)
 			(ra->client_in_use_list != LOGFILE_NO_CLIENT &&
 			le16_to_cpu(ra->client_in_use_list) >=
 			le16_to_cpu(ra->log_clients))) {
-		ntfs_error(vi->i_sb, "$LogFile restart area specifies "
+		ntfs_error(inode_sb(vi), "$LogFile restart area specifies "
 				"overflowing client free and/or in use lists.");
 		return false;
 	}
@@ -233,21 +236,21 @@ static bool ntfs_check_restart_area(struct inode *vi, RESTART_PAGE_HEADER *rp)
 		fs_bits++;
 	}
 	if (le32_to_cpu(ra->seq_number_bits) != 67 - fs_bits) {
-		ntfs_error(vi->i_sb, "$LogFile restart area specifies "
+		ntfs_error(inode_sb(vi), "$LogFile restart area specifies "
 				"inconsistent sequence number bits.");
 		return false;
 	}
 	/* The log record header length must be a multiple of 8. */
 	if (((le16_to_cpu(ra->log_record_header_length) + 7) & ~7) !=
 			le16_to_cpu(ra->log_record_header_length)) {
-		ntfs_error(vi->i_sb, "$LogFile restart area specifies "
+		ntfs_error(inode_sb(vi), "$LogFile restart area specifies "
 				"inconsistent log record header length.");
 		return false;
 	}
 	/* Dito for the log page data offset. */
 	if (((le16_to_cpu(ra->log_page_data_offset) + 7) & ~7) !=
 			le16_to_cpu(ra->log_page_data_offset)) {
-		ntfs_error(vi->i_sb, "$LogFile restart area specifies "
+		ntfs_error(inode_sb(vi), "$LogFile restart area specifies "
 				"inconsistent log page data offset.");
 		return false;
 	}
@@ -316,7 +319,7 @@ static bool ntfs_check_log_client_array(struct inode *vi,
 	ntfs_debug("Done.");
 	return true;
 err_out:
-	ntfs_error(vi->i_sb, "$LogFile log client array is corrupt.");
+	ntfs_error(inode_sb(vi), "$LogFile log client array is corrupt.");
 	return false;
 }
 
@@ -373,7 +376,8 @@ static int ntfs_check_and_load_restart_page(struct inode *vi,
 	 */
 	trp = ntfs_malloc_nofs(le32_to_cpu(rp->system_page_size));
 	if (!trp) {
-		ntfs_error(vi->i_sb, "Failed to allocate memory for $LogFile "
+		ntfs_error(inode_sb(vi),
+				"Failed to allocate memory for $LogFile "
 				"restart page buffer.");
 		return -ENOMEM;
 	}
@@ -400,7 +404,8 @@ static int ntfs_check_and_load_restart_page(struct inode *vi,
 		do {
 			page = ntfs_map_page(vi->i_mapping, idx);
 			if (IS_ERR(page)) {
-				ntfs_error(vi->i_sb, "Error mapping $LogFile "
+				ntfs_error(inode_sb(vi),
+						"Error mapping $LogFile "
 						"page (index %lu).", idx);
 				err = PTR_ERR(page);
 				if (err != -EIO && err != -ENOMEM)
@@ -430,7 +435,8 @@ static int ntfs_check_and_load_restart_page(struct inode *vi,
 		if (le16_to_cpu(rp->restart_area_offset) +
 				le16_to_cpu(ra->restart_area_length) >
 				NTFS_BLOCK_SIZE - sizeof(u16)) {
-			ntfs_error(vi->i_sb, "Multi sector transfer error "
+			ntfs_error(inode_sb(vi),
+					"Multi sector transfer error "
 					"detected in $LogFile restart page.");
 			err = -EINVAL;
 			goto err_out;
@@ -486,7 +492,7 @@ bool ntfs_check_logfile(struct inode *log_vi, RESTART_PAGE_HEADER **rp)
 {
 	s64 size, pos;
 	LSN rstr1_lsn, rstr2_lsn;
-	ntfs_volume *vol = NTFS_SB(log_vi->i_sb);
+	ntfs_volume *vol = NTFS_SB(inode_sb(log_vi));
 	struct address_space *mapping = log_vi->i_mapping;
 	struct page *page = NULL;
 	u8 *kaddr = NULL;
@@ -679,7 +685,7 @@ bool ntfs_check_logfile(struct inode *log_vi, RESTART_PAGE_HEADER **rp)
  */
 bool ntfs_is_logfile_clean(struct inode *log_vi, const RESTART_PAGE_HEADER *rp)
 {
-	ntfs_volume *vol = NTFS_SB(log_vi->i_sb);
+	ntfs_volume *vol = NTFS_SB(inode_sb(log_vi));
 	RESTART_AREA *ra;
 
 	ntfs_debug("Entering.");
diff --git a/fs/ntfs/namei.c b/fs/ntfs/namei.c
index 4690cd75d8d7..b55c2fb0ed56 100644
--- a/fs/ntfs/namei.c
+++ b/fs/ntfs/namei.c
@@ -103,7 +103,7 @@
 static struct dentry *ntfs_lookup(struct inode *dir_ino, struct dentry *dent,
 		unsigned int flags)
 {
-	ntfs_volume *vol = NTFS_SB(dir_ino->i_sb);
+	ntfs_volume *vol = NTFS_SB(inode_sb(dir_ino));
 	struct inode *dent_inode;
 	ntfschar *uname;
 	ntfs_name *name = NULL;
@@ -326,7 +326,8 @@ static struct dentry *ntfs_get_parent(struct dentry *child_dent)
 		ntfs_attr_put_search_ctx(ctx);
 		unmap_mft_record(ni);
 		if (err == -ENOENT)
-			ntfs_error(vi->i_sb, "Inode 0x%lx does not have a "
+			ntfs_error(inode_sb(vi),
+					"Inode 0x%lx does not have a "
 					"file name attribute.  Run chkdsk.",
 					vi->i_ino);
 		return ERR_PTR(err);
@@ -345,7 +346,7 @@ static struct dentry *ntfs_get_parent(struct dentry *child_dent)
 	ntfs_attr_put_search_ctx(ctx);
 	unmap_mft_record(ni);
 
-	return d_obtain_alias(ntfs_iget(vi->i_sb, parent_ino));
+	return d_obtain_alias(ntfs_iget(inode_sb(vi), parent_ino));
 }
 
 static struct inode *ntfs_nfs_get_inode(struct super_block *sb,
-- 
2.15.1

^ permalink raw reply related	[flat|nested] 88+ messages in thread

* [PATCH 54/76] fs/ocfs2: Use inode_sb() helper instead of inode->i_sb
  2018-05-08 18:03 [RFC][PATCH 0/76] vfs: 'views' for filesystems with more than one root Mark Fasheh
                   ` (52 preceding siblings ...)
  2018-05-08 18:04 ` [PATCH 53/76] fs/ntfs: " Mark Fasheh
@ 2018-05-08 18:04 ` Mark Fasheh
  2018-05-08 18:04 ` [PATCH 55/76] fs/omfs: " Mark Fasheh
                   ` (22 subsequent siblings)
  76 siblings, 0 replies; 88+ messages in thread
From: Mark Fasheh @ 2018-05-08 18:04 UTC (permalink / raw)
  To: linux-fsdevel; +Cc: linux-kernel, linux-btrfs, Mark Fasheh

Signed-off-by: Mark Fasheh <mfasheh@suse.de>
---
 fs/ocfs2/acl.c          |  10 +-
 fs/ocfs2/alloc.c        |  47 +++----
 fs/ocfs2/aops.c         |  85 ++++++------
 fs/ocfs2/dcache.c       |   2 +-
 fs/ocfs2/dir.c          | 127 +++++++++---------
 fs/ocfs2/dlmfs/dlmfs.c  |   2 +-
 fs/ocfs2/dlmglue.c      |  62 ++++-----
 fs/ocfs2/export.c       |   2 +-
 fs/ocfs2/extent_map.c   |  48 +++----
 fs/ocfs2/file.c         |  93 ++++++-------
 fs/ocfs2/inode.c        |  30 ++---
 fs/ocfs2/inode.h        |   2 +-
 fs/ocfs2/ioctl.c        |  22 ++--
 fs/ocfs2/journal.c      |   5 +-
 fs/ocfs2/journal.h      |   4 +-
 fs/ocfs2/localalloc.c   |   2 +-
 fs/ocfs2/locks.c        |   4 +-
 fs/ocfs2/mmap.c         |   4 +-
 fs/ocfs2/move_extents.c |  47 +++----
 fs/ocfs2/namei.c        |  24 ++--
 fs/ocfs2/ocfs2.h        |   2 +-
 fs/ocfs2/quota_global.c |   2 +-
 fs/ocfs2/quota_local.c  |  12 +-
 fs/ocfs2/refcounttree.c | 117 +++++++++--------
 fs/ocfs2/resize.c       |  27 ++--
 fs/ocfs2/slot_map.c     |   2 +-
 fs/ocfs2/suballoc.c     |  71 +++++-----
 fs/ocfs2/suballoc.h     |   2 +-
 fs/ocfs2/symlink.c      |   2 +-
 fs/ocfs2/xattr.c        | 339 ++++++++++++++++++++++++------------------------
 30 files changed, 620 insertions(+), 578 deletions(-)

diff --git a/fs/ocfs2/acl.c b/fs/ocfs2/acl.c
index 917fadca8a7b..20bd414b4cfd 100644
--- a/fs/ocfs2/acl.c
+++ b/fs/ocfs2/acl.c
@@ -181,7 +181,7 @@ static int ocfs2_acl_set_mode(struct inode *inode, struct buffer_head *di_bh,
 		get_bh(di_bh);
 
 	if (handle == NULL) {
-		handle = ocfs2_start_trans(OCFS2_SB(inode->i_sb),
+		handle = ocfs2_start_trans(OCFS2_SB(inode_sb(inode)),
 					   OCFS2_INODE_UPDATE_CREDITS);
 		if (IS_ERR(handle)) {
 			ret = PTR_ERR(handle);
@@ -211,7 +211,7 @@ static int ocfs2_acl_set_mode(struct inode *inode, struct buffer_head *di_bh,
 
 out_commit:
 	if (commit_handle)
-		ocfs2_commit_trans(OCFS2_SB(inode->i_sb), handle);
+		ocfs2_commit_trans(OCFS2_SB(inode_sb(inode)), handle);
 out_brelse:
 	brelse(di_bh);
 out:
@@ -303,7 +303,7 @@ struct posix_acl *ocfs2_iop_get_acl(struct inode *inode, int type)
 	int had_lock;
 	struct ocfs2_lock_holder oh;
 
-	osb = OCFS2_SB(inode->i_sb);
+	osb = OCFS2_SB(inode_sb(inode));
 	if (!(osb->s_mount_opt & OCFS2_MOUNT_POSIX_ACL))
 		return NULL;
 
@@ -322,7 +322,7 @@ struct posix_acl *ocfs2_iop_get_acl(struct inode *inode, int type)
 
 int ocfs2_acl_chmod(struct inode *inode, struct buffer_head *bh)
 {
-	struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
+	struct ocfs2_super *osb = OCFS2_SB(inode_sb(inode));
 	struct posix_acl *acl;
 	int ret;
 
@@ -358,7 +358,7 @@ int ocfs2_init_acl(handle_t *handle,
 		   struct ocfs2_alloc_context *meta_ac,
 		   struct ocfs2_alloc_context *data_ac)
 {
-	struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
+	struct ocfs2_super *osb = OCFS2_SB(inode_sb(inode));
 	struct posix_acl *acl = NULL;
 	int ret = 0, ret2;
 	umode_t mode;
diff --git a/fs/ocfs2/alloc.c b/fs/ocfs2/alloc.c
index 9a876bb07cac..10fd4f40d202 100644
--- a/fs/ocfs2/alloc.c
+++ b/fs/ocfs2/alloc.c
@@ -232,7 +232,7 @@ static int ocfs2_dinode_insert_check(struct ocfs2_extent_tree *et,
 				     struct ocfs2_extent_rec *rec)
 {
 	struct ocfs2_inode_info *oi = cache_info_to_inode(et->et_ci);
-	struct ocfs2_super *osb = OCFS2_SB(oi->vfs_inode.i_sb);
+	struct ocfs2_super *osb = OCFS2_SB(inode_sb(&oi->vfs_inode));
 
 	BUG_ON(oi->ip_dyn_features & OCFS2_INLINE_DATA_FL);
 	mlog_bug_on_msg(!ocfs2_sparse_alloc(osb) &&
@@ -5275,8 +5275,9 @@ int ocfs2_mark_extent_written(struct inode *inode,
 		(unsigned long long)OCFS2_I(inode)->ip_blkno,
 		cpos, len, phys);
 
-	if (!ocfs2_writes_unwritten_extents(OCFS2_SB(inode->i_sb))) {
-		ocfs2_error(inode->i_sb, "Inode %llu has unwritten extents that are being written to, but the feature bit is not set in the super block\n",
+	if (!ocfs2_writes_unwritten_extents(OCFS2_SB(inode_sb(inode)))) {
+		ocfs2_error(inode_sb(inode),
+			    "Inode %llu has unwritten extents that are being written to, but the feature bit is not set in the super block\n",
 			    (unsigned long long)OCFS2_I(inode)->ip_blkno);
 		ret = -EROFS;
 		goto out;
@@ -5687,7 +5688,7 @@ static int ocfs2_reserve_blocks_for_rec_trunc(struct inode *inode,
 {
 	int ret = 0, num_free_extents;
 	unsigned int max_recs_needed = 2 * extents_to_split;
-	struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
+	struct ocfs2_super *osb = OCFS2_SB(inode_sb(inode));
 
 	*ac = NULL;
 
@@ -5729,8 +5730,8 @@ int ocfs2_remove_btree_range(struct inode *inode,
 			     u64 refcount_loc, bool refcount_tree_locked)
 {
 	int ret, credits = 0, extra_blocks = 0;
-	u64 phys_blkno = ocfs2_clusters_to_blocks(inode->i_sb, phys_cpos);
-	struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
+	u64 phys_blkno = ocfs2_clusters_to_blocks(inode_sb(inode), phys_cpos);
+	struct ocfs2_super *osb = OCFS2_SB(inode_sb(inode));
 	struct inode *tl_inode = osb->osb_tl_inode;
 	handle_t *handle;
 	struct ocfs2_alloc_context *meta_ac = NULL;
@@ -5793,7 +5794,7 @@ int ocfs2_remove_btree_range(struct inode *inode,
 	}
 
 	dquot_free_space_nodirty(inode,
-				  ocfs2_clusters_to_bytes(inode->i_sb, len));
+				  ocfs2_clusters_to_bytes(inode_sb(inode), len));
 
 	ret = ocfs2_remove_extent(handle, et, cpos, len, meta_ac, dealloc);
 	if (ret) {
@@ -5984,8 +5985,8 @@ static int ocfs2_replay_truncate_records(struct ocfs2_super *osb,
 		ocfs2_journal_dirty(handle, tl_bh);
 
 		rec = tl->tl_recs[i];
-		start_blk = ocfs2_clusters_to_blocks(data_alloc_inode->i_sb,
-						    le32_to_cpu(rec.t_start));
+		start_blk = ocfs2_clusters_to_blocks(inode_sb(data_alloc_inode),
+						     le32_to_cpu(rec.t_start));
 		num_clusters = le32_to_cpu(rec.t_clusters);
 
 		/* if start_blk is not set, we ignore the record as
@@ -6861,7 +6862,7 @@ static void ocfs2_zero_cluster_pages(struct inode *inode, loff_t start,
 	int i;
 	struct page *page;
 	unsigned int from, to = PAGE_SIZE;
-	struct super_block *sb = inode->i_sb;
+	struct super_block *sb = inode_sb(inode);
 
 	BUG_ON(!ocfs2_sparse_alloc(OCFS2_SB(sb)));
 
@@ -6929,7 +6930,7 @@ int ocfs2_grab_pages(struct inode *inode, loff_t start, loff_t end,
 static int ocfs2_grab_eof_pages(struct inode *inode, loff_t start, loff_t end,
 				struct page **pages, int *num)
 {
-	struct super_block *sb = inode->i_sb;
+	struct super_block *sb = inode_sb(inode);
 
 	BUG_ON(start >> OCFS2_SB(sb)->s_clustersize_bits !=
 	       (end - 1) >> OCFS2_SB(sb)->s_clustersize_bits);
@@ -6953,7 +6954,7 @@ int ocfs2_zero_range_for_truncate(struct inode *inode, handle_t *handle,
 	struct page **pages = NULL;
 	u64 phys;
 	unsigned int ext_flags;
-	struct super_block *sb = inode->i_sb;
+	struct super_block *sb = inode_sb(inode);
 
 	/*
 	 * File systems which don't support sparse files zero on every
@@ -7017,7 +7018,7 @@ int ocfs2_zero_range_for_truncate(struct inode *inode, handle_t *handle,
 static void ocfs2_zero_dinode_id2_with_xattr(struct inode *inode,
 					     struct ocfs2_dinode *di)
 {
-	unsigned int blocksize = 1 << inode->i_sb->s_blocksize_bits;
+	unsigned int blocksize = 1 << inode_sb(inode)->s_blocksize_bits;
 	unsigned int xattrsize = le16_to_cpu(di->i_xattr_inline_size);
 
 	if (le16_to_cpu(di->i_dyn_features) & OCFS2_INLINE_XATTR_FL)
@@ -7036,7 +7037,7 @@ void ocfs2_dinode_new_extent_list(struct inode *inode,
 	di->id2.i_list.l_tree_depth = 0;
 	di->id2.i_list.l_next_free_rec = 0;
 	di->id2.i_list.l_count = cpu_to_le16(
-		ocfs2_extent_recs_per_inode_with_xattr(inode->i_sb, di));
+		ocfs2_extent_recs_per_inode_with_xattr(inode_sb(inode), di));
 }
 
 void ocfs2_set_inode_data_inline(struct inode *inode, struct ocfs2_dinode *di)
@@ -7056,7 +7057,7 @@ void ocfs2_set_inode_data_inline(struct inode *inode, struct ocfs2_dinode *di)
 	ocfs2_zero_dinode_id2_with_xattr(inode, di);
 
 	idata->id_count = cpu_to_le16(
-			ocfs2_max_inline_data_with_xattr(inode->i_sb, di));
+			ocfs2_max_inline_data_with_xattr(inode_sb(inode), di));
 }
 
 int ocfs2_convert_inline_data_to_extents(struct inode *inode,
@@ -7068,7 +7069,7 @@ int ocfs2_convert_inline_data_to_extents(struct inode *inode,
 	handle_t *handle;
 	u64 uninitialized_var(block);
 	struct ocfs2_inode_info *oi = OCFS2_I(inode);
-	struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
+	struct ocfs2_super *osb = OCFS2_SB(inode_sb(inode));
 	struct ocfs2_dinode *di = (struct ocfs2_dinode *)di_bh->b_data;
 	struct ocfs2_alloc_context *data_ac = NULL;
 	struct page **pages = NULL;
@@ -7132,7 +7133,8 @@ int ocfs2_convert_inline_data_to_extents(struct inode *inode,
 		 * Save two copies, one for insert, and one that can
 		 * be changed by ocfs2_map_and_dirty_page() below.
 		 */
-		block = phys = ocfs2_clusters_to_blocks(inode->i_sb, bit_off);
+		block = phys = ocfs2_clusters_to_blocks(inode_sb(inode),
+							bit_off);
 
 		/*
 		 * Non sparse file systems zero on extend, so no need
@@ -7303,7 +7305,7 @@ int ocfs2_commit_truncate(struct ocfs2_super *osb,
 	 */
 	el = path_leaf_el(path);
 	if (le16_to_cpu(el->l_next_free_rec) == 0) {
-		ocfs2_error(inode->i_sb,
+		ocfs2_error(inode_sb(inode),
 			    "Inode %llu has empty extent block at %llu\n",
 			    (unsigned long long)OCFS2_I(inode)->ip_blkno,
 			    (unsigned long long)path_leaf_bh(path)->b_blocknr);
@@ -7355,7 +7357,8 @@ int ocfs2_commit_truncate(struct ocfs2_super *osb,
 		trunc_len = range - new_highest_cpos;
 		coff = new_highest_cpos - le32_to_cpu(rec->e_cpos);
 		blkno = le64_to_cpu(rec->e_blkno) +
-				ocfs2_clusters_to_blocks(inode->i_sb, coff);
+				ocfs2_clusters_to_blocks(inode_sb(inode),
+							 coff);
 	} else {
 		/*
 		 * Truncate completed, leave happily.
@@ -7364,7 +7367,7 @@ int ocfs2_commit_truncate(struct ocfs2_super *osb,
 		goto bail;
 	}
 
-	phys_cpos = ocfs2_blocks_to_clusters(inode->i_sb, blkno);
+	phys_cpos = ocfs2_blocks_to_clusters(inode_sb(inode), blkno);
 
 	if ((flags & OCFS2_EXT_REFCOUNTED) && trunc_len && !ref_tree) {
 		status = ocfs2_lock_refcount_tree(osb, refcount_loc, 1,
@@ -7413,7 +7416,7 @@ int ocfs2_truncate_inline(struct inode *inode, struct buffer_head *di_bh,
 	int ret;
 	unsigned int numbytes;
 	handle_t *handle;
-	struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
+	struct ocfs2_super *osb = OCFS2_SB(inode_sb(inode));
 	struct ocfs2_dinode *di = (struct ocfs2_dinode *)di_bh->b_data;
 	struct ocfs2_inline_data *idata = &di->id2.i_data;
 
@@ -7425,7 +7428,7 @@ int ocfs2_truncate_inline(struct inode *inode, struct buffer_head *di_bh,
 	if (!(OCFS2_I(inode)->ip_dyn_features & OCFS2_INLINE_DATA_FL) ||
 	    !(le16_to_cpu(di->i_dyn_features) & OCFS2_INLINE_DATA_FL) ||
 	    !ocfs2_supports_inline_data(osb)) {
-		ocfs2_error(inode->i_sb,
+		ocfs2_error(inode_sb(inode),
 			    "Inline data flags for inode %llu don't agree! Disk: 0x%x, Memory: 0x%x, Superblock: 0x%x\n",
 			    (unsigned long long)OCFS2_I(inode)->ip_blkno,
 			    le16_to_cpu(di->i_dyn_features),
diff --git a/fs/ocfs2/aops.c b/fs/ocfs2/aops.c
index e8e205bf2e41..12c487fe8ddc 100644
--- a/fs/ocfs2/aops.c
+++ b/fs/ocfs2/aops.c
@@ -61,7 +61,7 @@ static int ocfs2_symlink_get_block(struct inode *inode, sector_t iblock,
 	struct ocfs2_dinode *fe = NULL;
 	struct buffer_head *bh = NULL;
 	struct buffer_head *buffer_cache_bh = NULL;
-	struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
+	struct ocfs2_super *osb = OCFS2_SB(inode_sb(inode));
 	void *kaddr;
 
 	trace_ocfs2_symlink_get_block(
@@ -70,7 +70,7 @@ static int ocfs2_symlink_get_block(struct inode *inode, sector_t iblock,
 
 	BUG_ON(ocfs2_inode_is_fast_symlink(inode));
 
-	if ((iblock << inode->i_sb->s_blocksize_bits) > PATH_MAX + 1) {
+	if ((iblock << inode_sb(inode)->s_blocksize_bits) > PATH_MAX + 1) {
 		mlog(ML_ERROR, "block offset > PATH_MAX: %llu",
 		     (unsigned long long)iblock);
 		goto bail;
@@ -83,7 +83,7 @@ static int ocfs2_symlink_get_block(struct inode *inode, sector_t iblock,
 	}
 	fe = (struct ocfs2_dinode *) bh->b_data;
 
-	if ((u64)iblock >= ocfs2_clusters_to_blocks(inode->i_sb,
+	if ((u64)iblock >= ocfs2_clusters_to_blocks(inode_sb(inode),
 						    le32_to_cpu(fe->i_clusters))) {
 		err = -ENOMEM;
 		mlog(ML_ERROR, "block offset is outside the allocated size: "
@@ -123,7 +123,7 @@ static int ocfs2_symlink_get_block(struct inode *inode, sector_t iblock,
 		brelse(buffer_cache_bh);
 	}
 
-	map_bh(bh_result, inode->i_sb,
+	map_bh(bh_result, inode_sb(inode),
 	       le64_to_cpu(fe->id2.i_list.l_recs[0].e_blkno) + iblock);
 
 	err = 0;
@@ -154,7 +154,7 @@ int ocfs2_get_block(struct inode *inode, sector_t iblock,
 	unsigned int ext_flags;
 	u64 max_blocks = bh_result->b_size >> inode->i_blkbits;
 	u64 p_blkno, count, past_eof;
-	struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
+	struct ocfs2_super *osb = OCFS2_SB(inode_sb(inode));
 
 	trace_ocfs2_get_block((unsigned long long)OCFS2_I(inode)->ip_blkno,
 			      (unsigned long long)iblock, bh_result, create);
@@ -200,7 +200,7 @@ int ocfs2_get_block(struct inode *inode, sector_t iblock,
 
 	/* Treat the unwritten extent as a hole for zeroing purposes. */
 	if (p_blkno && !(ext_flags & OCFS2_EXT_UNWRITTEN))
-		map_bh(bh_result, inode->i_sb, p_blkno);
+		map_bh(bh_result, inode_sb(inode), p_blkno);
 
 	bh_result->b_size = count << inode->i_blkbits;
 
@@ -218,7 +218,7 @@ int ocfs2_get_block(struct inode *inode, sector_t iblock,
 		}
 	}
 
-	past_eof = ocfs2_blocks_for_bytes(inode->i_sb, i_size_read(inode));
+	past_eof = ocfs2_blocks_for_bytes(inode_sb(inode), i_size_read(inode));
 
 	trace_ocfs2_get_block_end((unsigned long long)OCFS2_I(inode)->ip_blkno,
 				  (unsigned long long)past_eof);
@@ -240,7 +240,8 @@ int ocfs2_read_inline_data(struct inode *inode, struct page *page,
 	struct ocfs2_dinode *di = (struct ocfs2_dinode *)di_bh->b_data;
 
 	if (!(le16_to_cpu(di->i_dyn_features) & OCFS2_INLINE_DATA_FL)) {
-		ocfs2_error(inode->i_sb, "Inode %llu lost inline data flag\n",
+		ocfs2_error(inode_sb(inode),
+			    "Inode %llu lost inline data flag\n",
 			    (unsigned long long)OCFS2_I(inode)->ip_blkno);
 		return -EROFS;
 	}
@@ -248,8 +249,8 @@ int ocfs2_read_inline_data(struct inode *inode, struct page *page,
 	size = i_size_read(inode);
 
 	if (size > PAGE_SIZE ||
-	    size > ocfs2_max_inline_data_with_xattr(inode->i_sb, di)) {
-		ocfs2_error(inode->i_sb,
+	    size > ocfs2_max_inline_data_with_xattr(inode_sb(inode), di)) {
+		ocfs2_error(inode_sb(inode),
 			    "Inode %llu has with inline data has bad size: %Lu\n",
 			    (unsigned long long)OCFS2_I(inode)->ip_blkno,
 			    (unsigned long long)size);
@@ -598,7 +599,7 @@ static int ocfs2_should_read_blk(struct inode *inode, struct page *page,
 {
 	u64 offset = page_offset(page) + block_start;
 
-	if (ocfs2_sparse_alloc(OCFS2_SB(inode->i_sb)))
+	if (ocfs2_sparse_alloc(OCFS2_SB(inode_sb(inode))))
 		return 1;
 
 	if (i_size_read(inode) > offset)
@@ -651,7 +652,7 @@ int ocfs2_map_page_blocks(struct page *page, u64 *p_blkno,
 			set_buffer_new(bh);
 
 		if (!buffer_mapped(bh)) {
-			map_bh(bh, inode->i_sb, *p_blkno);
+			map_bh(bh, inode_sb(inode), *p_blkno);
 			clean_bdev_bh_alias(bh);
 		}
 
@@ -973,7 +974,7 @@ static int ocfs2_prepare_page_for_write(struct inode *inode, u64 *p_blkno,
 	unsigned int cluster_start, cluster_end;
 	unsigned int user_data_from = 0, user_data_to = 0;
 
-	ocfs2_figure_cluster_boundaries(OCFS2_SB(inode->i_sb), cpos,
+	ocfs2_figure_cluster_boundaries(OCFS2_SB(inode_sb(inode)), cpos,
 					&cluster_start, &cluster_end);
 
 	/* treat the write as new if the a hole/lseek spanned across
@@ -1034,7 +1035,7 @@ static int ocfs2_prepare_page_for_write(struct inode *inode, u64 *p_blkno,
 	 * been zero'd from being read in as a hole.
 	 */
 	if (new && !PageUptodate(page))
-		ocfs2_clear_page_regions(page, OCFS2_SB(inode->i_sb),
+		ocfs2_clear_page_regions(page, OCFS2_SB(inode_sb(inode)),
 					 cpos, user_data_from, user_data_to);
 
 	flush_dcache_page(page);
@@ -1067,8 +1068,9 @@ static int ocfs2_grab_pages_for_write(struct address_space *mapping,
 	 * last page of the write.
 	 */
 	if (new) {
-		wc->w_num_pages = ocfs2_pages_per_cluster(inode->i_sb);
-		start = ocfs2_align_clusters_to_page_index(inode->i_sb, cpos);
+		wc->w_num_pages = ocfs2_pages_per_cluster(inode_sb(inode));
+		start = ocfs2_align_clusters_to_page_index(inode_sb(inode),
+							   cpos);
 		/*
 		 * We need the index *past* the last page we could possibly
 		 * touch.  This is the page past the end of the write or
@@ -1149,7 +1151,7 @@ static int ocfs2_write_cluster(struct address_space *mapping,
 	u64 p_blkno;
 	struct inode *inode = mapping->host;
 	struct ocfs2_extent_tree et;
-	int bpc = ocfs2_clusters_to_blocks(inode->i_sb, 1);
+	int bpc = ocfs2_clusters_to_blocks(inode_sb(inode), 1);
 
 	if (new) {
 		u32 tmp_pos;
@@ -1159,7 +1161,7 @@ static int ocfs2_write_cluster(struct address_space *mapping,
 		 * any additional semaphores or cluster locks.
 		 */
 		tmp_pos = cpos;
-		ret = ocfs2_add_inode_data(OCFS2_SB(inode->i_sb), inode,
+		ret = ocfs2_add_inode_data(OCFS2_SB(inode_sb(inode)), inode,
 					   &tmp_pos, 1, !clear_unwritten,
 					   wc->w_di_bh, wc->w_handle,
 					   data_ac, meta_ac, NULL);
@@ -1205,9 +1207,9 @@ static int ocfs2_write_cluster(struct address_space *mapping,
 
 	BUG_ON(*phys == 0);
 
-	p_blkno = ocfs2_clusters_to_blocks(inode->i_sb, *phys);
+	p_blkno = ocfs2_clusters_to_blocks(inode_sb(inode), *phys);
 	if (!should_zero)
-		p_blkno += (user_pos >> inode->i_sb->s_blocksize_bits) & (u64)(bpc - 1);
+		p_blkno += (user_pos >> inode_sb(inode)->s_blocksize_bits) & (u64)(bpc - 1);
 
 	for(i = 0; i < wc->w_num_pages; i++) {
 		int tmpret;
@@ -1250,7 +1252,7 @@ static int ocfs2_write_cluster_by_desc(struct address_space *mapping,
 	loff_t cluster_off;
 	unsigned int local_len = len;
 	struct ocfs2_write_cluster_desc *desc;
-	struct ocfs2_super *osb = OCFS2_SB(mapping->host->i_sb);
+	struct ocfs2_super *osb = OCFS2_SB(inode_sb(mapping->host));
 
 	for (i = 0; i < wc->w_clen; i++) {
 		desc = &wc->w_desc[i];
@@ -1500,7 +1502,7 @@ static int ocfs2_write_begin_inline(struct address_space *mapping,
 				    struct ocfs2_write_ctxt *wc)
 {
 	int ret;
-	struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
+	struct ocfs2_super *osb = OCFS2_SB(inode_sb(inode));
 	struct page *page;
 	handle_t *handle;
 	struct ocfs2_dinode *di = (struct ocfs2_dinode *)wc->w_di_bh->b_data;
@@ -1604,7 +1606,7 @@ static int ocfs2_try_to_write_inline_data(struct address_space *mapping,
 	 */
 	di = (struct ocfs2_dinode *)wc->w_di_bh->b_data;
 	if (mmap_page ||
-	    end > ocfs2_max_inline_data_with_xattr(inode->i_sb, di))
+	    end > ocfs2_max_inline_data_with_xattr(inode_sb(inode), di))
 		return 0;
 
 do_inline_write:
@@ -1640,7 +1642,7 @@ static int ocfs2_expand_nonsparse_inode(struct inode *inode,
 	int ret;
 	loff_t newsize = pos + len;
 
-	BUG_ON(ocfs2_sparse_alloc(OCFS2_SB(inode->i_sb)));
+	BUG_ON(ocfs2_sparse_alloc(OCFS2_SB(inode_sb(inode))));
 
 	if (newsize <= i_size_read(inode))
 		return 0;
@@ -1652,7 +1654,8 @@ static int ocfs2_expand_nonsparse_inode(struct inode *inode,
 	/* There is no wc if this is call from direct. */
 	if (wc)
 		wc->w_first_new_cpos =
-			ocfs2_clusters_for_bytes(inode->i_sb, i_size_read(inode));
+			ocfs2_clusters_for_bytes(inode_sb(inode),
+						 i_size_read(inode));
 
 	return ret;
 }
@@ -1662,7 +1665,7 @@ static int ocfs2_zero_tail(struct inode *inode, struct buffer_head *di_bh,
 {
 	int ret = 0;
 
-	BUG_ON(!ocfs2_sparse_alloc(OCFS2_SB(inode->i_sb)));
+	BUG_ON(!ocfs2_sparse_alloc(OCFS2_SB(inode_sb(inode))));
 	if (pos > i_size_read(inode))
 		ret = ocfs2_zero_extend(inode, di_bh, pos);
 
@@ -1678,7 +1681,7 @@ int ocfs2_write_begin_nolock(struct address_space *mapping,
 	unsigned int clusters_to_alloc, extents_to_split, clusters_need = 0;
 	struct ocfs2_write_ctxt *wc;
 	struct inode *inode = mapping->host;
-	struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
+	struct ocfs2_super *osb = OCFS2_SB(inode_sb(inode));
 	struct ocfs2_dinode *di;
 	struct ocfs2_alloc_context *data_ac = NULL;
 	struct ocfs2_alloc_context *meta_ac = NULL;
@@ -1775,7 +1778,7 @@ int ocfs2_write_begin_nolock(struct address_space *mapping,
 		if (data_ac)
 			data_ac->ac_resv = &OCFS2_I(inode)->ip_la_data_resv;
 
-		credits = ocfs2_calc_extend_credits(inode->i_sb,
+		credits = ocfs2_calc_extend_credits(inode_sb(inode),
 						    &di->id2.i_list);
 	} else if (type == OCFS2_WRITE_DIRECT)
 		/* direct write needs not to start trans if no extents alloc. */
@@ -1979,7 +1982,7 @@ int ocfs2_write_end_nolock(struct address_space *mapping,
 	int i, ret;
 	unsigned from, to, start = pos & (PAGE_SIZE - 1);
 	struct inode *inode = mapping->host;
-	struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
+	struct ocfs2_super *osb = OCFS2_SB(inode_sb(inode));
 	struct ocfs2_write_ctxt *wc = fsdata;
 	struct ocfs2_dinode *di = (struct ocfs2_dinode *)wc->w_di_bh->b_data;
 	handle_t *handle = wc->w_handle;
@@ -2146,14 +2149,14 @@ static void ocfs2_dio_free_write_ctx(struct inode *inode,
 static int ocfs2_dio_wr_get_block(struct inode *inode, sector_t iblock,
 			       struct buffer_head *bh_result, int create)
 {
-	struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
+	struct ocfs2_super *osb = OCFS2_SB(inode_sb(inode));
 	struct ocfs2_inode_info *oi = OCFS2_I(inode);
 	struct ocfs2_write_ctxt *wc;
 	struct ocfs2_write_cluster_desc *desc = NULL;
 	struct ocfs2_dio_write_ctxt *dwc = NULL;
 	struct buffer_head *di_bh = NULL;
 	u64 p_blkno;
-	loff_t pos = iblock << inode->i_sb->s_blocksize_bits;
+	loff_t pos = iblock << inode_sb(inode)->s_blocksize_bits;
 	unsigned len, total_len = bh_result->b_size;
 	int ret = 0, first_get_block = 0;
 
@@ -2188,8 +2191,8 @@ static int ocfs2_dio_wr_get_block(struct inode *inode, sector_t iblock,
 		goto out;
 	}
 
-	if (ocfs2_clusters_for_bytes(inode->i_sb, pos + total_len) >
-	    ocfs2_clusters_for_bytes(inode->i_sb, i_size_read(inode)) &&
+	if (ocfs2_clusters_for_bytes(inode_sb(inode), pos + total_len) >
+	    ocfs2_clusters_for_bytes(inode_sb(inode), i_size_read(inode)) &&
 	    !dwc->dw_orphaned) {
 		/*
 		 * when we are going to alloc extents beyond file size, add the
@@ -2213,7 +2216,7 @@ static int ocfs2_dio_wr_get_block(struct inode *inode, sector_t iblock,
 	down_write(&oi->ip_alloc_sem);
 
 	if (first_get_block) {
-		if (ocfs2_sparse_alloc(OCFS2_SB(inode->i_sb)))
+		if (ocfs2_sparse_alloc(OCFS2_SB(inode_sb(inode))))
 			ret = ocfs2_zero_tail(inode, di_bh, pos);
 		else
 			ret = ocfs2_expand_nonsparse_inode(inode, di_bh, pos,
@@ -2234,11 +2237,11 @@ static int ocfs2_dio_wr_get_block(struct inode *inode, sector_t iblock,
 
 	desc = &wc->w_desc[0];
 
-	p_blkno = ocfs2_clusters_to_blocks(inode->i_sb, desc->c_phys);
+	p_blkno = ocfs2_clusters_to_blocks(inode_sb(inode), desc->c_phys);
 	BUG_ON(p_blkno == 0);
-	p_blkno += iblock & (u64)(ocfs2_clusters_to_blocks(inode->i_sb, 1) - 1);
+	p_blkno += iblock & (u64)(ocfs2_clusters_to_blocks(inode_sb(inode), 1) - 1);
 
-	map_bh(bh_result, inode->i_sb, p_blkno);
+	map_bh(bh_result, inode_sb(inode), p_blkno);
 	bh_result->b_size = len;
 	if (desc->c_needs_zero)
 		set_buffer_new(bh_result);
@@ -2281,7 +2284,7 @@ static int ocfs2_dio_end_io_write(struct inode *inode,
 {
 	struct ocfs2_cached_dealloc_ctxt dealloc;
 	struct ocfs2_extent_tree et;
-	struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
+	struct ocfs2_super *osb = OCFS2_SB(inode_sb(inode));
 	struct ocfs2_inode_info *oi = OCFS2_I(inode);
 	struct ocfs2_unwritten_extent *ue = NULL;
 	struct buffer_head *di_bh = NULL;
@@ -2345,7 +2348,7 @@ static int ocfs2_dio_end_io_write(struct inode *inode,
 		goto unlock;
 	}
 
-	credits = ocfs2_calc_extend_credits(inode->i_sb, &di->id2.i_list);
+	credits = ocfs2_calc_extend_credits(inode_sb(inode), &di->id2.i_list);
 
 	handle = ocfs2_start_trans(osb, credits);
 	if (IS_ERR(handle)) {
@@ -2426,7 +2429,7 @@ static ssize_t ocfs2_direct_IO(struct kiocb *iocb, struct iov_iter *iter)
 {
 	struct file *file = iocb->ki_filp;
 	struct inode *inode = file->f_mapping->host;
-	struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
+	struct ocfs2_super *osb = OCFS2_SB(inode_sb(inode));
 	get_block_t *get_block;
 
 	/*
@@ -2446,7 +2449,7 @@ static ssize_t ocfs2_direct_IO(struct kiocb *iocb, struct iov_iter *iter)
 	else
 		get_block = ocfs2_dio_wr_get_block;
 
-	return __blockdev_direct_IO(iocb, inode, inode->i_sb->s_bdev,
+	return __blockdev_direct_IO(iocb, inode, inode_sb(inode)->s_bdev,
 				    iter, get_block,
 				    ocfs2_dio_end_io, NULL, 0);
 }
diff --git a/fs/ocfs2/dcache.c b/fs/ocfs2/dcache.c
index 290373024d9d..a39ccd03fc83 100644
--- a/fs/ocfs2/dcache.c
+++ b/fs/ocfs2/dcache.c
@@ -445,7 +445,7 @@ void ocfs2_dentry_move(struct dentry *dentry, struct dentry *target,
 		       struct inode *old_dir, struct inode *new_dir)
 {
 	int ret;
-	struct ocfs2_super *osb = OCFS2_SB(old_dir->i_sb);
+	struct ocfs2_super *osb = OCFS2_SB(inode_sb(old_dir));
 	struct inode *inode = d_inode(dentry);
 
 	/*
diff --git a/fs/ocfs2/dir.c b/fs/ocfs2/dir.c
index 977763d4c27d..b4bb93d1259d 100644
--- a/fs/ocfs2/dir.c
+++ b/fs/ocfs2/dir.c
@@ -88,7 +88,7 @@ static int ocfs2_dir_indexed(struct inode *inode);
  */
 static int ocfs2_supports_dir_trailer(struct inode *dir)
 {
-	struct ocfs2_super *osb = OCFS2_SB(dir->i_sb);
+	struct ocfs2_super *osb = OCFS2_SB(inode_sb(dir));
 
 	if (OCFS2_I(dir)->ip_dyn_features & OCFS2_INLINE_DATA_FL)
 		return 0;
@@ -106,7 +106,7 @@ static int ocfs2_supports_dir_trailer(struct inode *dir)
  */
 static int ocfs2_new_dir_wants_trailer(struct inode *dir)
 {
-	struct ocfs2_super *osb = OCFS2_SB(dir->i_sb);
+	struct ocfs2_super *osb = OCFS2_SB(inode_sb(dir));
 
 	return ocfs2_meta_ecc(osb) ||
 		ocfs2_supports_indexed_dirs(osb);
@@ -155,7 +155,7 @@ static void ocfs2_init_dir_trailer(struct inode *inode,
 {
 	struct ocfs2_dir_block_trailer *trailer;
 
-	trailer = ocfs2_trailer_from_bh(bh, inode->i_sb);
+	trailer = ocfs2_trailer_from_bh(bh, inode_sb(inode));
 	strcpy(trailer->db_signature, OCFS2_DIR_TRAILER_SIGNATURE);
 	trailer->db_compat_rec_len =
 			cpu_to_le16(sizeof(struct ocfs2_dir_block_trailer));
@@ -182,7 +182,7 @@ static int ocfs2_dx_dir_link_trailer(struct inode *dir, handle_t *handle,
 		mlog_errno(ret);
 		goto out;
 	}
-	trailer = ocfs2_trailer_from_bh(dirdata_bh, dir->i_sb);
+	trailer = ocfs2_trailer_from_bh(dirdata_bh, inode_sb(dir));
 	dx_root = (struct ocfs2_dx_root_block *)dx_root_bh->b_data;
 
 	trailer->db_free_next = dx_root->dr_free_blk;
@@ -271,7 +271,7 @@ static void str2hashbuf(const char *msg, int len, __u32 *buf, int num)
 static void ocfs2_dx_dir_name_hash(struct inode *dir, const char *name, int len,
 				   struct ocfs2_dx_hinfo *hinfo)
 {
-	struct ocfs2_super *osb = OCFS2_SB(dir->i_sb);
+	struct ocfs2_super *osb = OCFS2_SB(inode_sb(dir));
 	const char	*p;
 	__u32		in[8], buf[4];
 
@@ -329,7 +329,7 @@ static int ocfs2_check_dir_entry(struct inode * dir,
 	else if (unlikely(rlen < OCFS2_DIR_REC_LEN(de->name_len)))
 		error_msg = "rec_len is too small for name_len";
 	else if (unlikely(
-		 ((char *) de - bh->b_data) + rlen > dir->i_sb->s_blocksize))
+		 ((char *) de - bh->b_data) + rlen > inode_sb(dir)->s_blocksize))
 		error_msg = "directory entry across blocks";
 
 	if (unlikely(error_msg != NULL))
@@ -479,16 +479,16 @@ static int ocfs2_check_dir_trailer(struct inode *dir, struct buffer_head *bh)
 	int rc = 0;
 	struct ocfs2_dir_block_trailer *trailer;
 
-	trailer = ocfs2_trailer_from_bh(bh, dir->i_sb);
+	trailer = ocfs2_trailer_from_bh(bh, inode_sb(dir));
 	if (!OCFS2_IS_VALID_DIR_TRAILER(trailer)) {
-		rc = ocfs2_error(dir->i_sb,
+		rc = ocfs2_error(inode_sb(dir),
 				 "Invalid dirblock #%llu: signature = %.*s\n",
 				 (unsigned long long)bh->b_blocknr, 7,
 				 trailer->db_signature);
 		goto out;
 	}
 	if (le64_to_cpu(trailer->db_blkno) != bh->b_blocknr) {
-		rc = ocfs2_error(dir->i_sb,
+		rc = ocfs2_error(inode_sb(dir),
 				 "Directory block #%llu has an invalid db_blkno of %llu\n",
 				 (unsigned long long)bh->b_blocknr,
 				 (unsigned long long)le64_to_cpu(trailer->db_blkno));
@@ -496,7 +496,7 @@ static int ocfs2_check_dir_trailer(struct inode *dir, struct buffer_head *bh)
 	}
 	if (le64_to_cpu(trailer->db_parent_dinode) !=
 	    OCFS2_I(dir)->ip_blkno) {
-		rc = ocfs2_error(dir->i_sb,
+		rc = ocfs2_error(inode_sb(dir),
 				 "Directory block #%llu on dinode #%llu has an invalid parent_dinode of %llu\n",
 				 (unsigned long long)bh->b_blocknr,
 				 (unsigned long long)OCFS2_I(dir)->ip_blkno,
@@ -696,7 +696,7 @@ static struct buffer_head *ocfs2_find_entry_el(const char *name, int namelen,
 	int num = 0;
 	int nblocks, i, err;
 
-	sb = dir->i_sb;
+	sb = inode_sb(dir);
 
 	nblocks = i_size_read(dir) >> sb->s_blocksize_bits;
 	start = OCFS2_I(dir)->ip_dir_start_lookup;
@@ -804,7 +804,7 @@ static int ocfs2_dx_dir_lookup_rec(struct inode *inode,
 		el = &eb->h_list;
 
 		if (el->l_tree_depth) {
-			ret = ocfs2_error(inode->i_sb,
+			ret = ocfs2_error(inode_sb(inode),
 					  "Inode %lu has non zero tree depth in btree tree block %llu\n",
 					  inode->i_ino,
 					  (unsigned long long)eb_bh->b_blocknr);
@@ -823,7 +823,7 @@ static int ocfs2_dx_dir_lookup_rec(struct inode *inode,
 	}
 
 	if (!found) {
-		ret = ocfs2_error(inode->i_sb,
+		ret = ocfs2_error(inode_sb(inode),
 				  "Inode %lu has bad extent record (%u, %u, 0) in btree\n",
 				  inode->i_ino,
 				  le32_to_cpu(rec->e_cpos),
@@ -881,10 +881,10 @@ static int ocfs2_dx_dir_lookup(struct inode *inode,
 	cend = cpos + clen;
 	if (name_hash >= cend) {
 		/* We want the last cluster */
-		blkno += ocfs2_clusters_to_blocks(inode->i_sb, clen - 1);
+		blkno += ocfs2_clusters_to_blocks(inode_sb(inode), clen - 1);
 		cpos += clen - 1;
 	} else {
-		blkno += ocfs2_clusters_to_blocks(inode->i_sb,
+		blkno += ocfs2_clusters_to_blocks(inode_sb(inode),
 						  name_hash - cpos);
 		cpos = name_hash;
 	}
@@ -894,7 +894,7 @@ static int ocfs2_dx_dir_lookup(struct inode *inode,
 	 * find the exact block from the start of the cluster to
 	 * search, we take the lower bits of the hash.
 	 */
-	blkno += ocfs2_dx_dir_hash_idx(OCFS2_SB(inode->i_sb), hinfo);
+	blkno += ocfs2_dx_dir_hash_idx(OCFS2_SB(inode_sb(inode)), hinfo);
 
 	if (ret_phys_blkno)
 		*ret_phys_blkno = blkno;
@@ -986,7 +986,8 @@ static int ocfs2_dx_dir_search(const char *name, int namelen,
 
 		found = ocfs2_search_dirblock(dir_ent_bh, dir, name, namelen,
 					      0, dir_ent_bh->b_data,
-					      dir->i_sb->s_blocksize, &dir_ent);
+					      inode_sb(dir)->s_blocksize,
+					      &dir_ent);
 		if (found == 1)
 			break;
 
@@ -1297,7 +1298,7 @@ static int ocfs2_delete_entry_dx(handle_t *handle, struct inode *dir,
 	 * for a new one, so add this block to the free list if it
 	 * isn't already there.
 	 */
-	trailer = ocfs2_trailer_from_bh(leaf_bh, dir->i_sb);
+	trailer = ocfs2_trailer_from_bh(leaf_bh, inode_sb(dir));
 	if (trailer->db_free_rec_len == 0)
 		add_to_free_list = 1;
 
@@ -1339,7 +1340,7 @@ static int ocfs2_delete_entry_dx(handle_t *handle, struct inode *dir,
 		goto out;
 	}
 
-	max_rec_len = ocfs2_find_max_rec_len(dir->i_sb, leaf_bh);
+	max_rec_len = ocfs2_find_max_rec_len(inode_sb(dir), leaf_bh);
 	trailer->db_free_rec_len = cpu_to_le16(max_rec_len);
 	if (add_to_free_list) {
 		trailer->db_free_next = dx_root->dr_free_blk;
@@ -1545,7 +1546,7 @@ static void ocfs2_remove_block_from_free_list(struct inode *dir,
 	struct ocfs2_dx_root_block *dx_root;
 	struct buffer_head *bh;
 
-	trailer = ocfs2_trailer_from_bh(lookup->dl_leaf_bh, dir->i_sb);
+	trailer = ocfs2_trailer_from_bh(lookup->dl_leaf_bh, inode_sb(dir));
 
 	if (ocfs2_free_list_at_root(lookup)) {
 		bh = lookup->dl_dx_root_bh;
@@ -1553,7 +1554,7 @@ static void ocfs2_remove_block_from_free_list(struct inode *dir,
 		dx_root->dr_free_blk = trailer->db_free_next;
 	} else {
 		bh = lookup->dl_prev_leaf_bh;
-		prev = ocfs2_trailer_from_bh(bh, dir->i_sb);
+		prev = ocfs2_trailer_from_bh(bh, inode_sb(dir));
 		prev->db_free_next = trailer->db_free_next;
 	}
 
@@ -1575,14 +1576,16 @@ static void ocfs2_recalc_free_list(struct inode *dir, handle_t *handle,
 	struct ocfs2_dir_block_trailer *trailer;
 
 	/* Walk dl_leaf_bh to figure out what the new free rec_len is. */
-	max_rec_len = ocfs2_find_max_rec_len(dir->i_sb, lookup->dl_leaf_bh);
+	max_rec_len = ocfs2_find_max_rec_len(inode_sb(dir),
+					     lookup->dl_leaf_bh);
 	if (max_rec_len) {
 		/*
 		 * There's still room in this block, so no need to remove it
 		 * from the free list. In this case, we just want to update
 		 * the rec len accounting.
 		 */
-		trailer = ocfs2_trailer_from_bh(lookup->dl_leaf_bh, dir->i_sb);
+		trailer = ocfs2_trailer_from_bh(lookup->dl_leaf_bh,
+						inode_sb(dir));
 		trailer->db_free_rec_len = cpu_to_le16(max_rec_len);
 		ocfs2_journal_dirty(handle, lookup->dl_leaf_bh);
 	} else {
@@ -1607,7 +1610,7 @@ int __ocfs2_add_entry(handle_t *handle,
 	unsigned short rec_len;
 	struct ocfs2_dir_entry *de, *de1;
 	struct ocfs2_dinode *di = (struct ocfs2_dinode *)parent_fe_bh->b_data;
-	struct super_block *sb = dir->i_sb;
+	struct super_block *sb = inode_sb(dir);
 	int retval;
 	unsigned int size = sb->s_blocksize;
 	struct buffer_head *insert_bh = lookup->dl_leaf_bh;
@@ -1675,7 +1678,8 @@ int __ocfs2_add_entry(handle_t *handle,
 				"offset is %lu, trailer offset is %d\n",
 				namelen, name, namelen,
 				(unsigned long long)parent_fe_bh->b_blocknr,
-				offset, ocfs2_dir_trailer_blk_off(dir->i_sb));
+				offset,
+				ocfs2_dir_trailer_blk_off(inode_sb(dir)));
 
 		if (ocfs2_dirent_would_fit(de, rec_len)) {
 			dir->i_mtime = dir->i_ctime = current_time(dir);
@@ -1832,7 +1836,7 @@ static int ocfs2_dir_foreach_blk_el(struct inode *inode,
 	int i;
 	struct buffer_head * bh, * tmp;
 	struct ocfs2_dir_entry * de;
-	struct super_block * sb = inode->i_sb;
+	struct super_block * sb = inode_sb(inode);
 	unsigned int ra_sectors = 16;
 	int stored = 0;
 
@@ -2252,7 +2256,7 @@ static int ocfs2_fill_new_dir_el(struct ocfs2_super *osb,
 	struct ocfs2_dir_entry *de;
 
 	if (ocfs2_new_dir_wants_trailer(inode))
-		size = ocfs2_dir_trailer_blk_off(parent->i_sb);
+		size = ocfs2_dir_trailer_blk_off(inode_sb(parent));
 
 	status = ocfs2_do_extend_dir(osb->sb, handle, inode, fe_bh,
 				     data_ac, NULL, &new_bh);
@@ -2288,7 +2292,7 @@ static int ocfs2_fill_new_dir_el(struct ocfs2_super *osb,
 
 	ocfs2_journal_dirty(handle, new_bh);
 
-	i_size_write(inode, inode->i_sb->s_blocksize);
+	i_size_write(inode, inode_sb(inode)->s_blocksize);
 	set_nlink(inode, 2);
 	inode->i_blocks = ocfs2_inode_sector_count(inode);
 	status = ocfs2_mark_inode_dirty(handle, inode, fe_bh);
@@ -2324,7 +2328,7 @@ static int ocfs2_dx_dir_attach_index(struct ocfs2_super *osb,
 	struct buffer_head *dx_root_bh = NULL;
 	struct ocfs2_dx_root_block *dx_root;
 	struct ocfs2_dir_block_trailer *trailer =
-		ocfs2_trailer_from_bh(dirdata_bh, dir->i_sb);
+		ocfs2_trailer_from_bh(dirdata_bh, inode_sb(dir));
 
 	ret = ocfs2_claim_metadata(handle, meta_ac, 1, &suballoc_loc,
 				   &dr_suballoc_bit, &num_bits, &dr_blkno);
@@ -2462,7 +2466,7 @@ static int __ocfs2_dx_dir_new_cluster(struct inode *dir,
 	int ret;
 	u32 phys, num;
 	u64 phys_blkno;
-	struct ocfs2_super *osb = OCFS2_SB(dir->i_sb);
+	struct ocfs2_super *osb = OCFS2_SB(inode_sb(dir));
 
 	/*
 	 * XXX: For create, this should claim cluster for the index
@@ -2625,7 +2629,7 @@ static int ocfs2_dx_dir_index_block(struct inode *dir,
 	u64 dirent_blk = dirent_bh->b_blocknr;
 
 	de_buf = dirent_bh->b_data;
-	limit = de_buf + dir->i_sb->s_blocksize;
+	limit = de_buf + inode_sb(dir)->s_blocksize;
 
 	while (de_buf < limit) {
 		de = (struct ocfs2_dir_entry *)de_buf;
@@ -2636,7 +2640,7 @@ static int ocfs2_dx_dir_index_block(struct inode *dir,
 
 		ocfs2_dx_dir_name_hash(dir, de->name, namelen, &hinfo);
 
-		i = ocfs2_dx_dir_hash_idx(OCFS2_SB(dir->i_sb), &hinfo);
+		i = ocfs2_dx_dir_hash_idx(OCFS2_SB(inode_sb(dir)), &hinfo);
 		dx_leaf_bh = dx_leaves[i];
 
 		ret = __ocfs2_dx_dir_leaf_insert(dir, handle, &hinfo,
@@ -2672,7 +2676,7 @@ static void ocfs2_dx_dir_index_root_block(struct inode *dir,
 	dx_root = (struct ocfs2_dx_root_block *)dx_root_bh->b_data;
 
 	de_buf = dirent_bh->b_data;
-	limit = de_buf + dir->i_sb->s_blocksize;
+	limit = de_buf + inode_sb(dir)->s_blocksize;
 
 	while (de_buf < limit) {
 		de = (struct ocfs2_dir_entry *)de_buf;
@@ -2723,7 +2727,7 @@ static int ocfs2_new_dx_should_be_inline(struct inode *dir,
 	}
 
 	/* We are careful to leave room for one extra record. */
-	return dirent_count < ocfs2_dx_entries_per_root(dir->i_sb);
+	return dirent_count < ocfs2_dx_entries_per_root(inode_sb(dir));
 }
 
 /*
@@ -2743,7 +2747,7 @@ static int ocfs2_new_dx_should_be_inline(struct inode *dir,
 static unsigned int ocfs2_expand_last_dirent(char *start, unsigned int old_size,
 					     struct inode *dir)
 {
-	struct super_block *sb = dir->i_sb;
+	struct super_block *sb = inode_sb(dir);
 	struct ocfs2_dir_entry *de;
 	struct ocfs2_dir_entry *prev_de;
 	char *de_buf, *limit;
@@ -2796,12 +2800,12 @@ static int ocfs2_expand_inline_dir(struct inode *dir, struct buffer_head *di_bh,
 				   struct buffer_head **first_block_bh)
 {
 	u32 alloc, dx_alloc, bit_off, len, num_dx_entries = 0;
-	struct super_block *sb = dir->i_sb;
+	struct super_block *sb = inode_sb(dir);
 	int ret, i, num_dx_leaves = 0, dx_inline = 0,
 		credits = ocfs2_inline_to_extents_credits(sb);
 	u64 dx_insert_blkno, blkno,
 		bytes = blocks_wanted << sb->s_blocksize_bits;
-	struct ocfs2_super *osb = OCFS2_SB(dir->i_sb);
+	struct ocfs2_super *osb = OCFS2_SB(inode_sb(dir));
 	struct ocfs2_inode_info *oi = OCFS2_I(dir);
 	struct ocfs2_alloc_context *data_ac = NULL;
 	struct ocfs2_alloc_context *meta_ac = NULL;
@@ -2894,7 +2898,7 @@ static int ocfs2_expand_inline_dir(struct inode *dir, struct buffer_head *di_bh,
 			mlog_errno(ret);
 			goto out_commit;
 		}
-		bytes_allocated += ocfs2_clusters_to_bytes(dir->i_sb, 1);
+		bytes_allocated += ocfs2_clusters_to_bytes(inode_sb(dir), 1);
 	}
 
 	/*
@@ -2909,14 +2913,14 @@ static int ocfs2_expand_inline_dir(struct inode *dir, struct buffer_head *di_bh,
 		mlog_errno(ret);
 		goto out_commit;
 	}
-	bytes_allocated += ocfs2_clusters_to_bytes(dir->i_sb, 1);
+	bytes_allocated += ocfs2_clusters_to_bytes(inode_sb(dir), 1);
 
 	/*
 	 * Operations are carefully ordered so that we set up the new
 	 * data block first. The conversion from inline data to
 	 * extents follows.
 	 */
-	blkno = ocfs2_clusters_to_blocks(dir->i_sb, bit_off);
+	blkno = ocfs2_clusters_to_blocks(inode_sb(dir), bit_off);
 	dirdata_bh = sb_getblk(sb, blkno);
 	if (!dirdata_bh) {
 		ret = -ENOMEM;
@@ -3051,7 +3055,7 @@ static int ocfs2_expand_inline_dir(struct inode *dir, struct buffer_head *di_bh,
 			mlog_errno(ret);
 			goto out_commit;
 		}
-		blkno = ocfs2_clusters_to_blocks(dir->i_sb, bit_off);
+		blkno = ocfs2_clusters_to_blocks(inode_sb(dir), bit_off);
 
 		ret = ocfs2_insert_extent(handle, &et, 1,
 					  blkno, len, 0, NULL);
@@ -3059,7 +3063,7 @@ static int ocfs2_expand_inline_dir(struct inode *dir, struct buffer_head *di_bh,
 			mlog_errno(ret);
 			goto out_commit;
 		}
-		bytes_allocated += ocfs2_clusters_to_bytes(dir->i_sb, 1);
+		bytes_allocated += ocfs2_clusters_to_bytes(inode_sb(dir), 1);
 	}
 
 	*first_block_bh = dirdata_bh;
@@ -3072,7 +3076,7 @@ static int ocfs2_expand_inline_dir(struct inode *dir, struct buffer_head *di_bh,
 			 * We need to return the correct block within the
 			 * cluster which should hold our entry.
 			 */
-			off = ocfs2_dx_dir_hash_idx(OCFS2_SB(dir->i_sb),
+			off = ocfs2_dx_dir_hash_idx(OCFS2_SB(inode_sb(dir)),
 						    &lookup->dl_hinfo);
 			get_bh(dx_leaves[off]);
 			lookup->dl_dx_leaf_bh = dx_leaves[off];
@@ -3333,7 +3337,7 @@ static int ocfs2_extend_dir(struct ocfs2_super *osb,
 	ocfs2_update_inode_fsync_trans(handle, dir, 1);
 	ocfs2_journal_dirty(handle, new_bh);
 
-	dir_i_size += dir->i_sb->s_blocksize;
+	dir_i_size += inode_sb(dir)->s_blocksize;
 	i_size_write(dir, dir_i_size);
 	dir->i_blocks = ocfs2_inode_sector_count(dir);
 	status = ocfs2_mark_inode_dirty(handle, dir, parent_fe_bh);
@@ -3367,12 +3371,12 @@ static int ocfs2_find_dir_space_id(struct inode *dir, struct buffer_head *di_bh,
 				   unsigned int *blocks_wanted)
 {
 	int ret;
-	struct super_block *sb = dir->i_sb;
+	struct super_block *sb = inode_sb(dir);
 	struct ocfs2_dinode *di = (struct ocfs2_dinode *)di_bh->b_data;
 	struct ocfs2_dir_entry *de, *last_de = NULL;
 	char *de_buf, *limit;
 	unsigned long offset = 0;
-	unsigned int rec_len, new_rec_len, free_space = dir->i_sb->s_blocksize;
+	unsigned int rec_len, new_rec_len, free_space = inode_sb(dir)->s_blocksize;
 
 	/*
 	 * This calculates how many free bytes we'd have in block zero, should
@@ -3381,7 +3385,7 @@ static int ocfs2_find_dir_space_id(struct inode *dir, struct buffer_head *di_bh,
 	if (ocfs2_new_dir_wants_trailer(dir))
 		free_space = ocfs2_dir_trailer_blk_off(sb) - i_size_read(dir);
 	else
-		free_space = dir->i_sb->s_blocksize - i_size_read(dir);
+		free_space = inode_sb(dir)->s_blocksize - i_size_read(dir);
 
 	de_buf = di->id2.i_data.id_data;
 	limit = de_buf + i_size_read(dir);
@@ -3439,9 +3443,9 @@ static int ocfs2_find_dir_space_el(struct inode *dir, const char *name,
 	struct buffer_head *bh = NULL;
 	unsigned short rec_len;
 	struct ocfs2_dir_entry *de;
-	struct super_block *sb = dir->i_sb;
+	struct super_block *sb = inode_sb(dir);
 	int status;
-	int blocksize = dir->i_sb->s_blocksize;
+	int blocksize = inode_sb(dir)->s_blocksize;
 
 	status = ocfs2_read_dir_block(dir, 0, &bh, 0);
 	if (status)
@@ -3676,7 +3680,7 @@ static void ocfs2_dx_dir_transfer_leaf(struct inode *dir, u32 split_hash,
 
 		num_used = le16_to_cpu(orig_list->de_num_used);
 
-		memcpy(tmp_dx_leaf, orig_dx_leaf, dir->i_sb->s_blocksize);
+		memcpy(tmp_dx_leaf, orig_dx_leaf, inode_sb(dir)->s_blocksize);
 		tmp_list->de_num_used = cpu_to_le16(0);
 		memset(&tmp_list->de_entries, 0, sizeof(*dx_entry)*num_used);
 
@@ -3690,7 +3694,7 @@ static void ocfs2_dx_dir_transfer_leaf(struct inode *dir, u32 split_hash,
 				ocfs2_dx_dir_leaf_insert_tail(tmp_dx_leaf,
 							      dx_entry);
 		}
-		memcpy(orig_dx_leaf, tmp_dx_leaf, dir->i_sb->s_blocksize);
+		memcpy(orig_dx_leaf, tmp_dx_leaf, inode_sb(dir)->s_blocksize);
 
 		ocfs2_journal_dirty(handle, orig_dx_leaves[i]);
 		ocfs2_journal_dirty(handle, new_dx_leaves[i]);
@@ -3784,7 +3788,7 @@ static int ocfs2_dx_dir_rebalance(struct ocfs2_super *osb, struct inode *dir,
 	}
 
 	ret = dquot_alloc_space_nodirty(dir,
-				       ocfs2_clusters_to_bytes(dir->i_sb, 1));
+				       ocfs2_clusters_to_bytes(inode_sb(dir), 1));
 	if (ret)
 		goto out_commit;
 	did_quota = 1;
@@ -3839,7 +3843,8 @@ static int ocfs2_dx_dir_rebalance(struct ocfs2_super *osb, struct inode *dir,
 		goto out_commit;
 	}
 
-	orig_leaves_start = ocfs2_block_to_cluster_start(dir->i_sb, leaf_blkno);
+	orig_leaves_start = ocfs2_block_to_cluster_start(inode_sb(dir),
+							 leaf_blkno);
 	ret = ocfs2_read_dx_leaves(dir, orig_leaves_start, num_dx_leaves,
 				   orig_dx_leaves);
 	if (ret) {
@@ -3880,7 +3885,7 @@ static int ocfs2_dx_dir_rebalance(struct ocfs2_super *osb, struct inode *dir,
 out_commit:
 	if (ret < 0 && did_quota)
 		dquot_free_space_nodirty(dir,
-				ocfs2_clusters_to_bytes(dir->i_sb, 1));
+				ocfs2_clusters_to_bytes(inode_sb(dir), 1));
 
 	ocfs2_update_inode_fsync_trans(handle, dir, 1);
 	ocfs2_commit_trans(osb, handle);
@@ -4005,7 +4010,7 @@ static int ocfs2_search_dx_free_list(struct inode *dir,
 			goto out;
 		}
 
-		db = ocfs2_trailer_from_bh(leaf_bh, dir->i_sb);
+		db = ocfs2_trailer_from_bh(leaf_bh, inode_sb(dir));
 		if (rec_len <= le16_to_cpu(db->db_free_rec_len)) {
 			lookup->dl_leaf_bh = leaf_bh;
 			lookup->dl_prev_leaf_bh = prev_leaf_bh;
@@ -4035,7 +4040,7 @@ static int ocfs2_expand_inline_dx_root(struct inode *dir,
 	struct ocfs2_extent_tree et;
 	u64 insert_blkno;
 	struct ocfs2_alloc_context *data_ac = NULL;
-	struct ocfs2_super *osb = OCFS2_SB(dir->i_sb);
+	struct ocfs2_super *osb = OCFS2_SB(inode_sb(dir));
 	handle_t *handle = NULL;
 	struct ocfs2_dx_root_block *dx_root;
 	struct ocfs2_dx_entry_list *entry_list;
@@ -4127,7 +4132,7 @@ static int ocfs2_expand_inline_dx_root(struct inode *dir,
 out_commit:
 	if (ret < 0 && did_quota)
 		dquot_free_space_nodirty(dir,
-					  ocfs2_clusters_to_bytes(dir->i_sb, 1));
+					  ocfs2_clusters_to_bytes(inode_sb(dir), 1));
 
 	ocfs2_commit_trans(osb, handle);
 
@@ -4165,7 +4170,7 @@ static int ocfs2_prepare_dx_dir_for_insert(struct inode *dir,
 					   struct ocfs2_dir_lookup_result *lookup)
 {
 	int ret, free_dx_root = 1;
-	struct ocfs2_super *osb = OCFS2_SB(dir->i_sb);
+	struct ocfs2_super *osb = OCFS2_SB(inode_sb(dir));
 	struct buffer_head *dx_root_bh = NULL;
 	struct buffer_head *leaf_bh = NULL;
 	struct ocfs2_dinode *di = (struct ocfs2_dinode *)di_bh->b_data;
@@ -4342,7 +4347,7 @@ static int ocfs2_dx_dir_remove_index(struct inode *dir,
 				     struct buffer_head *dx_root_bh)
 {
 	int ret;
-	struct ocfs2_super *osb = OCFS2_SB(dir->i_sb);
+	struct ocfs2_super *osb = OCFS2_SB(inode_sb(dir));
 	struct ocfs2_dinode *di = (struct ocfs2_dinode *)di_bh->b_data;
 	struct ocfs2_dx_root_block *dx_root;
 	struct inode *dx_alloc_inode = NULL;
@@ -4424,7 +4429,7 @@ int ocfs2_dx_dir_truncate(struct inode *dir, struct buffer_head *di_bh)
 	unsigned int uninitialized_var(clen);
 	u32 major_hash = UINT_MAX, p_cpos, uninitialized_var(cpos);
 	u64 uninitialized_var(blkno);
-	struct ocfs2_super *osb = OCFS2_SB(dir->i_sb);
+	struct ocfs2_super *osb = OCFS2_SB(inode_sb(dir));
 	struct buffer_head *dx_root_bh = NULL;
 	struct ocfs2_dx_root_block *dx_root;
 	struct ocfs2_dinode *di = (struct ocfs2_dinode *)di_bh->b_data;
@@ -4457,7 +4462,7 @@ int ocfs2_dx_dir_truncate(struct inode *dir, struct buffer_head *di_bh)
 			goto out;
 		}
 
-		p_cpos = ocfs2_blocks_to_clusters(dir->i_sb, blkno);
+		p_cpos = ocfs2_blocks_to_clusters(inode_sb(dir), blkno);
 
 		ret = ocfs2_remove_btree_range(dir, &et, cpos, p_cpos, clen, 0,
 					       &dealloc, 0, false);
diff --git a/fs/ocfs2/dlmfs/dlmfs.c b/fs/ocfs2/dlmfs/dlmfs.c
index 602c71f32740..a434f7e143cf 100644
--- a/fs/ocfs2/dlmfs/dlmfs.c
+++ b/fs/ocfs2/dlmfs/dlmfs.c
@@ -412,7 +412,7 @@ static struct inode *dlmfs_get_inode(struct inode *parent,
 				     struct dentry *dentry,
 				     umode_t mode)
 {
-	struct super_block *sb = parent->i_sb;
+	struct super_block *sb = inode_sb(parent);
 	struct inode * inode = new_inode(sb);
 	struct dlmfs_inode_private *ip;
 
diff --git a/fs/ocfs2/dlmglue.c b/fs/ocfs2/dlmglue.c
index 9479f99c2145..ada39d788169 100644
--- a/fs/ocfs2/dlmglue.c
+++ b/fs/ocfs2/dlmglue.c
@@ -565,14 +565,15 @@ void ocfs2_inode_lock_res_init(struct ocfs2_lock_res *res,
 
 	ocfs2_build_lock_name(type, OCFS2_I(inode)->ip_blkno,
 			      generation, res->l_name);
-	ocfs2_lock_res_init_common(OCFS2_SB(inode->i_sb), res, type, ops, inode);
+	ocfs2_lock_res_init_common(OCFS2_SB(inode_sb(inode)), res, type, ops,
+				   inode);
 }
 
 static struct ocfs2_super *ocfs2_get_inode_osb(struct ocfs2_lock_res *lockres)
 {
 	struct inode *inode = ocfs2_lock_res_inode(lockres);
 
-	return OCFS2_SB(inode->i_sb);
+	return OCFS2_SB(inode_sb(inode));
 }
 
 static struct ocfs2_super *ocfs2_get_qinfo_osb(struct ocfs2_lock_res *lockres)
@@ -586,7 +587,7 @@ static struct ocfs2_super *ocfs2_get_file_osb(struct ocfs2_lock_res *lockres)
 {
 	struct ocfs2_file_private *fp = lockres->l_priv;
 
-	return OCFS2_SB(fp->fp_file->f_mapping->host->i_sb);
+	return OCFS2_SB(inode_sb(fp->fp_file->f_mapping->host));
 }
 
 static __u64 ocfs2_get_dentry_lock_ino(struct ocfs2_lock_res *lockres)
@@ -603,7 +604,7 @@ static struct ocfs2_super *ocfs2_get_dentry_osb(struct ocfs2_lock_res *lockres)
 {
 	struct ocfs2_dentry_lock *dl = lockres->l_priv;
 
-	return OCFS2_SB(dl->dl_inode->i_sb);
+	return OCFS2_SB(inode_sb(dl->dl_inode));
 }
 
 void ocfs2_dentry_lock_res_init(struct ocfs2_dentry_lock *dl,
@@ -641,7 +642,7 @@ void ocfs2_dentry_lock_res_init(struct ocfs2_dentry_lock *dl,
 	memcpy(&lockres->l_name[OCFS2_DENTRY_LOCK_INO_START], &inode_blkno_be,
 	       sizeof(__be64));
 
-	ocfs2_lock_res_init_common(OCFS2_SB(inode->i_sb), lockres,
+	ocfs2_lock_res_init_common(OCFS2_SB(inode_sb(inode)), lockres,
 				   OCFS2_LOCK_TYPE_DENTRY, &ocfs2_dentry_lops,
 				   dl);
 }
@@ -716,7 +717,7 @@ void ocfs2_file_lock_res_init(struct ocfs2_lock_res *lockres,
 	ocfs2_lock_res_init_once(lockres);
 	ocfs2_build_lock_name(OCFS2_LOCK_TYPE_FLOCK, oi->ip_blkno,
 			      inode->i_generation, lockres->l_name);
-	ocfs2_lock_res_init_common(OCFS2_SB(inode->i_sb), lockres,
+	ocfs2_lock_res_init_common(OCFS2_SB(inode_sb(inode)), lockres,
 				   OCFS2_LOCK_TYPE_FLOCK, &ocfs2_flock_lops,
 				   fp);
 	lockres->l_flags |= OCFS2_LOCK_NOCACHE;
@@ -1701,7 +1702,7 @@ static int ocfs2_create_new_lock(struct ocfs2_super *osb,
 int ocfs2_create_new_inode_locks(struct inode *inode)
 {
 	int ret;
-	struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
+	struct ocfs2_super *osb = OCFS2_SB(inode_sb(inode));
 
 	BUG_ON(!ocfs2_inode_is_new(inode));
 
@@ -1743,7 +1744,7 @@ int ocfs2_rw_lock(struct inode *inode, int write)
 {
 	int status, level;
 	struct ocfs2_lock_res *lockres;
-	struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
+	struct ocfs2_super *osb = OCFS2_SB(inode_sb(inode));
 
 	mlog(0, "inode %llu take %s RW lock\n",
 	     (unsigned long long)OCFS2_I(inode)->ip_blkno,
@@ -1756,7 +1757,8 @@ int ocfs2_rw_lock(struct inode *inode, int write)
 
 	level = write ? DLM_LOCK_EX : DLM_LOCK_PR;
 
-	status = ocfs2_cluster_lock(OCFS2_SB(inode->i_sb), lockres, level, 0,
+	status = ocfs2_cluster_lock(OCFS2_SB(inode_sb(inode)), lockres, level,
+				    0,
 				    0);
 	if (status < 0)
 		mlog_errno(status);
@@ -1768,7 +1770,7 @@ int ocfs2_try_rw_lock(struct inode *inode, int write)
 {
 	int status, level;
 	struct ocfs2_lock_res *lockres;
-	struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
+	struct ocfs2_super *osb = OCFS2_SB(inode_sb(inode));
 
 	mlog(0, "inode %llu try to take %s RW lock\n",
 	     (unsigned long long)OCFS2_I(inode)->ip_blkno,
@@ -1789,14 +1791,15 @@ void ocfs2_rw_unlock(struct inode *inode, int write)
 {
 	int level = write ? DLM_LOCK_EX : DLM_LOCK_PR;
 	struct ocfs2_lock_res *lockres = &OCFS2_I(inode)->ip_rw_lockres;
-	struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
+	struct ocfs2_super *osb = OCFS2_SB(inode_sb(inode));
 
 	mlog(0, "inode %llu drop %s RW lock\n",
 	     (unsigned long long)OCFS2_I(inode)->ip_blkno,
 	     write ? "EXMODE" : "PRMODE");
 
 	if (!ocfs2_mount_local(osb))
-		ocfs2_cluster_unlock(OCFS2_SB(inode->i_sb), lockres, level);
+		ocfs2_cluster_unlock(OCFS2_SB(inode_sb(inode)), lockres,
+				     level);
 }
 
 /*
@@ -1806,7 +1809,7 @@ int ocfs2_open_lock(struct inode *inode)
 {
 	int status = 0;
 	struct ocfs2_lock_res *lockres;
-	struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
+	struct ocfs2_super *osb = OCFS2_SB(inode_sb(inode));
 
 	mlog(0, "inode %llu take PRMODE open lock\n",
 	     (unsigned long long)OCFS2_I(inode)->ip_blkno);
@@ -1816,7 +1819,7 @@ int ocfs2_open_lock(struct inode *inode)
 
 	lockres = &OCFS2_I(inode)->ip_open_lockres;
 
-	status = ocfs2_cluster_lock(OCFS2_SB(inode->i_sb), lockres,
+	status = ocfs2_cluster_lock(OCFS2_SB(inode_sb(inode)), lockres,
 				    DLM_LOCK_PR, 0, 0);
 	if (status < 0)
 		mlog_errno(status);
@@ -1829,7 +1832,7 @@ int ocfs2_try_open_lock(struct inode *inode, int write)
 {
 	int status = 0, level;
 	struct ocfs2_lock_res *lockres;
-	struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
+	struct ocfs2_super *osb = OCFS2_SB(inode_sb(inode));
 
 	mlog(0, "inode %llu try to take %s open lock\n",
 	     (unsigned long long)OCFS2_I(inode)->ip_blkno,
@@ -1854,7 +1857,7 @@ int ocfs2_try_open_lock(struct inode *inode, int write)
 	 * other nodes and the -EAGAIN will indicate to the caller that
 	 * this inode is still in use.
 	 */
-	status = ocfs2_cluster_lock(OCFS2_SB(inode->i_sb), lockres,
+	status = ocfs2_cluster_lock(OCFS2_SB(inode_sb(inode)), lockres,
 				    level, DLM_LKF_NOQUEUE, 0);
 
 out:
@@ -1867,7 +1870,7 @@ int ocfs2_try_open_lock(struct inode *inode, int write)
 void ocfs2_open_unlock(struct inode *inode)
 {
 	struct ocfs2_lock_res *lockres = &OCFS2_I(inode)->ip_open_lockres;
-	struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
+	struct ocfs2_super *osb = OCFS2_SB(inode_sb(inode));
 
 	mlog(0, "inode %llu drop open lock\n",
 	     (unsigned long long)OCFS2_I(inode)->ip_blkno);
@@ -1876,10 +1879,10 @@ void ocfs2_open_unlock(struct inode *inode)
 		goto out;
 
 	if(lockres->l_ro_holders)
-		ocfs2_cluster_unlock(OCFS2_SB(inode->i_sb), lockres,
+		ocfs2_cluster_unlock(OCFS2_SB(inode_sb(inode)), lockres,
 				     DLM_LOCK_PR);
 	if(lockres->l_ex_holders)
-		ocfs2_cluster_unlock(OCFS2_SB(inode->i_sb), lockres,
+		ocfs2_cluster_unlock(OCFS2_SB(inode_sb(inode)), lockres,
 				     DLM_LOCK_EX);
 
 out:
@@ -1961,7 +1964,7 @@ int ocfs2_file_lock(struct file *file, int ex, int trylock)
 	unsigned long flags;
 	struct ocfs2_file_private *fp = file->private_data;
 	struct ocfs2_lock_res *lockres = &fp->fp_flock;
-	struct ocfs2_super *osb = OCFS2_SB(file->f_mapping->host->i_sb);
+	struct ocfs2_super *osb = OCFS2_SB(inode_sb(file->f_mapping->host));
 	struct ocfs2_mask_waiter mw;
 
 	ocfs2_init_mask_waiter(&mw);
@@ -2057,7 +2060,7 @@ void ocfs2_file_unlock(struct file *file)
 	unsigned long flags;
 	struct ocfs2_file_private *fp = file->private_data;
 	struct ocfs2_lock_res *lockres = &fp->fp_flock;
-	struct ocfs2_super *osb = OCFS2_SB(file->f_mapping->host->i_sb);
+	struct ocfs2_super *osb = OCFS2_SB(inode_sb(file->f_mapping->host));
 	struct ocfs2_mask_waiter mw;
 
 	ocfs2_init_mask_waiter(&mw);
@@ -2297,7 +2300,7 @@ static int ocfs2_inode_lock_update(struct inode *inode,
 	struct ocfs2_inode_info *oi = OCFS2_I(inode);
 	struct ocfs2_lock_res *lockres = &oi->ip_inode_lockres;
 	struct ocfs2_dinode *fe;
-	struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
+	struct ocfs2_super *osb = OCFS2_SB(inode_sb(inode));
 
 	if (ocfs2_mount_local(osb))
 		goto bail;
@@ -2405,7 +2408,7 @@ int ocfs2_inode_lock_full_nested(struct inode *inode,
 	int status, level, acquired;
 	u32 dlm_flags;
 	struct ocfs2_lock_res *lockres = NULL;
-	struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
+	struct ocfs2_super *osb = OCFS2_SB(inode_sb(inode));
 	struct buffer_head *local_bh = NULL;
 
 	mlog(0, "inode %llu, take %s META lock\n",
@@ -2595,15 +2598,16 @@ void ocfs2_inode_unlock(struct inode *inode,
 {
 	int level = ex ? DLM_LOCK_EX : DLM_LOCK_PR;
 	struct ocfs2_lock_res *lockres = &OCFS2_I(inode)->ip_inode_lockres;
-	struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
+	struct ocfs2_super *osb = OCFS2_SB(inode_sb(inode));
 
 	mlog(0, "inode %llu drop %s META lock\n",
 	     (unsigned long long)OCFS2_I(inode)->ip_blkno,
 	     ex ? "EXMODE" : "PRMODE");
 
-	if (!ocfs2_is_hard_readonly(OCFS2_SB(inode->i_sb)) &&
+	if (!ocfs2_is_hard_readonly(OCFS2_SB(inode_sb(inode))) &&
 	    !ocfs2_mount_local(osb))
-		ocfs2_cluster_unlock(OCFS2_SB(inode->i_sb), lockres, level);
+		ocfs2_cluster_unlock(OCFS2_SB(inode_sb(inode)), lockres,
+				     level);
 }
 
 /*
@@ -3468,21 +3472,21 @@ int ocfs2_drop_inode_locks(struct inode *inode)
 	/* No need to call ocfs2_mark_lockres_freeing here -
 	 * ocfs2_clear_inode has done it for us. */
 
-	err = ocfs2_drop_lock(OCFS2_SB(inode->i_sb),
+	err = ocfs2_drop_lock(OCFS2_SB(inode_sb(inode)),
 			      &OCFS2_I(inode)->ip_open_lockres);
 	if (err < 0)
 		mlog_errno(err);
 
 	status = err;
 
-	err = ocfs2_drop_lock(OCFS2_SB(inode->i_sb),
+	err = ocfs2_drop_lock(OCFS2_SB(inode_sb(inode)),
 			      &OCFS2_I(inode)->ip_inode_lockres);
 	if (err < 0)
 		mlog_errno(err);
 	if (err < 0 && !status)
 		status = err;
 
-	err = ocfs2_drop_lock(OCFS2_SB(inode->i_sb),
+	err = ocfs2_drop_lock(OCFS2_SB(inode_sb(inode)),
 			      &OCFS2_I(inode)->ip_rw_lockres);
 	if (err < 0)
 		mlog_errno(err);
diff --git a/fs/ocfs2/export.c b/fs/ocfs2/export.c
index 9f88188060db..f54d262627ae 100644
--- a/fs/ocfs2/export.c
+++ b/fs/ocfs2/export.c
@@ -166,7 +166,7 @@ static struct dentry *ocfs2_get_parent(struct dentry *child)
 		goto bail_unlock;
 	}
 
-	parent = d_obtain_alias(ocfs2_iget(OCFS2_SB(dir->i_sb), blkno, 0, 0));
+	parent = d_obtain_alias(ocfs2_iget(OCFS2_SB(inode_sb(dir)), blkno, 0, 0));
 
 bail_unlock:
 	ocfs2_inode_unlock(dir, 0);
diff --git a/fs/ocfs2/extent_map.c b/fs/ocfs2/extent_map.c
index 06cb96462bf9..7b9b0bf66d0f 100644
--- a/fs/ocfs2/extent_map.c
+++ b/fs/ocfs2/extent_map.c
@@ -234,7 +234,7 @@ void ocfs2_extent_map_insert_rec(struct inode *inode,
 	struct ocfs2_extent_map_item ins;
 
 	ins.ei_cpos = le32_to_cpu(rec->e_cpos);
-	ins.ei_phys = ocfs2_blocks_to_clusters(inode->i_sb,
+	ins.ei_phys = ocfs2_blocks_to_clusters(inode_sb(inode),
 					       le64_to_cpu(rec->e_blkno));
 	ins.ei_clusters = le16_to_cpu(rec->e_leaf_clusters);
 	ins.ei_flags = rec->e_flags;
@@ -305,7 +305,7 @@ static int ocfs2_last_eb_is_empty(struct inode *inode,
 	el = &eb->h_list;
 
 	if (el->l_tree_depth) {
-		ocfs2_error(inode->i_sb,
+		ocfs2_error(inode_sb(inode),
 			    "Inode %lu has non zero tree depth in leaf block %llu\n",
 			    inode->i_ino,
 			    (unsigned long long)eb_bh->b_blocknr);
@@ -441,7 +441,7 @@ static int ocfs2_get_clusters_nocache(struct inode *inode,
 		el = &eb->h_list;
 
 		if (el->l_tree_depth) {
-			ocfs2_error(inode->i_sb,
+			ocfs2_error(inode_sb(inode),
 				    "Inode %lu has non zero tree depth in leaf block %llu\n",
 				    inode->i_ino,
 				    (unsigned long long)eb_bh->b_blocknr);
@@ -476,7 +476,7 @@ static int ocfs2_get_clusters_nocache(struct inode *inode,
 	BUG_ON(v_cluster < le32_to_cpu(rec->e_cpos));
 
 	if (!rec->e_blkno) {
-		ocfs2_error(inode->i_sb,
+		ocfs2_error(inode_sb(inode),
 			    "Inode %lu has bad extent record (%u, %u, 0)\n",
 			    inode->i_ino,
 			    le32_to_cpu(rec->e_cpos),
@@ -565,7 +565,7 @@ int ocfs2_xattr_get_clusters(struct inode *inode, u32 v_cluster,
 		el = &eb->h_list;
 
 		if (el->l_tree_depth) {
-			ocfs2_error(inode->i_sb,
+			ocfs2_error(inode_sb(inode),
 				    "Inode %lu has non zero tree depth in xattr leaf block %llu\n",
 				    inode->i_ino,
 				    (unsigned long long)eb_bh->b_blocknr);
@@ -584,7 +584,7 @@ int ocfs2_xattr_get_clusters(struct inode *inode, u32 v_cluster,
 		BUG_ON(v_cluster < le32_to_cpu(rec->e_cpos));
 
 		if (!rec->e_blkno) {
-			ocfs2_error(inode->i_sb,
+			ocfs2_error(inode_sb(inode),
 				    "Inode %lu has bad extent record (%u, %u, 0) in xattr\n",
 				    inode->i_ino,
 				    le32_to_cpu(rec->e_cpos),
@@ -593,8 +593,8 @@ int ocfs2_xattr_get_clusters(struct inode *inode, u32 v_cluster,
 			goto out;
 		}
 		coff = v_cluster - le32_to_cpu(rec->e_cpos);
-		*p_cluster = ocfs2_blocks_to_clusters(inode->i_sb,
-						    le64_to_cpu(rec->e_blkno));
+		*p_cluster = ocfs2_blocks_to_clusters(inode_sb(inode),
+						      le64_to_cpu(rec->e_blkno));
 		*p_cluster = *p_cluster + coff;
 		if (num_clusters)
 			*num_clusters = ocfs2_rec_clusters(el, rec) - coff;
@@ -652,7 +652,8 @@ int ocfs2_get_clusters(struct inode *inode, u32 v_cluster,
 			*num_clusters = hole_len;
 		}
 	} else {
-		ocfs2_relative_extent_offsets(inode->i_sb, v_cluster, &rec,
+		ocfs2_relative_extent_offsets(inode_sb(inode), v_cluster,
+					      &rec,
 					      p_cluster, num_clusters);
 		flags = rec.e_flags;
 
@@ -675,11 +676,11 @@ int ocfs2_extent_map_get_blocks(struct inode *inode, u64 v_blkno, u64 *p_blkno,
 				u64 *ret_count, unsigned int *extent_flags)
 {
 	int ret;
-	int bpc = ocfs2_clusters_to_blocks(inode->i_sb, 1);
+	int bpc = ocfs2_clusters_to_blocks(inode_sb(inode), 1);
 	u32 cpos, num_clusters, p_cluster;
 	u64 boff = 0;
 
-	cpos = ocfs2_blocks_to_clusters(inode->i_sb, v_blkno);
+	cpos = ocfs2_blocks_to_clusters(inode_sb(inode), v_blkno);
 
 	ret = ocfs2_get_clusters(inode, cpos, &p_cluster, &num_clusters,
 				 extent_flags);
@@ -692,14 +693,15 @@ int ocfs2_extent_map_get_blocks(struct inode *inode, u64 v_blkno, u64 *p_blkno,
 	 * p_cluster == 0 indicates a hole.
 	 */
 	if (p_cluster) {
-		boff = ocfs2_clusters_to_blocks(inode->i_sb, p_cluster);
+		boff = ocfs2_clusters_to_blocks(inode_sb(inode), p_cluster);
 		boff += (v_blkno & (u64)(bpc - 1));
 	}
 
 	*p_blkno = boff;
 
 	if (ret_count) {
-		*ret_count = ocfs2_clusters_to_blocks(inode->i_sb, num_clusters);
+		*ret_count = ocfs2_clusters_to_blocks(inode_sb(inode),
+						      num_clusters);
 		*ret_count -= v_blkno & (u64)(bpc - 1);
 	}
 
@@ -726,12 +728,12 @@ static int ocfs2_fiemap_inline(struct inode *inode, struct buffer_head *di_bh,
 
 	di = (struct ocfs2_dinode *)di_bh->b_data;
 	if (ocfs2_inode_is_fast_symlink(inode))
-		id_count = ocfs2_fast_symlink_chars(inode->i_sb);
+		id_count = ocfs2_fast_symlink_chars(inode_sb(inode));
 	else
 		id_count = le16_to_cpu(di->id2.i_data.id_count);
 
 	if (map_start < id_count) {
-		phys = oi->ip_blkno << inode->i_sb->s_blocksize_bits;
+		phys = oi->ip_blkno << inode_sb(inode)->s_blocksize_bits;
 		if (ocfs2_inode_is_fast_symlink(inode))
 			phys += offsetof(struct ocfs2_dinode, id2.i_symlink);
 		else
@@ -755,7 +757,7 @@ int ocfs2_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo,
 	int ret, is_last;
 	u32 mapping_end, cpos;
 	unsigned int hole_size;
-	struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
+	struct ocfs2_super *osb = OCFS2_SB(inode_sb(inode));
 	u64 len_bytes, phys_bytes, virt_bytes;
 	struct buffer_head *di_bh = NULL;
 	struct ocfs2_extent_rec rec;
@@ -782,7 +784,7 @@ int ocfs2_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo,
 	}
 
 	cpos = map_start >> osb->s_clustersize_bits;
-	mapping_end = ocfs2_clusters_for_bytes(inode->i_sb,
+	mapping_end = ocfs2_clusters_for_bytes(inode_sb(inode),
 					       map_start + map_len);
 	is_last = 0;
 	while (cpos < mapping_end && !is_last) {
@@ -839,7 +841,7 @@ int ocfs2_overwrite_io(struct inode *inode, struct buffer_head *di_bh,
 {
 	int ret = 0, is_last;
 	u32 mapping_end, cpos;
-	struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
+	struct ocfs2_super *osb = OCFS2_SB(inode_sb(inode));
 	struct ocfs2_extent_rec rec;
 
 	if (OCFS2_I(inode)->ip_dyn_features & OCFS2_INLINE_DATA_FL) {
@@ -850,7 +852,7 @@ int ocfs2_overwrite_io(struct inode *inode, struct buffer_head *di_bh,
 	}
 
 	cpos = map_start >> osb->s_clustersize_bits;
-	mapping_end = ocfs2_clusters_for_bytes(inode->i_sb,
+	mapping_end = ocfs2_clusters_for_bytes(inode_sb(inode),
 					       map_start + map_len);
 	is_last = 0;
 	while (cpos < mapping_end && !is_last) {
@@ -882,7 +884,7 @@ int ocfs2_seek_data_hole_offset(struct file *file, loff_t *offset, int whence)
 	struct inode *inode = file->f_mapping->host;
 	int ret;
 	unsigned int is_last = 0, is_data = 0;
-	u16 cs_bits = OCFS2_SB(inode->i_sb)->s_clustersize_bits;
+	u16 cs_bits = OCFS2_SB(inode_sb(inode))->s_clustersize_bits;
 	u32 cpos, cend, clen, hole_size;
 	u64 extoff, extlen;
 	struct buffer_head *di_bh = NULL;
@@ -911,7 +913,7 @@ int ocfs2_seek_data_hole_offset(struct file *file, loff_t *offset, int whence)
 
 	clen = 0;
 	cpos = *offset >> cs_bits;
-	cend = ocfs2_clusters_for_bytes(inode->i_sb, i_size_read(inode));
+	cend = ocfs2_clusters_for_bytes(inode_sb(inode), i_size_read(inode));
 
 	while (cpos < cend && !is_last) {
 		ret = ocfs2_get_clusters_nocache(inode, di_bh, cpos, &hole_size,
@@ -984,7 +986,7 @@ int ocfs2_read_virt_blocks(struct inode *inode, u64 v_block, int nr,
 	     inode, (unsigned long long)v_block, nr, bhs, flags,
 	     validate);
 
-	if (((v_block + nr - 1) << inode->i_sb->s_blocksize_bits) >=
+	if (((v_block + nr - 1) << inode_sb(inode)->s_blocksize_bits) >=
 	    i_size_read(inode)) {
 		BUG_ON(!(flags & OCFS2_BH_READAHEAD));
 		goto out;
@@ -1006,7 +1008,7 @@ int ocfs2_read_virt_blocks(struct inode *inode, u64 v_block, int nr,
 			     "Inode #%llu contains a hole at offset %llu\n",
 			     (unsigned long long)OCFS2_I(inode)->ip_blkno,
 			     (unsigned long long)(v_block + done) <<
-			     inode->i_sb->s_blocksize_bits);
+			     inode_sb(inode)->s_blocksize_bits);
 			break;
 		}
 
diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c
index 5d1784a365a3..b41f89b0f814 100644
--- a/fs/ocfs2/file.c
+++ b/fs/ocfs2/file.c
@@ -84,7 +84,7 @@ static int ocfs2_init_file_private(struct inode *inode, struct file *file)
 static void ocfs2_free_file_private(struct inode *inode, struct file *file)
 {
 	struct ocfs2_file_private *fp = file->private_data;
-	struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
+	struct ocfs2_super *osb = OCFS2_SB(inode_sb(inode));
 
 	if (fp) {
 		ocfs2_simple_drop_lockres(osb, &fp->fp_flock);
@@ -182,7 +182,7 @@ static int ocfs2_sync_file(struct file *file, loff_t start, loff_t end,
 {
 	int err = 0;
 	struct inode *inode = file->f_mapping->host;
-	struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
+	struct ocfs2_super *osb = OCFS2_SB(inode_sb(inode));
 	struct ocfs2_inode_info *oi = OCFS2_I(inode);
 	journal_t *journal = osb->journal->j_journal;
 	int ret;
@@ -208,7 +208,8 @@ static int ocfs2_sync_file(struct file *file, loff_t start, loff_t end,
 		needs_barrier = true;
 	err = jbd2_complete_transaction(journal, commit_tid);
 	if (needs_barrier) {
-		ret = blkdev_issue_flush(inode->i_sb->s_bdev, GFP_KERNEL, NULL);
+		ret = blkdev_issue_flush(inode_sb(inode)->s_bdev, GFP_KERNEL,
+					 NULL);
 		if (!err)
 			err = ret;
 	}
@@ -223,13 +224,13 @@ int ocfs2_should_update_atime(struct inode *inode,
 			      struct vfsmount *vfsmnt)
 {
 	struct timespec now;
-	struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
+	struct ocfs2_super *osb = OCFS2_SB(inode_sb(inode));
 
 	if (ocfs2_is_hard_readonly(osb) || ocfs2_is_soft_readonly(osb))
 		return 0;
 
 	if ((inode->i_flags & S_NOATIME) ||
-	    ((inode->i_sb->s_flags & SB_NODIRATIME) && S_ISDIR(inode->i_mode)))
+	    ((inode_sb(inode)->s_flags & SB_NODIRATIME) && S_ISDIR(inode->i_mode)))
 		return 0;
 
 	/*
@@ -266,7 +267,7 @@ int ocfs2_update_inode_atime(struct inode *inode,
 			     struct buffer_head *bh)
 {
 	int ret;
-	struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
+	struct ocfs2_super *osb = OCFS2_SB(inode_sb(inode));
 	handle_t *handle;
 	struct ocfs2_dinode *di = (struct ocfs2_dinode *) bh->b_data;
 
@@ -296,7 +297,7 @@ int ocfs2_update_inode_atime(struct inode *inode,
 	ocfs2_journal_dirty(handle, bh);
 
 out_commit:
-	ocfs2_commit_trans(OCFS2_SB(inode->i_sb), handle);
+	ocfs2_commit_trans(OCFS2_SB(inode_sb(inode)), handle);
 out:
 	return ret;
 }
@@ -327,7 +328,7 @@ int ocfs2_simple_size_update(struct inode *inode,
 			     u64 new_i_size)
 {
 	int ret;
-	struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
+	struct ocfs2_super *osb = OCFS2_SB(inode_sb(inode));
 	handle_t *handle = NULL;
 
 	handle = ocfs2_start_trans(osb, OCFS2_INODE_UPDATE_CREDITS);
@@ -353,7 +354,7 @@ static int ocfs2_cow_file_pos(struct inode *inode,
 			      u64 offset)
 {
 	int status;
-	u32 phys, cpos = offset >> OCFS2_SB(inode->i_sb)->s_clustersize_bits;
+	u32 phys, cpos = offset >> OCFS2_SB(inode_sb(inode))->s_clustersize_bits;
 	unsigned int num_clusters = 0;
 	unsigned int ext_flags = 0;
 
@@ -362,7 +363,7 @@ static int ocfs2_cow_file_pos(struct inode *inode,
 	 * no space for ocfs2_zero_range_for_truncate to fill, so no need to
 	 * CoW either.
 	 */
-	if ((offset & (OCFS2_SB(inode->i_sb)->s_clustersize - 1)) == 0)
+	if ((offset & (OCFS2_SB(inode_sb(inode))->s_clustersize - 1)) == 0)
 		return 0;
 
 	status = ocfs2_get_clusters(inode, cpos, &phys,
@@ -422,7 +423,8 @@ static int ocfs2_orphan_for_truncate(struct ocfs2_super *osb,
 	/*
 	 * Do this before setting i_size.
 	 */
-	cluster_bytes = ocfs2_align_bytes_to_clusters(inode->i_sb, new_i_size);
+	cluster_bytes = ocfs2_align_bytes_to_clusters(inode_sb(inode),
+						      new_i_size);
 	status = ocfs2_zero_range_for_truncate(inode, handle, new_i_size,
 					       cluster_bytes);
 	if (status) {
@@ -453,7 +455,7 @@ int ocfs2_truncate_file(struct inode *inode,
 {
 	int status = 0;
 	struct ocfs2_dinode *fe = NULL;
-	struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
+	struct ocfs2_super *osb = OCFS2_SB(inode_sb(inode));
 
 	/* We trust di_bh because it comes from ocfs2_inode_lock(), which
 	 * already validated it */
@@ -576,7 +578,7 @@ static int __ocfs2_extend_allocation(struct inode *inode, u32 logical_start,
 	struct ocfs2_alloc_context *data_ac = NULL;
 	struct ocfs2_alloc_context *meta_ac = NULL;
 	enum ocfs2_alloc_restarted why = RESTART_NONE;
-	struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
+	struct ocfs2_super *osb = OCFS2_SB(inode_sb(inode));
 	struct ocfs2_extent_tree et;
 	int did_quota = 0;
 
@@ -722,7 +724,7 @@ static int __ocfs2_extend_allocation(struct inode *inode, u32 logical_start,
 static handle_t *ocfs2_zero_start_ordered_transaction(struct inode *inode,
 						struct buffer_head *di_bh)
 {
-	struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
+	struct ocfs2_super *osb = OCFS2_SB(inode_sb(inode));
 	handle_t *handle = NULL;
 	int ret = 0;
 
@@ -849,7 +851,7 @@ static int ocfs2_write_zero_page(struct inode *inode, u64 abs_from,
 	put_page(page);
 out_commit_trans:
 	if (handle)
-		ocfs2_commit_trans(OCFS2_SB(inode->i_sb), handle);
+		ocfs2_commit_trans(OCFS2_SB(inode_sb(inode)), handle);
 out:
 	return ret;
 }
@@ -874,8 +876,8 @@ static int ocfs2_zero_extend_get_range(struct inode *inode,
 	int rc = 0, needs_cow = 0;
 	u32 p_cpos, zero_clusters = 0;
 	u32 zero_cpos =
-		zero_start >> OCFS2_SB(inode->i_sb)->s_clustersize_bits;
-	u32 last_cpos = ocfs2_clusters_for_bytes(inode->i_sb, zero_end);
+		zero_start >> OCFS2_SB(inode_sb(inode))->s_clustersize_bits;
+	u32 last_cpos = ocfs2_clusters_for_bytes(inode_sb(inode), zero_end);
 	unsigned int num_clusters = 0;
 	unsigned int ext_flags = 0;
 
@@ -928,8 +930,8 @@ static int ocfs2_zero_extend_get_range(struct inode *inode,
 		}
 	}
 
-	*range_start = ocfs2_clusters_to_bytes(inode->i_sb, zero_cpos);
-	*range_end = ocfs2_clusters_to_bytes(inode->i_sb,
+	*range_start = ocfs2_clusters_to_bytes(inode_sb(inode), zero_cpos);
+	*range_end = ocfs2_clusters_to_bytes(inode_sb(inode),
 					     zero_cpos + zero_clusters);
 
 out:
@@ -979,7 +981,7 @@ int ocfs2_zero_extend(struct inode *inode, struct buffer_head *di_bh,
 {
 	int ret = 0;
 	u64 zero_start, range_start = 0, range_end = 0;
-	struct super_block *sb = inode->i_sb;
+	struct super_block *sb = inode_sb(inode);
 
 	zero_start = ocfs2_align_bytes_to_blocks(sb, i_size_read(inode));
 	trace_ocfs2_zero_extend((unsigned long long)OCFS2_I(inode)->ip_blkno,
@@ -1028,7 +1030,8 @@ int ocfs2_extend_no_holes(struct inode *inode, struct buffer_head *di_bh,
 	BUG_ON(!di_bh && ocfs2_is_refcount_inode(inode));
 	BUG_ON(!di_bh && !(oi->ip_flags & OCFS2_INODE_SYSTEM_FILE));
 
-	clusters_to_add = ocfs2_clusters_for_bytes(inode->i_sb, new_i_size);
+	clusters_to_add = ocfs2_clusters_for_bytes(inode_sb(inode),
+						   new_i_size);
 	if (clusters_to_add < oi->ip_clusters)
 		clusters_to_add = 0;
 	else
@@ -1100,7 +1103,7 @@ static int ocfs2_extend_file(struct inode *inode,
 		}
 	}
 
-	if (ocfs2_sparse_alloc(OCFS2_SB(inode->i_sb)))
+	if (ocfs2_sparse_alloc(OCFS2_SB(inode_sb(inode))))
 		ret = ocfs2_zero_extend(inode, di_bh, new_i_size);
 	else
 		ret = ocfs2_extend_no_holes(inode, di_bh, new_i_size,
@@ -1127,7 +1130,7 @@ int ocfs2_setattr(struct dentry *dentry, struct iattr *attr)
 	int status = 0, size_change;
 	int inode_locked = 0;
 	struct inode *inode = d_inode(dentry);
-	struct super_block *sb = inode->i_sb;
+	struct super_block *sb = inode_sb(inode);
 	struct ocfs2_super *osb = OCFS2_SB(sb);
 	struct buffer_head *bh = NULL;
 	handle_t *handle = NULL;
@@ -1375,7 +1378,7 @@ static int __ocfs2_write_remove_suid(struct inode *inode,
 {
 	int ret;
 	handle_t *handle;
-	struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
+	struct ocfs2_super *osb = OCFS2_SB(inode_sb(inode));
 	struct ocfs2_dinode *di;
 
 	trace_ocfs2_write_remove_suid(
@@ -1466,8 +1469,8 @@ static int ocfs2_allocate_unwritten_extents(struct inode *inode,
 	/*
 	 * We consider both start and len to be inclusive.
 	 */
-	cpos = start >> OCFS2_SB(inode->i_sb)->s_clustersize_bits;
-	clusters = ocfs2_clusters_for_bytes(inode->i_sb, start + len);
+	cpos = start >> OCFS2_SB(inode_sb(inode))->s_clustersize_bits;
+	clusters = ocfs2_clusters_for_bytes(inode_sb(inode), start + len);
 	clusters -= cpos;
 
 	while (clusters) {
@@ -1519,11 +1522,12 @@ static int ocfs2_allocate_unwritten_extents(struct inode *inode,
 static void ocfs2_truncate_cluster_pages(struct inode *inode, u64 byte_start,
 					 u64 byte_len)
 {
-	struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
+	struct ocfs2_super *osb = OCFS2_SB(inode_sb(inode));
 	loff_t start, end;
 	struct address_space *mapping = inode->i_mapping;
 
-	start = (loff_t)ocfs2_align_bytes_to_clusters(inode->i_sb, byte_start);
+	start = (loff_t)ocfs2_align_bytes_to_clusters(inode_sb(inode),
+						      byte_start);
 	end = byte_start + byte_len;
 	end = end & ~(osb->s_clustersize - 1);
 
@@ -1539,7 +1543,7 @@ static int ocfs2_zero_partial_clusters(struct inode *inode,
 	int ret = 0;
 	u64 tmpend = 0;
 	u64 end = start + len;
-	struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
+	struct ocfs2_super *osb = OCFS2_SB(inode_sb(inode));
 	unsigned int csize = osb->s_clustersize;
 	handle_t *handle;
 
@@ -1681,7 +1685,8 @@ static void ocfs2_calc_trunc_pos(struct inode *inode,
 		*trunc_len = *trunc_end - trunc_start;
 		coff = trunc_start - le32_to_cpu(rec->e_cpos);
 		*blkno = le64_to_cpu(rec->e_blkno) +
-				ocfs2_clusters_to_blocks(inode->i_sb, coff);
+				ocfs2_clusters_to_blocks(inode_sb(inode),
+							 coff);
 		*trunc_end = trunc_start;
 	} else {
 		/*
@@ -1705,7 +1710,7 @@ int ocfs2_remove_inode_range(struct inode *inode,
 	int ret = 0, flags = 0, done = 0, i;
 	u32 trunc_start, trunc_len, trunc_end, trunc_cpos, phys_cpos;
 	u32 cluster_in_el;
-	struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
+	struct ocfs2_super *osb = OCFS2_SB(inode_sb(inode));
 	struct ocfs2_cached_dealloc_ctxt dealloc;
 	struct address_space *mapping = inode->i_mapping;
 	struct ocfs2_extent_tree et;
@@ -1800,7 +1805,7 @@ int ocfs2_remove_inode_range(struct inode *inode,
 			if (path->p_tree_depth == 0)
 				break;
 
-			ret = ocfs2_find_cpos_for_left_leaf(inode->i_sb,
+			ret = ocfs2_find_cpos_for_left_leaf(inode_sb(inode),
 							    path,
 							    &cluster_in_el);
 			if (ret) {
@@ -1834,7 +1839,7 @@ int ocfs2_remove_inode_range(struct inode *inode,
 			break;
 
 		flags = rec->e_flags;
-		phys_cpos = ocfs2_blocks_to_clusters(inode->i_sb, blkno);
+		phys_cpos = ocfs2_blocks_to_clusters(inode_sb(inode), blkno);
 
 		ret = ocfs2_remove_btree_range(inode, &et, trunc_cpos,
 					       phys_cpos, trunc_len, flags,
@@ -1870,10 +1875,10 @@ static int __ocfs2_change_file_space(struct file *file, struct inode *inode,
 	int ret;
 	s64 llen;
 	loff_t size;
-	struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
+	struct ocfs2_super *osb = OCFS2_SB(inode_sb(inode));
 	struct buffer_head *di_bh = NULL;
 	handle_t *handle;
-	unsigned long long max_off = inode->i_sb->s_maxbytes;
+	unsigned long long max_off = inode_sb(inode)->s_maxbytes;
 
 	if (ocfs2_is_hard_readonly(osb) || ocfs2_is_soft_readonly(osb))
 		return -EROFS;
@@ -2005,7 +2010,7 @@ int ocfs2_change_file_space(struct file *file, unsigned int cmd,
 			    struct ocfs2_space_resv *sr)
 {
 	struct inode *inode = file_inode(file);
-	struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
+	struct ocfs2_super *osb = OCFS2_SB(inode_sb(inode));
 	int ret;
 
 	if ((cmd == OCFS2_IOC_RESVSP || cmd == OCFS2_IOC_RESVSP64) &&
@@ -2033,7 +2038,7 @@ static long ocfs2_fallocate(struct file *file, int mode, loff_t offset,
 			    loff_t len)
 {
 	struct inode *inode = file_inode(file);
-	struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
+	struct ocfs2_super *osb = OCFS2_SB(inode_sb(inode));
 	struct ocfs2_space_resv sr;
 	int change_size = 1;
 	int cmd = OCFS2_IOC_RESVSP64;
@@ -2063,9 +2068,9 @@ int ocfs2_check_range_for_refcount(struct inode *inode, loff_t pos,
 	int ret = 0;
 	unsigned int extent_flags;
 	u32 cpos, clusters, extent_len, phys_cpos;
-	struct super_block *sb = inode->i_sb;
+	struct super_block *sb = inode_sb(inode);
 
-	if (!ocfs2_refcount_tree(OCFS2_SB(inode->i_sb)) ||
+	if (!ocfs2_refcount_tree(OCFS2_SB(inode_sb(inode))) ||
 	    !ocfs2_is_refcount_inode(inode) ||
 	    OCFS2_I(inode)->ip_dyn_features & OCFS2_INLINE_DATA_FL)
 		return 0;
@@ -2098,7 +2103,7 @@ int ocfs2_check_range_for_refcount(struct inode *inode, loff_t pos,
 
 static int ocfs2_is_io_unaligned(struct inode *inode, size_t count, loff_t pos)
 {
-	int blockmask = inode->i_sb->s_blocksize - 1;
+	int blockmask = inode_sb(inode)->s_blocksize - 1;
 	loff_t final_size = pos + count;
 
 	if ((pos & blockmask) || (final_size & blockmask))
@@ -2113,9 +2118,9 @@ static int ocfs2_prepare_inode_for_refcount(struct inode *inode,
 {
 	int ret;
 	struct buffer_head *di_bh = NULL;
-	u32 cpos = pos >> OCFS2_SB(inode->i_sb)->s_clustersize_bits;
+	u32 cpos = pos >> OCFS2_SB(inode_sb(inode))->s_clustersize_bits;
 	u32 clusters =
-		ocfs2_clusters_for_bytes(inode->i_sb, pos + count) - cpos;
+		ocfs2_clusters_for_bytes(inode_sb(inode), pos + count) - cpos;
 
 	ret = ocfs2_inode_lock(inode, &di_bh, 1);
 	if (ret) {
@@ -2248,7 +2253,7 @@ static ssize_t ocfs2_file_write_iter(struct kiocb *iocb,
 	size_t count = iov_iter_count(from);
 	struct file *file = iocb->ki_filp;
 	struct inode *inode = file_inode(file);
-	struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
+	struct ocfs2_super *osb = OCFS2_SB(inode_sb(inode));
 	int full_coherency = !(osb->s_mount_opt &
 			       OCFS2_MOUNT_COHERENCY_BUFFERED);
 	void *saved_ki_complete = NULL;
@@ -2518,7 +2523,7 @@ static loff_t ocfs2_file_llseek(struct file *file, loff_t offset, int whence)
 		goto out;
 	}
 
-	offset = vfs_setpos(file, offset, inode->i_sb->s_maxbytes);
+	offset = vfs_setpos(file, offset, inode_sb(inode)->s_maxbytes);
 
 out:
 	inode_unlock(inode);
diff --git a/fs/ocfs2/inode.c b/fs/ocfs2/inode.c
index d51b80edd972..ebceb88328ee 100644
--- a/fs/ocfs2/inode.c
+++ b/fs/ocfs2/inode.c
@@ -280,7 +280,7 @@ void ocfs2_populate_inode(struct inode *inode, struct ocfs2_dinode *fe,
 	struct ocfs2_super *osb;
 	int use_plocks = 1;
 
-	sb = inode->i_sb;
+	sb = inode_sb(inode);
 	osb = OCFS2_SB(sb);
 
 	if ((osb->s_mount_opt & OCFS2_MOUNT_LOCALFLOCKS) ||
@@ -383,8 +383,8 @@ void ocfs2_populate_inode(struct inode *inode, struct ocfs2_dinode *fe,
 	}
 
 	if (create_ino) {
-		inode->i_ino = ino_from_blkno(inode->i_sb,
-			       le64_to_cpu(fe->i_blkno));
+		inode->i_ino = ino_from_blkno(inode_sb(inode),
+				              le64_to_cpu(fe->i_blkno));
 
 		/*
 		 * If we ever want to create system files from kernel,
@@ -425,7 +425,7 @@ static int ocfs2_read_locked_inode(struct inode *inode,
 	u32 generation = 0;
 
 	status = -EINVAL;
-	sb = inode->i_sb;
+	sb = inode_sb(inode);
 	osb = OCFS2_SB(sb);
 
 	/*
@@ -658,7 +658,7 @@ static int ocfs2_remove_inode(struct inode *inode,
 	struct inode *inode_alloc_inode = NULL;
 	struct buffer_head *inode_alloc_bh = NULL;
 	handle_t *handle;
-	struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
+	struct ocfs2_super *osb = OCFS2_SB(inode_sb(inode));
 	struct ocfs2_dinode *di = (struct ocfs2_dinode *) di_bh->b_data;
 
 	inode_alloc_inode =
@@ -680,7 +680,7 @@ static int ocfs2_remove_inode(struct inode *inode,
 	}
 
 	handle = ocfs2_start_trans(osb, OCFS2_DELETE_INODE_CREDITS +
-				   ocfs2_quota_trans_credits(inode->i_sb));
+				   ocfs2_quota_trans_credits(inode_sb(inode)));
 	if (IS_ERR(handle)) {
 		status = PTR_ERR(handle);
 		mlog_errno(status);
@@ -769,7 +769,7 @@ static int ocfs2_wipe_inode(struct inode *inode,
 	int status, orphaned_slot = -1;
 	struct inode *orphan_dir_inode = NULL;
 	struct buffer_head *orphan_dir_bh = NULL;
-	struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
+	struct ocfs2_super *osb = OCFS2_SB(inode_sb(inode));
 	struct ocfs2_dinode *di = (struct ocfs2_dinode *) di_bh->b_data;
 
 	if (!(OCFS2_I(inode)->ip_flags & OCFS2_INODE_SKIP_ORPHAN_DIR)) {
@@ -858,7 +858,7 @@ static int ocfs2_inode_is_valid_to_delete(struct inode *inode)
 {
 	int ret = 0;
 	struct ocfs2_inode_info *oi = OCFS2_I(inode);
-	struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
+	struct ocfs2_super *osb = OCFS2_SB(inode_sb(inode));
 
 	trace_ocfs2_inode_is_valid_to_delete(current, osb->dc_task,
 					     (unsigned long long)oi->ip_blkno,
@@ -1045,7 +1045,7 @@ static void ocfs2_delete_inode(struct inode *inode)
 	 * shared mode so that all nodes can still concurrently
 	 * process deletes.
 	 */
-	status = ocfs2_nfs_sync_lock(OCFS2_SB(inode->i_sb), 0);
+	status = ocfs2_nfs_sync_lock(OCFS2_SB(inode_sb(inode)), 0);
 	if (status < 0) {
 		mlog(ML_ERROR, "getting nfs sync lock(PR) failed %d\n", status);
 		ocfs2_cleanup_delete_inode(inode, 0);
@@ -1117,7 +1117,7 @@ static void ocfs2_delete_inode(struct inode *inode)
 	brelse(di_bh);
 
 bail_unlock_nfs_sync:
-	ocfs2_nfs_sync_unlock(OCFS2_SB(inode->i_sb), 0);
+	ocfs2_nfs_sync_unlock(OCFS2_SB(inode_sb(inode)), 0);
 
 bail_unblock:
 	ocfs2_unblock_signals(&oldset);
@@ -1129,13 +1129,13 @@ static void ocfs2_clear_inode(struct inode *inode)
 {
 	int status;
 	struct ocfs2_inode_info *oi = OCFS2_I(inode);
-	struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
+	struct ocfs2_super *osb = OCFS2_SB(inode_sb(inode));
 
 	clear_inode(inode);
 	trace_ocfs2_clear_inode((unsigned long long)oi->ip_blkno,
 				inode->i_nlink);
 
-	mlog_bug_on_msg(OCFS2_SB(inode->i_sb) == NULL,
+	mlog_bug_on_msg(OCFS2_SB(inode_sb(inode)) == NULL,
 			"Inode=%lu\n", inode->i_ino);
 
 	dquot_drop(inode);
@@ -1150,7 +1150,7 @@ static void ocfs2_clear_inode(struct inode *inode)
 	ocfs2_mark_lockres_freeing(osb, &oi->ip_inode_lockres);
 	ocfs2_mark_lockres_freeing(osb, &oi->ip_open_lockres);
 
-	ocfs2_resv_discard(&OCFS2_SB(inode->i_sb)->osb_la_resmap,
+	ocfs2_resv_discard(&OCFS2_SB(inode_sb(inode))->osb_la_resmap,
 			   &oi->ip_la_data_resv);
 	ocfs2_resv_init_once(&oi->ip_la_data_resv);
 
@@ -1223,7 +1223,7 @@ static void ocfs2_clear_inode(struct inode *inode)
 	 * the journal is flushed before journal shutdown. Thus it is safe to
 	 * have inodes get cleaned up after journal shutdown.
 	 */
-	jbd2_journal_release_jbd_inode(OCFS2_SB(inode->i_sb)->journal->j_journal,
+	jbd2_journal_release_jbd_inode(OCFS2_SB(inode_sb(inode))->journal->j_journal,
 				       &oi->ip_jinode);
 }
 
@@ -1636,7 +1636,7 @@ static struct super_block *ocfs2_inode_cache_get_super(struct ocfs2_caching_info
 {
 	struct ocfs2_inode_info *oi = cache_info_to_inode(ci);
 
-	return oi->vfs_inode.i_sb;
+	return inode_sb(&oi->vfs_inode);
 }
 
 static void ocfs2_inode_cache_lock(struct ocfs2_caching_info *ci)
diff --git a/fs/ocfs2/inode.h b/fs/ocfs2/inode.h
index 9b955f732bca..740204816ff7 100644
--- a/fs/ocfs2/inode.h
+++ b/fs/ocfs2/inode.h
@@ -158,7 +158,7 @@ void ocfs2_get_inode_flags(struct ocfs2_inode_info *oi);
 
 static inline blkcnt_t ocfs2_inode_sector_count(struct inode *inode)
 {
-	int c_to_s_bits = OCFS2_SB(inode->i_sb)->s_clustersize_bits - 9;
+	int c_to_s_bits = OCFS2_SB(inode_sb(inode))->s_clustersize_bits - 9;
 
 	return (blkcnt_t)OCFS2_I(inode)->ip_clusters << c_to_s_bits;
 }
diff --git a/fs/ocfs2/ioctl.c b/fs/ocfs2/ioctl.c
index ab30c005cc4b..9be6d9d1390d 100644
--- a/fs/ocfs2/ioctl.c
+++ b/fs/ocfs2/ioctl.c
@@ -81,7 +81,7 @@ static int ocfs2_set_inode_attr(struct inode *inode, unsigned flags,
 				unsigned mask)
 {
 	struct ocfs2_inode_info *ocfs2_inode = OCFS2_I(inode);
-	struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
+	struct ocfs2_super *osb = OCFS2_SB(inode_sb(inode));
 	handle_t *handle = NULL;
 	struct buffer_head *bh = NULL;
 	unsigned oldflags;
@@ -151,7 +151,7 @@ static int ocfs2_info_handle_blocksize(struct inode *inode,
 	if (o2info_from_user(oib, req))
 		return -EFAULT;
 
-	oib.ib_blocksize = inode->i_sb->s_blocksize;
+	oib.ib_blocksize = inode_sb(inode)->s_blocksize;
 
 	o2info_set_request_filled(&oib.ib_req);
 
@@ -165,7 +165,7 @@ static int ocfs2_info_handle_clustersize(struct inode *inode,
 					 struct ocfs2_info_request __user *req)
 {
 	struct ocfs2_info_clustersize oic;
-	struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
+	struct ocfs2_super *osb = OCFS2_SB(inode_sb(inode));
 
 	if (o2info_from_user(oic, req))
 		return -EFAULT;
@@ -184,7 +184,7 @@ static int ocfs2_info_handle_maxslots(struct inode *inode,
 				      struct ocfs2_info_request __user *req)
 {
 	struct ocfs2_info_maxslots oim;
-	struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
+	struct ocfs2_super *osb = OCFS2_SB(inode_sb(inode));
 
 	if (o2info_from_user(oim, req))
 		return -EFAULT;
@@ -203,7 +203,7 @@ static int ocfs2_info_handle_label(struct inode *inode,
 				   struct ocfs2_info_request __user *req)
 {
 	struct ocfs2_info_label oil;
-	struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
+	struct ocfs2_super *osb = OCFS2_SB(inode_sb(inode));
 
 	if (o2info_from_user(oil, req))
 		return -EFAULT;
@@ -222,7 +222,7 @@ static int ocfs2_info_handle_uuid(struct inode *inode,
 				  struct ocfs2_info_request __user *req)
 {
 	struct ocfs2_info_uuid oiu;
-	struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
+	struct ocfs2_super *osb = OCFS2_SB(inode_sb(inode));
 
 	if (o2info_from_user(oiu, req))
 		return -EFAULT;
@@ -241,7 +241,7 @@ static int ocfs2_info_handle_fs_features(struct inode *inode,
 					 struct ocfs2_info_request __user *req)
 {
 	struct ocfs2_info_fs_features oif;
-	struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
+	struct ocfs2_super *osb = OCFS2_SB(inode_sb(inode));
 
 	if (o2info_from_user(oif, req))
 		return -EFAULT;
@@ -262,7 +262,7 @@ static int ocfs2_info_handle_journal_size(struct inode *inode,
 					  struct ocfs2_info_request __user *req)
 {
 	struct ocfs2_info_journal_size oij;
-	struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
+	struct ocfs2_super *osb = OCFS2_SB(inode_sb(inode));
 
 	if (o2info_from_user(oij, req))
 		return -EFAULT;
@@ -333,7 +333,7 @@ static int ocfs2_info_handle_freeinode(struct inode *inode,
 	char namebuf[40];
 	int status, type = INODE_ALLOC_SYSTEM_INODE;
 	struct ocfs2_info_freeinode *oifi = NULL;
-	struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
+	struct ocfs2_super *osb = OCFS2_SB(inode_sb(inode));
 	struct inode *inode_alloc = NULL;
 
 	oifi = kzalloc(sizeof(struct ocfs2_info_freeinode), GFP_KERNEL);
@@ -621,7 +621,7 @@ static int ocfs2_info_handle_freefrag(struct inode *inode,
 	int status, type = GLOBAL_BITMAP_SYSTEM_INODE;
 
 	struct ocfs2_info_freefrag *oiff;
-	struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
+	struct ocfs2_super *osb = OCFS2_SB(inode_sb(inode));
 	struct inode *gb_inode = NULL;
 
 	oiff = kzalloc(sizeof(struct ocfs2_info_freefrag), GFP_KERNEL);
@@ -924,7 +924,7 @@ long ocfs2_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
 		return ocfs2_info_handle(inode, &info, 0);
 	case FITRIM:
 	{
-		struct super_block *sb = inode->i_sb;
+		struct super_block *sb = inode_sb(inode);
 		struct request_queue *q = bdev_get_queue(sb->s_bdev);
 		struct fstrim_range range;
 		int ret = 0;
diff --git a/fs/ocfs2/journal.c b/fs/ocfs2/journal.c
index e5dcea6cee5f..e0047816c7b7 100644
--- a/fs/ocfs2/journal.c
+++ b/fs/ocfs2/journal.c
@@ -1161,9 +1161,10 @@ static int ocfs2_force_read_journal(struct inode *inode)
 	int i;
 	u64 v_blkno, p_blkno, p_blocks, num_blocks;
 	struct buffer_head *bh = NULL;
-	struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
+	struct ocfs2_super *osb = OCFS2_SB(inode_sb(inode));
 
-	num_blocks = ocfs2_blocks_for_bytes(inode->i_sb, i_size_read(inode));
+	num_blocks = ocfs2_blocks_for_bytes(inode_sb(inode),
+					    i_size_read(inode));
 	v_blkno = 0;
 	while (v_blkno < num_blocks) {
 		status = ocfs2_extent_map_get_blocks(inode, v_blkno,
diff --git a/fs/ocfs2/journal.h b/fs/ocfs2/journal.h
index 497a4171ef61..504560ccfa94 100644
--- a/fs/ocfs2/journal.h
+++ b/fs/ocfs2/journal.h
@@ -205,7 +205,7 @@ static inline void ocfs2_start_checkpoint(struct ocfs2_super *osb)
 
 static inline void ocfs2_checkpoint_inode(struct inode *inode)
 {
-	struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
+	struct ocfs2_super *osb = OCFS2_SB(inode_sb(inode));
 
 	if (ocfs2_mount_local(osb))
 		return;
@@ -626,7 +626,7 @@ static inline int ocfs2_begin_ordered_truncate(struct inode *inode,
 					       loff_t new_size)
 {
 	return jbd2_journal_begin_ordered_truncate(
-				OCFS2_SB(inode->i_sb)->journal->j_journal,
+				OCFS2_SB(inode_sb(inode))->journal->j_journal,
 				&OCFS2_I(inode)->ip_jinode,
 				new_size);
 }
diff --git a/fs/ocfs2/localalloc.c b/fs/ocfs2/localalloc.c
index fe0d1f9571bb..579b6a5848aa 100644
--- a/fs/ocfs2/localalloc.c
+++ b/fs/ocfs2/localalloc.c
@@ -330,7 +330,7 @@ int ocfs2_load_local_alloc(struct ocfs2_super *osb)
 	}
 
 	if ((la->la_size == 0) ||
-	    (le16_to_cpu(la->la_size) > ocfs2_local_alloc_size(inode->i_sb))) {
+	    (le16_to_cpu(la->la_size) > ocfs2_local_alloc_size(inode_sb(inode)))) {
 		mlog(ML_ERROR, "Local alloc size is invalid (la_size = %u)\n",
 		     le16_to_cpu(la->la_size));
 		status = -EINVAL;
diff --git a/fs/ocfs2/locks.c b/fs/ocfs2/locks.c
index d56f0079b858..91888b521133 100644
--- a/fs/ocfs2/locks.c
+++ b/fs/ocfs2/locks.c
@@ -113,7 +113,7 @@ static int ocfs2_do_funlock(struct file *file, int cmd, struct file_lock *fl)
 int ocfs2_flock(struct file *file, int cmd, struct file_lock *fl)
 {
 	struct inode *inode = file->f_mapping->host;
-	struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
+	struct ocfs2_super *osb = OCFS2_SB(inode_sb(inode));
 
 	if (!(fl->fl_flags & FL_FLOCK))
 		return -ENOLCK;
@@ -133,7 +133,7 @@ int ocfs2_flock(struct file *file, int cmd, struct file_lock *fl)
 int ocfs2_lock(struct file *file, int cmd, struct file_lock *fl)
 {
 	struct inode *inode = file->f_mapping->host;
-	struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
+	struct ocfs2_super *osb = OCFS2_SB(inode_sb(inode));
 
 	if (!(fl->fl_flags & FL_POSIX))
 		return -ENOLCK;
diff --git a/fs/ocfs2/mmap.c b/fs/ocfs2/mmap.c
index fb9a20e3d608..83aa18171e29 100644
--- a/fs/ocfs2/mmap.c
+++ b/fs/ocfs2/mmap.c
@@ -136,7 +136,7 @@ static int ocfs2_page_mkwrite(struct vm_fault *vmf)
 	sigset_t oldset;
 	int ret;
 
-	sb_start_pagefault(inode->i_sb);
+	sb_start_pagefault(inode_sb(inode));
 	ocfs2_block_signals(&oldset);
 
 	/*
@@ -170,7 +170,7 @@ static int ocfs2_page_mkwrite(struct vm_fault *vmf)
 
 out:
 	ocfs2_unblock_signals(&oldset);
-	sb_end_pagefault(inode->i_sb);
+	sb_end_pagefault(inode_sb(inode));
 	return ret;
 }
 
diff --git a/fs/ocfs2/move_extents.c b/fs/ocfs2/move_extents.c
index 7eb3b0a6347e..c652bd0a0d8a 100644
--- a/fs/ocfs2/move_extents.c
+++ b/fs/ocfs2/move_extents.c
@@ -62,12 +62,12 @@ static int __ocfs2_move_extent(handle_t *handle,
 {
 	int ret = 0, index;
 	struct inode *inode = context->inode;
-	struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
+	struct ocfs2_super *osb = OCFS2_SB(inode_sb(inode));
 	struct ocfs2_extent_rec *rec, replace_rec;
 	struct ocfs2_path *path = NULL;
 	struct ocfs2_extent_list *el;
 	u64 ino = ocfs2_metadata_cache_owner(context->et.et_ci);
-	u64 old_blkno = ocfs2_clusters_to_blocks(inode->i_sb, p_cpos);
+	u64 old_blkno = ocfs2_clusters_to_blocks(inode_sb(inode), p_cpos);
 
 	ret = ocfs2_duplicate_clusters_by_page(handle, inode, cpos,
 					       p_cpos, new_p_cpos, len);
@@ -79,7 +79,7 @@ static int __ocfs2_move_extent(handle_t *handle,
 	memset(&replace_rec, 0, sizeof(replace_rec));
 	replace_rec.e_cpos = cpu_to_le32(cpos);
 	replace_rec.e_leaf_clusters = cpu_to_le16(len);
-	replace_rec.e_blkno = cpu_to_le64(ocfs2_clusters_to_blocks(inode->i_sb,
+	replace_rec.e_blkno = cpu_to_le64(ocfs2_clusters_to_blocks(inode_sb(inode),
 								   new_p_cpos));
 
 	path = ocfs2_new_path_from_et(&context->et);
@@ -99,7 +99,7 @@ static int __ocfs2_move_extent(handle_t *handle,
 
 	index = ocfs2_search_extent_list(el, cpos);
 	if (index == -1) {
-		ret = ocfs2_error(inode->i_sb,
+		ret = ocfs2_error(inode_sb(inode),
 				  "Inode %llu has an extent at cpos %u which can no longer be found\n",
 				  (unsigned long long)ino, cpos);
 		goto out;
@@ -173,7 +173,7 @@ static int ocfs2_lock_allocators_move_extents(struct inode *inode,
 {
 	int ret, num_free_extents;
 	unsigned int max_recs_needed = 2 * extents_to_split + clusters_to_move;
-	struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
+	struct ocfs2_super *osb = OCFS2_SB(inode_sb(inode));
 
 	num_free_extents = ocfs2_num_free_extents(et);
 	if (num_free_extents < 0) {
@@ -228,11 +228,11 @@ static int ocfs2_defrag_extent(struct ocfs2_move_extents_context *context,
 	int ret, credits = 0, extra_blocks = 0, partial = context->partial;
 	handle_t *handle;
 	struct inode *inode = context->inode;
-	struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
+	struct ocfs2_super *osb = OCFS2_SB(inode_sb(inode));
 	struct inode *tl_inode = osb->osb_tl_inode;
 	struct ocfs2_refcount_tree *ref_tree = NULL;
 	u32 new_phys_cpos, new_len;
-	u64 phys_blkno = ocfs2_clusters_to_blocks(inode->i_sb, phys_cpos);
+	u64 phys_blkno = ocfs2_clusters_to_blocks(inode_sb(inode), phys_cpos);
 
 	if ((ext_flags & OCFS2_EXT_REFCOUNTED) && *len) {
 		BUG_ON(!ocfs2_is_refcount_inode(inode));
@@ -327,7 +327,8 @@ static int ocfs2_defrag_extent(struct ocfs2_move_extents_context *context,
 	 * Here we should write the new page out first if we are
 	 * in write-back mode.
 	 */
-	ret = ocfs2_cow_sync_writeback(inode->i_sb, context->inode, cpos, *len);
+	ret = ocfs2_cow_sync_writeback(inode_sb(inode), context->inode, cpos,
+				       *len);
 	if (ret)
 		mlog_errno(ret);
 
@@ -367,7 +368,7 @@ static int ocfs2_find_victim_alloc_group(struct inode *inode,
 	u64 blkno;
 	char namebuf[40];
 
-	struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
+	struct ocfs2_super *osb = OCFS2_SB(inode_sb(inode));
 	struct buffer_head *ac_bh = NULL, *gd_bh = NULL;
 	struct ocfs2_chain_list *cl;
 	struct ocfs2_chain_rec *rec;
@@ -394,7 +395,7 @@ static int ocfs2_find_victim_alloc_group(struct inode *inode,
 
 	if (type == GLOBAL_BITMAP_SYSTEM_INODE)
 		bits_per_unit = osb->s_clustersize_bits -
-					inode->i_sb->s_blocksize_bits;
+					inode_sb(inode)->s_blocksize_bits;
 	/*
 	 * 'vict_blkno' was out of the valid range.
 	 */
@@ -468,14 +469,14 @@ static int ocfs2_validate_and_adjust_move_goal(struct inode *inode,
 
 	struct buffer_head *gd_bh = NULL;
 	struct ocfs2_group_desc *bg;
-	struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
+	struct ocfs2_super *osb = OCFS2_SB(inode_sb(inode));
 	int c_to_b = 1 << (osb->s_clustersize_bits -
-					inode->i_sb->s_blocksize_bits);
+					inode_sb(inode)->s_blocksize_bits);
 
 	/*
 	 * make goal become cluster aligned.
 	 */
-	range->me_goal = ocfs2_block_to_cluster_start(inode->i_sb,
+	range->me_goal = ocfs2_block_to_cluster_start(inode_sb(inode),
 						      range->me_goal);
 	/*
 	 * validate goal sits within global_bitmap, and return the victim
@@ -524,7 +525,7 @@ static void ocfs2_probe_alloc_group(struct inode *inode, struct buffer_head *bh,
 {
 	int i, used, last_free_bits = 0, base_bit = *goal_bit;
 	struct ocfs2_group_desc *gd = (struct ocfs2_group_desc *)bh->b_data;
-	u32 base_cpos = ocfs2_blocks_to_clusters(inode->i_sb,
+	u32 base_cpos = ocfs2_blocks_to_clusters(inode_sb(inode),
 						 le64_to_cpu(gd->bg_blkno));
 
 	for (i = base_bit; i < le16_to_cpu(gd->bg_bits); i++) {
@@ -564,18 +565,18 @@ static int ocfs2_move_extent(struct ocfs2_move_extents_context *context,
 	int ret, credits = 0, extra_blocks = 0, goal_bit = 0;
 	handle_t *handle;
 	struct inode *inode = context->inode;
-	struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
+	struct ocfs2_super *osb = OCFS2_SB(inode_sb(inode));
 	struct inode *tl_inode = osb->osb_tl_inode;
 	struct inode *gb_inode = NULL;
 	struct buffer_head *gb_bh = NULL;
 	struct buffer_head *gd_bh = NULL;
 	struct ocfs2_group_desc *gd;
 	struct ocfs2_refcount_tree *ref_tree = NULL;
-	u32 move_max_hop = ocfs2_blocks_to_clusters(inode->i_sb,
+	u32 move_max_hop = ocfs2_blocks_to_clusters(inode_sb(inode),
 						    context->range->me_threshold);
 	u64 phys_blkno, new_phys_blkno;
 
-	phys_blkno = ocfs2_clusters_to_blocks(inode->i_sb, phys_cpos);
+	phys_blkno = ocfs2_clusters_to_blocks(inode_sb(inode), phys_cpos);
 
 	if ((ext_flags & OCFS2_EXT_REFCOUNTED) && len) {
 		BUG_ON(!ocfs2_is_refcount_inode(inode));
@@ -643,7 +644,8 @@ static int ocfs2_move_extent(struct ocfs2_move_extents_context *context,
 		goto out_unlock_tl_inode;
 	}
 
-	new_phys_blkno = ocfs2_clusters_to_blocks(inode->i_sb, *new_phys_cpos);
+	new_phys_blkno = ocfs2_clusters_to_blocks(inode_sb(inode),
+						  *new_phys_cpos);
 	ret = ocfs2_find_victim_alloc_group(inode, new_phys_blkno,
 					    GLOBAL_BITMAP_SYSTEM_INODE,
 					    OCFS2_INVALID_SLOT,
@@ -693,7 +695,8 @@ static int ocfs2_move_extent(struct ocfs2_move_extents_context *context,
 	 * Here we should write the new page out first if we are
 	 * in write-back mode.
 	 */
-	ret = ocfs2_cow_sync_writeback(inode->i_sb, context->inode, cpos, len);
+	ret = ocfs2_cow_sync_writeback(inode_sb(inode), context->inode, cpos,
+				       len);
 	if (ret)
 		mlog_errno(ret);
 
@@ -762,7 +765,7 @@ static int __ocfs2_move_extents_range(struct buffer_head *di_bh,
 	struct inode *inode = context->inode;
 	struct ocfs2_dinode *di = (struct ocfs2_dinode *)di_bh->b_data;
 	struct ocfs2_move_extents *range = context->range;
-	struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
+	struct ocfs2_super *osb = OCFS2_SB(inode_sb(inode));
 
 	if ((i_size_read(inode) == 0) || (range->me_len == 0))
 		return 0;
@@ -801,7 +804,7 @@ static int __ocfs2_move_extents_range(struct buffer_head *di_bh,
 		if (defrag_thresh <= 1)
 			goto done;
 	} else
-		new_phys_cpos = ocfs2_blocks_to_clusters(inode->i_sb,
+		new_phys_cpos = ocfs2_blocks_to_clusters(inode_sb(inode),
 							 range->me_goal);
 
 	mlog(0, "Inode: %llu, start: %llu, len: %llu, cstart: %u, clen: %u, "
@@ -894,7 +897,7 @@ static int ocfs2_move_extents(struct ocfs2_move_extents_context *context)
 	struct inode *inode = context->inode;
 	struct ocfs2_dinode *di;
 	struct buffer_head *di_bh = NULL;
-	struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
+	struct ocfs2_super *osb = OCFS2_SB(inode_sb(inode));
 
 	if (ocfs2_is_hard_readonly(osb) || ocfs2_is_soft_readonly(osb))
 		return -EROFS;
diff --git a/fs/ocfs2/namei.c b/fs/ocfs2/namei.c
index c801eddc4bf3..5e8eaf059b93 100644
--- a/fs/ocfs2/namei.c
+++ b/fs/ocfs2/namei.c
@@ -139,7 +139,7 @@ static struct dentry *ocfs2_lookup(struct inode *dir, struct dentry *dentry,
 	if (status < 0)
 		goto bail_add;
 
-	inode = ocfs2_iget(OCFS2_SB(dir->i_sb), blkno, 0, 0);
+	inode = ocfs2_iget(OCFS2_SB(inode_sb(dir)), blkno, 0, 0);
 	if (IS_ERR(inode)) {
 		ret = ERR_PTR(-EACCES);
 		goto bail_unlock;
@@ -201,7 +201,7 @@ static struct inode *ocfs2_get_init_inode(struct inode *dir, umode_t mode)
 	struct inode *inode;
 	int status;
 
-	inode = new_inode(dir->i_sb);
+	inode = new_inode(inode_sb(dir));
 	if (!inode) {
 		mlog(ML_ERROR, "new_inode failed!\n");
 		return ERR_PTR(-ENOMEM);
@@ -273,7 +273,7 @@ static int ocfs2_mknod(struct inode *dir,
 	}
 
 	/* get our super block */
-	osb = OCFS2_SB(dir->i_sb);
+	osb = OCFS2_SB(inode_sb(dir));
 
 	status = ocfs2_inode_lock(dir, &parent_fe_bh, 1);
 	if (status < 0) {
@@ -512,7 +512,7 @@ static int __ocfs2_mknod_locked(struct inode *dir,
 				u64 fe_blkno, u64 suballoc_loc, u16 suballoc_bit)
 {
 	int status = 0;
-	struct ocfs2_super *osb = OCFS2_SB(dir->i_sb);
+	struct ocfs2_super *osb = OCFS2_SB(inode_sb(dir));
 	struct ocfs2_dinode *fe = NULL;
 	struct ocfs2_extent_list *fel;
 	u16 feat;
@@ -696,7 +696,7 @@ static int ocfs2_link(struct dentry *old_dentry,
 	struct buffer_head *old_dir_bh = NULL;
 	struct buffer_head *parent_fe_bh = NULL;
 	struct ocfs2_dinode *fe = NULL;
-	struct ocfs2_super *osb = OCFS2_SB(dir->i_sb);
+	struct ocfs2_super *osb = OCFS2_SB(inode_sb(dir));
 	struct ocfs2_dir_lookup_result lookup = { NULL, };
 	sigset_t oldset;
 	u64 old_de_ino;
@@ -885,7 +885,7 @@ static int ocfs2_unlink(struct inode *dir,
 	bool is_unlinkable = false;
 	struct inode *inode = d_inode(dentry);
 	struct inode *orphan_dir = NULL;
-	struct ocfs2_super *osb = OCFS2_SB(dir->i_sb);
+	struct ocfs2_super *osb = OCFS2_SB(inode_sb(dir));
 	u64 blkno;
 	struct ocfs2_dinode *fe = NULL;
 	struct buffer_head *fe_bh = NULL;
@@ -1253,7 +1253,7 @@ static int ocfs2_rename(struct inode *old_dir,
 		goto bail;
 	}
 
-	osb = OCFS2_SB(old_dir->i_sb);
+	osb = OCFS2_SB(inode_sb(old_dir));
 
 	if (new_inode) {
 		if (!igrab(new_inode))
@@ -1829,7 +1829,7 @@ static int ocfs2_symlink(struct inode *dir,
 		goto bail;
 	}
 
-	sb = dir->i_sb;
+	sb = inode_sb(dir);
 	osb = OCFS2_SB(sb);
 
 	l = strlen(symname) + 1;
@@ -2134,7 +2134,7 @@ static int __ocfs2_prepare_orphan_dir(struct inode *orphan_dir_inode,
 				      bool dio)
 {
 	int ret;
-	struct ocfs2_super *osb = OCFS2_SB(orphan_dir_inode->i_sb);
+	struct ocfs2_super *osb = OCFS2_SB(inode_sb(orphan_dir_inode));
 	int namelen = dio ?
 			(OCFS2_DIO_ORPHAN_PREFIX_LEN + OCFS2_ORPHAN_NAMELEN) :
 			OCFS2_ORPHAN_NAMELEN;
@@ -2434,7 +2434,7 @@ static int ocfs2_prep_new_orphaned_file(struct inode *dir,
 {
 	int ret;
 	u64 di_blkno;
-	struct ocfs2_super *osb = OCFS2_SB(dir->i_sb);
+	struct ocfs2_super *osb = OCFS2_SB(inode_sb(dir));
 	struct inode *orphan_dir = NULL;
 	struct buffer_head *orphan_dir_bh = NULL;
 	struct ocfs2_alloc_context *inode_ac = NULL;
@@ -2500,7 +2500,7 @@ int ocfs2_create_inode_in_orphan(struct inode *dir,
 	int status, did_quota_inode = 0;
 	struct inode *inode = NULL;
 	struct inode *orphan_dir = NULL;
-	struct ocfs2_super *osb = OCFS2_SB(dir->i_sb);
+	struct ocfs2_super *osb = OCFS2_SB(inode_sb(dir));
 	struct ocfs2_dinode *di = NULL;
 	handle_t *handle = NULL;
 	char orphan_name[OCFS2_ORPHAN_NAMELEN + 1];
@@ -2773,7 +2773,7 @@ int ocfs2_mv_orphaned_inode_to_new(struct inode *dir,
 	int status = 0;
 	struct buffer_head *parent_di_bh = NULL;
 	handle_t *handle = NULL;
-	struct ocfs2_super *osb = OCFS2_SB(dir->i_sb);
+	struct ocfs2_super *osb = OCFS2_SB(inode_sb(dir));
 	struct ocfs2_dinode *dir_di, *di;
 	struct inode *orphan_dir_inode = NULL;
 	struct buffer_head *orphan_dir_bh = NULL;
diff --git a/fs/ocfs2/ocfs2.h b/fs/ocfs2/ocfs2.h
index 6867eef2e06b..ec6501f88b75 100644
--- a/fs/ocfs2/ocfs2.h
+++ b/fs/ocfs2/ocfs2.h
@@ -485,7 +485,7 @@ static inline int ocfs2_should_order_data(struct inode *inode)
 {
 	if (!S_ISREG(inode->i_mode))
 		return 0;
-	if (OCFS2_SB(inode->i_sb)->s_mount_opt & OCFS2_MOUNT_DATA_WRITEBACK)
+	if (OCFS2_SB(inode_sb(inode))->s_mount_opt & OCFS2_MOUNT_DATA_WRITEBACK)
 		return 0;
 	return 1;
 }
diff --git a/fs/ocfs2/quota_global.c b/fs/ocfs2/quota_global.c
index 7a922190a8c7..aa80eb17f73a 100644
--- a/fs/ocfs2/quota_global.c
+++ b/fs/ocfs2/quota_global.c
@@ -638,7 +638,7 @@ static void qsync_work_fn(struct work_struct *work)
 	struct ocfs2_mem_dqinfo *oinfo = container_of(work,
 						      struct ocfs2_mem_dqinfo,
 						      dqi_sync_work.work);
-	struct super_block *sb = oinfo->dqi_gqinode->i_sb;
+	struct super_block *sb = inode_sb(oinfo->dqi_gqinode);
 
 	/*
 	 * We have to be careful here not to deadlock on s_umount as umount
diff --git a/fs/ocfs2/quota_local.c b/fs/ocfs2/quota_local.c
index 16c42ed0dca8..25e59756fec1 100644
--- a/fs/ocfs2/quota_local.c
+++ b/fs/ocfs2/quota_local.c
@@ -94,7 +94,7 @@ static int ol_dqblk_chunk_off(struct super_block *sb, int c, loff_t off)
 static int ocfs2_modify_bh(struct inode *inode, struct buffer_head *bh,
 		void (*modify)(struct buffer_head *, void *), void *private)
 {
-	struct super_block *sb = inode->i_sb;
+	struct super_block *sb = inode_sb(inode);
 	handle_t *handle;
 	int status;
 
@@ -137,8 +137,8 @@ static int ocfs2_read_quota_block(struct inode *inode, u64 v_block,
 	int rc = 0;
 	struct buffer_head *tmp = *bh;
 
-	if (i_size_read(inode) >> inode->i_sb->s_blocksize_bits <= v_block) {
-		ocfs2_error(inode->i_sb,
+	if (i_size_read(inode) >> inode_sb(inode)->s_blocksize_bits <= v_block) {
+		ocfs2_error(inode_sb(inode),
 			    "Quota file %llu is probably corrupted! Requested to read block %Lu but file has size only %Lu\n",
 			    (unsigned long long)OCFS2_I(inode)->ip_blkno,
 			    (unsigned long long)v_block,
@@ -264,7 +264,7 @@ static int ocfs2_load_local_quota_bitmaps(struct inode *inode,
 		newchunk->qc_num = i;
 		newchunk->qc_headerbh = NULL;
 		status = ocfs2_read_quota_block(inode,
-				ol_quota_chunk_block(inode->i_sb, i),
+				ol_quota_chunk_block(inode_sb(inode), i),
 				&newchunk->qc_headerbh);
 		if (status) {
 			mlog_errno(status);
@@ -341,7 +341,7 @@ static int ocfs2_recovery_load_quota(struct inode *lqinode,
 				     int type,
 				     struct list_head *head)
 {
-	struct super_block *sb = lqinode->i_sb;
+	struct super_block *sb = inode_sb(lqinode);
 	struct buffer_head *hbh;
 	struct ocfs2_local_disk_chunk *dchunk;
 	int i, chunks = le32_to_cpu(ldinfo->dqi_chunks);
@@ -460,7 +460,7 @@ static int ocfs2_recover_local_quota_file(struct inode *lqinode,
 					  int type,
 					  struct ocfs2_quota_recovery *rec)
 {
-	struct super_block *sb = lqinode->i_sb;
+	struct super_block *sb = inode_sb(lqinode);
 	struct ocfs2_mem_dqinfo *oinfo = sb_dqinfo(sb, type)->dqi_priv;
 	struct ocfs2_local_disk_chunk *dchunk;
 	struct ocfs2_local_disk_dqblk *dqblk;
diff --git a/fs/ocfs2/refcounttree.c b/fs/ocfs2/refcounttree.c
index ab156e35ec00..0a7f5db63ce3 100644
--- a/fs/ocfs2/refcounttree.c
+++ b/fs/ocfs2/refcounttree.c
@@ -562,7 +562,7 @@ static int ocfs2_create_refcount_tree(struct inode *inode,
 	struct ocfs2_alloc_context *meta_ac = NULL;
 	struct ocfs2_dinode *di = (struct ocfs2_dinode *)di_bh->b_data;
 	struct ocfs2_inode_info *oi = OCFS2_I(inode);
-	struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
+	struct ocfs2_super *osb = OCFS2_SB(inode_sb(inode));
 	struct buffer_head *new_bh = NULL;
 	struct ocfs2_refcount_block *rb;
 	struct ocfs2_refcount_tree *new_tree = NULL, *tree = NULL;
@@ -610,7 +610,7 @@ static int ocfs2_create_refcount_tree(struct inode *inode,
 		goto out_commit;
 	}
 
-	new_bh = sb_getblk(inode->i_sb, first_blkno);
+	new_bh = sb_getblk(inode_sb(inode), first_blkno);
 	if (!new_bh) {
 		ret = -ENOMEM;
 		mlog_errno(ret);
@@ -627,7 +627,7 @@ static int ocfs2_create_refcount_tree(struct inode *inode,
 
 	/* Initialize ocfs2_refcount_block. */
 	rb = (struct ocfs2_refcount_block *)new_bh->b_data;
-	memset(rb, 0, inode->i_sb->s_blocksize);
+	memset(rb, 0, inode_sb(inode)->s_blocksize);
 	strcpy((void *)rb, OCFS2_REFCOUNT_BLOCK_SIGNATURE);
 	rb->rf_suballoc_slot = cpu_to_le16(meta_ac->ac_alloc_slot);
 	rb->rf_suballoc_loc = cpu_to_le64(suballoc_loc);
@@ -703,7 +703,7 @@ static int ocfs2_set_refcount_tree(struct inode *inode,
 	handle_t *handle = NULL;
 	struct ocfs2_dinode *di = (struct ocfs2_dinode *)di_bh->b_data;
 	struct ocfs2_inode_info *oi = OCFS2_I(inode);
-	struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
+	struct ocfs2_super *osb = OCFS2_SB(inode_sb(inode));
 	struct buffer_head *ref_root_bh = NULL;
 	struct ocfs2_refcount_block *rb;
 	struct ocfs2_refcount_tree *ref_tree;
@@ -765,7 +765,7 @@ int ocfs2_remove_refcount_tree(struct inode *inode, struct buffer_head *di_bh)
 	handle_t *handle = NULL;
 	struct ocfs2_dinode *di = (struct ocfs2_dinode *)di_bh->b_data;
 	struct ocfs2_inode_info *oi = OCFS2_I(inode);
-	struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
+	struct ocfs2_super *osb = OCFS2_SB(inode_sb(inode));
 	struct ocfs2_refcount_block *rb;
 	struct inode *alloc_inode = NULL;
 	struct buffer_head *alloc_bh = NULL;
@@ -2310,7 +2310,8 @@ int ocfs2_decrease_refcount(struct inode *inode,
 		goto out;
 	}
 
-	ret = ocfs2_get_refcount_tree(OCFS2_SB(inode->i_sb), ref_blkno, &tree);
+	ret = ocfs2_get_refcount_tree(OCFS2_SB(inode_sb(inode)), ref_blkno,
+				      &tree);
 	if (ret) {
 		mlog_errno(ret);
 		goto out;
@@ -2353,8 +2354,9 @@ static int ocfs2_mark_extent_refcounted(struct inode *inode,
 	trace_ocfs2_mark_extent_refcounted(OCFS2_I(inode)->ip_blkno,
 					   cpos, len, phys);
 
-	if (!ocfs2_refcount_tree(OCFS2_SB(inode->i_sb))) {
-		ret = ocfs2_error(inode->i_sb, "Inode %lu want to use refcount tree, but the feature bit is not set in the super block\n",
+	if (!ocfs2_refcount_tree(OCFS2_SB(inode_sb(inode)))) {
+		ret = ocfs2_error(inode_sb(inode),
+				  "Inode %lu want to use refcount tree, but the feature bit is not set in the super block\n",
 				  inode->i_ino);
 		goto out;
 	}
@@ -2534,17 +2536,18 @@ int ocfs2_prepare_refcount_change_for_del(struct inode *inode,
 	int ret;
 	struct buffer_head *ref_root_bh = NULL;
 	struct ocfs2_refcount_tree *tree;
-	u64 start_cpos = ocfs2_blocks_to_clusters(inode->i_sb, phys_blkno);
+	u64 start_cpos = ocfs2_blocks_to_clusters(inode_sb(inode), phys_blkno);
 
-	if (!ocfs2_refcount_tree(OCFS2_SB(inode->i_sb))) {
-		ret = ocfs2_error(inode->i_sb, "Inode %lu want to use refcount tree, but the feature bit is not set in the super block\n",
+	if (!ocfs2_refcount_tree(OCFS2_SB(inode_sb(inode)))) {
+		ret = ocfs2_error(inode_sb(inode),
+				  "Inode %lu want to use refcount tree, but the feature bit is not set in the super block\n",
 				  inode->i_ino);
 		goto out;
 	}
 
 	BUG_ON(!ocfs2_is_refcount_inode(inode));
 
-	ret = ocfs2_get_refcount_tree(OCFS2_SB(inode->i_sb),
+	ret = ocfs2_get_refcount_tree(OCFS2_SB(inode_sb(inode)),
 				      refcount_loc, &tree);
 	if (ret) {
 		mlog_errno(ret);
@@ -2558,7 +2561,7 @@ int ocfs2_prepare_refcount_change_for_del(struct inode *inode,
 		goto out;
 	}
 
-	ret = ocfs2_calc_refcount_meta_credits(inode->i_sb,
+	ret = ocfs2_calc_refcount_meta_credits(inode_sb(inode),
 					       &tree->rf_ci,
 					       ref_root_bh,
 					       start_cpos, clusters,
@@ -2646,7 +2649,7 @@ static int ocfs2_refcount_cal_cow_clusters(struct inode *inode,
 	struct ocfs2_extent_block *eb = NULL;
 	struct ocfs2_extent_rec *rec;
 	unsigned int want_clusters, rec_end = 0;
-	int contig_clusters = ocfs2_cow_contig_clusters(inode->i_sb);
+	int contig_clusters = ocfs2_cow_contig_clusters(inode_sb(inode));
 	int leaf_clusters;
 
 	BUG_ON(cpos + write_len > max_cpos);
@@ -2662,7 +2665,7 @@ static int ocfs2_refcount_cal_cow_clusters(struct inode *inode,
 		el = &eb->h_list;
 
 		if (el->l_tree_depth) {
-			ret = ocfs2_error(inode->i_sb,
+			ret = ocfs2_error(inode_sb(inode),
 					  "Inode %lu has non zero tree depth in leaf block %llu\n",
 					  inode->i_ino,
 					  (unsigned long long)eb_bh->b_blocknr);
@@ -2741,7 +2744,7 @@ static int ocfs2_refcount_cal_cow_clusters(struct inode *inode,
 			 * want_clusters to the edge of contig_clusters
 			 * to get better I/O.
 			 */
-			want_clusters = ocfs2_cow_align_length(inode->i_sb,
+			want_clusters = ocfs2_cow_align_length(inode_sb(inode),
 							       want_clusters);
 
 			if (leaf_clusters < want_clusters)
@@ -2774,7 +2777,7 @@ static int ocfs2_refcount_cal_cow_clusters(struct inode *inode,
 			 * contig_clusters of the front), we'll CoW the
 			 * entire extent.
 			 */
-			*cow_start = ocfs2_cow_align_start(inode->i_sb,
+			*cow_start = ocfs2_cow_align_start(inode_sb(inode),
 							   *cow_start, cpos);
 			*cow_len = rec_end - *cow_start;
 		} else {
@@ -2786,11 +2789,11 @@ static int ocfs2_refcount_cal_cow_clusters(struct inode *inode,
 			 * extent and goes for n*contig_clusters,
 			 * covering the entire write.
 			 */
-			*cow_start = ocfs2_cow_align_start(inode->i_sb,
+			*cow_start = ocfs2_cow_align_start(inode_sb(inode),
 							   *cow_start, cpos);
 
 			want_clusters = (cpos + write_len) - *cow_start;
-			want_clusters = ocfs2_cow_align_length(inode->i_sb,
+			want_clusters = ocfs2_cow_align_length(inode_sb(inode),
 							       want_clusters);
 			if (*cow_start + want_clusters <= rec_end)
 				*cow_len = want_clusters;
@@ -2914,7 +2917,7 @@ int ocfs2_duplicate_clusters_by_page(handle_t *handle,
 				     u32 new_cluster, u32 new_len)
 {
 	int ret = 0, partial;
-	struct super_block *sb = inode->i_sb;
+	struct super_block *sb = inode_sb(inode);
 	u64 new_block = ocfs2_clusters_to_blocks(sb, new_cluster);
 	struct page *page;
 	pgoff_t page_index;
@@ -3001,7 +3004,7 @@ int ocfs2_duplicate_clusters_by_jbd(handle_t *handle,
 				    u32 new_cluster, u32 new_len)
 {
 	int ret = 0;
-	struct super_block *sb = inode->i_sb;
+	struct super_block *sb = inode_sb(inode);
 	struct ocfs2_caching_info *ci = INODE_CACHE(inode);
 	int i, blocks = ocfs2_clusters_to_blocks(sb, new_len);
 	u64 old_block = ocfs2_clusters_to_blocks(sb, old_cluster);
@@ -3357,10 +3360,11 @@ static int ocfs2_replace_cow(struct ocfs2_cow_context *context)
 	u32 cow_start = context->cow_start, cow_len = context->cow_len;
 	u32 p_cluster, num_clusters;
 	unsigned int ext_flags;
-	struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
+	struct ocfs2_super *osb = OCFS2_SB(inode_sb(inode));
 
-	if (!ocfs2_refcount_tree(OCFS2_SB(inode->i_sb))) {
-		return ocfs2_error(inode->i_sb, "Inode %lu want to use refcount tree, but the feature bit is not set in the super block\n",
+	if (!ocfs2_refcount_tree(OCFS2_SB(inode_sb(inode)))) {
+		return ocfs2_error(inode_sb(inode),
+				   "Inode %lu want to use refcount tree, but the feature bit is not set in the super block\n",
 				   inode->i_ino);
 	}
 
@@ -3379,7 +3383,7 @@ static int ocfs2_replace_cow(struct ocfs2_cow_context *context)
 		if (cow_len < num_clusters)
 			num_clusters = cow_len;
 
-		ret = ocfs2_make_clusters_writable(inode->i_sb, context,
+		ret = ocfs2_make_clusters_writable(inode_sb(inode), context,
 						   cow_start, p_cluster,
 						   num_clusters, ext_flags);
 		if (ret) {
@@ -3410,7 +3414,7 @@ static int ocfs2_refcount_cow_hunk(struct inode *inode,
 {
 	int ret;
 	u32 cow_start = 0, cow_len = 0;
-	struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
+	struct ocfs2_super *osb = OCFS2_SB(inode_sb(inode));
 	struct ocfs2_dinode *di = (struct ocfs2_dinode *)di_bh->b_data;
 	struct buffer_head *ref_root_bh = NULL;
 	struct ocfs2_refcount_tree *ref_tree;
@@ -3604,7 +3608,7 @@ int ocfs2_refcounted_xattr_delete_need(struct inode *inode,
 		struct ocfs2_extent_tree et;
 
 		ocfs2_init_refcount_extent_tree(&et, ref_ci, ref_root_bh);
-		*credits += ocfs2_calc_extend_credits(inode->i_sb,
+		*credits += ocfs2_calc_extend_credits(inode_sb(inode),
 						      et.et_root_el);
 	}
 
@@ -3658,7 +3662,7 @@ int ocfs2_refcount_cow_xattr(struct inode *inode,
 	context->cow_duplicate_clusters = ocfs2_duplicate_clusters_by_jbd;
 	/* We need the extra credits for duplicate_clusters by jbd. */
 	context->extra_credits =
-		ocfs2_clusters_to_blocks(inode->i_sb, 1) * cow_len;
+		ocfs2_clusters_to_blocks(inode_sb(inode), 1) * cow_len;
 	context->get_clusters = ocfs2_xattr_value_get_clusters;
 	context->post_refcount = post;
 
@@ -3689,13 +3693,13 @@ int ocfs2_add_refcount_flag(struct inode *inode,
 	int ret;
 	handle_t *handle;
 	int credits = 1, ref_blocks = 0;
-	struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
+	struct ocfs2_super *osb = OCFS2_SB(inode_sb(inode));
 	struct ocfs2_alloc_context *meta_ac = NULL;
 
 	/* We need to be able to handle at least an extent tree split. */
 	ref_blocks = ocfs2_extend_meta_needed(data_et->et_root_el);
 
-	ret = ocfs2_calc_refcount_meta_credits(inode->i_sb,
+	ret = ocfs2_calc_refcount_meta_credits(inode_sb(inode),
 					       ref_ci, ref_root_bh,
 					       p_cluster, num_clusters,
 					       &ref_blocks, &credits);
@@ -3707,7 +3711,7 @@ int ocfs2_add_refcount_flag(struct inode *inode,
 	trace_ocfs2_add_refcount_flag(ref_blocks, credits);
 
 	if (ref_blocks) {
-		ret = ocfs2_reserve_new_metadata_blocks(OCFS2_SB(inode->i_sb),
+		ret = ocfs2_reserve_new_metadata_blocks(OCFS2_SB(inode_sb(inode)),
 							ref_blocks, &meta_ac);
 		if (ret) {
 			mlog_errno(ret);
@@ -3762,7 +3766,7 @@ static int ocfs2_change_ctime(struct inode *inode,
 	handle_t *handle;
 	struct ocfs2_dinode *di = (struct ocfs2_dinode *)di_bh->b_data;
 
-	handle = ocfs2_start_trans(OCFS2_SB(inode->i_sb),
+	handle = ocfs2_start_trans(OCFS2_SB(inode_sb(inode)),
 				   OCFS2_INODE_UPDATE_CREDITS);
 	if (IS_ERR(handle)) {
 		ret = PTR_ERR(handle);
@@ -3784,7 +3788,7 @@ static int ocfs2_change_ctime(struct inode *inode,
 	ocfs2_journal_dirty(handle, di_bh);
 
 out_commit:
-	ocfs2_commit_trans(OCFS2_SB(inode->i_sb), handle);
+	ocfs2_commit_trans(OCFS2_SB(inode_sb(inode)), handle);
 out:
 	return ret;
 }
@@ -3796,7 +3800,7 @@ static int ocfs2_attach_refcount_tree(struct inode *inode,
 	struct buffer_head *ref_root_bh = NULL;
 	struct ocfs2_inode_info *oi = OCFS2_I(inode);
 	struct ocfs2_dinode *di = (struct ocfs2_dinode *)di_bh->b_data;
-	struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
+	struct ocfs2_super *osb = OCFS2_SB(inode_sb(inode));
 	struct ocfs2_refcount_tree *ref_tree;
 	unsigned int ext_flags;
 	loff_t size;
@@ -3829,7 +3833,7 @@ static int ocfs2_attach_refcount_tree(struct inode *inode,
 	ocfs2_init_dinode_extent_tree(&di_et, INODE_CACHE(inode), di_bh);
 
 	size = i_size_read(inode);
-	clusters = ocfs2_clusters_for_bytes(inode->i_sb, size);
+	clusters = ocfs2_clusters_for_bytes(inode_sb(inode), size);
 
 	cpos = 0;
 	while (cpos < clusters) {
@@ -3902,10 +3906,10 @@ static int ocfs2_add_refcounted_extent(struct inode *inode,
 	int ret;
 	handle_t *handle;
 	int credits = 0;
-	struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
+	struct ocfs2_super *osb = OCFS2_SB(inode_sb(inode));
 	struct ocfs2_alloc_context *meta_ac = NULL;
 
-	ret = ocfs2_lock_refcount_allocators(inode->i_sb,
+	ret = ocfs2_lock_refcount_allocators(inode_sb(inode),
 					     p_cluster, num_clusters,
 					     et, ref_ci,
 					     ref_root_bh, &meta_ac,
@@ -3923,7 +3927,7 @@ static int ocfs2_add_refcounted_extent(struct inode *inode,
 	}
 
 	ret = ocfs2_insert_extent(handle, et, cpos,
-			ocfs2_clusters_to_blocks(inode->i_sb, p_cluster),
+			ocfs2_clusters_to_blocks(inode_sb(inode), p_cluster),
 			num_clusters, ext_flags, meta_ac);
 	if (ret) {
 		mlog_errno(ret);
@@ -3958,7 +3962,7 @@ static int ocfs2_duplicate_inline_data(struct inode *s_inode,
 {
 	int ret;
 	handle_t *handle;
-	struct ocfs2_super *osb = OCFS2_SB(s_inode->i_sb);
+	struct ocfs2_super *osb = OCFS2_SB(inode_sb(s_inode));
 	struct ocfs2_dinode *s_di = (struct ocfs2_dinode *)s_bh->b_data;
 	struct ocfs2_dinode *t_di = (struct ocfs2_dinode *)t_bh->b_data;
 
@@ -4010,7 +4014,7 @@ static int ocfs2_duplicate_extent_list(struct inode *s_inode,
 	ocfs2_init_dinode_extent_tree(&et, INODE_CACHE(t_inode), t_bh);
 
 	size = i_size_read(s_inode);
-	clusters = ocfs2_clusters_for_bytes(s_inode->i_sb, size);
+	clusters = ocfs2_clusters_for_bytes(inode_sb(s_inode), size);
 
 	cpos = 0;
 	while (cpos < clusters) {
@@ -4058,7 +4062,7 @@ static int ocfs2_complete_reflink(struct inode *s_inode,
 	struct ocfs2_dinode *di = (struct ocfs2_dinode *)t_bh->b_data;
 	loff_t size = i_size_read(s_inode);
 
-	handle = ocfs2_start_trans(OCFS2_SB(t_inode->i_sb),
+	handle = ocfs2_start_trans(OCFS2_SB(inode_sb(t_inode)),
 				   OCFS2_INODE_UPDATE_CREDITS);
 	if (IS_ERR(handle)) {
 		ret = PTR_ERR(handle);
@@ -4113,7 +4117,7 @@ static int ocfs2_complete_reflink(struct inode *s_inode,
 	ocfs2_journal_dirty(handle, t_bh);
 
 out_commit:
-	ocfs2_commit_trans(OCFS2_SB(t_inode->i_sb), handle);
+	ocfs2_commit_trans(OCFS2_SB(inode_sb(t_inode)), handle);
 	return ret;
 }
 
@@ -4126,7 +4130,7 @@ static int ocfs2_create_reflink_node(struct inode *s_inode,
 	int ret;
 	struct buffer_head *ref_root_bh = NULL;
 	struct ocfs2_cached_dealloc_ctxt dealloc;
-	struct ocfs2_super *osb = OCFS2_SB(s_inode->i_sb);
+	struct ocfs2_super *osb = OCFS2_SB(inode_sb(s_inode));
 	struct ocfs2_refcount_block *rb;
 	struct ocfs2_dinode *di = (struct ocfs2_dinode *)s_bh->b_data;
 	struct ocfs2_refcount_tree *ref_tree;
@@ -4255,7 +4259,7 @@ static int ocfs2_reflink(struct dentry *old_dentry, struct inode *dir,
 	struct buffer_head *old_bh = NULL;
 	struct inode *new_orphan_inode = NULL;
 
-	if (!ocfs2_refcount_tree(OCFS2_SB(inode->i_sb)))
+	if (!ocfs2_refcount_tree(OCFS2_SB(inode_sb(inode))))
 		return -EOPNOTSUPP;
 
 
@@ -4360,7 +4364,7 @@ static int ocfs2_vfs_reflink(struct dentry *old_dentry, struct inode *dir,
 	if (error)
 		return error;
 
-	if (dir->i_sb != inode->i_sb)
+	if (inode_sb(dir) != inode_sb(inode))
 		return -EXDEV;
 
 	/*
@@ -4416,7 +4420,7 @@ int ocfs2_reflink_ioctl(struct inode *inode,
 	struct path old_path, new_path;
 	int error;
 
-	if (!ocfs2_refcount_tree(OCFS2_SB(inode->i_sb)))
+	if (!ocfs2_refcount_tree(OCFS2_SB(inode_sb(inode))))
 		return -EOPNOTSUPP;
 
 	error = user_path_at(AT_FDCWD, oldname, 0, &old_path);
@@ -4462,7 +4466,7 @@ static int ocfs2_reflink_update_dest(struct inode *dest,
 	if (newlen <= i_size_read(dest))
 		return 0;
 
-	handle = ocfs2_start_trans(OCFS2_SB(dest->i_sb),
+	handle = ocfs2_start_trans(OCFS2_SB(inode_sb(dest)),
 				   OCFS2_INODE_UPDATE_CREDITS);
 	if (IS_ERR(handle)) {
 		ret = PTR_ERR(handle);
@@ -4484,7 +4488,7 @@ static int ocfs2_reflink_update_dest(struct inode *dest,
 	}
 
 out_commit:
-	ocfs2_commit_trans(OCFS2_SB(dest->i_sb), handle);
+	ocfs2_commit_trans(OCFS2_SB(inode_sb(dest)), handle);
 	return ret;
 }
 
@@ -4509,14 +4513,14 @@ static int ocfs2_reflink_remap_extent(struct inode *s_inode,
 	unsigned int ext_flags;
 	int ret = 0;
 
-	osb = OCFS2_SB(s_inode->i_sb);
+	osb = OCFS2_SB(inode_sb(s_inode));
 	dis = (struct ocfs2_dinode *)s_bh->b_data;
 	ocfs2_init_dinode_extent_tree(&s_et, INODE_CACHE(s_inode), s_bh);
 	ocfs2_init_dinode_extent_tree(&t_et, INODE_CACHE(t_inode), t_bh);
 
-	spos = ocfs2_bytes_to_clusters(s_inode->i_sb, pos_in);
-	tpos = ocfs2_bytes_to_clusters(t_inode->i_sb, pos_out);
-	slast = ocfs2_clusters_for_bytes(s_inode->i_sb, pos_in + len);
+	spos = ocfs2_bytes_to_clusters(inode_sb(s_inode), pos_in);
+	tpos = ocfs2_bytes_to_clusters(inode_sb(t_inode), pos_out);
+	slast = ocfs2_clusters_for_bytes(inode_sb(s_inode), pos_in + len);
 
 	while (spos < slast) {
 		if (fatal_signal_pending(current)) {
@@ -4535,8 +4539,9 @@ static int ocfs2_reflink_remap_extent(struct inode *s_inode,
 		num_clusters = min_t(u32, num_clusters, slast - spos);
 
 		/* Punch out the dest range. */
-		pstart = ocfs2_clusters_to_bytes(t_inode->i_sb, tpos);
-		plen = ocfs2_clusters_to_bytes(t_inode->i_sb, num_clusters);
+		pstart = ocfs2_clusters_to_bytes(inode_sb(t_inode), tpos);
+		plen = ocfs2_clusters_to_bytes(inode_sb(t_inode),
+					       num_clusters);
 		ret = ocfs2_remove_inode_range(t_inode, t_bh, pstart, plen);
 		if (ret) {
 			mlog_errno(ret);
@@ -4612,7 +4617,7 @@ static int ocfs2_reflink_remap_blocks(struct inode *s_inode,
 	struct ocfs2_dinode *dit;
 	int ret;
 
-	osb = OCFS2_SB(s_inode->i_sb);
+	osb = OCFS2_SB(inode_sb(s_inode));
 	dis = (struct ocfs2_dinode *)s_bh->b_data;
 	dit = (struct ocfs2_dinode *)t_bh->b_data;
 	ocfs2_init_dealloc_ctxt(&dealloc);
@@ -4811,7 +4816,7 @@ int ocfs2_reflink_remap_range(struct file *file_in,
 {
 	struct inode *inode_in = file_inode(file_in);
 	struct inode *inode_out = file_inode(file_out);
-	struct ocfs2_super *osb = OCFS2_SB(inode_in->i_sb);
+	struct ocfs2_super *osb = OCFS2_SB(inode_sb(inode_in));
 	struct buffer_head *in_bh = NULL, *out_bh = NULL;
 	bool same_inode = (inode_in == inode_out);
 	ssize_t ret;
diff --git a/fs/ocfs2/resize.c b/fs/ocfs2/resize.c
index 18451e0fab81..ae75edf88a65 100644
--- a/fs/ocfs2/resize.c
+++ b/fs/ocfs2/resize.c
@@ -63,8 +63,8 @@ static u16 ocfs2_calc_new_backup_super(struct inode *inode,
 	u64 blkno, gd_blkno, lgd_blkno = le64_to_cpu(gd->bg_blkno);
 
 	for (i = 0; i < OCFS2_MAX_BACKUP_SUPERBLOCKS; i++) {
-		blkno = ocfs2_backup_super_blkno(inode->i_sb, i);
-		cluster = ocfs2_blocks_to_clusters(inode->i_sb, blkno);
+		blkno = ocfs2_backup_super_blkno(inode_sb(inode), i);
+		cluster = ocfs2_blocks_to_clusters(inode_sb(inode), blkno);
 
 		gd_blkno = ocfs2_which_cluster_group(inode, cluster);
 		if (gd_blkno < lgd_blkno)
@@ -73,7 +73,8 @@ static u16 ocfs2_calc_new_backup_super(struct inode *inode,
 			break;
 
 		/* check if already done backup super */
-		lgd_cluster = ocfs2_blocks_to_clusters(inode->i_sb, lgd_blkno);
+		lgd_cluster = ocfs2_blocks_to_clusters(inode_sb(inode),
+						       lgd_blkno);
 		lgd_cluster += old_bg_clusters;
 		if (lgd_cluster >= cluster)
 			continue;
@@ -98,7 +99,7 @@ static int ocfs2_update_last_group_and_inode(handle_t *handle,
 					     int new_clusters)
 {
 	int ret = 0;
-	struct ocfs2_super *osb = OCFS2_SB(bm_inode->i_sb);
+	struct ocfs2_super *osb = OCFS2_SB(inode_sb(bm_inode));
 	struct ocfs2_dinode *fe = (struct ocfs2_dinode *) bm_bh->b_data;
 	struct ocfs2_chain_list *cl = &fe->id2.i_chain;
 	struct ocfs2_chain_rec *cr;
@@ -190,12 +191,12 @@ static int update_backups(struct inode * inode, u32 clusters, char *data)
 	u64 blkno;
 	struct buffer_head *backup = NULL;
 	struct ocfs2_dinode *backup_di = NULL;
-	struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
+	struct ocfs2_super *osb = OCFS2_SB(inode_sb(inode));
 
 	/* calculate the real backups we need to update. */
 	for (i = 0; i < OCFS2_MAX_BACKUP_SUPERBLOCKS; i++) {
-		blkno = ocfs2_backup_super_blkno(inode->i_sb, i);
-		cluster = ocfs2_blocks_to_clusters(inode->i_sb, blkno);
+		blkno = ocfs2_backup_super_blkno(inode_sb(inode), i);
+		cluster = ocfs2_blocks_to_clusters(inode_sb(inode), blkno);
 		if (cluster >= clusters)
 			break;
 
@@ -205,7 +206,7 @@ static int update_backups(struct inode * inode, u32 clusters, char *data)
 			break;
 		}
 
-		memcpy(backup->b_data, data, inode->i_sb->s_blocksize);
+		memcpy(backup->b_data, data, inode_sb(inode)->s_blocksize);
 
 		backup_di = (struct ocfs2_dinode *)backup->b_data;
 		backup_di->i_blkno = cpu_to_le64(blkno);
@@ -229,7 +230,7 @@ static void ocfs2_update_super_and_backups(struct inode *inode,
 	u32 clusters = 0;
 	struct buffer_head *super_bh = NULL;
 	struct ocfs2_dinode *super_di = NULL;
-	struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
+	struct ocfs2_super *osb = OCFS2_SB(inode_sb(inode));
 
 	/*
 	 * update the superblock last.
@@ -279,7 +280,7 @@ int ocfs2_group_extend(struct inode * inode, int new_clusters)
 	struct inode *main_bm_inode = NULL;
 	struct ocfs2_dinode *fe = NULL;
 	struct ocfs2_group_desc *group = NULL;
-	struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
+	struct ocfs2_super *osb = OCFS2_SB(inode_sb(inode));
 	u16 cl_bpc;
 	u32 first_new_cluster;
 	u64 lgd_blkno;
@@ -392,7 +393,7 @@ static int ocfs2_check_new_group(struct inode *inode,
 		(struct ocfs2_group_desc *)group_bh->b_data;
 	u16 cl_bpc = le16_to_cpu(di->id2.i_chain.cl_bpc);
 
-	ret = ocfs2_check_group_descriptor(inode->i_sb, di, group_bh);
+	ret = ocfs2_check_group_descriptor(inode_sb(inode), di, group_bh);
 	if (ret)
 		goto out;
 
@@ -428,7 +429,7 @@ static int ocfs2_verify_group_and_input(struct inode *inode,
 	u16 cl_count = le16_to_cpu(di->id2.i_chain.cl_count);
 	u16 cl_cpg = le16_to_cpu(di->id2.i_chain.cl_cpg);
 	u16 next_free = le16_to_cpu(di->id2.i_chain.cl_next_free_rec);
-	u32 cluster = ocfs2_blocks_to_clusters(inode->i_sb, input->group);
+	u32 cluster = ocfs2_blocks_to_clusters(inode_sb(inode), input->group);
 	u32 total_clusters = le32_to_cpu(di->i_clusters);
 	int ret = -EINVAL;
 
@@ -466,7 +467,7 @@ int ocfs2_group_add(struct inode *inode, struct ocfs2_new_group_input *input)
 	struct buffer_head *main_bm_bh = NULL;
 	struct inode *main_bm_inode = NULL;
 	struct ocfs2_dinode *fe = NULL;
-	struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
+	struct ocfs2_super *osb = OCFS2_SB(inode_sb(inode));
 	struct buffer_head *group_bh = NULL;
 	struct ocfs2_group_desc *group = NULL;
 	struct ocfs2_chain_list *cl;
diff --git a/fs/ocfs2/slot_map.c b/fs/ocfs2/slot_map.c
index d7407994f308..3c0018119153 100644
--- a/fs/ocfs2/slot_map.c
+++ b/fs/ocfs2/slot_map.c
@@ -363,7 +363,7 @@ static int ocfs2_map_slot_buffers(struct ocfs2_super *osb,
 	if (status)
 		goto bail;
 
-	blocks = ocfs2_blocks_for_bytes(si->si_inode->i_sb, bytes);
+	blocks = ocfs2_blocks_for_bytes(inode_sb(si->si_inode), bytes);
 	BUG_ON(blocks > UINT_MAX);
 	si->si_blocks = blocks;
 	if (!si->si_blocks)
diff --git a/fs/ocfs2/suballoc.c b/fs/ocfs2/suballoc.c
index d8f5f6ce99dc..01ec1d59b2d6 100644
--- a/fs/ocfs2/suballoc.c
+++ b/fs/ocfs2/suballoc.c
@@ -319,7 +319,7 @@ int ocfs2_read_group_descriptor(struct inode *inode, struct ocfs2_dinode *di,
 	if (rc)
 		goto out;
 
-	rc = ocfs2_validate_gd_parent(inode->i_sb, di, tmp, 0);
+	rc = ocfs2_validate_gd_parent(inode_sb(inode), di, tmp, 0);
 	if (rc) {
 		brelse(tmp);
 		goto out;
@@ -364,12 +364,12 @@ static int ocfs2_block_group_fill(handle_t *handle,
 				  struct ocfs2_chain_list *cl)
 {
 	int status = 0;
-	struct ocfs2_super *osb = OCFS2_SB(alloc_inode->i_sb);
+	struct ocfs2_super *osb = OCFS2_SB(inode_sb(alloc_inode));
 	struct ocfs2_group_desc *bg = (struct ocfs2_group_desc *) bg_bh->b_data;
-	struct super_block * sb = alloc_inode->i_sb;
+	struct super_block * sb = inode_sb(alloc_inode);
 
 	if (((unsigned long long) bg_bh->b_blocknr) != group_blkno) {
-		status = ocfs2_error(alloc_inode->i_sb,
+		status = ocfs2_error(inode_sb(alloc_inode),
 				     "group block (%llu) != b_blocknr (%llu)\n",
 				     (unsigned long long)group_blkno,
 				     (unsigned long long) bg_bh->b_blocknr);
@@ -504,7 +504,7 @@ static int ocfs2_block_group_grow_discontig(handle_t *handle,
 					    unsigned int min_bits)
 {
 	int status;
-	struct ocfs2_super *osb = OCFS2_SB(alloc_inode->i_sb);
+	struct ocfs2_super *osb = OCFS2_SB(inode_sb(alloc_inode));
 	struct ocfs2_group_desc *bg =
 		(struct ocfs2_group_desc *)bg_bh->b_data;
 	unsigned int needed = le16_to_cpu(cl->cl_cpg) -
@@ -600,7 +600,7 @@ ocfs2_block_group_alloc_discontig(handle_t *handle,
 	unsigned int min_bits = le16_to_cpu(cl->cl_cpg) >> 1;
 	struct buffer_head *bg_bh = NULL;
 	unsigned int alloc_rec = ocfs2_find_smallest_chain(cl);
-	struct ocfs2_super *osb = OCFS2_SB(alloc_inode->i_sb);
+	struct ocfs2_super *osb = OCFS2_SB(inode_sb(alloc_inode));
 
 	if (!ocfs2_supports_discontig_bg(osb)) {
 		status = -ENOSPC;
@@ -750,8 +750,8 @@ static int ocfs2_block_group_alloc(struct ocfs2_super *osb,
 
 	spin_lock(&OCFS2_I(alloc_inode)->ip_lock);
 	OCFS2_I(alloc_inode)->ip_clusters = le32_to_cpu(fe->i_clusters);
-	fe->i_size = cpu_to_le64(ocfs2_clusters_to_bytes(alloc_inode->i_sb,
-					     le32_to_cpu(fe->i_clusters)));
+	fe->i_size = cpu_to_le64(ocfs2_clusters_to_bytes(inode_sb(alloc_inode),
+							 le32_to_cpu(fe->i_clusters)));
 	spin_unlock(&OCFS2_I(alloc_inode)->ip_lock);
 	i_size_write(alloc_inode, le64_to_cpu(fe->i_size));
 	alloc_inode->i_blocks = ocfs2_inode_sector_count(alloc_inode);
@@ -818,7 +818,7 @@ static int ocfs2_reserve_suballoc_bits(struct ocfs2_super *osb,
 	BUG_ON(!OCFS2_IS_VALID_DINODE(fe));
 
 	if (!(fe->i_flags & cpu_to_le32(OCFS2_CHAIN_FL))) {
-		status = ocfs2_error(alloc_inode->i_sb,
+		status = ocfs2_error(inode_sb(alloc_inode),
 				     "Invalid chain allocator %llu\n",
 				     (unsigned long long)le64_to_cpu(fe->i_blkno));
 		goto bail;
@@ -1379,7 +1379,8 @@ int ocfs2_block_group_set_bits(handle_t *handle,
 
 	le16_add_cpu(&bg->bg_free_bits_count, -num_bits);
 	if (le16_to_cpu(bg->bg_free_bits_count) > le16_to_cpu(bg->bg_bits)) {
-		return ocfs2_error(alloc_inode->i_sb, "Group descriptor # %llu has bit count %u but claims %u are freed. num_bits %d\n",
+		return ocfs2_error(inode_sb(alloc_inode),
+				   "Group descriptor # %llu has bit count %u but claims %u are freed. num_bits %d\n",
 				   (unsigned long long)le64_to_cpu(bg->bg_blkno),
 				   le16_to_cpu(bg->bg_bits),
 				   le16_to_cpu(bg->bg_free_bits_count),
@@ -1496,7 +1497,7 @@ static int ocfs2_cluster_group_search(struct inode *inode,
 	int ret;
 	u64 blkoff;
 	struct ocfs2_group_desc *gd = (struct ocfs2_group_desc *) group_bh->b_data;
-	struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
+	struct ocfs2_super *osb = OCFS2_SB(inode_sb(inode));
 	unsigned int max_bits, gd_cluster_off;
 
 	BUG_ON(!ocfs2_is_cluster_bitmap(inode));
@@ -1510,7 +1511,7 @@ static int ocfs2_cluster_group_search(struct inode *inode,
 		 * update the dinode cluster count, then we don't want
 		 * to trust any clusters past it, regardless of what
 		 * the group descriptor says. */
-		gd_cluster_off = ocfs2_blocks_to_clusters(inode->i_sb,
+		gd_cluster_off = ocfs2_blocks_to_clusters(inode_sb(inode),
 							  le64_to_cpu(gd->bg_blkno));
 		if ((gd_cluster_off + max_bits) >
 		    OCFS2_I(inode)->ip_clusters) {
@@ -1521,14 +1522,14 @@ static int ocfs2_cluster_group_search(struct inode *inode,
 				OCFS2_I(inode)->ip_clusters, max_bits);
 		}
 
-		ret = ocfs2_block_group_find_clear_bits(OCFS2_SB(inode->i_sb),
+		ret = ocfs2_block_group_find_clear_bits(OCFS2_SB(inode_sb(inode)),
 							group_bh, bits_wanted,
 							max_bits, res);
 		if (ret)
 			return ret;
 
 		if (max_block) {
-			blkoff = ocfs2_clusters_to_blocks(inode->i_sb,
+			blkoff = ocfs2_clusters_to_blocks(inode_sb(inode),
 							  gd_cluster_off +
 							  res->sr_bit_offset +
 							  res->sr_bits);
@@ -1571,7 +1572,7 @@ static int ocfs2_block_group_search(struct inode *inode,
 	BUG_ON(ocfs2_is_cluster_bitmap(inode));
 
 	if (bg->bg_free_bits_count) {
-		ret = ocfs2_block_group_find_clear_bits(OCFS2_SB(inode->i_sb),
+		ret = ocfs2_block_group_find_clear_bits(OCFS2_SB(inode_sb(inode)),
 							group_bh, bits_wanted,
 							le16_to_cpu(bg->bg_bits),
 							res);
@@ -1667,7 +1668,7 @@ static void ocfs2_bg_discontig_fix_result(struct ocfs2_alloc_context *ac,
 
 	res->sr_blkno = res->sr_bg_blkno + res->sr_bit_offset;
 	res->sr_bg_blkno = 0;  /* Clear it for contig block groups */
-	if (!ocfs2_supports_discontig_bg(OCFS2_SB(ac->ac_inode->i_sb)) ||
+	if (!ocfs2_supports_discontig_bg(OCFS2_SB(inode_sb(ac->ac_inode))) ||
 	    !bg->bg_list.l_next_free_rec)
 		return;
 
@@ -1913,7 +1914,7 @@ static int ocfs2_claim_suballoc_bits(struct ocfs2_alloc_context *ac,
 
 	if (le32_to_cpu(fe->id1.bitmap1.i_used) >=
 	    le32_to_cpu(fe->id1.bitmap1.i_total)) {
-		status = ocfs2_error(ac->ac_inode->i_sb,
+		status = ocfs2_error(inode_sb(ac->ac_inode),
 				     "Chain allocator dinode %llu has %u used bits but only %u total\n",
 				     (unsigned long long)le64_to_cpu(fe->i_blkno),
 				     le32_to_cpu(fe->id1.bitmap1.i_used),
@@ -2023,7 +2024,7 @@ int ocfs2_claim_metadata(handle_t *handle,
 		mlog_errno(status);
 		goto bail;
 	}
-	atomic_inc(&OCFS2_SB(ac->ac_inode->i_sb)->alloc_stats.bg_allocs);
+	atomic_inc(&OCFS2_SB(inode_sb(ac->ac_inode))->alloc_stats.bg_allocs);
 
 	*suballoc_loc = res.sr_bg_blkno;
 	*suballoc_bit_start = res.sr_bit_offset;
@@ -2099,7 +2100,8 @@ int ocfs2_find_new_inode_loc(struct inode *dir,
 	 * The handle started here is for chain relink. Alternatively,
 	 * we could just disable relink for these calls.
 	 */
-	handle = ocfs2_start_trans(OCFS2_SB(dir->i_sb), OCFS2_SUBALLOC_ALLOC);
+	handle = ocfs2_start_trans(OCFS2_SB(inode_sb(dir)),
+				   OCFS2_SUBALLOC_ALLOC);
 	if (IS_ERR(handle)) {
 		ret = PTR_ERR(handle);
 		handle = NULL;
@@ -2125,7 +2127,7 @@ int ocfs2_find_new_inode_loc(struct inode *dir,
 	ocfs2_update_inode_fsync_trans(handle, dir, 0);
 out:
 	if (handle)
-		ocfs2_commit_trans(OCFS2_SB(dir->i_sb), handle);
+		ocfs2_commit_trans(OCFS2_SB(inode_sb(dir)), handle);
 
 	if (ret)
 		kfree(res);
@@ -2189,7 +2191,7 @@ int ocfs2_claim_new_inode_at_loc(handle_t *handle,
 	trace_ocfs2_claim_new_inode_at_loc((unsigned long long)di_blkno,
 					   res->sr_bits);
 
-	atomic_inc(&OCFS2_SB(ac->ac_inode->i_sb)->alloc_stats.bg_allocs);
+	atomic_inc(&OCFS2_SB(inode_sb(ac->ac_inode))->alloc_stats.bg_allocs);
 
 	BUG_ON(res->sr_bits != 1);
 
@@ -2231,7 +2233,7 @@ int ocfs2_claim_new_inode(handle_t *handle,
 		mlog_errno(status);
 		goto bail;
 	}
-	atomic_inc(&OCFS2_SB(ac->ac_inode->i_sb)->alloc_stats.bg_allocs);
+	atomic_inc(&OCFS2_SB(inode_sb(ac->ac_inode))->alloc_stats.bg_allocs);
 
 	BUG_ON(res.sr_bits != 1);
 
@@ -2253,13 +2255,13 @@ static inline u32 ocfs2_desc_bitmap_to_cluster_off(struct inode *inode,
 						   u64 bg_blkno,
 						   u16 bg_bit_off)
 {
-	struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
+	struct ocfs2_super *osb = OCFS2_SB(inode_sb(inode));
 	u32 cluster = 0;
 
 	BUG_ON(!ocfs2_is_cluster_bitmap(inode));
 
 	if (bg_blkno != osb->first_cluster_group_blkno)
-		cluster = ocfs2_blocks_to_clusters(inode->i_sb, bg_blkno);
+		cluster = ocfs2_blocks_to_clusters(inode_sb(inode), bg_blkno);
 	cluster += (u32) bg_bit_off;
 	return cluster;
 }
@@ -2268,7 +2270,7 @@ static inline u32 ocfs2_desc_bitmap_to_cluster_off(struct inode *inode,
  * and return that block offset. */
 u64 ocfs2_which_cluster_group(struct inode *inode, u32 cluster)
 {
-	struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
+	struct ocfs2_super *osb = OCFS2_SB(inode_sb(inode));
 	u32 group_no;
 
 	BUG_ON(!ocfs2_is_cluster_bitmap(inode));
@@ -2276,7 +2278,7 @@ u64 ocfs2_which_cluster_group(struct inode *inode, u32 cluster)
 	group_no = cluster / osb->bitmap_cpg;
 	if (!group_no)
 		return osb->first_cluster_group_blkno;
-	return ocfs2_clusters_to_blocks(inode->i_sb,
+	return ocfs2_clusters_to_blocks(inode_sb(inode),
 					group_no * osb->bitmap_cpg);
 }
 
@@ -2287,7 +2289,7 @@ static inline void ocfs2_block_to_cluster_group(struct inode *inode,
 						u64 *bg_blkno,
 						u16 *bg_bit_off)
 {
-	struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
+	struct ocfs2_super *osb = OCFS2_SB(inode_sb(inode));
 	u32 data_cluster = ocfs2_blocks_to_clusters(osb->sb, data_blkno);
 
 	BUG_ON(!ocfs2_is_cluster_bitmap(inode));
@@ -2318,7 +2320,7 @@ int __ocfs2_claim_clusters(handle_t *handle,
 	int status;
 	unsigned int bits_wanted = max_clusters;
 	struct ocfs2_suballoc_result res = { .sr_blkno = 0, };
-	struct ocfs2_super *osb = OCFS2_SB(ac->ac_inode->i_sb);
+	struct ocfs2_super *osb = OCFS2_SB(inode_sb(ac->ac_inode));
 
 	BUG_ON(ac->ac_bits_given >= ac->ac_bits_wanted);
 
@@ -2440,7 +2442,8 @@ static int ocfs2_block_group_clear_bits(handle_t *handle,
 	if (le16_to_cpu(bg->bg_free_bits_count) > le16_to_cpu(bg->bg_bits)) {
 		if (undo_fn)
 			jbd_unlock_bh_state(group_bh);
-		return ocfs2_error(alloc_inode->i_sb, "Group descriptor # %llu has bit count %u but claims %u are freed. num_bits %d\n",
+		return ocfs2_error(inode_sb(alloc_inode),
+				   "Group descriptor # %llu has bit count %u but claims %u are freed. num_bits %d\n",
 				   (unsigned long long)le64_to_cpu(bg->bg_blkno),
 				   le16_to_cpu(bg->bg_bits),
 				   le16_to_cpu(bg->bg_free_bits_count),
@@ -2571,9 +2574,9 @@ static int _ocfs2_free_clusters(handle_t *handle,
 	 * about looping on them.
 	 * This is expensive. We can safely remove once this stuff has
 	 * gotten tested really well. */
-	BUG_ON(start_blk != ocfs2_clusters_to_blocks(bitmap_inode->i_sb,
-				ocfs2_blocks_to_clusters(bitmap_inode->i_sb,
-							 start_blk)));
+	BUG_ON(start_blk != ocfs2_clusters_to_blocks(inode_sb(bitmap_inode),
+						     ocfs2_blocks_to_clusters(inode_sb(bitmap_inode),
+									      start_blk)));
 
 
 	ocfs2_block_to_cluster_group(bitmap_inode, start_blk, &bg_blkno,
@@ -2591,7 +2594,7 @@ static int _ocfs2_free_clusters(handle_t *handle,
 		goto out;
 	}
 
-	ocfs2_local_alloc_seen_free_bits(OCFS2_SB(bitmap_inode->i_sb),
+	ocfs2_local_alloc_seen_free_bits(OCFS2_SB(inode_sb(bitmap_inode)),
 					 num_clusters);
 
 out:
@@ -2691,7 +2694,7 @@ int ocfs2_lock_allocators(struct inode *inode,
 {
 	int ret = 0, num_free_extents;
 	unsigned int max_recs_needed = clusters_to_add + 2 * extents_to_split;
-	struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
+	struct ocfs2_super *osb = OCFS2_SB(inode_sb(inode));
 
 	*meta_ac = NULL;
 	if (data_ac)
diff --git a/fs/ocfs2/suballoc.h b/fs/ocfs2/suballoc.h
index 2d2501767c0c..95ad9e247205 100644
--- a/fs/ocfs2/suballoc.h
+++ b/fs/ocfs2/suballoc.h
@@ -178,7 +178,7 @@ static inline u32 ocfs2_cluster_from_desc(struct ocfs2_super *osb,
 
 static inline int ocfs2_is_cluster_bitmap(struct inode *inode)
 {
-	struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
+	struct ocfs2_super *osb = OCFS2_SB(inode_sb(inode));
 	return osb->bitmap_blkno == OCFS2_I(inode)->ip_blkno;
 }
 
diff --git a/fs/ocfs2/symlink.c b/fs/ocfs2/symlink.c
index 94cfacc9bad7..a3386fcdf699 100644
--- a/fs/ocfs2/symlink.c
+++ b/fs/ocfs2/symlink.c
@@ -72,7 +72,7 @@ static int ocfs2_fast_symlink_readpage(struct file *unused, struct page *page)
 	fe = (struct ocfs2_dinode *) bh->b_data;
 	link = (char *) fe->id2.i_symlink;
 	/* will be less than a page size */
-	len = strnlen(link, ocfs2_fast_symlink_chars(inode->i_sb));
+	len = strnlen(link, ocfs2_fast_symlink_chars(inode_sb(inode)));
 	kaddr = kmap_atomic(page);
 	memcpy(kaddr, link, len + 1);
 	kunmap_atomic(kaddr);
diff --git a/fs/ocfs2/xattr.c b/fs/ocfs2/xattr.c
index c261c1dfd374..a81dc212b215 100644
--- a/fs/ocfs2/xattr.c
+++ b/fs/ocfs2/xattr.c
@@ -88,7 +88,7 @@ struct ocfs2_xattr_set_ctxt {
 #define OCFS2_XATTR_FREE_IN_IBODY	(OCFS2_MIN_XATTR_INLINE_SIZE \
 					 - sizeof(struct ocfs2_xattr_header) \
 					 - OCFS2_XATTR_HEADER_GAP)
-#define OCFS2_XATTR_FREE_IN_BLOCK(ptr)	((ptr)->i_sb->s_blocksize \
+#define OCFS2_XATTR_FREE_IN_BLOCK(ptr)	(inode_sb((ptr))->s_blocksize \
 					 - sizeof(struct ocfs2_xattr_block) \
 					 - sizeof(struct ocfs2_xattr_header) \
 					 - OCFS2_XATTR_HEADER_GAP)
@@ -330,7 +330,7 @@ static inline u16 ocfs2_blocks_per_xattr_bucket(struct super_block *sb)
 static struct ocfs2_xattr_bucket *ocfs2_xattr_bucket_new(struct inode *inode)
 {
 	struct ocfs2_xattr_bucket *bucket;
-	int blks = ocfs2_blocks_per_xattr_bucket(inode->i_sb);
+	int blks = ocfs2_blocks_per_xattr_bucket(inode_sb(inode));
 
 	BUG_ON(blks > OCFS2_XATTR_MAX_BLOCKS_PER_BUCKET);
 
@@ -374,7 +374,7 @@ static int ocfs2_init_xattr_bucket(struct ocfs2_xattr_bucket *bucket,
 	int i, rc = 0;
 
 	for (i = 0; i < bucket->bu_blocks; i++) {
-		bucket->bu_bhs[i] = sb_getblk(bucket->bu_inode->i_sb,
+		bucket->bu_bhs[i] = sb_getblk(inode_sb(bucket->bu_inode),
 					      xb_blkno + i);
 		if (!bucket->bu_bhs[i]) {
 			rc = -ENOMEM;
@@ -410,12 +410,12 @@ static int ocfs2_read_xattr_bucket(struct ocfs2_xattr_bucket *bucket,
 			       bucket->bu_blocks, bucket->bu_bhs, 0,
 			       NULL);
 	if (!rc) {
-		spin_lock(&OCFS2_SB(bucket->bu_inode->i_sb)->osb_xattr_lock);
-		rc = ocfs2_validate_meta_ecc_bhs(bucket->bu_inode->i_sb,
+		spin_lock(&OCFS2_SB(inode_sb(bucket->bu_inode))->osb_xattr_lock);
+		rc = ocfs2_validate_meta_ecc_bhs(inode_sb(bucket->bu_inode),
 						 bucket->bu_bhs,
 						 bucket->bu_blocks,
 						 &bucket_xh(bucket)->xh_check);
-		spin_unlock(&OCFS2_SB(bucket->bu_inode->i_sb)->osb_xattr_lock);
+		spin_unlock(&OCFS2_SB(inode_sb(bucket->bu_inode))->osb_xattr_lock);
 		if (rc)
 			mlog_errno(rc);
 	}
@@ -449,11 +449,11 @@ static void ocfs2_xattr_bucket_journal_dirty(handle_t *handle,
 {
 	int i;
 
-	spin_lock(&OCFS2_SB(bucket->bu_inode->i_sb)->osb_xattr_lock);
-	ocfs2_compute_meta_ecc_bhs(bucket->bu_inode->i_sb,
+	spin_lock(&OCFS2_SB(inode_sb(bucket->bu_inode))->osb_xattr_lock);
+	ocfs2_compute_meta_ecc_bhs(inode_sb(bucket->bu_inode),
 				   bucket->bu_bhs, bucket->bu_blocks,
 				   &bucket_xh(bucket)->xh_check);
-	spin_unlock(&OCFS2_SB(bucket->bu_inode->i_sb)->osb_xattr_lock);
+	spin_unlock(&OCFS2_SB(inode_sb(bucket->bu_inode))->osb_xattr_lock);
 
 	for (i = 0; i < bucket->bu_blocks; i++)
 		ocfs2_journal_dirty(handle, bucket->bu_bhs[i]);
@@ -463,7 +463,7 @@ static void ocfs2_xattr_bucket_copy_data(struct ocfs2_xattr_bucket *dest,
 					 struct ocfs2_xattr_bucket *src)
 {
 	int i;
-	int blocksize = src->bu_inode->i_sb->s_blocksize;
+	int blocksize = inode_sb(src->bu_inode)->s_blocksize;
 
 	BUG_ON(dest->bu_blocks != src->bu_blocks);
 	BUG_ON(dest->bu_inode != src->bu_inode);
@@ -552,7 +552,7 @@ static u32 ocfs2_xattr_name_hash(struct inode *inode,
 				 int name_len)
 {
 	/* Get hash value of uuid from super block */
-	u32 hash = OCFS2_SB(inode->i_sb)->uuid_hash;
+	u32 hash = OCFS2_SB(inode_sb(inode))->uuid_hash;
 	int i;
 
 	/* hash extended attribute name */
@@ -590,7 +590,7 @@ int ocfs2_calc_security_init(struct inode *dir,
 			     struct ocfs2_alloc_context **xattr_ac)
 {
 	int ret = 0;
-	struct ocfs2_super *osb = OCFS2_SB(dir->i_sb);
+	struct ocfs2_super *osb = OCFS2_SB(inode_sb(dir));
 	int s_size = ocfs2_xattr_entry_real_size(strlen(si->name),
 						 si->value_len);
 
@@ -599,7 +599,7 @@ int ocfs2_calc_security_init(struct inode *dir,
 	 * 256(name) + 80(value) + 16(entry) = 352 bytes,
 	 * So reserve one metadata block for it is ok.
 	 */
-	if (dir->i_sb->s_blocksize == OCFS2_MIN_BLOCKSIZE ||
+	if (inode_sb(dir)->s_blocksize == OCFS2_MIN_BLOCKSIZE ||
 	    s_size > OCFS2_XATTR_FREE_IN_IBODY) {
 		ret = ocfs2_reserve_new_metadata_blocks(osb, 1, xattr_ac);
 		if (ret) {
@@ -611,10 +611,10 @@ int ocfs2_calc_security_init(struct inode *dir,
 
 	/* reserve clusters for xattr value which will be set in B tree*/
 	if (si->value_len > OCFS2_XATTR_INLINE_SIZE) {
-		int new_clusters = ocfs2_clusters_for_bytes(dir->i_sb,
+		int new_clusters = ocfs2_clusters_for_bytes(inode_sb(dir),
 							    si->value_len);
 
-		*xattr_credits += ocfs2_clusters_to_blocks(dir->i_sb,
+		*xattr_credits += ocfs2_clusters_to_blocks(inode_sb(dir),
 							   new_clusters);
 		*want_clusters += new_clusters;
 	}
@@ -630,7 +630,7 @@ int ocfs2_calc_xattr_init(struct inode *dir,
 			  int *want_meta)
 {
 	int ret = 0;
-	struct ocfs2_super *osb = OCFS2_SB(dir->i_sb);
+	struct ocfs2_super *osb = OCFS2_SB(inode_sb(dir));
 	int s_size = 0, a_size = 0, acl_len = 0, new_clusters;
 
 	if (si->enable)
@@ -669,17 +669,17 @@ int ocfs2_calc_xattr_init(struct inode *dir,
 	 * we choose to reserve the entire inline area for
 	 * directory contents and force an external xattr block.
 	 */
-	if (dir->i_sb->s_blocksize == OCFS2_MIN_BLOCKSIZE ||
+	if (inode_sb(dir)->s_blocksize == OCFS2_MIN_BLOCKSIZE ||
 	    (S_ISDIR(mode) && ocfs2_supports_inline_data(osb)) ||
 	    (s_size + a_size) > OCFS2_XATTR_FREE_IN_IBODY) {
 		*want_meta = *want_meta + 1;
 		*xattr_credits += OCFS2_XATTR_BLOCK_CREATE_CREDITS;
 	}
 
-	if (dir->i_sb->s_blocksize == OCFS2_MIN_BLOCKSIZE &&
+	if (inode_sb(dir)->s_blocksize == OCFS2_MIN_BLOCKSIZE &&
 	    (s_size + a_size) > OCFS2_XATTR_FREE_IN_BLOCK(dir)) {
 		*want_clusters += 1;
-		*xattr_credits += ocfs2_blocks_per_xattr_bucket(dir->i_sb);
+		*xattr_credits += ocfs2_blocks_per_xattr_bucket(inode_sb(dir));
 	}
 
 	/*
@@ -687,9 +687,9 @@ int ocfs2_calc_xattr_init(struct inode *dir,
 	 * and have to be set outside
 	 */
 	if (si->enable && si->value_len > OCFS2_XATTR_INLINE_SIZE) {
-		new_clusters = ocfs2_clusters_for_bytes(dir->i_sb,
+		new_clusters = ocfs2_clusters_for_bytes(inode_sb(dir),
 							si->value_len);
-		*xattr_credits += ocfs2_clusters_to_blocks(dir->i_sb,
+		*xattr_credits += ocfs2_clusters_to_blocks(inode_sb(dir),
 							   new_clusters);
 		*want_clusters += new_clusters;
 	}
@@ -697,8 +697,9 @@ int ocfs2_calc_xattr_init(struct inode *dir,
 	    acl_len > OCFS2_XATTR_INLINE_SIZE) {
 		/* for directory, it has DEFAULT and ACCESS two types of acls */
 		new_clusters = (S_ISDIR(mode) ? 2 : 1) *
-				ocfs2_clusters_for_bytes(dir->i_sb, acl_len);
-		*xattr_credits += ocfs2_clusters_to_blocks(dir->i_sb,
+				ocfs2_clusters_for_bytes(inode_sb(dir),
+							 acl_len);
+		*xattr_credits += ocfs2_clusters_to_blocks(inode_sb(dir),
 							   new_clusters);
 		*want_clusters += new_clusters;
 	}
@@ -756,7 +757,7 @@ static int ocfs2_xattr_extend_allocation(struct inode *inode,
 			 */
 			BUG_ON(why == RESTART_META);
 
-			credits = ocfs2_calc_extend_credits(inode->i_sb,
+			credits = ocfs2_calc_extend_credits(inode_sb(inode),
 							    &vb->vb_xv->xr_list);
 			status = ocfs2_extend_trans(handle, credits);
 			if (status < 0) {
@@ -777,7 +778,7 @@ static int __ocfs2_remove_xattr_range(struct inode *inode,
 				      struct ocfs2_xattr_set_ctxt *ctxt)
 {
 	int ret;
-	u64 phys_blkno = ocfs2_clusters_to_blocks(inode->i_sb, phys_cpos);
+	u64 phys_blkno = ocfs2_clusters_to_blocks(inode_sb(inode), phys_cpos);
 	handle_t *handle = ctxt->handle;
 	struct ocfs2_extent_tree et;
 
@@ -802,7 +803,7 @@ static int __ocfs2_remove_xattr_range(struct inode *inode,
 
 	if (ext_flags & OCFS2_EXT_REFCOUNTED)
 		ret = ocfs2_decrease_refcount(inode, handle,
-					ocfs2_blocks_to_clusters(inode->i_sb,
+					ocfs2_blocks_to_clusters(inode_sb(inode),
 								 phys_blkno),
 					len, ctxt->meta_ac, &ctxt->dealloc, 1);
 	else
@@ -851,7 +852,7 @@ static int ocfs2_xattr_shrink_size(struct inode *inode,
 			goto out;
 		}
 
-		block = ocfs2_clusters_to_blocks(inode->i_sb, phys_cpos);
+		block = ocfs2_clusters_to_blocks(inode_sb(inode), phys_cpos);
 		ocfs2_remove_xattr_clusters_from_cache(INODE_CACHE(inode),
 						       block, alloc_size);
 		cpos += alloc_size;
@@ -868,7 +869,7 @@ static int ocfs2_xattr_value_truncate(struct inode *inode,
 				      struct ocfs2_xattr_set_ctxt *ctxt)
 {
 	int ret;
-	u32 new_clusters = ocfs2_clusters_for_bytes(inode->i_sb, len);
+	u32 new_clusters = ocfs2_clusters_for_bytes(inode_sb(inode), len);
 	u32 old_clusters = le32_to_cpu(vb->vb_xv->xr_clusters);
 
 	if (new_clusters == old_clusters)
@@ -949,7 +950,7 @@ static int ocfs2_xattr_list_entries(struct inode *inode,
 		name = (const char *)header +
 			le16_to_cpu(entry->xe_name_offset);
 
-		ret = ocfs2_xattr_list_entry(inode->i_sb,
+		ret = ocfs2_xattr_list_entry(inode_sb(inode),
 					     buffer, buffer_size,
 					     &result, type, name,
 					     entry->xe_name_len);
@@ -967,8 +968,8 @@ int ocfs2_has_inline_xattr_value_outside(struct inode *inode,
 	int i;
 
 	xh = (struct ocfs2_xattr_header *)
-		 ((void *)di + inode->i_sb->s_blocksize -
-		 le16_to_cpu(di->i_xattr_inline_size));
+		 ((void *)di + inode_sb(inode)->s_blocksize -
+		  le16_to_cpu(di->i_xattr_inline_size));
 
 	for (i = 0; i < le16_to_cpu(xh->xh_count); i++)
 		if (!ocfs2_xattr_is_local(&xh->xh_entries[i]))
@@ -990,8 +991,8 @@ static int ocfs2_xattr_ibody_list(struct inode *inode,
 		return ret;
 
 	header = (struct ocfs2_xattr_header *)
-		 ((void *)di + inode->i_sb->s_blocksize -
-		 le16_to_cpu(di->i_xattr_inline_size));
+		 ((void *)di + inode_sb(inode)->s_blocksize -
+		  le16_to_cpu(di->i_xattr_inline_size));
 
 	ret = ocfs2_xattr_list_entries(inode, header, buffer, buffer_size);
 
@@ -1120,8 +1121,8 @@ static int ocfs2_xattr_get_value_outside(struct inode *inode,
 
 	el = &xv->xr_list;
 	clusters = le32_to_cpu(xv->xr_clusters);
-	bpc = ocfs2_clusters_to_blocks(inode->i_sb, 1);
-	blocksize = inode->i_sb->s_blocksize;
+	bpc = ocfs2_clusters_to_blocks(inode_sb(inode), 1);
+	blocksize = inode_sb(inode)->s_blocksize;
 
 	cpos = 0;
 	while (cpos < clusters) {
@@ -1132,7 +1133,7 @@ static int ocfs2_xattr_get_value_outside(struct inode *inode,
 			goto out;
 		}
 
-		blkno = ocfs2_clusters_to_blocks(inode->i_sb, p_cluster);
+		blkno = ocfs2_clusters_to_blocks(inode_sb(inode), p_cluster);
 		/* Copy ocfs2_xattr_value */
 		for (i = 0; i < num_clusters * bpc; i++, blkno++) {
 			ret = ocfs2_read_block(INODE_CACHE(inode), blkno,
@@ -1174,7 +1175,7 @@ static int ocfs2_xattr_ibody_get(struct inode *inode,
 	if (!(oi->ip_dyn_features & OCFS2_INLINE_XATTR_FL))
 		return -ENODATA;
 
-	xs->end = (void *)di + inode->i_sb->s_blocksize;
+	xs->end = (void *)di + inode_sb(inode)->s_blocksize;
 	xs->header = (struct ocfs2_xattr_header *)
 			(xs->end - le16_to_cpu(di->i_xattr_inline_size));
 	xs->base = (void *)xs->header;
@@ -1251,7 +1252,7 @@ static int ocfs2_xattr_block_get(struct inode *inode,
 		i = xs->here - xs->header->xh_entries;
 
 		if (le16_to_cpu(xb->xb_flags) & OCFS2_XATTR_INDEXED) {
-			ret = ocfs2_xattr_bucket_get_name_value(inode->i_sb,
+			ret = ocfs2_xattr_bucket_get_name_value(inode_sb(inode),
 								bucket_xh(xs->bucket),
 								i,
 								&block_off,
@@ -1302,7 +1303,7 @@ int ocfs2_xattr_get_nolock(struct inode *inode,
 		.not_found = -ENODATA,
 	};
 
-	if (!ocfs2_supports_xattr(OCFS2_SB(inode->i_sb)))
+	if (!ocfs2_supports_xattr(OCFS2_SB(inode_sb(inode))))
 		return -EOPNOTSUPP;
 
 	if (!(oi->ip_dyn_features & OCFS2_HAS_XATTR_FL))
@@ -1359,10 +1360,10 @@ static int __ocfs2_xattr_set_value_outside(struct inode *inode,
 					   int value_len)
 {
 	int ret = 0, i, cp_len;
-	u16 blocksize = inode->i_sb->s_blocksize;
+	u16 blocksize = inode_sb(inode)->s_blocksize;
 	u32 p_cluster, num_clusters;
-	u32 cpos = 0, bpc = ocfs2_clusters_to_blocks(inode->i_sb, 1);
-	u32 clusters = ocfs2_clusters_for_bytes(inode->i_sb, value_len);
+	u32 cpos = 0, bpc = ocfs2_clusters_to_blocks(inode_sb(inode), 1);
+	u32 clusters = ocfs2_clusters_for_bytes(inode_sb(inode), value_len);
 	u64 blkno;
 	struct buffer_head *bh = NULL;
 	unsigned int ext_flags;
@@ -1381,7 +1382,7 @@ static int __ocfs2_xattr_set_value_outside(struct inode *inode,
 
 		BUG_ON(ext_flags & OCFS2_EXT_REFCOUNTED);
 
-		blkno = ocfs2_clusters_to_blocks(inode->i_sb, p_cluster);
+		blkno = ocfs2_clusters_to_blocks(inode_sb(inode), p_cluster);
 
 		for (i = 0; i < num_clusters * bpc; i++, blkno++) {
 			ret = ocfs2_read_block(INODE_CACHE(inode), blkno,
@@ -1732,8 +1733,8 @@ static void *ocfs2_xa_bucket_offset_pointer(struct ocfs2_xa_loc *loc,
 	int block, block_offset;
 
 	/* The header is at the front of the bucket */
-	block = offset >> loc->xl_inode->i_sb->s_blocksize_bits;
-	block_offset = offset % loc->xl_inode->i_sb->s_blocksize;
+	block = offset >> inode_sb(loc->xl_inode)->s_blocksize_bits;
+	block_offset = offset % inode_sb(loc->xl_inode)->s_blocksize;
 
 	return bucket_block(bucket, block) + block_offset;
 }
@@ -1773,7 +1774,7 @@ static int ocfs2_xa_bucket_check_space(struct ocfs2_xa_loc *loc,
 	int free_start = ocfs2_xa_get_free_start(loc);
 	int needed_space = ocfs2_xi_entry_usage(xi);
 	int size = namevalue_size_xi(xi);
-	struct super_block *sb = loc->xl_inode->i_sb;
+	struct super_block *sb = inode_sb(loc->xl_inode);
 
 	/*
 	 * Bucket storage does not reclaim name+value pairs it cannot
@@ -1855,7 +1856,7 @@ static void ocfs2_xa_bucket_add_namevalue(struct ocfs2_xa_loc *loc, int size)
 {
 	int free_start = ocfs2_xa_get_free_start(loc);
 	struct ocfs2_xattr_header *xh = loc->xl_header;
-	struct super_block *sb = loc->xl_inode->i_sb;
+	struct super_block *sb = inode_sb(loc->xl_inode);
 	int nameval_offset;
 
 	free_start = ocfs2_bucket_align_free_start(sb, free_start, size);
@@ -1870,7 +1871,7 @@ static void ocfs2_xa_bucket_fill_value_buf(struct ocfs2_xa_loc *loc,
 					   struct ocfs2_xattr_value_buf *vb)
 {
 	struct ocfs2_xattr_bucket *bucket = loc->xl_storage;
-	struct super_block *sb = loc->xl_inode->i_sb;
+	struct super_block *sb = inode_sb(loc->xl_inode);
 	int nameval_offset = le16_to_cpu(loc->xl_entry->xe_name_offset);
 	int size = namevalue_size_xe(loc->xl_entry);
 	int block_offset = nameval_offset >> sb->s_blocksize_bits;
@@ -2358,7 +2359,7 @@ static int ocfs2_lock_xattr_remove_allocators(struct inode *inode,
 		goto out;
 	}
 
-	ret = ocfs2_reserve_new_metadata_blocks(OCFS2_SB(inode->i_sb),
+	ret = ocfs2_reserve_new_metadata_blocks(OCFS2_SB(inode_sb(inode)),
 						meta_add, meta_ac);
 	if (ret)
 		mlog_errno(ret);
@@ -2374,7 +2375,7 @@ static int ocfs2_remove_value_outside(struct inode*inode,
 				      struct buffer_head *ref_root_bh)
 {
 	int ret = 0, i, ref_credits;
-	struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
+	struct ocfs2_super *osb = OCFS2_SB(inode_sb(inode));
 	struct ocfs2_xattr_set_ctxt ctxt = { NULL, NULL, };
 	void *val;
 
@@ -2441,8 +2442,8 @@ static int ocfs2_xattr_ibody_remove(struct inode *inode,
 	};
 
 	header = (struct ocfs2_xattr_header *)
-		 ((void *)di + inode->i_sb->s_blocksize -
-		 le16_to_cpu(di->i_xattr_inline_size));
+		 ((void *)di + inode_sb(inode)->s_blocksize -
+		  le16_to_cpu(di->i_xattr_inline_size));
 
 	ret = ocfs2_remove_value_outside(inode, &vb, header,
 					 ref_ci, ref_root_bh);
@@ -2494,7 +2495,7 @@ static int ocfs2_xattr_free_block(struct inode *inode,
 	struct buffer_head *xb_alloc_bh = NULL;
 	struct buffer_head *blk_bh = NULL;
 	struct ocfs2_xattr_block *xb;
-	struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
+	struct ocfs2_super *osb = OCFS2_SB(inode_sb(inode));
 	handle_t *handle;
 	int ret = 0;
 	u64 blk, bg_blkno;
@@ -2575,14 +2576,14 @@ int ocfs2_xattr_remove(struct inode *inode, struct buffer_head *di_bh)
 	handle_t *handle;
 	int ret;
 
-	if (!ocfs2_supports_xattr(OCFS2_SB(inode->i_sb)))
+	if (!ocfs2_supports_xattr(OCFS2_SB(inode_sb(inode))))
 		return 0;
 
 	if (!(oi->ip_dyn_features & OCFS2_HAS_XATTR_FL))
 		return 0;
 
 	if (ocfs2_is_refcount_inode(inode)) {
-		ret = ocfs2_lock_refcount_tree(OCFS2_SB(inode->i_sb),
+		ret = ocfs2_lock_refcount_tree(OCFS2_SB(inode_sb(inode)),
 					       le64_to_cpu(di->i_refcount_loc),
 					       1, &ref_tree, &ref_root_bh);
 		if (ret) {
@@ -2612,7 +2613,7 @@ int ocfs2_xattr_remove(struct inode *inode, struct buffer_head *di_bh)
 		}
 	}
 
-	handle = ocfs2_start_trans((OCFS2_SB(inode->i_sb)),
+	handle = ocfs2_start_trans((OCFS2_SB(inode_sb(inode))),
 				   OCFS2_INODE_UPDATE_CREDITS);
 	if (IS_ERR(handle)) {
 		ret = PTR_ERR(handle);
@@ -2636,10 +2637,11 @@ int ocfs2_xattr_remove(struct inode *inode, struct buffer_head *di_bh)
 
 	ocfs2_journal_dirty(handle, di_bh);
 out_commit:
-	ocfs2_commit_trans(OCFS2_SB(inode->i_sb), handle);
+	ocfs2_commit_trans(OCFS2_SB(inode_sb(inode)), handle);
 out:
 	if (ref_tree)
-		ocfs2_unlock_refcount_tree(OCFS2_SB(inode->i_sb), ref_tree, 1);
+		ocfs2_unlock_refcount_tree(OCFS2_SB(inode_sb(inode)),
+					   ref_tree, 1);
 	brelse(ref_root_bh);
 	return ret;
 }
@@ -2648,7 +2650,7 @@ static int ocfs2_xattr_has_space_inline(struct inode *inode,
 					struct ocfs2_dinode *di)
 {
 	struct ocfs2_inode_info *oi = OCFS2_I(inode);
-	unsigned int xattrsize = OCFS2_SB(inode->i_sb)->s_xattr_inline_size;
+	unsigned int xattrsize = OCFS2_SB(inode_sb(inode))->s_xattr_inline_size;
 	int free;
 
 	if (xattrsize < OCFS2_MIN_XATTR_INLINE_SIZE)
@@ -2658,7 +2660,7 @@ static int ocfs2_xattr_has_space_inline(struct inode *inode,
 		struct ocfs2_inline_data *idata = &di->id2.i_data;
 		free = le16_to_cpu(idata->id_count) - le64_to_cpu(di->i_size);
 	} else if (ocfs2_inode_is_fast_symlink(inode)) {
-		free = ocfs2_fast_symlink_chars(inode->i_sb) -
+		free = ocfs2_fast_symlink_chars(inode_sb(inode)) -
 			le64_to_cpu(di->i_size);
 	} else {
 		struct ocfs2_extent_list *el = &di->id2.i_list;
@@ -2688,7 +2690,7 @@ static int ocfs2_xattr_ibody_find(struct inode *inode,
 	int ret;
 	int has_space = 0;
 
-	if (inode->i_sb->s_blocksize == OCFS2_MIN_BLOCKSIZE)
+	if (inode_sb(inode)->s_blocksize == OCFS2_MIN_BLOCKSIZE)
 		return 0;
 
 	if (!(oi->ip_dyn_features & OCFS2_INLINE_XATTR_FL)) {
@@ -2700,13 +2702,13 @@ static int ocfs2_xattr_ibody_find(struct inode *inode,
 	}
 
 	xs->xattr_bh = xs->inode_bh;
-	xs->end = (void *)di + inode->i_sb->s_blocksize;
+	xs->end = (void *)di + inode_sb(inode)->s_blocksize;
 	if (oi->ip_dyn_features & OCFS2_INLINE_XATTR_FL)
 		xs->header = (struct ocfs2_xattr_header *)
 			(xs->end - le16_to_cpu(di->i_xattr_inline_size));
 	else
 		xs->header = (struct ocfs2_xattr_header *)
-			(xs->end - OCFS2_SB(inode->i_sb)->s_xattr_inline_size);
+			(xs->end - OCFS2_SB(inode_sb(inode))->s_xattr_inline_size);
 	xs->base = (void *)xs->header;
 	xs->here = xs->header->xh_entries;
 
@@ -2728,7 +2730,7 @@ static int ocfs2_xattr_ibody_init(struct inode *inode,
 	int ret;
 	struct ocfs2_inode_info *oi = OCFS2_I(inode);
 	struct ocfs2_dinode *di = (struct ocfs2_dinode *)di_bh->b_data;
-	struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
+	struct ocfs2_super *osb = OCFS2_SB(inode_sb(inode));
 	unsigned int xattrsize = osb->s_xattr_inline_size;
 
 	if (!ocfs2_xattr_has_space_inline(inode, di)) {
@@ -2783,7 +2785,7 @@ static int ocfs2_xattr_ibody_set(struct inode *inode,
 	struct ocfs2_inode_info *oi = OCFS2_I(inode);
 	struct ocfs2_xa_loc loc;
 
-	if (inode->i_sb->s_blocksize == OCFS2_MIN_BLOCKSIZE)
+	if (inode_sb(inode)->s_blocksize == OCFS2_MIN_BLOCKSIZE)
 		return -ENOSPC;
 
 	down_write(&oi->ip_alloc_sem);
@@ -2894,7 +2896,7 @@ static int ocfs2_create_xattr_block(struct inode *inode,
 		goto end;
 	}
 
-	new_bh = sb_getblk(inode->i_sb, first_blkno);
+	new_bh = sb_getblk(inode_sb(inode), first_blkno);
 	if (!new_bh) {
 		ret = -ENOMEM;
 		mlog_errno(ret);
@@ -2913,13 +2915,13 @@ static int ocfs2_create_xattr_block(struct inode *inode,
 
 	/* Initialize ocfs2_xattr_block */
 	xblk = (struct ocfs2_xattr_block *)new_bh->b_data;
-	memset(xblk, 0, inode->i_sb->s_blocksize);
+	memset(xblk, 0, inode_sb(inode)->s_blocksize);
 	strcpy((void *)xblk, OCFS2_XATTR_BLOCK_SIGNATURE);
 	xblk->xb_suballoc_slot = cpu_to_le16(ctxt->meta_ac->ac_alloc_slot);
 	xblk->xb_suballoc_loc = cpu_to_le64(suballoc_loc);
 	xblk->xb_suballoc_bit = cpu_to_le16(suballoc_bit_start);
 	xblk->xb_fs_generation =
-		cpu_to_le32(OCFS2_SB(inode->i_sb)->fs_generation);
+		cpu_to_le32(OCFS2_SB(inode_sb(inode))->fs_generation);
 	xblk->xb_blkno = cpu_to_le64(first_blkno);
 	if (indexed) {
 		struct ocfs2_xattr_tree_root *xr = &xblk->xb_attrs.xb_root;
@@ -2927,7 +2929,7 @@ static int ocfs2_create_xattr_block(struct inode *inode,
 		xr->xt_last_eb_blk = 0;
 		xr->xt_list.l_tree_depth = 0;
 		xr->xt_list.l_count = cpu_to_le16(
-					ocfs2_xattr_recs_per_xb(inode->i_sb));
+					ocfs2_xattr_recs_per_xb(inode_sb(inode)));
 		xr->xt_list.l_next_free_rec = cpu_to_le16(1);
 		xblk->xb_flags = cpu_to_le16(OCFS2_XATTR_INDEXED);
 	}
@@ -2979,7 +2981,7 @@ static int ocfs2_xattr_block_set(struct inode *inode,
 		xblk = (struct ocfs2_xattr_block *)xs->xattr_bh->b_data;
 		xs->header = &xblk->xb_attrs.xb_header;
 		xs->base = (void *)xs->header;
-		xs->end = (void *)xblk + inode->i_sb->s_blocksize;
+		xs->end = (void *)xblk + inode_sb(inode)->s_blocksize;
 		xs->here = xs->header->xh_entries;
 	} else
 		xblk = (struct ocfs2_xattr_block *)xs->xattr_bh->b_data;
@@ -3057,7 +3059,7 @@ static int ocfs2_calc_xattr_set_need(struct inode *inode,
 	struct ocfs2_xattr_value_root *xv = NULL;
 	char *base = NULL;
 	int name_offset, name_len = 0;
-	u32 new_clusters = ocfs2_clusters_for_bytes(inode->i_sb,
+	u32 new_clusters = ocfs2_clusters_for_bytes(inode_sb(inode),
 						    xi->xi_value_len);
 	u64 value_size;
 
@@ -3068,15 +3070,15 @@ static int ocfs2_calc_xattr_set_need(struct inode *inode,
 	 */
 	if (xi->xi_value_len > OCFS2_XATTR_INLINE_SIZE)
 		credits += new_clusters *
-			   ocfs2_clusters_to_blocks(inode->i_sb, 1);
+			   ocfs2_clusters_to_blocks(inode_sb(inode), 1);
 
 	if (xis->not_found && xbs->not_found) {
-		credits += ocfs2_blocks_per_xattr_bucket(inode->i_sb);
+		credits += ocfs2_blocks_per_xattr_bucket(inode_sb(inode));
 
 		if (xi->xi_value_len > OCFS2_XATTR_INLINE_SIZE) {
 			clusters_add += new_clusters;
-			credits += ocfs2_calc_extend_credits(inode->i_sb,
-							&def_xv.xv.xr_list);
+			credits += ocfs2_calc_extend_credits(inode_sb(inode),
+							     &def_xv.xv.xr_list);
 		}
 
 		goto meta_guess;
@@ -3098,12 +3100,12 @@ static int ocfs2_calc_xattr_set_need(struct inode *inode,
 		old_in_xb = 1;
 
 		if (le16_to_cpu(xb->xb_flags) & OCFS2_XATTR_INDEXED) {
-			ret = ocfs2_xattr_bucket_get_name_value(inode->i_sb,
-							bucket_xh(xbs->bucket),
-							i, &block_off,
-							&name_offset);
+			ret = ocfs2_xattr_bucket_get_name_value(inode_sb(inode),
+								bucket_xh(xbs->bucket),
+								i, &block_off,
+								&name_offset);
 			base = bucket_block(xbs->bucket, block_off);
-			credits += ocfs2_blocks_per_xattr_bucket(inode->i_sb);
+			credits += ocfs2_blocks_per_xattr_bucket(inode_sb(inode));
 		} else {
 			base = xbs->base;
 			credits += OCFS2_XATTR_BLOCK_UPDATE_CREDITS;
@@ -3119,7 +3121,7 @@ static int ocfs2_calc_xattr_set_need(struct inode *inode,
 	 */
 	if (!xi->xi_value) {
 		if (!ocfs2_xattr_is_local(xe))
-			credits += ocfs2_remove_extent_credits(inode->i_sb);
+			credits += ocfs2_remove_extent_credits(inode_sb(inode));
 
 		goto out;
 	}
@@ -3136,12 +3138,11 @@ static int ocfs2_calc_xattr_set_need(struct inode *inode,
 		 */
 		if (ocfs2_xattr_can_be_in_inode(inode, xi, xis)) {
 			clusters_add += new_clusters;
-			credits += ocfs2_remove_extent_credits(inode->i_sb) +
+			credits += ocfs2_remove_extent_credits(inode_sb(inode)) +
 				    OCFS2_INODE_UPDATE_CREDITS;
 			if (!ocfs2_xattr_is_local(xe))
-				credits += ocfs2_calc_extend_credits(
-							inode->i_sb,
-							&def_xv.xv.xr_list);
+				credits += ocfs2_calc_extend_credits(inode_sb(inode),
+								     &def_xv.xv.xr_list);
 			goto out;
 		}
 	}
@@ -3151,8 +3152,8 @@ static int ocfs2_calc_xattr_set_need(struct inode *inode,
 		u32 old_clusters = 0;
 
 		if (!ocfs2_xattr_is_local(xe)) {
-			old_clusters =	ocfs2_clusters_for_bytes(inode->i_sb,
-								 value_size);
+			old_clusters =	ocfs2_clusters_for_bytes(inode_sb(inode),
+								       value_size);
 			xv = (struct ocfs2_xattr_value_root *)
 			     (base + name_offset + name_len);
 			value_size = OCFS2_XATTR_ROOT_SIZE;
@@ -3160,12 +3161,12 @@ static int ocfs2_calc_xattr_set_need(struct inode *inode,
 			xv = &def_xv.xv;
 
 		if (old_clusters >= new_clusters) {
-			credits += ocfs2_remove_extent_credits(inode->i_sb);
+			credits += ocfs2_remove_extent_credits(inode_sb(inode));
 			goto out;
 		} else {
 			meta_add += ocfs2_extend_meta_needed(&xv->xr_list);
 			clusters_add += new_clusters - old_clusters;
-			credits += ocfs2_calc_extend_credits(inode->i_sb,
+			credits += ocfs2_calc_extend_credits(inode_sb(inode),
 							     &xv->xr_list);
 			if (value_size >= OCFS2_XATTR_ROOT_SIZE)
 				goto out;
@@ -3211,7 +3212,7 @@ static int ocfs2_calc_xattr_set_need(struct inode *inode,
 			struct ocfs2_extent_list *el =
 				 &xb->xb_attrs.xb_root.xt_list;
 			meta_add += ocfs2_extend_meta_needed(el);
-			credits += ocfs2_calc_extend_credits(inode->i_sb,
+			credits += ocfs2_calc_extend_credits(inode_sb(inode),
 							     el);
 		} else
 			credits += OCFS2_SUBALLOC_ALLOC + 1;
@@ -3224,10 +3225,10 @@ static int ocfs2_calc_xattr_set_need(struct inode *inode,
 		 * also.
 		 */
 		clusters_add += 1;
-		credits += ocfs2_blocks_per_xattr_bucket(inode->i_sb);
+		credits += ocfs2_blocks_per_xattr_bucket(inode_sb(inode));
 		if (OCFS2_XATTR_BUCKET_SIZE ==
-			OCFS2_SB(inode->i_sb)->s_clustersize) {
-			credits += ocfs2_blocks_per_xattr_bucket(inode->i_sb);
+			OCFS2_SB(inode_sb(inode))->s_clustersize) {
+			credits += ocfs2_blocks_per_xattr_bucket(inode_sb(inode));
 			clusters_add += 1;
 		}
 	} else {
@@ -3235,7 +3236,7 @@ static int ocfs2_calc_xattr_set_need(struct inode *inode,
 		if (xi->xi_value_len > OCFS2_XATTR_INLINE_SIZE) {
 			struct ocfs2_extent_list *el = &def_xv.xv.xr_list;
 			meta_add += ocfs2_extend_meta_needed(el);
-			credits += ocfs2_calc_extend_credits(inode->i_sb,
+			credits += ocfs2_calc_extend_credits(inode_sb(inode),
 							     el);
 		} else {
 			meta_add += 1;
@@ -3262,7 +3263,7 @@ static int ocfs2_init_xattr_set_ctxt(struct inode *inode,
 				     int *credits)
 {
 	int clusters_add, meta_add, ret;
-	struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
+	struct ocfs2_super *osb = OCFS2_SB(inode_sb(inode));
 
 	memset(ctxt, 0, sizeof(struct ocfs2_xattr_set_ctxt));
 
@@ -3485,7 +3486,7 @@ int ocfs2_xattr_set_handle(handle_t *handle,
 		.data_ac = data_ac,
 	};
 
-	if (!ocfs2_supports_xattr(OCFS2_SB(inode->i_sb)))
+	if (!ocfs2_supports_xattr(OCFS2_SB(inode_sb(inode))))
 		return -EOPNOTSUPP;
 
 	/*
@@ -3493,7 +3494,7 @@ int ocfs2_xattr_set_handle(handle_t *handle,
 	 * block size is too small. And we have already reserved
 	 * the credits for bucket in mknod.
 	 */
-	if (inode->i_sb->s_blocksize == OCFS2_MIN_BLOCKSIZE) {
+	if (inode_sb(inode)->s_blocksize == OCFS2_MIN_BLOCKSIZE) {
 		xbs.bucket = ocfs2_xattr_bucket_new(inode);
 		if (!xbs.bucket) {
 			mlog_errno(-ENOMEM);
@@ -3542,7 +3543,7 @@ int ocfs2_xattr_set(struct inode *inode,
 	struct buffer_head *di_bh = NULL;
 	struct ocfs2_dinode *di;
 	int ret, credits, had_lock, ref_meta = 0, ref_credits = 0;
-	struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
+	struct ocfs2_super *osb = OCFS2_SB(inode_sb(inode));
 	struct inode *tl_inode = osb->osb_tl_inode;
 	struct ocfs2_xattr_set_ctxt ctxt = { NULL, NULL, NULL, };
 	struct ocfs2_refcount_tree *ref_tree = NULL;
@@ -3564,7 +3565,7 @@ int ocfs2_xattr_set(struct inode *inode,
 		.not_found = -ENODATA,
 	};
 
-	if (!ocfs2_supports_xattr(OCFS2_SB(inode->i_sb)))
+	if (!ocfs2_supports_xattr(OCFS2_SB(inode_sb(inode))))
 		return -EOPNOTSUPP;
 
 	/*
@@ -3715,7 +3716,7 @@ static int ocfs2_xattr_get_rec(struct inode *inode,
 		el = &eb->h_list;
 
 		if (el->l_tree_depth) {
-			ret = ocfs2_error(inode->i_sb,
+			ret = ocfs2_error(inode_sb(inode),
 					  "Inode %lu has non zero tree depth in xattr tree block %llu\n",
 					  inode->i_ino,
 					  (unsigned long long)eb_bh->b_blocknr);
@@ -3733,7 +3734,8 @@ static int ocfs2_xattr_get_rec(struct inode *inode,
 	}
 
 	if (!e_blkno) {
-		ret = ocfs2_error(inode->i_sb, "Inode %lu has bad extent record (%u, %u, 0) in xattr\n",
+		ret = ocfs2_error(inode_sb(inode),
+				  "Inode %lu has bad extent record (%u, %u, 0) in xattr\n",
 				  inode->i_ino,
 				  le32_to_cpu(rec->e_cpos),
 				  ocfs2_rec_clusters(el, rec));
@@ -3785,7 +3787,7 @@ static int ocfs2_find_xe_in_bucket(struct inode *inode,
 		if (cmp)
 			continue;
 
-		ret = ocfs2_xattr_bucket_get_name_value(inode->i_sb,
+		ret = ocfs2_xattr_bucket_get_name_value(inode_sb(inode),
 							xh,
 							i,
 							&block_off,
@@ -3830,7 +3832,7 @@ static int ocfs2_xattr_bucket_find(struct inode *inode,
 	struct ocfs2_xattr_header *xh = NULL;
 	struct ocfs2_xattr_entry *xe = NULL;
 	u16 index = 0;
-	u16 blk_per_bucket = ocfs2_blocks_per_xattr_bucket(inode->i_sb);
+	u16 blk_per_bucket = ocfs2_blocks_per_xattr_bucket(inode_sb(inode));
 	int low_bucket = 0, bucket, high_bucket;
 	struct ocfs2_xattr_bucket *search;
 	u32 last_hash;
@@ -3915,7 +3917,7 @@ static int ocfs2_xattr_bucket_find(struct inode *inode,
 
 	xs->header = bucket_xh(xs->bucket);
 	xs->base = bucket_block(xs->bucket, 0);
-	xs->end = xs->base + inode->i_sb->s_blocksize;
+	xs->end = xs->base + inode_sb(inode)->s_blocksize;
 
 	if (found) {
 		xs->here = &xs->header->xh_entries[index];
@@ -3982,7 +3984,7 @@ static int ocfs2_iterate_xattr_buckets(struct inode *inode,
 				       void *para)
 {
 	int i, ret = 0;
-	u32 bpc = ocfs2_xattr_buckets_per_cluster(OCFS2_SB(inode->i_sb));
+	u32 bpc = ocfs2_xattr_buckets_per_cluster(OCFS2_SB(inode_sb(inode)));
 	u32 num_buckets = clusters * bpc;
 	struct ocfs2_xattr_bucket *bucket;
 
@@ -4066,7 +4068,7 @@ static int ocfs2_list_xattr_bucket(struct inode *inode,
 		struct ocfs2_xattr_entry *entry = &bucket_xh(bucket)->xh_entries[i];
 		type = ocfs2_xattr_get_type(entry);
 
-		ret = ocfs2_xattr_bucket_get_name_value(inode->i_sb,
+		ret = ocfs2_xattr_bucket_get_name_value(inode_sb(inode),
 							bucket_xh(bucket),
 							i,
 							&block_off,
@@ -4076,7 +4078,7 @@ static int ocfs2_list_xattr_bucket(struct inode *inode,
 
 		name = (const char *)bucket_block(bucket, block_off) +
 			new_offset;
-		ret = ocfs2_xattr_list_entry(inode->i_sb,
+		ret = ocfs2_xattr_list_entry(inode_sb(inode),
 					     xl->buffer,
 					     xl->buffer_size,
 					     &xl->result,
@@ -4196,8 +4198,8 @@ static void ocfs2_cp_xattr_block_to_bucket(struct inode *inode,
 					   struct buffer_head *xb_bh,
 					   struct ocfs2_xattr_bucket *bucket)
 {
-	int i, blocksize = inode->i_sb->s_blocksize;
-	int blks = ocfs2_blocks_per_xattr_bucket(inode->i_sb);
+	int i, blocksize = inode_sb(inode)->s_blocksize;
+	int blks = ocfs2_blocks_per_xattr_bucket(inode_sb(inode));
 	u16 offset, size, off_change;
 	struct ocfs2_xattr_entry *xe;
 	struct ocfs2_xattr_block *xb =
@@ -4271,7 +4273,7 @@ static void ocfs2_xattr_update_xattr_search(struct inode *inode,
 
 	xs->header = bucket_xh(xs->bucket);
 	xs->base = bucket_block(xs->bucket, 0);
-	xs->end = xs->base + inode->i_sb->s_blocksize;
+	xs->end = xs->base + inode_sb(inode)->s_blocksize;
 
 	if (xs->not_found)
 		return;
@@ -4327,7 +4329,7 @@ static int ocfs2_xattr_create_index_block(struct inode *inode,
 	 * we will only touch the 1st block and the last block
 	 * in the whole bucket(one for entry and one for data).
 	 */
-	blkno = ocfs2_clusters_to_blocks(inode->i_sb, bit_off);
+	blkno = ocfs2_clusters_to_blocks(inode_sb(inode), bit_off);
 
 	trace_ocfs2_xattr_create_index_block((unsigned long long)blkno);
 
@@ -4350,14 +4352,14 @@ static int ocfs2_xattr_create_index_block(struct inode *inode,
 	ocfs2_xattr_update_xattr_search(inode, xs, xb_bh);
 
 	/* Change from ocfs2_xattr_header to ocfs2_xattr_tree_root */
-	memset(&xb->xb_attrs, 0, inode->i_sb->s_blocksize -
+	memset(&xb->xb_attrs, 0, inode_sb(inode)->s_blocksize -
 	       offsetof(struct ocfs2_xattr_block, xb_attrs));
 
 	xr = &xb->xb_attrs.xb_root;
 	xr->xt_clusters = cpu_to_le32(1);
 	xr->xt_last_eb_blk = 0;
 	xr->xt_list.l_tree_depth = 0;
-	xr->xt_list.l_count = cpu_to_le16(ocfs2_xattr_recs_per_xb(inode->i_sb));
+	xr->xt_list.l_count = cpu_to_le16(ocfs2_xattr_recs_per_xb(inode_sb(inode)));
 	xr->xt_list.l_next_free_rec = cpu_to_le16(1);
 
 	xr->xt_list.l_recs[0].e_cpos = 0;
@@ -4403,7 +4405,7 @@ static int ocfs2_defrag_xattr_bucket(struct inode *inode,
 	char *entries, *buf, *bucket_buf = NULL;
 	u64 blkno = bucket_blkno(bucket);
 	u16 xh_free_start;
-	size_t blocksize = inode->i_sb->s_blocksize;
+	size_t blocksize = inode_sb(inode)->s_blocksize;
 	struct ocfs2_xattr_entry *xe;
 
 	/*
@@ -4524,7 +4526,7 @@ static int ocfs2_mv_xattr_bucket_cross_cluster(struct inode *inode,
 					       u32 *first_hash)
 {
 	int ret;
-	struct super_block *sb = inode->i_sb;
+	struct super_block *sb = inode_sb(inode);
 	int blks_per_bucket = ocfs2_blocks_per_xattr_bucket(sb);
 	int num_buckets = ocfs2_xattr_buckets_per_cluster(OCFS2_SB(sb));
 	int to_move = num_buckets / 2;
@@ -4645,7 +4647,7 @@ static int ocfs2_divide_xattr_bucket(struct inode *inode,
 	struct ocfs2_xattr_bucket *s_bucket = NULL, *t_bucket = NULL;
 	struct ocfs2_xattr_header *xh;
 	struct ocfs2_xattr_entry *xe;
-	int blocksize = inode->i_sb->s_blocksize;
+	int blocksize = inode_sb(inode)->s_blocksize;
 
 	trace_ocfs2_divide_xattr_bucket_begin((unsigned long long)blk,
 					      (unsigned long long)new_blk);
@@ -4890,8 +4892,8 @@ static int ocfs2_mv_xattr_buckets(struct inode *inode, handle_t *handle,
 				  u32 *first_hash)
 {
 	int i, ret, credits;
-	struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
-	int blks_per_bucket = ocfs2_blocks_per_xattr_bucket(inode->i_sb);
+	struct ocfs2_super *osb = OCFS2_SB(inode_sb(inode));
+	int blks_per_bucket = ocfs2_blocks_per_xattr_bucket(inode_sb(inode));
 	int num_buckets = ocfs2_xattr_buckets_per_cluster(osb);
 	struct ocfs2_xattr_bucket *old_first, *new_first;
 
@@ -4993,10 +4995,10 @@ static int ocfs2_divide_xattr_cluster(struct inode *inode,
 				      u64 new_blk,
 				      u32 *first_hash)
 {
-	u16 blk_per_bucket = ocfs2_blocks_per_xattr_bucket(inode->i_sb);
+	u16 blk_per_bucket = ocfs2_blocks_per_xattr_bucket(inode_sb(inode));
 	int ret, credits = 2 * blk_per_bucket;
 
-	BUG_ON(OCFS2_XATTR_BUCKET_SIZE < OCFS2_SB(inode->i_sb)->s_clustersize);
+	BUG_ON(OCFS2_XATTR_BUCKET_SIZE < OCFS2_SB(inode_sb(inode))->s_clustersize);
 
 	ret = ocfs2_extend_trans(handle, credits);
 	if (ret) {
@@ -5050,7 +5052,7 @@ static int ocfs2_adjust_xattr_cross_cluster(struct inode *inode,
 			(unsigned long long)bucket_blkno(first),
 			(unsigned long long)new_blk, prev_clusters);
 
-	if (ocfs2_xattr_buckets_per_cluster(OCFS2_SB(inode->i_sb)) > 1) {
+	if (ocfs2_xattr_buckets_per_cluster(OCFS2_SB(inode_sb(inode))) > 1) {
 		ret = ocfs2_mv_xattr_bucket_cross_cluster(inode,
 							  handle,
 							  first, target,
@@ -5063,7 +5065,7 @@ static int ocfs2_adjust_xattr_cross_cluster(struct inode *inode,
 		/* The start of the last cluster in the first extent */
 		u64 last_blk = bucket_blkno(first) +
 			((prev_clusters - 1) *
-			 ocfs2_clusters_to_blocks(inode->i_sb, 1));
+			 ocfs2_clusters_to_blocks(inode_sb(inode), 1));
 
 		if (prev_clusters > 1 && bucket_blkno(target) != last_blk) {
 			ret = ocfs2_mv_xattr_buckets(inode, handle,
@@ -5113,12 +5115,12 @@ static int ocfs2_add_new_xattr_cluster(struct inode *inode,
 				       struct ocfs2_xattr_set_ctxt *ctxt)
 {
 	int ret;
-	u16 bpc = ocfs2_clusters_to_blocks(inode->i_sb, 1);
+	u16 bpc = ocfs2_clusters_to_blocks(inode_sb(inode), 1);
 	u32 prev_clusters = *num_clusters;
 	u32 clusters_to_add = 1, bit_off, num_bits, v_start = 0;
 	u64 block;
 	handle_t *handle = ctxt->handle;
-	struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
+	struct ocfs2_super *osb = OCFS2_SB(inode_sb(inode));
 	struct ocfs2_extent_tree et;
 
 	trace_ocfs2_add_new_xattr_cluster_begin(
@@ -5208,8 +5210,8 @@ static int ocfs2_extend_xattr_bucket(struct inode *inode,
 				     u32 num_clusters)
 {
 	int ret, credits;
-	struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
-	u16 blk_per_bucket = ocfs2_blocks_per_xattr_bucket(inode->i_sb);
+	struct ocfs2_super *osb = OCFS2_SB(inode_sb(inode));
+	u16 blk_per_bucket = ocfs2_blocks_per_xattr_bucket(inode_sb(inode));
 	u64 end_blk;
 	u16 new_bucket = le16_to_cpu(bucket_xh(first)->xh_num_buckets);
 
@@ -5288,7 +5290,7 @@ static int ocfs2_add_new_xattr_bucket(struct inode *inode,
 	struct ocfs2_extent_list *el = &xb_root->xt_list;
 	u32 name_hash =
 		le32_to_cpu(bucket_xh(target)->xh_entries[0].xe_name_hash);
-	struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
+	struct ocfs2_super *osb = OCFS2_SB(inode_sb(inode));
 	int ret, num_buckets, extend = 1;
 	u64 p_blkno;
 	u32 e_cpos, num_clusters;
@@ -5372,7 +5374,7 @@ static int ocfs2_xattr_bucket_value_truncate(struct inode *inode,
 	u64 value_blk;
 	struct ocfs2_xattr_entry *xe;
 	struct ocfs2_xattr_header *xh = bucket_xh(bucket);
-	size_t blocksize = inode->i_sb->s_blocksize;
+	size_t blocksize = inode_sb(inode)->s_blocksize;
 	struct ocfs2_xattr_value_buf vb = {
 		.vb_access = ocfs2_journal_access,
 	};
@@ -5433,7 +5435,7 @@ static int ocfs2_rm_xattr_cluster(struct inode *inode,
 				  void *para)
 {
 	int ret;
-	struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
+	struct ocfs2_super *osb = OCFS2_SB(inode_sb(inode));
 	struct inode *tl_inode = osb->osb_tl_inode;
 	handle_t *handle;
 	struct ocfs2_xattr_block *xb =
@@ -5669,10 +5671,10 @@ static int ocfs2_delete_xattr_in_bucket(struct inode *inode,
 	struct ocfs2_xattr_header *xh = bucket_xh(bucket);
 	u16 i;
 	struct ocfs2_xattr_entry *xe;
-	struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
+	struct ocfs2_super *osb = OCFS2_SB(inode_sb(inode));
 	struct ocfs2_xattr_set_ctxt ctxt = {NULL, NULL,};
 	int credits = ocfs2_remove_extent_credits(osb->sb) +
-		ocfs2_blocks_per_xattr_bucket(inode->i_sb);
+		ocfs2_blocks_per_xattr_bucket(inode_sb(inode));
 	struct ocfs2_xattr_value_root *xv;
 	struct ocfs2_rm_xattr_bucket_para *args =
 			(struct ocfs2_rm_xattr_bucket_para *)para;
@@ -5684,7 +5686,7 @@ static int ocfs2_delete_xattr_in_bucket(struct inode *inode,
 		if (ocfs2_xattr_is_local(xe))
 			continue;
 
-		ret = ocfs2_get_xattr_tree_value_root(inode->i_sb, bucket,
+		ret = ocfs2_get_xattr_tree_value_root(inode_sb(inode), bucket,
 						      i, &xv, NULL);
 		if (ret) {
 			mlog_errno(ret);
@@ -5785,7 +5787,7 @@ static int ocfs2_prepare_refcount_xattr(struct inode *inode,
 	int name_offset, name_len;
 	struct ocfs2_xattr_value_buf vb;
 	struct ocfs2_xattr_bucket *bucket = NULL;
-	struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
+	struct ocfs2_super *osb = OCFS2_SB(inode_sb(inode));
 	struct ocfs2_post_refcount refcount;
 	struct ocfs2_post_refcount *p = NULL;
 	struct buffer_head *ref_root_bh = NULL;
@@ -5806,10 +5808,10 @@ static int ocfs2_prepare_refcount_xattr(struct inode *inode,
 		i = xbs->here - xbs->header->xh_entries;
 
 		if (le16_to_cpu(xb->xb_flags) & OCFS2_XATTR_INDEXED) {
-			ret = ocfs2_xattr_bucket_get_name_value(inode->i_sb,
-							bucket_xh(xbs->bucket),
-							i, &block_off,
-							&name_offset);
+			ret = ocfs2_xattr_bucket_get_name_value(inode_sb(inode),
+								bucket_xh(xbs->bucket),
+								i, &block_off,
+								&name_offset);
 			if (ret) {
 				mlog_errno(ret);
 				goto out;
@@ -5991,8 +5993,8 @@ static int ocfs2_xattr_inline_attach_refcount(struct inode *inode,
 {
 	struct ocfs2_dinode *di = (struct ocfs2_dinode *)fe_bh->b_data;
 	struct ocfs2_xattr_header *header = (struct ocfs2_xattr_header *)
-				(fe_bh->b_data + inode->i_sb->s_blocksize -
-				le16_to_cpu(di->i_xattr_inline_size));
+				(fe_bh->b_data + inode_sb(inode)->s_blocksize -
+				 le16_to_cpu(di->i_xattr_inline_size));
 	struct ocfs2_xattr_value_buf vb = {
 		.vb_bh = fe_bh,
 		.vb_access = ocfs2_journal_access_di,
@@ -6066,7 +6068,7 @@ static int ocfs2_xattr_bucket_value_refcount(struct inode *inode,
 	struct ocfs2_post_refcount *p = NULL;
 
 	/* We only need post_refcount if we support metaecc. */
-	if (ocfs2_meta_ecc(OCFS2_SB(inode->i_sb)))
+	if (ocfs2_meta_ecc(OCFS2_SB(inode_sb(inode))))
 		p = &refcount;
 
 	trace_ocfs2_xattr_bucket_value_refcount(
@@ -6078,7 +6080,8 @@ static int ocfs2_xattr_bucket_value_refcount(struct inode *inode,
 		if (ocfs2_xattr_is_local(xe))
 			continue;
 
-		ret = ocfs2_get_xattr_tree_value_root(inode->i_sb, bucket, i,
+		ret = ocfs2_get_xattr_tree_value_root(inode_sb(inode), bucket,
+						      i,
 						      &vb.vb_xv, &vb.vb_bh);
 		if (ret) {
 			mlog_errno(ret);
@@ -6358,7 +6361,7 @@ static int ocfs2_reflink_xattr_header(handle_t *handle,
 				      void *para)
 {
 	int ret = 0, i, j;
-	struct super_block *sb = args->old_inode->i_sb;
+	struct super_block *sb = inode_sb(args->old_inode);
 	struct buffer_head *value_bh;
 	struct ocfs2_xattr_entry *xe, *last;
 	struct ocfs2_xattr_value_root *xv, *new_xv;
@@ -6444,9 +6447,8 @@ static int ocfs2_reflink_xattr_header(handle_t *handle,
 			if (xv->xr_list.l_tree_depth) {
 				ret = ocfs2_insert_extent(handle,
 						&data_et, cpos,
-						ocfs2_clusters_to_blocks(
-							args->old_inode->i_sb,
-							p_cluster),
+						ocfs2_clusters_to_blocks(inode_sb(args->old_inode),
+									 p_cluster),
 						num_clusters, ext_flags,
 						meta_ac);
 				if (ret) {
@@ -6476,7 +6478,7 @@ static int ocfs2_reflink_xattr_inline(struct ocfs2_xattr_reflink *args)
 {
 	int ret = 0, credits = 0;
 	handle_t *handle;
-	struct ocfs2_super *osb = OCFS2_SB(args->old_inode->i_sb);
+	struct ocfs2_super *osb = OCFS2_SB(inode_sb(args->old_inode));
 	struct ocfs2_dinode *di = (struct ocfs2_dinode *)args->old_bh->b_data;
 	int inline_size = le16_to_cpu(di->i_xattr_inline_size);
 	int header_off = osb->sb->s_blocksize - inline_size;
@@ -6560,7 +6562,7 @@ static int ocfs2_create_empty_xattr_block(struct inode *inode,
 					  int indexed)
 {
 	int ret;
-	struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
+	struct ocfs2_super *osb = OCFS2_SB(inode_sb(inode));
 	struct ocfs2_xattr_set_ctxt ctxt;
 
 	memset(&ctxt, 0, sizeof(ctxt));
@@ -6598,7 +6600,7 @@ static int ocfs2_reflink_xattr_block(struct ocfs2_xattr_reflink *args,
 	handle_t *handle;
 	struct ocfs2_inode_info *new_oi = OCFS2_I(args->new_inode);
 	struct ocfs2_dinode *new_di;
-	struct ocfs2_super *osb = OCFS2_SB(args->new_inode->i_sb);
+	struct ocfs2_super *osb = OCFS2_SB(inode_sb(args->new_inode));
 	int header_off = offsetof(struct ocfs2_xattr_block, xb_attrs.xb_header);
 	struct ocfs2_xattr_block *xb =
 			(struct ocfs2_xattr_block *)blk_bh->b_data;
@@ -6743,11 +6745,13 @@ static int ocfs2_calc_value_tree_metas(struct inode *inode,
 
 	/* Add the credits for this bucket first. */
 	metas->credits += bucket->bu_blocks;
-	return ocfs2_value_metas_in_xattr_header(inode->i_sb, bucket->bu_bhs[0],
-					xh, &metas->num_metas,
-					&metas->credits, &metas->num_recs,
-					ocfs2_value_tree_metas_in_bucket,
-					bucket);
+	return ocfs2_value_metas_in_xattr_header(inode_sb(inode),
+						 bucket->bu_bhs[0],
+						 xh, &metas->num_metas,
+						 &metas->credits,
+						 &metas->num_recs,
+						 ocfs2_value_tree_metas_in_bucket,
+						 bucket);
 }
 
 /*
@@ -6764,7 +6768,7 @@ static int ocfs2_lock_reflink_xattr_rec_allocators(
 {
 	int ret, num_free_extents;
 	struct ocfs2_value_tree_metas metas;
-	struct ocfs2_super *osb = OCFS2_SB(args->reflink->old_inode->i_sb);
+	struct ocfs2_super *osb = OCFS2_SB(inode_sb(args->reflink->old_inode));
 	struct ocfs2_refcount_block *rb;
 
 	memset(&metas, 0, sizeof(metas));
@@ -6849,7 +6853,7 @@ static int ocfs2_reflink_xattr_bucket(handle_t *handle,
 				struct ocfs2_reflink_xattr_tree_args *args)
 {
 	int i, j, ret = 0;
-	struct super_block *sb = args->reflink->old_inode->i_sb;
+	struct super_block *sb = inode_sb(args->reflink->old_inode);
 	int bpb = args->old_bucket->bu_blocks;
 	struct ocfs2_xattr_value_buf vb = {
 		.vb_access = ocfs2_journal_access,
@@ -6945,7 +6949,7 @@ static int ocfs2_reflink_xattr_buckets(handle_t *handle,
 	u64 new_blkno;
 	unsigned int num_buckets, reflink_buckets;
 	unsigned int bpc =
-		ocfs2_xattr_buckets_per_cluster(OCFS2_SB(inode->i_sb));
+		ocfs2_xattr_buckets_per_cluster(OCFS2_SB(inode_sb(inode)));
 
 	ret = ocfs2_read_xattr_bucket(args->old_bucket, blkno);
 	if (ret) {
@@ -6963,7 +6967,8 @@ static int ocfs2_reflink_xattr_buckets(handle_t *handle,
 			goto out;
 		}
 
-		new_blkno = ocfs2_clusters_to_blocks(inode->i_sb, p_cluster);
+		new_blkno = ocfs2_clusters_to_blocks(inode_sb(inode),
+						     p_cluster);
 		reflink_buckets = min(num_buckets, bpc * num_clusters);
 
 		ret = ocfs2_reflink_xattr_bucket(handle, blkno,
@@ -6993,7 +6998,8 @@ static int ocfs2_reflink_xattr_buckets(handle_t *handle,
 						  num_clusters, reflink_cpos);
 
 		len -= num_clusters;
-		blkno += ocfs2_clusters_to_blocks(inode->i_sb, num_clusters);
+		blkno += ocfs2_clusters_to_blocks(inode_sb(inode),
+						  num_clusters);
 		num_buckets -= reflink_buckets;
 	}
 out:
@@ -7014,7 +7020,7 @@ static int ocfs2_reflink_xattr_rec(struct inode *inode,
 	handle_t *handle;
 	struct ocfs2_reflink_xattr_tree_args *args =
 			(struct ocfs2_reflink_xattr_tree_args *)para;
-	struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
+	struct ocfs2_super *osb = OCFS2_SB(inode_sb(inode));
 	struct ocfs2_alloc_context *meta_ac = NULL;
 	struct ocfs2_alloc_context *data_ac = NULL;
 	struct ocfs2_extent_tree et;
@@ -7153,7 +7159,7 @@ int ocfs2_reflink_xattrs(struct inode *old_inode,
 	struct ocfs2_refcount_tree *ref_tree;
 	struct buffer_head *ref_root_bh = NULL;
 
-	ret = ocfs2_lock_refcount_tree(OCFS2_SB(old_inode->i_sb),
+	ret = ocfs2_lock_refcount_tree(OCFS2_SB(inode_sb(old_inode)),
 				       le64_to_cpu(di->i_refcount_loc),
 				       1, &ref_tree, &ref_root_bh);
 	if (ret) {
@@ -7200,13 +7206,14 @@ int ocfs2_reflink_xattrs(struct inode *old_inode,
 	brelse(blk_bh);
 
 out_unlock:
-	ocfs2_unlock_refcount_tree(OCFS2_SB(old_inode->i_sb),
+	ocfs2_unlock_refcount_tree(OCFS2_SB(inode_sb(old_inode)),
 				   ref_tree, 1);
 	brelse(ref_root_bh);
 
 	if (ocfs2_dealloc_has_cluster(&dealloc)) {
-		ocfs2_schedule_truncate_log_flush(OCFS2_SB(old_inode->i_sb), 1);
-		ocfs2_run_deallocs(OCFS2_SB(old_inode->i_sb), &dealloc);
+		ocfs2_schedule_truncate_log_flush(OCFS2_SB(inode_sb(old_inode)),
+						  1);
+		ocfs2_run_deallocs(OCFS2_SB(inode_sb(old_inode)), &dealloc);
 	}
 
 out:
@@ -7290,7 +7297,7 @@ int ocfs2_init_security_get(struct inode *inode,
 			    struct ocfs2_security_xattr_info *si)
 {
 	/* check whether ocfs2 support feature xattr */
-	if (!ocfs2_supports_xattr(OCFS2_SB(dir->i_sb)))
+	if (!ocfs2_supports_xattr(OCFS2_SB(inode_sb(dir))))
 		return -EOPNOTSUPP;
 	if (si)
 		return security_old_inode_init_security(inode, dir, qstr,
@@ -7353,7 +7360,7 @@ static int ocfs2_xattr_user_get(const struct xattr_handler *handler,
 				struct dentry *unused, struct inode *inode,
 				const char *name, void *buffer, size_t size)
 {
-	struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
+	struct ocfs2_super *osb = OCFS2_SB(inode_sb(inode));
 
 	if (osb->s_mount_opt & OCFS2_MOUNT_NOUSERXATTR)
 		return -EOPNOTSUPP;
@@ -7366,7 +7373,7 @@ static int ocfs2_xattr_user_set(const struct xattr_handler *handler,
 				const char *name, const void *value,
 				size_t size, int flags)
 {
-	struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
+	struct ocfs2_super *osb = OCFS2_SB(inode_sb(inode));
 
 	if (osb->s_mount_opt & OCFS2_MOUNT_NOUSERXATTR)
 		return -EOPNOTSUPP;
-- 
2.15.1

^ permalink raw reply related	[flat|nested] 88+ messages in thread

* [PATCH 55/76] fs/omfs: Use inode_sb() helper instead of inode->i_sb
  2018-05-08 18:03 [RFC][PATCH 0/76] vfs: 'views' for filesystems with more than one root Mark Fasheh
                   ` (53 preceding siblings ...)
  2018-05-08 18:04 ` [PATCH 54/76] fs/ocfs2: " Mark Fasheh
@ 2018-05-08 18:04 ` Mark Fasheh
  2018-05-08 18:04 ` [PATCH 56/76] fs/openpromfs: " Mark Fasheh
                   ` (21 subsequent siblings)
  76 siblings, 0 replies; 88+ messages in thread
From: Mark Fasheh @ 2018-05-08 18:04 UTC (permalink / raw)
  To: linux-fsdevel; +Cc: linux-kernel, linux-btrfs, Mark Fasheh

Signed-off-by: Mark Fasheh <mfasheh@suse.de>
---
 fs/omfs/dir.c   | 24 ++++++++++++------------
 fs/omfs/file.c  | 37 +++++++++++++++++++------------------
 fs/omfs/inode.c | 19 ++++++++++---------
 3 files changed, 41 insertions(+), 39 deletions(-)

diff --git a/fs/omfs/dir.c b/fs/omfs/dir.c
index b7146526afff..5a589c5a852f 100644
--- a/fs/omfs/dir.c
+++ b/fs/omfs/dir.c
@@ -28,7 +28,7 @@ static struct buffer_head *omfs_get_bucket(struct inode *dir,
 	int bucket = omfs_hash(name, namelen, nbuckets);
 
 	*ofs = OMFS_DIR_START + bucket * 8;
-	return omfs_bread(dir->i_sb, dir->i_ino);
+	return omfs_bread(inode_sb(dir), dir->i_ino);
 }
 
 static struct buffer_head *omfs_scan_list(struct inode *dir, u64 block,
@@ -41,14 +41,14 @@ static struct buffer_head *omfs_scan_list(struct inode *dir, u64 block,
 	*prev_block = ~0;
 
 	while (block != ~0) {
-		bh = omfs_bread(dir->i_sb, block);
+		bh = omfs_bread(inode_sb(dir), block);
 		if (!bh) {
 			err = -EIO;
 			goto err;
 		}
 
 		oi = (struct omfs_inode *) bh->b_data;
-		if (omfs_is_bad(OMFS_SB(dir->i_sb), &oi->i_head, block)) {
+		if (omfs_is_bad(OMFS_SB(inode_sb(dir)), &oi->i_head, block)) {
 			brelse(bh);
 			goto err;
 		}
@@ -131,7 +131,7 @@ static int omfs_add_link(struct dentry *dentry, struct inode *inode)
 	brelse(bh);
 
 	/* now set the sibling and parent pointers on the new inode */
-	bh = omfs_bread(dir->i_sb, inode->i_ino);
+	bh = omfs_bread(inode_sb(dir), inode->i_ino);
 	if (!bh)
 		goto out;
 
@@ -187,7 +187,7 @@ static int omfs_delete_entry(struct dentry *dentry)
 	if (prev != ~0) {
 		/* found in middle of list, get list ptr */
 		brelse(bh);
-		bh = omfs_bread(dir->i_sb, prev);
+		bh = omfs_bread(inode_sb(dir), prev);
 		if (!bh)
 			goto out;
 
@@ -199,7 +199,7 @@ static int omfs_delete_entry(struct dentry *dentry)
 	mark_buffer_dirty(bh);
 
 	if (prev != ~0) {
-		dirty = omfs_iget(dir->i_sb, prev);
+		dirty = omfs_iget(inode_sb(dir), prev);
 		if (!IS_ERR(dirty)) {
 			mark_inode_dirty(dirty);
 			iput(dirty);
@@ -220,7 +220,7 @@ static int omfs_dir_is_empty(struct inode *inode)
 	u64 *ptr;
 	int i;
 
-	bh = omfs_bread(inode->i_sb, inode->i_ino);
+	bh = omfs_bread(inode_sb(inode), inode->i_ino);
 
 	if (!bh)
 		return 0;
@@ -263,7 +263,7 @@ static int omfs_add_node(struct inode *dir, struct dentry *dentry, umode_t mode)
 	if (IS_ERR(inode))
 		return PTR_ERR(inode);
 
-	err = omfs_make_empty(inode, dir->i_sb);
+	err = omfs_make_empty(inode, inode_sb(dir));
 	if (err)
 		goto out_free_inode;
 
@@ -304,7 +304,7 @@ static struct dentry *omfs_lookup(struct inode *dir, struct dentry *dentry,
 		struct omfs_inode *oi = (struct omfs_inode *)bh->b_data;
 		ino_t ino = be64_to_cpu(oi->i_head.h_self);
 		brelse(bh);
-		inode = omfs_iget(dir->i_sb, ino);
+		inode = omfs_iget(inode_sb(dir), ino);
 		if (IS_ERR(inode))
 			return ERR_CAST(inode);
 	}
@@ -332,7 +332,7 @@ static bool omfs_fill_chain(struct inode *dir, struct dir_context *ctx,
 {
 	/* follow chain in this bucket */
 	while (fsblock != ~0) {
-		struct buffer_head *bh = omfs_bread(dir->i_sb, fsblock);
+		struct buffer_head *bh = omfs_bread(inode_sb(dir), fsblock);
 		struct omfs_inode *oi;
 		u64 self;
 		unsigned char d_type;
@@ -341,7 +341,7 @@ static bool omfs_fill_chain(struct inode *dir, struct dir_context *ctx,
 			return true;
 
 		oi = (struct omfs_inode *) bh->b_data;
-		if (omfs_is_bad(OMFS_SB(dir->i_sb), &oi->i_head, fsblock)) {
+		if (omfs_is_bad(OMFS_SB(inode_sb(dir)), &oi->i_head, fsblock)) {
 			brelse(bh);
 			return true;
 		}
@@ -428,7 +428,7 @@ static int omfs_readdir(struct file *file, struct dir_context *ctx)
 	hchain = (ctx->pos >> 20) - 1;
 	hindex = ctx->pos & 0xfffff;
 
-	bh = omfs_bread(dir->i_sb, dir->i_ino);
+	bh = omfs_bread(inode_sb(dir), dir->i_ino);
 	if (!bh)
 		return -EINVAL;
 
diff --git a/fs/omfs/file.c b/fs/omfs/file.c
index bf83e6644333..a714a3ba6d6a 100644
--- a/fs/omfs/file.c
+++ b/fs/omfs/file.c
@@ -30,7 +30,7 @@ void omfs_make_empty_table(struct buffer_head *bh, int offset)
 
 int omfs_shrink_inode(struct inode *inode)
 {
-	struct omfs_sb_info *sbi = OMFS_SB(inode->i_sb);
+	struct omfs_sb_info *sbi = OMFS_SB(inode_sb(inode));
 	struct omfs_extent *oe;
 	struct omfs_extent_entry *entry;
 	struct buffer_head *bh;
@@ -49,7 +49,7 @@ int omfs_shrink_inode(struct inode *inode)
 	if (inode->i_size != 0)
 		goto out;
 
-	bh = omfs_bread(inode->i_sb, next);
+	bh = omfs_bread(inode_sb(inode), next);
 	if (!bh)
 		goto out;
 
@@ -76,7 +76,7 @@ int omfs_shrink_inode(struct inode *inode)
 			start = be64_to_cpu(entry->e_cluster);
 			count = be64_to_cpu(entry->e_blocks);
 
-			omfs_clear_range(inode->i_sb, start, (int) count);
+			omfs_clear_range(inode_sb(inode), start, (int) count);
 			entry++;
 		}
 		omfs_make_empty_table(bh, (char *) oe - bh->b_data);
@@ -84,12 +84,13 @@ int omfs_shrink_inode(struct inode *inode)
 		brelse(bh);
 
 		if (last != inode->i_ino)
-			omfs_clear_range(inode->i_sb, last, sbi->s_mirrors);
+			omfs_clear_range(inode_sb(inode), last,
+					 sbi->s_mirrors);
 
 		if (next == ~0)
 			break;
 
-		bh = omfs_bread(inode->i_sb, next);
+		bh = omfs_bread(inode_sb(inode), next);
 		if (!bh)
 			goto out;
 		oe = (struct omfs_extent *) (&bh->b_data[OMFS_EXTENT_CONT]);
@@ -118,7 +119,7 @@ static int omfs_grow_extent(struct inode *inode, struct omfs_extent *oe,
 {
 	struct omfs_extent_entry *terminator;
 	struct omfs_extent_entry *entry = &oe->e_entry;
-	struct omfs_sb_info *sbi = OMFS_SB(inode->i_sb);
+	struct omfs_sb_info *sbi = OMFS_SB(inode_sb(inode));
 	u32 extent_count = be32_to_cpu(oe->e_extent_count);
 	u64 new_block = 0;
 	u32 max_count;
@@ -145,7 +146,7 @@ static int omfs_grow_extent(struct inode *inode, struct omfs_extent *oe,
 		new_block = be64_to_cpu(entry->e_cluster) +
 			be64_to_cpu(entry->e_blocks);
 
-		if (omfs_allocate_block(inode->i_sb, new_block)) {
+		if (omfs_allocate_block(inode_sb(inode), new_block)) {
 			be64_add_cpu(&entry->e_blocks, 1);
 			terminator->e_blocks = ~(cpu_to_be64(
 				be64_to_cpu(~terminator->e_blocks) + 1));
@@ -159,8 +160,8 @@ static int omfs_grow_extent(struct inode *inode, struct omfs_extent *oe,
 		return -EIO;
 
 	/* try to allocate a new cluster */
-	ret = omfs_allocate_range(inode->i_sb, 1, sbi->s_clustersize,
-		&new_block, &new_count);
+	ret = omfs_allocate_range(inode_sb(inode), 1, sbi->s_clustersize,
+				  &new_block, &new_count);
 	if (ret)
 		goto out_fail;
 
@@ -194,8 +195,8 @@ static sector_t find_block(struct inode *inode, struct omfs_extent_entry *ent,
 	/* count > 1 because of terminator */
 	sector_t searched = 0;
 	for (; count > 1; count--) {
-		int numblocks = clus_to_blk(OMFS_SB(inode->i_sb),
-			be64_to_cpu(ent->e_blocks));
+		int numblocks = clus_to_blk(OMFS_SB(inode_sb(inode)),
+					    be64_to_cpu(ent->e_blocks));
 
 		if (block >= searched  &&
 		    block < searched + numblocks) {
@@ -204,8 +205,8 @@ static sector_t find_block(struct inode *inode, struct omfs_extent_entry *ent,
 			 * numblocks - (block - searched) is remainder
 			 */
 			*left = numblocks - (block - searched);
-			return clus_to_blk(OMFS_SB(inode->i_sb),
-				be64_to_cpu(ent->e_cluster)) +
+			return clus_to_blk(OMFS_SB(inode_sb(inode)),
+					   be64_to_cpu(ent->e_cluster)) +
 				block - searched;
 		}
 		searched += numblocks;
@@ -225,12 +226,12 @@ static int omfs_get_block(struct inode *inode, sector_t block,
 	int extent_count;
 	struct omfs_extent *oe;
 	struct omfs_extent_entry *entry;
-	struct omfs_sb_info *sbi = OMFS_SB(inode->i_sb);
+	struct omfs_sb_info *sbi = OMFS_SB(inode_sb(inode));
 	int max_blocks = bh_result->b_size >> inode->i_blkbits;
 	int remain;
 
 	ret = -EIO;
-	bh = omfs_bread(inode->i_sb, inode->i_ino);
+	bh = omfs_bread(inode_sb(inode), inode->i_ino);
 	if (!bh)
 		goto out;
 
@@ -253,7 +254,7 @@ static int omfs_get_block(struct inode *inode, sector_t block,
 		offset = find_block(inode, entry, block, extent_count, &remain);
 		if (offset > 0) {
 			ret = 0;
-			map_bh(bh_result, inode->i_sb, offset);
+			map_bh(bh_result, inode_sb(inode), offset);
 			if (remain > max_blocks)
 				remain = max_blocks;
 			bh_result->b_size = (remain << inode->i_blkbits);
@@ -263,7 +264,7 @@ static int omfs_get_block(struct inode *inode, sector_t block,
 			break;
 
 		brelse(bh);
-		bh = omfs_bread(inode->i_sb, next);
+		bh = omfs_bread(inode_sb(inode), next);
 		if (!bh)
 			goto out;
 		oe = (struct omfs_extent *) (&bh->b_data[OMFS_EXTENT_CONT]);
@@ -274,7 +275,7 @@ static int omfs_get_block(struct inode *inode, sector_t block,
 		if (ret == 0) {
 			mark_buffer_dirty(bh);
 			mark_inode_dirty(inode);
-			map_bh(bh_result, inode->i_sb,
+			map_bh(bh_result, inode_sb(inode),
 					clus_to_blk(sbi, new_block));
 		}
 	}
diff --git a/fs/omfs/inode.c b/fs/omfs/inode.c
index ee14af9e26f2..4e319c7712c9 100644
--- a/fs/omfs/inode.c
+++ b/fs/omfs/inode.c
@@ -36,14 +36,15 @@ struct inode *omfs_new_inode(struct inode *dir, umode_t mode)
 	u64 new_block;
 	int err;
 	int len;
-	struct omfs_sb_info *sbi = OMFS_SB(dir->i_sb);
+	struct omfs_sb_info *sbi = OMFS_SB(inode_sb(dir));
 
-	inode = new_inode(dir->i_sb);
+	inode = new_inode(inode_sb(dir));
 	if (!inode)
 		return ERR_PTR(-ENOMEM);
 
-	err = omfs_allocate_range(dir->i_sb, sbi->s_mirrors, sbi->s_mirrors,
-			&new_block, &len);
+	err = omfs_allocate_range(inode_sb(dir), sbi->s_mirrors,
+				  sbi->s_mirrors,
+				  &new_block, &len);
 	if (err)
 		goto fail;
 
@@ -102,7 +103,7 @@ static void omfs_update_checksums(struct omfs_inode *oi)
 static int __omfs_write_inode(struct inode *inode, int wait)
 {
 	struct omfs_inode *oi;
-	struct omfs_sb_info *sbi = OMFS_SB(inode->i_sb);
+	struct omfs_sb_info *sbi = OMFS_SB(inode_sb(inode));
 	struct buffer_head *bh, *bh2;
 	u64 ctime;
 	int i;
@@ -110,7 +111,7 @@ static int __omfs_write_inode(struct inode *inode, int wait)
 	int sync_failed = 0;
 
 	/* get current inode since we may have written sibling ptrs etc. */
-	bh = omfs_bread(inode->i_sb, inode->i_ino);
+	bh = omfs_bread(inode_sb(inode), inode->i_ino);
 	if (!bh)
 		goto out;
 
@@ -149,7 +150,7 @@ static int __omfs_write_inode(struct inode *inode, int wait)
 
 	/* if mirroring writes, copy to next fsblock */
 	for (i = 1; i < sbi->s_mirrors; i++) {
-		bh2 = omfs_bread(inode->i_sb, inode->i_ino + i);
+		bh2 = omfs_bread(inode_sb(inode), inode->i_ino + i);
 		if (!bh2)
 			goto out_brelse;
 
@@ -196,7 +197,7 @@ static void omfs_evict_inode(struct inode *inode)
 		omfs_shrink_inode(inode);
 	}
 
-	omfs_clear_range(inode->i_sb, inode->i_ino, 2);
+	omfs_clear_range(inode_sb(inode), inode->i_ino, 2);
 }
 
 struct inode *omfs_iget(struct super_block *sb, ino_t ino)
@@ -214,7 +215,7 @@ struct inode *omfs_iget(struct super_block *sb, ino_t ino)
 	if (!(inode->i_state & I_NEW))
 		return inode;
 
-	bh = omfs_bread(inode->i_sb, ino);
+	bh = omfs_bread(inode_sb(inode), ino);
 	if (!bh)
 		goto iget_failed;
 
-- 
2.15.1

^ permalink raw reply related	[flat|nested] 88+ messages in thread

* [PATCH 56/76] fs/openpromfs: Use inode_sb() helper instead of inode->i_sb
  2018-05-08 18:03 [RFC][PATCH 0/76] vfs: 'views' for filesystems with more than one root Mark Fasheh
                   ` (54 preceding siblings ...)
  2018-05-08 18:04 ` [PATCH 55/76] fs/omfs: " Mark Fasheh
@ 2018-05-08 18:04 ` Mark Fasheh
  2018-05-08 18:04 ` [PATCH 57/76] fs/orangefs: " Mark Fasheh
                   ` (20 subsequent siblings)
  76 siblings, 0 replies; 88+ messages in thread
From: Mark Fasheh @ 2018-05-08 18:04 UTC (permalink / raw)
  To: linux-fsdevel; +Cc: linux-kernel, linux-btrfs, Mark Fasheh

Signed-off-by: Mark Fasheh <mfasheh@suse.de>
---
 fs/openpromfs/inode.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/openpromfs/inode.c b/fs/openpromfs/inode.c
index 2200662a9bf1..d1c59e6252c5 100644
--- a/fs/openpromfs/inode.c
+++ b/fs/openpromfs/inode.c
@@ -229,7 +229,7 @@ static struct dentry *openpromfs_lookup(struct inode *dir, struct dentry *dentry
 	return ERR_PTR(-ENOENT);
 
 found:
-	inode = openprom_iget(dir->i_sb, ino);
+	inode = openprom_iget(inode_sb(dir), ino);
 	mutex_unlock(&op_mutex);
 	if (IS_ERR(inode))
 		return ERR_CAST(inode);
-- 
2.15.1

^ permalink raw reply related	[flat|nested] 88+ messages in thread

* [PATCH 57/76] fs/orangefs: Use inode_sb() helper instead of inode->i_sb
  2018-05-08 18:03 [RFC][PATCH 0/76] vfs: 'views' for filesystems with more than one root Mark Fasheh
                   ` (55 preceding siblings ...)
  2018-05-08 18:04 ` [PATCH 56/76] fs/openpromfs: " Mark Fasheh
@ 2018-05-08 18:04 ` Mark Fasheh
  2018-05-08 18:04 ` [PATCH 58/76] fs/overlayfs: " Mark Fasheh
                   ` (19 subsequent siblings)
  76 siblings, 0 replies; 88+ messages in thread
From: Mark Fasheh @ 2018-05-08 18:04 UTC (permalink / raw)
  To: linux-fsdevel; +Cc: linux-kernel, linux-btrfs, Mark Fasheh

Signed-off-by: Mark Fasheh <mfasheh@suse.de>
---
 fs/orangefs/file.c            |  2 +-
 fs/orangefs/namei.c           | 12 ++++++++----
 fs/orangefs/orangefs-kernel.h |  8 ++++----
 3 files changed, 13 insertions(+), 9 deletions(-)

diff --git a/fs/orangefs/file.c b/fs/orangefs/file.c
index 0d228cd087e6..123a0c5b4a22 100644
--- a/fs/orangefs/file.c
+++ b/fs/orangefs/file.c
@@ -722,7 +722,7 @@ static int orangefs_lock(struct file *filp, int cmd, struct file_lock *fl)
 {
 	int rc = -EINVAL;
 
-	if (ORANGEFS_SB(file_inode(filp)->i_sb)->flags & ORANGEFS_OPT_LOCAL_LOCK) {
+	if (ORANGEFS_SB(inode_sb(file_inode(filp)))->flags & ORANGEFS_OPT_LOCAL_LOCK) {
 		if (cmd == F_GETLK) {
 			rc = 0;
 			posix_test_lock(filp, fl);
diff --git a/fs/orangefs/namei.c b/fs/orangefs/namei.c
index 6e3134e6d98a..79b76f8f0ba8 100644
--- a/fs/orangefs/namei.c
+++ b/fs/orangefs/namei.c
@@ -60,7 +60,8 @@ static int orangefs_create(struct inode *dir,
 	ref = new_op->downcall.resp.create.refn;
 	op_release(new_op);
 
-	inode = orangefs_new_inode(dir->i_sb, dir, S_IFREG | mode, 0, &ref);
+	inode = orangefs_new_inode(inode_sb(dir), dir, S_IFREG | mode, 0,
+				   &ref);
 	if (IS_ERR(inode)) {
 		gossip_err("%s: Failed to allocate inode for file :%pd:\n",
 			   __func__,
@@ -192,7 +193,8 @@ static struct dentry *orangefs_lookup(struct inode *dir, struct dentry *dentry,
 
 	orangefs_set_timeout(dentry);
 
-	inode = orangefs_iget(dir->i_sb, &new_op->downcall.resp.lookup.refn);
+	inode = orangefs_iget(inode_sb(dir),
+			      &new_op->downcall.resp.lookup.refn);
 	if (IS_ERR(inode)) {
 		gossip_debug(GOSSIP_NAME_DEBUG,
 			"error %ld from iget\n", PTR_ERR(inode));
@@ -320,7 +322,8 @@ static int orangefs_symlink(struct inode *dir,
 	ref = new_op->downcall.resp.sym.refn;
 	op_release(new_op);
 
-	inode = orangefs_new_inode(dir->i_sb, dir, S_IFLNK | mode, 0, &ref);
+	inode = orangefs_new_inode(inode_sb(dir), dir, S_IFLNK | mode, 0,
+				   &ref);
 	if (IS_ERR(inode)) {
 		gossip_err
 		    ("*** Failed to allocate orangefs symlink inode\n");
@@ -391,7 +394,8 @@ static int orangefs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode
 	ref = new_op->downcall.resp.mkdir.refn;
 	op_release(new_op);
 
-	inode = orangefs_new_inode(dir->i_sb, dir, S_IFDIR | mode, 0, &ref);
+	inode = orangefs_new_inode(inode_sb(dir), dir, S_IFDIR | mode, 0,
+				   &ref);
 	if (IS_ERR(inode)) {
 		gossip_err("*** Failed to allocate orangefs dir inode\n");
 		ret = PTR_ERR(inode);
diff --git a/fs/orangefs/orangefs-kernel.h b/fs/orangefs/orangefs-kernel.h
index eebbaece85ef..c006a3f6dedd 100644
--- a/fs/orangefs/orangefs-kernel.h
+++ b/fs/orangefs/orangefs-kernel.h
@@ -325,11 +325,11 @@ static inline int is_root_handle(struct inode *inode)
 	gossip_debug(GOSSIP_DCACHE_DEBUG,
 		     "%s: root handle: %pU, this handle: %pU:\n",
 		     __func__,
-		     &ORANGEFS_SB(inode->i_sb)->root_khandle,
+		     &ORANGEFS_SB(inode_sb(inode))->root_khandle,
 		     get_khandle_from_ino(inode));
 
-	if (ORANGEFS_khandle_cmp(&(ORANGEFS_SB(inode->i_sb)->root_khandle),
-			     get_khandle_from_ino(inode)))
+	if (ORANGEFS_khandle_cmp(&(ORANGEFS_SB(inode_sb(inode))->root_khandle),
+				 get_khandle_from_ino(inode)))
 		return 0;
 	else
 		return 1;
@@ -513,7 +513,7 @@ int service_operation(struct orangefs_kernel_op_s *op,
 		      int flags);
 
 #define get_interruptible_flag(inode) \
-	((ORANGEFS_SB(inode->i_sb)->flags & ORANGEFS_OPT_INTR) ? \
+	((ORANGEFS_SB(inode_sb(inode))->flags & ORANGEFS_OPT_INTR) ? \
 		ORANGEFS_OP_INTERRUPTIBLE : 0)
 
 #define fill_default_sys_attrs(sys_attr, type, mode)			\
-- 
2.15.1

^ permalink raw reply related	[flat|nested] 88+ messages in thread

* [PATCH 58/76] fs/overlayfs: Use inode_sb() helper instead of inode->i_sb
  2018-05-08 18:03 [RFC][PATCH 0/76] vfs: 'views' for filesystems with more than one root Mark Fasheh
                   ` (56 preceding siblings ...)
  2018-05-08 18:04 ` [PATCH 57/76] fs/orangefs: " Mark Fasheh
@ 2018-05-08 18:04 ` Mark Fasheh
  2018-05-08 18:04 ` [PATCH 59/76] fs/proc: " Mark Fasheh
                   ` (18 subsequent siblings)
  76 siblings, 0 replies; 88+ messages in thread
From: Mark Fasheh @ 2018-05-08 18:04 UTC (permalink / raw)
  To: linux-fsdevel; +Cc: linux-kernel, linux-btrfs, Mark Fasheh

Signed-off-by: Mark Fasheh <mfasheh@suse.de>
---
 fs/overlayfs/export.c | 2 +-
 fs/overlayfs/inode.c  | 6 +++---
 fs/overlayfs/super.c  | 2 +-
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/fs/overlayfs/export.c b/fs/overlayfs/export.c
index 87bd4148f4fb..41b23510f5b9 100644
--- a/fs/overlayfs/export.c
+++ b/fs/overlayfs/export.c
@@ -316,7 +316,7 @@ static struct dentry *ovl_obtain_alias(struct super_block *sb,
 
 	dentry = d_find_any_alias(inode);
 	if (!dentry) {
-		dentry = d_alloc_anon(inode->i_sb);
+		dentry = d_alloc_anon(inode_sb(inode));
 		if (!dentry)
 			goto nomem;
 		oe = ovl_alloc_entry(lower ? 1 : 0);
diff --git a/fs/overlayfs/inode.c b/fs/overlayfs/inode.c
index 3b1bd469accd..ebf2a857d547 100644
--- a/fs/overlayfs/inode.c
+++ b/fs/overlayfs/inode.c
@@ -199,7 +199,7 @@ int ovl_permission(struct inode *inode, int mask)
 	if (err)
 		return err;
 
-	old_cred = ovl_override_creds(inode->i_sb);
+	old_cred = ovl_override_creds(inode_sb(inode));
 	if (!upperinode &&
 	    !special_file(realinode->i_mode) && mask & MAY_WRITE) {
 		mask &= ~(MAY_WRITE | MAY_APPEND);
@@ -342,7 +342,7 @@ struct posix_acl *ovl_get_acl(struct inode *inode, int type)
 	if (!IS_ENABLED(CONFIG_FS_POSIX_ACL) || !IS_POSIXACL(realinode))
 		return NULL;
 
-	old_cred = ovl_override_creds(inode->i_sb);
+	old_cred = ovl_override_creds(inode_sb(inode));
 	acl = get_acl(realinode, type);
 	revert_creds(old_cred);
 
@@ -445,7 +445,7 @@ static inline void ovl_lockdep_annotate_inode_mutex_key(struct inode *inode)
 	static struct lock_class_key ovl_i_mutex_dir_key[OVL_MAX_NESTING];
 	static struct lock_class_key ovl_i_lock_key[OVL_MAX_NESTING];
 
-	int depth = inode->i_sb->s_stack_depth - 1;
+	int depth = inode_sb(inode)->s_stack_depth - 1;
 
 	if (WARN_ON_ONCE(depth < 0 || depth >= OVL_MAX_NESTING))
 		depth = 0;
diff --git a/fs/overlayfs/super.c b/fs/overlayfs/super.c
index 7c24619ae7fc..bc04230f3ffb 100644
--- a/fs/overlayfs/super.c
+++ b/fs/overlayfs/super.c
@@ -127,7 +127,7 @@ static struct dentry *ovl_d_real(struct dentry *dentry,
 		return real;
 bug:
 	WARN(1, "ovl_d_real(%pd4, %s:%lu): real dentry not found\n", dentry,
-	     inode ? inode->i_sb->s_id : "NULL", inode ? inode->i_ino : 0);
+	     inode ? inode_sb(inode)->s_id : "NULL", inode ? inode->i_ino : 0);
 	return dentry;
 }
 
-- 
2.15.1

^ permalink raw reply related	[flat|nested] 88+ messages in thread

* [PATCH 59/76] fs/proc: Use inode_sb() helper instead of inode->i_sb
  2018-05-08 18:03 [RFC][PATCH 0/76] vfs: 'views' for filesystems with more than one root Mark Fasheh
                   ` (57 preceding siblings ...)
  2018-05-08 18:04 ` [PATCH 58/76] fs/overlayfs: " Mark Fasheh
@ 2018-05-08 18:04 ` Mark Fasheh
  2018-05-08 18:04 ` [PATCH 60/76] fs/qnx4: " Mark Fasheh
                   ` (17 subsequent siblings)
  76 siblings, 0 replies; 88+ messages in thread
From: Mark Fasheh @ 2018-05-08 18:04 UTC (permalink / raw)
  To: linux-fsdevel; +Cc: linux-kernel, linux-btrfs, Mark Fasheh

Signed-off-by: Mark Fasheh <mfasheh@suse.de>
---
 fs/proc/array.c       |  2 +-
 fs/proc/base.c        | 22 ++++++++++++----------
 fs/proc/fd.c          |  4 ++--
 fs/proc/generic.c     |  2 +-
 fs/proc/namespaces.c  |  2 +-
 fs/proc/nommu.c       |  2 +-
 fs/proc/proc_sysctl.c |  4 ++--
 fs/proc/self.c        |  2 +-
 fs/proc/task_mmu.c    |  2 +-
 fs/proc/task_nommu.c  |  2 +-
 fs/proc/thread_self.c |  2 +-
 11 files changed, 24 insertions(+), 22 deletions(-)

diff --git a/fs/proc/array.c b/fs/proc/array.c
index 598803576e4c..e7a668a89caf 100644
--- a/fs/proc/array.c
+++ b/fs/proc/array.c
@@ -687,7 +687,7 @@ static int children_seq_show(struct seq_file *seq, void *v)
 	struct inode *inode = seq->private;
 	pid_t pid;
 
-	pid = pid_nr_ns(v, inode->i_sb->s_fs_info);
+	pid = pid_nr_ns(v, inode_sb(inode)->s_fs_info);
 	seq_printf(seq, "%d ", pid);
 
 	return 0;
diff --git a/fs/proc/base.c b/fs/proc/base.c
index 9298324325ed..a39fdd56f5d9 100644
--- a/fs/proc/base.c
+++ b/fs/proc/base.c
@@ -698,7 +698,7 @@ static bool has_pid_permissions(struct pid_namespace *pid,
 
 static int proc_pid_permission(struct inode *inode, int mask)
 {
-	struct pid_namespace *pid = inode->i_sb->s_fs_info;
+	struct pid_namespace *pid = inode_sb(inode)->s_fs_info;
 	struct task_struct *task;
 	bool has_perms;
 
@@ -738,7 +738,7 @@ static int proc_single_show(struct seq_file *m, void *v)
 	struct task_struct *task;
 	int ret;
 
-	ns = inode->i_sb->s_fs_info;
+	ns = inode_sb(inode)->s_fs_info;
 	pid = proc_pid(inode);
 	task = get_pid_task(pid, PIDTYPE_PID);
 	if (!task)
@@ -1410,7 +1410,7 @@ static const struct file_operations proc_fail_nth_operations = {
 static int sched_show(struct seq_file *m, void *v)
 {
 	struct inode *inode = m->private;
-	struct pid_namespace *ns = inode->i_sb->s_fs_info;
+	struct pid_namespace *ns = inode_sb(inode)->s_fs_info;
 	struct task_struct *p;
 
 	p = get_proc_task(inode);
@@ -2065,7 +2065,7 @@ proc_map_files_instantiate(struct inode *dir, struct dentry *dentry,
 	struct proc_inode *ei;
 	struct inode *inode;
 
-	inode = proc_pid_make_inode(dir->i_sb, task, S_IFLNK |
+	inode = proc_pid_make_inode(inode_sb(dir), task, S_IFLNK |
 				    ((mode & FMODE_READ ) ? S_IRUSR : 0) |
 				    ((mode & FMODE_WRITE) ? S_IWUSR : 0));
 	if (!inode)
@@ -2327,7 +2327,7 @@ static int proc_timers_open(struct inode *inode, struct file *file)
 		return -ENOMEM;
 
 	tp->pid = proc_pid(inode);
-	tp->ns = inode->i_sb->s_fs_info;
+	tp->ns = inode_sb(inode)->s_fs_info;
 	return 0;
 }
 
@@ -2432,7 +2432,7 @@ static int proc_pident_instantiate(struct inode *dir,
 	struct inode *inode;
 	struct proc_inode *ei;
 
-	inode = proc_pid_make_inode(dir->i_sb, task, p->mode);
+	inode = proc_pid_make_inode(inode_sb(dir), task, p->mode);
 	if (!inode)
 		goto out;
 
@@ -3137,7 +3137,8 @@ static int proc_pid_instantiate(struct inode *dir,
 {
 	struct inode *inode;
 
-	inode = proc_pid_make_inode(dir->i_sb, task, S_IFDIR | S_IRUGO | S_IXUGO);
+	inode = proc_pid_make_inode(inode_sb(dir), task,
+				    S_IFDIR | S_IRUGO | S_IXUGO);
 	if (!inode)
 		goto out;
 
@@ -3232,7 +3233,7 @@ static struct tgid_iter next_tgid(struct pid_namespace *ns, struct tgid_iter ite
 int proc_pid_readdir(struct file *file, struct dir_context *ctx)
 {
 	struct tgid_iter iter;
-	struct pid_namespace *ns = file_inode(file)->i_sb->s_fs_info;
+	struct pid_namespace *ns = inode_sb(file_inode(file))->s_fs_info;
 	loff_t pos = ctx->pos;
 
 	if (pos >= PID_MAX_LIMIT + TGID_OFFSET)
@@ -3435,7 +3436,8 @@ static int proc_task_instantiate(struct inode *dir,
 	struct dentry *dentry, struct task_struct *task, const void *ptr)
 {
 	struct inode *inode;
-	inode = proc_pid_make_inode(dir->i_sb, task, S_IFDIR | S_IRUGO | S_IXUGO);
+	inode = proc_pid_make_inode(inode_sb(dir), task,
+				    S_IFDIR | S_IRUGO | S_IXUGO);
 
 	if (!inode)
 		goto out;
@@ -3584,7 +3586,7 @@ static int proc_task_readdir(struct file *file, struct dir_context *ctx)
 	/* f_version caches the tgid value that the last readdir call couldn't
 	 * return. lseek aka telldir automagically resets f_version to 0.
 	 */
-	ns = inode->i_sb->s_fs_info;
+	ns = inode_sb(inode)->s_fs_info;
 	tid = (int)file->f_version;
 	file->f_version = 0;
 	for (task = first_tid(proc_pid(inode), tid, ctx->pos - 2, ns);
diff --git a/fs/proc/fd.c b/fs/proc/fd.c
index 6b80cd1e419a..818fe341c3e7 100644
--- a/fs/proc/fd.c
+++ b/fs/proc/fd.c
@@ -174,7 +174,7 @@ proc_fd_instantiate(struct inode *dir, struct dentry *dentry,
 	struct proc_inode *ei;
 	struct inode *inode;
 
-	inode = proc_pid_make_inode(dir->i_sb, task, S_IFLNK);
+	inode = proc_pid_make_inode(inode_sb(dir), task, S_IFLNK);
 	if (!inode)
 		goto out;
 
@@ -312,7 +312,7 @@ proc_fdinfo_instantiate(struct inode *dir, struct dentry *dentry,
 	struct proc_inode *ei;
 	struct inode *inode;
 
-	inode = proc_pid_make_inode(dir->i_sb, task, S_IFREG | S_IRUSR);
+	inode = proc_pid_make_inode(inode_sb(dir), task, S_IFREG | S_IRUSR);
 	if (!inode)
 		goto out;
 
diff --git a/fs/proc/generic.c b/fs/proc/generic.c
index 5d709fa8f3a2..9da0c07329ea 100644
--- a/fs/proc/generic.c
+++ b/fs/proc/generic.c
@@ -221,7 +221,7 @@ struct dentry *proc_lookup_de(struct inode *dir, struct dentry *dentry,
 	if (de) {
 		pde_get(de);
 		read_unlock(&proc_subdir_lock);
-		inode = proc_get_inode(dir->i_sb, de);
+		inode = proc_get_inode(inode_sb(dir), de);
 		if (!inode)
 			return ERR_PTR(-ENOMEM);
 		d_set_d_op(dentry, &simple_dentry_operations);
diff --git a/fs/proc/namespaces.c b/fs/proc/namespaces.c
index 59b17e509f46..3d624af32bb2 100644
--- a/fs/proc/namespaces.c
+++ b/fs/proc/namespaces.c
@@ -94,7 +94,7 @@ static int proc_ns_instantiate(struct inode *dir,
 	struct inode *inode;
 	struct proc_inode *ei;
 
-	inode = proc_pid_make_inode(dir->i_sb, task, S_IFLNK | S_IRWXUGO);
+	inode = proc_pid_make_inode(inode_sb(dir), task, S_IFLNK | S_IRWXUGO);
 	if (!inode)
 		goto out;
 
diff --git a/fs/proc/nommu.c b/fs/proc/nommu.c
index 75634379f82e..5c979fc49662 100644
--- a/fs/proc/nommu.c
+++ b/fs/proc/nommu.c
@@ -46,7 +46,7 @@ static int nommu_region_show(struct seq_file *m, struct vm_region *region)
 
 	if (file) {
 		struct inode *inode = file_inode(region->vm_file);
-		dev = inode->i_sb->s_dev;
+		dev = inode_sb(inode)->s_dev;
 		ino = inode->i_ino;
 	}
 
diff --git a/fs/proc/proc_sysctl.c b/fs/proc/proc_sysctl.c
index c41ab261397d..a989afed4b1e 100644
--- a/fs/proc/proc_sysctl.c
+++ b/fs/proc/proc_sysctl.c
@@ -280,7 +280,7 @@ static void proc_sys_prune_dcache(struct ctl_table_header *head)
 		spin_unlock(&sysctl_lock);
 
 		inode = &ei->vfs_inode;
-		sb = inode->i_sb;
+		sb = inode_sb(inode);
 		if (!atomic_inc_not_zero(&sb->s_active))
 			continue;
 		inode = igrab(inode);
@@ -550,7 +550,7 @@ static struct dentry *proc_sys_lookup(struct inode *dir, struct dentry *dentry,
 	}
 
 	err = ERR_PTR(-ENOMEM);
-	inode = proc_sys_make_inode(dir->i_sb, h ? h : head, p);
+	inode = proc_sys_make_inode(inode_sb(dir), h ? h : head, p);
 	if (!inode)
 		goto out;
 
diff --git a/fs/proc/self.c b/fs/proc/self.c
index 4d7d061696b3..43875daa8e16 100644
--- a/fs/proc/self.c
+++ b/fs/proc/self.c
@@ -12,7 +12,7 @@ static const char *proc_self_get_link(struct dentry *dentry,
 				      struct inode *inode,
 				      struct delayed_call *done)
 {
-	struct pid_namespace *ns = inode->i_sb->s_fs_info;
+	struct pid_namespace *ns = inode_sb(inode)->s_fs_info;
 	pid_t tgid = task_tgid_nr_ns(current, ns);
 	char *name;
 
diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c
index ec6d2983a5cb..27bf744e8da9 100644
--- a/fs/proc/task_mmu.c
+++ b/fs/proc/task_mmu.c
@@ -312,7 +312,7 @@ show_map_vma(struct seq_file *m, struct vm_area_struct *vma, int is_pid)
 
 	if (file) {
 		struct inode *inode = file_inode(vma->vm_file);
-		dev = inode->i_sb->s_dev;
+		dev = inode_sb(inode)->s_dev;
 		ino = inode->i_ino;
 		pgoff = ((loff_t)vma->vm_pgoff) << PAGE_SHIFT;
 	}
diff --git a/fs/proc/task_nommu.c b/fs/proc/task_nommu.c
index 5b62f57bd9bc..d3acd4433d9d 100644
--- a/fs/proc/task_nommu.c
+++ b/fs/proc/task_nommu.c
@@ -157,7 +157,7 @@ static int nommu_vma_show(struct seq_file *m, struct vm_area_struct *vma,
 
 	if (file) {
 		struct inode *inode = file_inode(vma->vm_file);
-		dev = inode->i_sb->s_dev;
+		dev = inode_sb(inode)->s_dev;
 		ino = inode->i_ino;
 		pgoff = (loff_t)vma->vm_pgoff << PAGE_SHIFT;
 	}
diff --git a/fs/proc/thread_self.c b/fs/proc/thread_self.c
index 9d2efaca499f..fdcf057eab38 100644
--- a/fs/proc/thread_self.c
+++ b/fs/proc/thread_self.c
@@ -12,7 +12,7 @@ static const char *proc_thread_self_get_link(struct dentry *dentry,
 					     struct inode *inode,
 					     struct delayed_call *done)
 {
-	struct pid_namespace *ns = inode->i_sb->s_fs_info;
+	struct pid_namespace *ns = inode_sb(inode)->s_fs_info;
 	pid_t tgid = task_tgid_nr_ns(current, ns);
 	pid_t pid = task_pid_nr_ns(current, ns);
 	char *name;
-- 
2.15.1

^ permalink raw reply related	[flat|nested] 88+ messages in thread

* [PATCH 60/76] fs/qnx4: Use inode_sb() helper instead of inode->i_sb
  2018-05-08 18:03 [RFC][PATCH 0/76] vfs: 'views' for filesystems with more than one root Mark Fasheh
                   ` (58 preceding siblings ...)
  2018-05-08 18:04 ` [PATCH 59/76] fs/proc: " Mark Fasheh
@ 2018-05-08 18:04 ` Mark Fasheh
  2018-05-08 18:04 ` [PATCH 61/76] fs/qnx6: " Mark Fasheh
                   ` (16 subsequent siblings)
  76 siblings, 0 replies; 88+ messages in thread
From: Mark Fasheh @ 2018-05-08 18:04 UTC (permalink / raw)
  To: linux-fsdevel; +Cc: linux-kernel, linux-btrfs, Mark Fasheh

Signed-off-by: Mark Fasheh <mfasheh@suse.de>
---
 fs/qnx4/dir.c   | 2 +-
 fs/qnx4/inode.c | 4 ++--
 fs/qnx4/namei.c | 4 ++--
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/fs/qnx4/dir.c b/fs/qnx4/dir.c
index a6ee23aadd28..c0e764ce79dd 100644
--- a/fs/qnx4/dir.c
+++ b/fs/qnx4/dir.c
@@ -31,7 +31,7 @@ static int qnx4_readdir(struct file *file, struct dir_context *ctx)
 
 	while (ctx->pos < inode->i_size) {
 		blknum = qnx4_block_map(inode, ctx->pos >> QNX4_BLOCK_SIZE_BITS);
-		bh = sb_bread(inode->i_sb, blknum);
+		bh = sb_bread(inode_sb(inode), blknum);
 		if (bh == NULL) {
 			printk(KERN_ERR "qnx4_readdir: bread failed (%ld)\n", blknum);
 			return 0;
diff --git a/fs/qnx4/inode.c b/fs/qnx4/inode.c
index 3d46fe302fcb..2b5e5b18e084 100644
--- a/fs/qnx4/inode.c
+++ b/fs/qnx4/inode.c
@@ -60,7 +60,7 @@ static int qnx4_get_block( struct inode *inode, sector_t iblock, struct buffer_h
 	phys = qnx4_block_map( inode, iblock );
 	if ( phys ) {
 		// logical block is before EOF
-		map_bh(bh, inode->i_sb, phys);
+		map_bh(bh, inode_sb(inode), phys);
 	}
 	return 0;
 }
@@ -94,7 +94,7 @@ unsigned long qnx4_block_map( struct inode *inode, long iblock )
 		while ( --nxtnt > 0 ) {
 			if ( ix == 0 ) {
 				// read next xtnt block.
-				bh = sb_bread(inode->i_sb, i_xblk - 1);
+				bh = sb_bread(inode_sb(inode), i_xblk - 1);
 				if ( !bh ) {
 					QNX4DEBUG((KERN_ERR "qnx4: I/O error reading xtnt block [%ld])\n", i_xblk - 1));
 					return -EIO;
diff --git a/fs/qnx4/namei.c b/fs/qnx4/namei.c
index eca27878079d..3a84a8f6c6a7 100644
--- a/fs/qnx4/namei.c
+++ b/fs/qnx4/namei.c
@@ -67,7 +67,7 @@ static struct buffer_head *qnx4_find_entry(int len, struct inode *dir,
 		if (!bh) {
 			block = qnx4_block_map(dir, blkofs);
 			if (block)
-				bh = sb_bread(dir->i_sb, block);
+				bh = sb_bread(inode_sb(dir), block);
 			if (!bh) {
 				blkofs++;
 				continue;
@@ -113,7 +113,7 @@ struct dentry * qnx4_lookup(struct inode *dir, struct dentry *dentry, unsigned i
 	}
 	brelse(bh);
 
-	foundinode = qnx4_iget(dir->i_sb, ino);
+	foundinode = qnx4_iget(inode_sb(dir), ino);
 	if (IS_ERR(foundinode)) {
 		QNX4DEBUG((KERN_ERR "qnx4: lookup->iget -> error %ld\n",
 			   PTR_ERR(foundinode)));
-- 
2.15.1

^ permalink raw reply related	[flat|nested] 88+ messages in thread

* [PATCH 61/76] fs/qnx6: Use inode_sb() helper instead of inode->i_sb
  2018-05-08 18:03 [RFC][PATCH 0/76] vfs: 'views' for filesystems with more than one root Mark Fasheh
                   ` (59 preceding siblings ...)
  2018-05-08 18:04 ` [PATCH 60/76] fs/qnx4: " Mark Fasheh
@ 2018-05-08 18:04 ` Mark Fasheh
  2018-05-08 18:04 ` [PATCH 62/76] fs/quota: " Mark Fasheh
                   ` (15 subsequent siblings)
  76 siblings, 0 replies; 88+ messages in thread
From: Mark Fasheh @ 2018-05-08 18:04 UTC (permalink / raw)
  To: linux-fsdevel; +Cc: linux-kernel, linux-btrfs, Mark Fasheh

Signed-off-by: Mark Fasheh <mfasheh@suse.de>
---
 fs/qnx6/dir.c   | 8 ++++----
 fs/qnx6/inode.c | 4 ++--
 fs/qnx6/namei.c | 2 +-
 3 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/fs/qnx6/dir.c b/fs/qnx6/dir.c
index c1cfb8a19e9d..655d0eb9d82a 100644
--- a/fs/qnx6/dir.c
+++ b/fs/qnx6/dir.c
@@ -65,7 +65,7 @@ static int qnx6_dir_longfilename(struct inode *inode,
 			unsigned de_inode)
 {
 	struct qnx6_long_filename *lf;
-	struct super_block *s = inode->i_sb;
+	struct super_block *s = inode_sb(inode);
 	struct qnx6_sb_info *sbi = QNX6_SB(s);
 	struct page *page;
 	int lf_size;
@@ -112,7 +112,7 @@ static int qnx6_dir_longfilename(struct inode *inode,
 static int qnx6_readdir(struct file *file, struct dir_context *ctx)
 {
 	struct inode *inode = file_inode(file);
-	struct super_block *s = inode->i_sb;
+	struct super_block *s = inode_sb(inode);
 	struct qnx6_sb_info *sbi = QNX6_SB(s);
 	loff_t pos = ctx->pos & ~(QNX6_DIR_ENTRY_SIZE - 1);
 	unsigned long npages = dir_pages(inode);
@@ -175,7 +175,7 @@ static int qnx6_readdir(struct file *file, struct dir_context *ctx)
 static unsigned qnx6_long_match(int len, const char *name,
 			struct qnx6_long_dir_entry *de, struct inode *dir)
 {
-	struct super_block *s = dir->i_sb;
+	struct super_block *s = inode_sb(dir);
 	struct qnx6_sb_info *sbi = QNX6_SB(s);
 	struct page *page;
 	int thislen;
@@ -213,7 +213,7 @@ static unsigned qnx6_match(struct super_block *s, int len, const char *name,
 unsigned qnx6_find_entry(int len, struct inode *dir, const char *name,
 			 struct page **res_page)
 {
-	struct super_block *s = dir->i_sb;
+	struct super_block *s = inode_sb(dir);
 	struct qnx6_inode_info *ei = QNX6_I(dir);
 	struct page *page = NULL;
 	unsigned long start, n;
diff --git a/fs/qnx6/inode.c b/fs/qnx6/inode.c
index 4aeb26bcb4d0..4be77b89f11d 100644
--- a/fs/qnx6/inode.c
+++ b/fs/qnx6/inode.c
@@ -79,7 +79,7 @@ static int qnx6_get_block(struct inode *inode, sector_t iblock,
 	phys = qnx6_block_map(inode, iblock);
 	if (phys) {
 		/* logical block is before EOF */
-		map_bh(bh, inode->i_sb, phys);
+		map_bh(bh, inode_sb(inode), phys);
 	}
 	return 0;
 }
@@ -110,7 +110,7 @@ static int qnx6_readpages(struct file *file, struct address_space *mapping,
  */
 static unsigned qnx6_block_map(struct inode *inode, unsigned no)
 {
-	struct super_block *s = inode->i_sb;
+	struct super_block *s = inode_sb(inode);
 	struct qnx6_sb_info *sbi = QNX6_SB(s);
 	struct qnx6_inode_info *ei = QNX6_I(inode);
 	unsigned block = 0;
diff --git a/fs/qnx6/namei.c b/fs/qnx6/namei.c
index 72c2770830be..0b1a626c20d8 100644
--- a/fs/qnx6/namei.c
+++ b/fs/qnx6/namei.c
@@ -27,7 +27,7 @@ struct dentry *qnx6_lookup(struct inode *dir, struct dentry *dentry,
 
 	ino = qnx6_find_entry(len, dir, name, &page);
 	if (ino) {
-		foundinode = qnx6_iget(dir->i_sb, ino);
+		foundinode = qnx6_iget(inode_sb(dir), ino);
 		qnx6_put_page(page);
 		if (IS_ERR(foundinode)) {
 			pr_debug("lookup->iget ->  error %ld\n",
-- 
2.15.1

^ permalink raw reply related	[flat|nested] 88+ messages in thread

* [PATCH 62/76] fs/quota: Use inode_sb() helper instead of inode->i_sb
  2018-05-08 18:03 [RFC][PATCH 0/76] vfs: 'views' for filesystems with more than one root Mark Fasheh
                   ` (60 preceding siblings ...)
  2018-05-08 18:04 ` [PATCH 61/76] fs/qnx6: " Mark Fasheh
@ 2018-05-08 18:04 ` Mark Fasheh
  2018-05-08 18:04 ` [PATCH 63/76] fs/ramfs: " Mark Fasheh
                   ` (14 subsequent siblings)
  76 siblings, 0 replies; 88+ messages in thread
From: Mark Fasheh @ 2018-05-08 18:04 UTC (permalink / raw)
  To: linux-fsdevel; +Cc: linux-kernel, linux-btrfs, Mark Fasheh

Signed-off-by: Mark Fasheh <mfasheh@suse.de>
---
 fs/quota/dquot.c | 30 +++++++++++++++---------------
 1 file changed, 15 insertions(+), 15 deletions(-)

diff --git a/fs/quota/dquot.c b/fs/quota/dquot.c
index 020c597ef9b6..ba6d549323cb 100644
--- a/fs/quota/dquot.c
+++ b/fs/quota/dquot.c
@@ -920,7 +920,7 @@ EXPORT_SYMBOL(dqget);
 
 static inline struct dquot **i_dquot(struct inode *inode)
 {
-	return inode->i_sb->s_op->get_dquots(inode);
+	return inode_sb(inode)->s_op->get_dquots(inode);
 }
 
 static int dqinit_needed(struct inode *inode, int type)
@@ -1406,7 +1406,7 @@ static int info_bdq_free(struct dquot *dquot, qsize_t space)
 
 static int dquot_active(const struct inode *inode)
 {
-	struct super_block *sb = inode->i_sb;
+	struct super_block *sb = inode_sb(inode);
 
 	if (IS_NOQUOTA(inode))
 		return 0;
@@ -1423,7 +1423,7 @@ static int __dquot_initialize(struct inode *inode, int type)
 {
 	int cnt, init_needed = 0;
 	struct dquot **dquots, *got[MAXQUOTAS] = {};
-	struct super_block *sb = inode->i_sb;
+	struct super_block *sb = inode_sb(inode);
 	qsize_t rsv;
 	int ret = 0;
 
@@ -1462,7 +1462,7 @@ static int __dquot_initialize(struct inode *inode, int type)
 			qid = make_kqid_gid(inode->i_gid);
 			break;
 		case PRJQUOTA:
-			rc = inode->i_sb->dq_op->get_projid(inode, &projid);
+			rc = inode_sb(inode)->dq_op->get_projid(inode, &projid);
 			if (rc)
 				continue;
 			qid = make_kqid_projid(projid);
@@ -1540,7 +1540,7 @@ bool dquot_initialize_needed(struct inode *inode)
 
 	dquots = i_dquot(inode);
 	for (i = 0; i < MAXQUOTAS; i++)
-		if (!dquots[i] && sb_has_quota_active(inode->i_sb, i))
+		if (!dquots[i] && sb_has_quota_active(inode_sb(inode), i))
 			return true;
 	return false;
 }
@@ -1603,13 +1603,13 @@ static qsize_t *inode_reserved_space(struct inode * inode)
 {
 	/* Filesystem must explicitly define it's own method in order to use
 	 * quota reservation interface */
-	BUG_ON(!inode->i_sb->dq_op->get_reserved_space);
-	return inode->i_sb->dq_op->get_reserved_space(inode);
+	BUG_ON(!inode_sb(inode)->dq_op->get_reserved_space);
+	return inode_sb(inode)->dq_op->get_reserved_space(inode);
 }
 
 static qsize_t __inode_get_rsv_space(struct inode *inode)
 {
-	if (!inode->i_sb->dq_op->get_reserved_space)
+	if (!inode_sb(inode)->dq_op->get_reserved_space)
 		return 0;
 	return *inode_reserved_space(inode);
 }
@@ -1618,7 +1618,7 @@ static qsize_t inode_get_rsv_space(struct inode *inode)
 {
 	qsize_t ret;
 
-	if (!inode->i_sb->dq_op->get_reserved_space)
+	if (!inode_sb(inode)->dq_op->get_reserved_space)
 		return 0;
 	spin_lock(&inode->i_lock);
 	ret = __inode_get_rsv_space(inode);
@@ -1955,8 +1955,8 @@ int __dquot_transfer(struct inode *inode, struct dquot **transfer_to)
 	if (IS_NOQUOTA(inode))
 		return 0;
 
-	if (inode->i_sb->dq_op->get_inode_usage) {
-		ret = inode->i_sb->dq_op->get_inode_usage(inode, &inode_usage);
+	if (inode_sb(inode)->dq_op->get_inode_usage) {
+		ret = inode_sb(inode)->dq_op->get_inode_usage(inode, &inode_usage);
 		if (ret)
 			return ret;
 	}
@@ -1988,7 +1988,7 @@ int __dquot_transfer(struct inode *inode, struct dquot **transfer_to)
 		if (!transfer_to[cnt])
 			continue;
 		/* Avoid races with quotaoff() */
-		if (!sb_has_quota_active(inode->i_sb, cnt))
+		if (!sb_has_quota_active(inode_sb(inode), cnt))
 			continue;
 		is_valid[cnt] = 1;
 		transfer_from[cnt] = i_dquot(inode)[cnt];
@@ -2070,7 +2070,7 @@ int dquot_transfer(struct inode *inode, struct iattr *iattr)
 {
 	struct dquot *transfer_to[MAXQUOTAS] = {};
 	struct dquot *dquot;
-	struct super_block *sb = inode->i_sb;
+	struct super_block *sb = inode_sb(inode);
 	int ret;
 
 	if (!dquot_active(inode))
@@ -2302,7 +2302,7 @@ static int vfs_load_quota_inode(struct inode *inode, int type, int format_id,
 	unsigned int flags)
 {
 	struct quota_format_type *fmt = find_quota_format(format_id);
-	struct super_block *sb = inode->i_sb;
+	struct super_block *sb = inode_sb(inode);
 	struct quota_info *dqopt = sb_dqopt(sb);
 	int error;
 
@@ -2464,7 +2464,7 @@ EXPORT_SYMBOL(dquot_quota_on);
 int dquot_enable(struct inode *inode, int type, int format_id,
 		 unsigned int flags)
 {
-	struct super_block *sb = inode->i_sb;
+	struct super_block *sb = inode_sb(inode);
 
 	/* Just unsuspend quotas? */
 	BUG_ON(flags & DQUOT_SUSPENDED);
-- 
2.15.1

^ permalink raw reply related	[flat|nested] 88+ messages in thread

* [PATCH 63/76] fs/ramfs: Use inode_sb() helper instead of inode->i_sb
  2018-05-08 18:03 [RFC][PATCH 0/76] vfs: 'views' for filesystems with more than one root Mark Fasheh
                   ` (61 preceding siblings ...)
  2018-05-08 18:04 ` [PATCH 62/76] fs/quota: " Mark Fasheh
@ 2018-05-08 18:04 ` Mark Fasheh
  2018-05-08 18:04 ` [PATCH 64/76] fs/read: " Mark Fasheh
                   ` (13 subsequent siblings)
  76 siblings, 0 replies; 88+ messages in thread
From: Mark Fasheh @ 2018-05-08 18:04 UTC (permalink / raw)
  To: linux-fsdevel; +Cc: linux-kernel, linux-btrfs, Mark Fasheh

Signed-off-by: Mark Fasheh <mfasheh@suse.de>
---
 fs/ramfs/inode.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/ramfs/inode.c b/fs/ramfs/inode.c
index 11201b2d06b9..57b78ae51ed1 100644
--- a/fs/ramfs/inode.c
+++ b/fs/ramfs/inode.c
@@ -101,7 +101,7 @@ struct inode *ramfs_get_inode(struct super_block *sb,
 static int
 ramfs_mknod(struct inode *dir, struct dentry *dentry, umode_t mode, dev_t dev)
 {
-	struct inode * inode = ramfs_get_inode(dir->i_sb, dir, mode, dev);
+	struct inode * inode = ramfs_get_inode(inode_sb(dir), dir, mode, dev);
 	int error = -ENOSPC;
 
 	if (inode) {
@@ -131,7 +131,7 @@ static int ramfs_symlink(struct inode * dir, struct dentry *dentry, const char *
 	struct inode *inode;
 	int error = -ENOSPC;
 
-	inode = ramfs_get_inode(dir->i_sb, dir, S_IFLNK|S_IRWXUGO, 0);
+	inode = ramfs_get_inode(inode_sb(dir), dir, S_IFLNK|S_IRWXUGO, 0);
 	if (inode) {
 		int l = strlen(symname)+1;
 		error = page_symlink(inode, symname, l);
-- 
2.15.1

^ permalink raw reply related	[flat|nested] 88+ messages in thread

* [PATCH 64/76] fs/read: Use inode_sb() helper instead of inode->i_sb
  2018-05-08 18:03 [RFC][PATCH 0/76] vfs: 'views' for filesystems with more than one root Mark Fasheh
                   ` (62 preceding siblings ...)
  2018-05-08 18:04 ` [PATCH 63/76] fs/ramfs: " Mark Fasheh
@ 2018-05-08 18:04 ` Mark Fasheh
  2018-05-08 18:04 ` [PATCH 65/76] fs/reiserfs: " Mark Fasheh
                   ` (12 subsequent siblings)
  76 siblings, 0 replies; 88+ messages in thread
From: Mark Fasheh @ 2018-05-08 18:04 UTC (permalink / raw)
  To: linux-fsdevel; +Cc: linux-kernel, linux-btrfs, Mark Fasheh

Signed-off-by: Mark Fasheh <mfasheh@suse.de>
---
 fs/read_write.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/fs/read_write.c b/fs/read_write.c
index f8547b82dfb3..cf9900707558 100644
--- a/fs/read_write.c
+++ b/fs/read_write.c
@@ -146,7 +146,7 @@ loff_t generic_file_llseek(struct file *file, loff_t offset, int whence)
 	struct inode *inode = file->f_mapping->host;
 
 	return generic_file_llseek_size(file, offset, whence,
-					inode->i_sb->s_maxbytes,
+					inode_sb(inode)->s_maxbytes,
 					i_size_read(inode));
 }
 EXPORT_SYMBOL(generic_file_llseek);
@@ -1389,7 +1389,8 @@ static ssize_t do_sendfile(int out_fd, int in_fd, loff_t *ppos,
 		goto fput_out;
 
 	if (!max)
-		max = min(in_inode->i_sb->s_maxbytes, out_inode->i_sb->s_maxbytes);
+		max = min(inode_sb(in_inode)->s_maxbytes,
+			  inode_sb(out_inode)->s_maxbytes);
 
 	if (unlikely(pos + count > max)) {
 		retval = -EOVERFLOW;
@@ -1549,7 +1550,7 @@ ssize_t vfs_copy_file_range(struct file *file_in, loff_t pos_in,
 		return -EBADF;
 
 	/* this could be relaxed once a method supports cross-fs copies */
-	if (inode_in->i_sb != inode_out->i_sb)
+	if (inode_sb(inode_in) != inode_sb(inode_out))
 		return -EXDEV;
 
 	if (len == 0)
@@ -1694,7 +1695,7 @@ int vfs_clone_file_prep_inodes(struct inode *inode_in, loff_t pos_in,
 			       struct inode *inode_out, loff_t pos_out,
 			       u64 *len, bool is_dedupe)
 {
-	loff_t bs = inode_out->i_sb->s_blocksize;
+	loff_t bs = inode_sb(inode_out)->s_blocksize;
 	loff_t blen;
 	loff_t isize;
 	bool same_inode = (inode_in == inode_out);
@@ -1808,7 +1809,7 @@ int vfs_clone_file_range(struct file *file_in, loff_t pos_in,
 	 * the same mount. Practically, they only need to be on the same file
 	 * system.
 	 */
-	if (inode_in->i_sb != inode_out->i_sb)
+	if (inode_sb(inode_in) != inode_sb(inode_out))
 		return -EXDEV;
 
 	if (!(file_in->f_mode & FMODE_READ) ||
-- 
2.15.1

^ permalink raw reply related	[flat|nested] 88+ messages in thread

* [PATCH 65/76] fs/reiserfs: Use inode_sb() helper instead of inode->i_sb
  2018-05-08 18:03 [RFC][PATCH 0/76] vfs: 'views' for filesystems with more than one root Mark Fasheh
                   ` (63 preceding siblings ...)
  2018-05-08 18:04 ` [PATCH 64/76] fs/read: " Mark Fasheh
@ 2018-05-08 18:04 ` Mark Fasheh
  2018-05-08 18:04 ` [PATCH 66/76] fs/romfs: " Mark Fasheh
                   ` (11 subsequent siblings)
  76 siblings, 0 replies; 88+ messages in thread
From: Mark Fasheh @ 2018-05-08 18:04 UTC (permalink / raw)
  To: linux-fsdevel; +Cc: linux-kernel, linux-btrfs, Mark Fasheh

Signed-off-by: Mark Fasheh <mfasheh@suse.de>
---
 fs/reiserfs/bitmap.c          |  12 +-
 fs/reiserfs/dir.c             |  27 ++--
 fs/reiserfs/file.c            |  22 +--
 fs/reiserfs/inode.c           | 321 +++++++++++++++++++++---------------------
 fs/reiserfs/ioctl.c           |  18 +--
 fs/reiserfs/journal.c         |  10 +-
 fs/reiserfs/namei.c           | 190 +++++++++++++------------
 fs/reiserfs/reiserfs.h        |   8 +-
 fs/reiserfs/stree.c           |  69 ++++-----
 fs/reiserfs/super.c           |  31 ++--
 fs/reiserfs/tail_conversion.c |   6 +-
 fs/reiserfs/xattr.c           |  36 ++---
 fs/reiserfs/xattr.h           |  13 +-
 fs/reiserfs/xattr_acl.c       |  14 +-
 fs/reiserfs/xattr_security.c  |   2 +-
 fs/reiserfs/xattr_user.c      |   4 +-
 16 files changed, 397 insertions(+), 386 deletions(-)

diff --git a/fs/reiserfs/bitmap.c b/fs/reiserfs/bitmap.c
index edc8ef78b63f..9d73c0df3bf3 100644
--- a/fs/reiserfs/bitmap.c
+++ b/fs/reiserfs/bitmap.c
@@ -325,13 +325,13 @@ static inline int block_group_used(struct super_block *s, u32 id)
 __le32 reiserfs_choose_packing(struct inode * dir)
 {
 	__le32 packing;
-	if (TEST_OPTION(packing_groups, dir->i_sb)) {
+	if (TEST_OPTION(packing_groups, inode_sb(dir))) {
 		u32 parent_dir = le32_to_cpu(INODE_PKEY(dir)->k_dir_id);
 		/*
 		 * some versions of reiserfsck expect packing locality 1 to be
 		 * special
 		 */
-		if (parent_dir == 1 || block_group_used(dir->i_sb, parent_dir))
+		if (parent_dir == 1 || block_group_used(inode_sb(dir), parent_dir))
 			packing = INODE_PKEY(dir)->k_objectid;
 		else
 			packing = INODE_PKEY(dir)->k_dir_id;
@@ -837,11 +837,11 @@ static void oid_groups(reiserfs_blocknr_hint_t * hint)
 		 * the start of the disk
 		 */
 		if (dirid <= 2)
-			hash = (hint->inode->i_sb->s_blocksize << 3);
+			hash = (inode_sb(hint->inode)->s_blocksize << 3);
 		else {
 			oid = le32_to_cpu(INODE_PKEY(hint->inode)->k_objectid);
-			bm = bmap_hash_id(hint->inode->i_sb, oid);
-			hash = bm * (hint->inode->i_sb->s_blocksize << 3);
+			bm = bmap_hash_id(inode_sb(hint->inode), oid);
+			hash = bm * (inode_sb(hint->inode)->s_blocksize << 3);
 		}
 		hint->search_start = hash;
 	}
@@ -1139,7 +1139,7 @@ static int determine_prealloc_size(reiserfs_blocknr_hint_t * hint)
 		if (S_ISREG(hint->inode->i_mode) && !IS_PRIVATE(hint->inode)
 		    && hint->inode->i_size >=
 		    REISERFS_SB(hint->th->t_super)->s_alloc_options.
-		    preallocmin * hint->inode->i_sb->s_blocksize)
+		    preallocmin * inode_sb(hint->inode)->s_blocksize)
 			hint->prealloc_size =
 			    REISERFS_SB(hint->th->t_super)->s_alloc_options.
 			    preallocsize - 1;
diff --git a/fs/reiserfs/dir.c b/fs/reiserfs/dir.c
index 5b50689d8539..d9aff9f826cc 100644
--- a/fs/reiserfs/dir.c
+++ b/fs/reiserfs/dir.c
@@ -39,9 +39,9 @@ static int reiserfs_dir_fsync(struct file *filp, loff_t start, loff_t end,
 		return err;
 
 	inode_lock(inode);
-	reiserfs_write_lock(inode->i_sb);
+	reiserfs_write_lock(inode_sb(inode));
 	err = reiserfs_commit_for_inode(inode);
-	reiserfs_write_unlock(inode->i_sb);
+	reiserfs_write_unlock(inode_sb(inode));
 	inode_unlock(inode);
 	if (err < 0)
 		return err;
@@ -52,7 +52,7 @@ static int reiserfs_dir_fsync(struct file *filp, loff_t start, loff_t end,
 
 static inline bool is_privroot_deh(struct inode *dir, struct reiserfs_de_head *deh)
 {
-	struct dentry *privroot = REISERFS_SB(dir->i_sb)->priv_root;
+	struct dentry *privroot = REISERFS_SB(inode_sb(dir))->priv_root;
 	return (d_really_is_positive(privroot) &&
 	        deh->deh_objectid == INODE_PKEY(d_inode(privroot))->k_objectid);
 }
@@ -76,9 +76,9 @@ int reiserfs_readdir_inode(struct inode *inode, struct dir_context *ctx)
 	int ret = 0;
 	int depth;
 
-	reiserfs_write_lock(inode->i_sb);
+	reiserfs_write_lock(inode_sb(inode));
 
-	reiserfs_check_lock_depth(inode->i_sb, "readdir");
+	reiserfs_check_lock_depth(inode_sb(inode), "readdir");
 
 	/*
 	 * form key for search the next directory entry using
@@ -95,7 +95,8 @@ int reiserfs_readdir_inode(struct inode *inode, struct dir_context *ctx)
 		 * specified key
 		 */
 		search_res =
-		    search_by_entry_key(inode->i_sb, &pos_key, &path_to_entry,
+		    search_by_entry_key(inode_sb(inode), &pos_key,
+					&path_to_entry,
 					&de);
 		if (search_res == IO_ERROR) {
 			/*
@@ -165,7 +166,7 @@ int reiserfs_readdir_inode(struct inode *inode, struct dir_context *ctx)
 
 				/* too big to send back to VFS */
 				if (d_reclen >
-				    REISERFS_MAX_NAME(inode->i_sb->
+				    REISERFS_MAX_NAME(inode_sb(inode)->
 						      s_blocksize)) {
 					continue;
 				}
@@ -205,17 +206,19 @@ int reiserfs_readdir_inode(struct inode *inode, struct dir_context *ctx)
 				 * Since filldir might sleep, we can release
 				 * the write lock here for other waiters
 				 */
-				depth = reiserfs_write_unlock_nested(inode->i_sb);
+				depth = reiserfs_write_unlock_nested(inode_sb(inode));
 				if (!dir_emit
 				    (ctx, local_buf, d_reclen, d_ino,
 				     DT_UNKNOWN)) {
-					reiserfs_write_lock_nested(inode->i_sb, depth);
+					reiserfs_write_lock_nested(inode_sb(inode),
+								   depth);
 					if (local_buf != small_buf) {
 						kfree(local_buf);
 					}
 					goto end;
 				}
-				reiserfs_write_lock_nested(inode->i_sb, depth);
+				reiserfs_write_lock_nested(inode_sb(inode),
+							   depth);
 				if (local_buf != small_buf) {
 					kfree(local_buf);
 				}
@@ -239,7 +242,7 @@ int reiserfs_readdir_inode(struct inode *inode, struct dir_context *ctx)
 		 * item we went through is last item of node. Using right
 		 * delimiting key check is it directory end
 		 */
-		rkey = get_rkey(&path_to_entry, inode->i_sb);
+		rkey = get_rkey(&path_to_entry, inode_sb(inode));
 		if (!comp_le_keys(rkey, &MIN_KEY)) {
 			/*
 			 * set pos_key to key, that is the smallest and greater
@@ -265,7 +268,7 @@ int reiserfs_readdir_inode(struct inode *inode, struct dir_context *ctx)
 	pathrelse(&path_to_entry);
 	reiserfs_check_path(&path_to_entry);
 out:
-	reiserfs_write_unlock(inode->i_sb);
+	reiserfs_write_unlock(inode_sb(inode));
 	return ret;
 }
 
diff --git a/fs/reiserfs/file.c b/fs/reiserfs/file.c
index 843aadcc123c..8b41044bbd12 100644
--- a/fs/reiserfs/file.c
+++ b/fs/reiserfs/file.c
@@ -56,14 +56,14 @@ static int reiserfs_file_release(struct inode *inode, struct file *filp)
 		return 0;
 	}
 
-	reiserfs_write_lock(inode->i_sb);
+	reiserfs_write_lock(inode_sb(inode));
 	/*
 	 * freeing preallocation only involves relogging blocks that
 	 * are already in the current transaction.  preallocation gets
 	 * freed at the end of each transaction, so it is impossible for
 	 * us to log any additional blocks (including quota blocks)
 	 */
-	err = journal_begin(&th, inode->i_sb, 1);
+	err = journal_begin(&th, inode_sb(inode), 1);
 	if (err) {
 		/*
 		 * uh oh, we can't allow the inode to go away while there
@@ -71,7 +71,7 @@ static int reiserfs_file_release(struct inode *inode, struct file *filp)
 		 * aborted transaction
 		 */
 		jbegin_failure = err;
-		err = journal_join_abort(&th, inode->i_sb);
+		err = journal_join_abort(&th, inode_sb(inode));
 
 		if (err) {
 			/*
@@ -84,7 +84,7 @@ static int reiserfs_file_release(struct inode *inode, struct file *filp)
 			 * and let the admin know what is going on.
 			 */
 			igrab(inode);
-			reiserfs_warning(inode->i_sb, "clm-9001",
+			reiserfs_warning(inode_sb(inode), "clm-9001",
 					 "pinning inode %lu because the "
 					 "preallocation can't be freed",
 					 inode->i_ino);
@@ -115,7 +115,7 @@ static int reiserfs_file_release(struct inode *inode, struct file *filp)
 		err = reiserfs_truncate_file(inode, 0);
 	}
 out:
-	reiserfs_write_unlock(inode->i_sb);
+	reiserfs_write_unlock(inode_sb(inode));
 	mutex_unlock(&REISERFS_I(inode)->tailpack);
 	return err;
 }
@@ -161,11 +161,11 @@ static int reiserfs_sync_file(struct file *filp, loff_t start, loff_t end,
 	inode_lock(inode);
 	BUG_ON(!S_ISREG(inode->i_mode));
 	err = sync_mapping_buffers(inode->i_mapping);
-	reiserfs_write_lock(inode->i_sb);
+	reiserfs_write_lock(inode_sb(inode));
 	barrier_done = reiserfs_commit_for_inode(inode);
-	reiserfs_write_unlock(inode->i_sb);
-	if (barrier_done != 1 && reiserfs_barrier_flush(inode->i_sb))
-		blkdev_issue_flush(inode->i_sb->s_bdev, GFP_KERNEL, NULL);
+	reiserfs_write_unlock(inode_sb(inode));
+	if (barrier_done != 1 && reiserfs_barrier_flush(inode_sb(inode)))
+		blkdev_issue_flush(inode_sb(inode)->s_bdev, GFP_KERNEL, NULL);
 	inode_unlock(inode);
 	if (barrier_done < 0)
 		return barrier_done;
@@ -183,7 +183,7 @@ int reiserfs_commit_page(struct inode *inode, struct page *page,
 	unsigned long i_size_index = inode->i_size >> PAGE_SHIFT;
 	int new;
 	int logit = reiserfs_file_data_log(inode);
-	struct super_block *s = inode->i_sb;
+	struct super_block *s = inode_sb(inode);
 	int bh_per_page = PAGE_SIZE / s->s_blocksize;
 	struct reiserfs_transaction_handle th;
 	int ret = 0;
@@ -219,7 +219,7 @@ int reiserfs_commit_page(struct inode *inode, struct page *page,
 				 * do data=ordered on any page past the end
 				 * of file and any buffer marked BH_New.
 				 */
-				if (reiserfs_data_ordered(inode->i_sb) &&
+				if (reiserfs_data_ordered(inode_sb(inode)) &&
 				    (new || page->index >= i_size_index)) {
 					reiserfs_add_ordered_list(inode, bh);
 				}
diff --git a/fs/reiserfs/inode.c b/fs/reiserfs/inode.c
index b13fc024d2ee..a3c814ddb774 100644
--- a/fs/reiserfs/inode.c
+++ b/fs/reiserfs/inode.c
@@ -32,7 +32,7 @@ void reiserfs_evict_inode(struct inode *inode)
 	 */
 	int jbegin_count =
 	    JOURNAL_PER_BALANCE_CNT * 2 +
-	    2 * REISERFS_QUOTA_INIT_BLOCKS(inode->i_sb);
+	    2 * REISERFS_QUOTA_INIT_BLOCKS(inode_sb(inode));
 	struct reiserfs_transaction_handle th;
 	int err;
 
@@ -52,9 +52,9 @@ void reiserfs_evict_inode(struct inode *inode)
 
 		reiserfs_delete_xattrs(inode);
 
-		reiserfs_write_lock(inode->i_sb);
+		reiserfs_write_lock(inode_sb(inode));
 
-		if (journal_begin(&th, inode->i_sb, jbegin_count))
+		if (journal_begin(&th, inode_sb(inode), jbegin_count))
 			goto out;
 		reiserfs_update_inode_transaction(inode);
 
@@ -68,9 +68,9 @@ void reiserfs_evict_inode(struct inode *inode)
 		 * go into the same transaction as stat data deletion
 		 */
 		if (!err) {
-			int depth = reiserfs_write_unlock_nested(inode->i_sb);
+			int depth = reiserfs_write_unlock_nested(inode_sb(inode));
 			dquot_free_inode(inode);
-			reiserfs_write_lock_nested(inode->i_sb, depth);
+			reiserfs_write_lock_nested(inode_sb(inode), depth);
 		}
 
 		if (journal_end(&th))
@@ -90,7 +90,7 @@ void reiserfs_evict_inode(struct inode *inode)
 		 */
 		remove_save_link(inode, 0 /* not truncate */);
 out:
-		reiserfs_write_unlock(inode->i_sb);
+		reiserfs_write_unlock(inode_sb(inode));
 	} else {
 		/* no object items are in the tree */
 		;
@@ -231,7 +231,7 @@ static inline int indirect_item_found(int retval, struct item_head *ih)
 static inline void set_block_dev_mapped(struct buffer_head *bh,
 					b_blocknr_t block, struct inode *inode)
 {
-	map_bh(bh, inode->i_sb, block);
+	map_bh(bh, inode_sb(inode), block);
 }
 
 /*
@@ -243,7 +243,7 @@ static int file_capable(struct inode *inode, sector_t block)
 	/* it is new file. */
 	if (get_inode_item_key_version(inode) != KEY_FORMAT_3_5 ||
 	    /* old file, but 'block' is inside of 2gb */
-	    block < (1 << (31 - inode->i_sb->s_blocksize_bits)))
+	    block < (1 << (31 - inode_sb(inode)->s_blocksize_bits)))
 		return 1;
 
 	return 0;
@@ -299,10 +299,11 @@ static int _get_block_create_0(struct inode *inode, sector_t block,
 
 	/* prepare the key to look for the 'block'-th block of file */
 	make_cpu_key(&key, inode,
-		     (loff_t) block * inode->i_sb->s_blocksize + 1, TYPE_ANY,
+		     (loff_t) block * inode_sb(inode)->s_blocksize + 1,
+		     TYPE_ANY,
 		     3);
 
-	result = search_for_position_by_key(inode->i_sb, &key, &path);
+	result = search_for_position_by_key(inode_sb(inode), &key, &path);
 	if (result != POSITION_FOUND) {
 		pathrelse(&path);
 		if (p)
@@ -334,7 +335,7 @@ static int _get_block_create_0(struct inode *inode, sector_t block,
 		blocknr = get_block_num(ind_item, path.pos_in_item);
 		ret = 0;
 		if (blocknr) {
-			map_bh(bh_result, inode->i_sb, blocknr);
+			map_bh(bh_result, inode_sb(inode), blocknr);
 			if (path.pos_in_item ==
 			    ((ih_item_len(ih) / UNFM_P_SIZE) - 1)) {
 				set_buffer_boundary(bh_result);
@@ -400,7 +401,7 @@ static int _get_block_create_0(struct inode *inode, sector_t block,
 		p = (char *)kmap(bh_result->b_page);
 
 	p += offset;
-	memset(p, 0, inode->i_sb->s_blocksize);
+	memset(p, 0, inode_sb(inode)->s_blocksize);
 	do {
 		if (!is_direct_le_ih(ih)) {
 			BUG();
@@ -439,7 +440,8 @@ static int _get_block_create_0(struct inode *inode, sector_t block,
 
 		/* update key to look for the next piece */
 		set_cpu_key_k_offset(&key, cpu_key_k_offset(&key) + chars);
-		result = search_for_position_by_key(inode->i_sb, &key, &path);
+		result = search_for_position_by_key(inode_sb(inode), &key,
+						    &path);
 		if (result != POSITION_FOUND)
 			/* i/o error most likely */
 			break;
@@ -460,7 +462,7 @@ static int _get_block_create_0(struct inode *inode, sector_t block,
 	 * this buffer has valid data, but isn't valid for io.  mapping it to
 	 * block #0 tells the rest of reiserfs it just has a tail in it
 	 */
-	map_bh(bh_result, inode->i_sb, 0);
+	map_bh(bh_result, inode_sb(inode), 0);
 	set_buffer_uptodate(bh_result);
 	return 0;
 }
@@ -475,10 +477,10 @@ static int reiserfs_bmap(struct inode *inode, sector_t block,
 	if (!file_capable(inode, block))
 		return -EFBIG;
 
-	reiserfs_write_lock(inode->i_sb);
+	reiserfs_write_lock(inode_sb(inode));
 	/* do not read the direct item */
 	_get_block_create_0(inode, block, bh_result, 0);
-	reiserfs_write_unlock(inode->i_sb);
+	reiserfs_write_unlock(inode_sb(inode));
 	return 0;
 }
 
@@ -549,12 +551,12 @@ static int reiserfs_get_blocks_direct_io(struct inode *inode,
 	if (REISERFS_I(inode)->i_flags & i_pack_on_close_mask) {
 		int err;
 
-		reiserfs_write_lock(inode->i_sb);
+		reiserfs_write_lock(inode_sb(inode));
 
 		err = reiserfs_commit_for_inode(inode);
 		REISERFS_I(inode)->i_flags &= ~i_pack_on_close_mask;
 
-		reiserfs_write_unlock(inode->i_sb);
+		reiserfs_write_unlock(inode_sb(inode));
 
 		if (err < 0)
 			ret = err;
@@ -679,17 +681,17 @@ int reiserfs_get_block(struct inode *inode, sector_t block,
 	 */
 	int jbegin_count =
 	    JOURNAL_PER_BALANCE_CNT * 3 + 1 +
-	    2 * REISERFS_QUOTA_TRANS_BLOCKS(inode->i_sb);
+	    2 * REISERFS_QUOTA_TRANS_BLOCKS(inode_sb(inode));
 	int version;
 	int dangle = 1;
 	loff_t new_offset =
-	    (((loff_t) block) << inode->i_sb->s_blocksize_bits) + 1;
+	    (((loff_t) block) << inode_sb(inode)->s_blocksize_bits) + 1;
 
-	reiserfs_write_lock(inode->i_sb);
+	reiserfs_write_lock(inode_sb(inode));
 	version = get_inode_item_key_version(inode);
 
 	if (!file_capable(inode, block)) {
-		reiserfs_write_unlock(inode->i_sb);
+		reiserfs_write_unlock(inode_sb(inode));
 		return -EFBIG;
 	}
 
@@ -702,7 +704,7 @@ int reiserfs_get_block(struct inode *inode, sector_t block,
 		/* find number of block-th logical block of the file */
 		ret = _get_block_create_0(inode, block, bh_result,
 					  create | GET_BLOCK_READ_DIRECT);
-		reiserfs_write_unlock(inode->i_sb);
+		reiserfs_write_unlock(inode_sb(inode));
 		return ret;
 	}
 
@@ -711,7 +713,7 @@ int reiserfs_get_block(struct inode *inode, sector_t block,
 	 * any new transactions we start in this func
 	 */
 	if ((create & GET_BLOCK_NO_DANGLE) ||
-	    reiserfs_transaction_running(inode->i_sb))
+	    reiserfs_transaction_running(inode_sb(inode)))
 		dangle = 0;
 
 	/*
@@ -719,17 +721,18 @@ int reiserfs_get_block(struct inode *inode, sector_t block,
 	 * tails are enabled  we should mark it as possibly needing
 	 * tail packing on close
 	 */
-	if ((have_large_tails(inode->i_sb)
+	if ((have_large_tails(inode_sb(inode))
 	     && inode->i_size < i_block_size(inode) * 4)
-	    || (have_small_tails(inode->i_sb)
+	    || (have_small_tails(inode_sb(inode))
 		&& inode->i_size < i_block_size(inode)))
 		REISERFS_I(inode)->i_flags |= i_pack_on_close_mask;
 
 	/* set the key of the first byte in the 'block'-th block of file */
 	make_cpu_key(&key, inode, new_offset, TYPE_ANY, 3 /*key length */ );
-	if ((new_offset + inode->i_sb->s_blocksize - 1) > inode->i_size) {
+	if ((new_offset + inode_sb(inode)->s_blocksize - 1) > inode->i_size) {
 start_trans:
-		th = reiserfs_persistent_transaction(inode->i_sb, jbegin_count);
+		th = reiserfs_persistent_transaction(inode_sb(inode),
+						     jbegin_count);
 		if (!th) {
 			retval = -ENOMEM;
 			goto failure;
@@ -738,7 +741,7 @@ int reiserfs_get_block(struct inode *inode, sector_t block,
 	}
 research:
 
-	retval = search_for_position_by_key(inode->i_sb, &key, &path);
+	retval = search_for_position_by_key(inode_sb(inode), &key, &path);
 	if (retval == IO_ERROR) {
 		retval = -EIO;
 		goto failure;
@@ -749,7 +752,7 @@ int reiserfs_get_block(struct inode *inode, sector_t block,
 	item = tp_item_body(&path);
 	pos_in_item = path.pos_in_item;
 
-	fs_gen = get_generation(inode->i_sb);
+	fs_gen = get_generation(inode_sb(inode));
 	copy_item_head(&tmp_ih, ih);
 
 	if (allocation_needed
@@ -770,7 +773,7 @@ int reiserfs_get_block(struct inode *inode, sector_t block,
 		 * research if we succeed on the second try
 		 */
 		if (repeat == NO_DISK_SPACE || repeat == QUOTA_EXCEEDED) {
-			SB_JOURNAL(inode->i_sb)->j_next_async_flush = 1;
+			SB_JOURNAL(inode_sb(inode))->j_next_async_flush = 1;
 			retval = restart_transaction(th, inode, &path);
 			if (retval)
 				goto failure;
@@ -788,7 +791,7 @@ int reiserfs_get_block(struct inode *inode, sector_t block,
 			goto failure;
 		}
 
-		if (fs_changed(fs_gen, inode->i_sb)
+		if (fs_changed(fs_gen, inode_sb(inode))
 		    && item_moved(&tmp_ih, &path)) {
 			goto research;
 		}
@@ -804,16 +807,16 @@ int reiserfs_get_block(struct inode *inode, sector_t block,
 		unfm_ptr = get_block_num(item, pos_in_item);
 		if (unfm_ptr == 0) {
 			/* use allocated block to plug the hole */
-			reiserfs_prepare_for_journal(inode->i_sb, bh, 1);
-			if (fs_changed(fs_gen, inode->i_sb)
+			reiserfs_prepare_for_journal(inode_sb(inode), bh, 1);
+			if (fs_changed(fs_gen, inode_sb(inode))
 			    && item_moved(&tmp_ih, &path)) {
-				reiserfs_restore_prepared_buffer(inode->i_sb,
+				reiserfs_restore_prepared_buffer(inode_sb(inode),
 								 bh);
 				goto research;
 			}
 			set_buffer_new(bh_result);
 			if (buffer_dirty(bh_result)
-			    && reiserfs_data_ordered(inode->i_sb))
+			    && reiserfs_data_ordered(inode_sb(inode)))
 				reiserfs_add_ordered_list(inode, bh_result);
 			put_block_num(item, pos_in_item, allocated_block_nr);
 			unfm_ptr = allocated_block_nr;
@@ -826,7 +829,7 @@ int reiserfs_get_block(struct inode *inode, sector_t block,
 		if (!dangle && th)
 			retval = reiserfs_end_persistent_transaction(th);
 
-		reiserfs_write_unlock(inode->i_sb);
+		reiserfs_write_unlock(inode_sb(inode));
 
 		/*
 		 * the item was found, so new blocks were not added to the file
@@ -890,7 +893,7 @@ int reiserfs_get_block(struct inode *inode, sector_t block,
 
 			tail_offset =
 			    ((le_ih_k_offset(ih) -
-			      1) & ~(inode->i_sb->s_blocksize - 1)) + 1;
+			      1) & ~(inode_sb(inode)->s_blocksize - 1)) + 1;
 
 			/*
 			 * direct item we just found fits into block we have
@@ -930,19 +933,20 @@ int reiserfs_get_block(struct inode *inode, sector_t block,
 							  tail_offset);
 				if (retval) {
 					if (retval != -ENOSPC)
-						reiserfs_error(inode->i_sb,
-							"clm-6004",
-							"convert tail failed "
-							"inode %lu, error %d",
-							inode->i_ino,
-							retval);
+						reiserfs_error(inode_sb(inode),
+							       "clm-6004",
+							       "convert tail failed "
+							       "inode %lu, error %d",
+							       inode->i_ino,
+							       retval);
 					if (allocated_block_nr) {
 						/*
 						 * the bitmap, the super,
 						 * and the stat data == 3
 						 */
 						if (!th)
-							th = reiserfs_persistent_transaction(inode->i_sb, 3);
+							th = reiserfs_persistent_transaction(inode_sb(inode),
+											     3);
 						if (th)
 							reiserfs_free_block(th,
 									    inode,
@@ -1015,7 +1019,7 @@ int reiserfs_get_block(struct inode *inode, sector_t block,
 			unp_t unf_single = 0;
 			unp_t *un;
 			__u64 max_to_insert =
-			    MAX_ITEM_LEN(inode->i_sb->s_blocksize) /
+			    MAX_ITEM_LEN(inode_sb(inode)->s_blocksize) /
 			    UNFM_P_SIZE;
 			__u64 blocks_needed;
 
@@ -1030,7 +1034,7 @@ int reiserfs_get_block(struct inode *inode, sector_t block,
 				     le_key_k_offset(version,
 						     &ih->ih_key) +
 				     op_bytes_number(ih,
-						     inode->i_sb->s_blocksize),
+						     inode_sb(inode)->s_blocksize),
 				     TYPE_INDIRECT, 3);
 
 			RFALSE(cpu_key_k_offset(&tmp_key) > cpu_key_k_offset(&key),
@@ -1038,7 +1042,7 @@ int reiserfs_get_block(struct inode *inode, sector_t block,
 			blocks_needed =
 			    1 +
 			    ((cpu_key_k_offset(&key) -
-			      cpu_key_k_offset(&tmp_key)) >> inode->i_sb->
+			      cpu_key_k_offset(&tmp_key)) >> inode_sb(inode)->
 			     s_blocksize_bits);
 
 			if (blocks_needed == 1) {
@@ -1094,7 +1098,7 @@ int reiserfs_get_block(struct inode *inode, sector_t block,
 				 * holes.
 				 */
 				inode->i_size +=
-				    inode->i_sb->s_blocksize * blocks_needed;
+				    inode_sb(inode)->s_blocksize * blocks_needed;
 			}
 		}
 
@@ -1119,15 +1123,16 @@ int reiserfs_get_block(struct inode *inode, sector_t block,
 		 * long time.  reschedule if needed and also release the write
 		 * lock for others.
 		 */
-		reiserfs_cond_resched(inode->i_sb);
+		reiserfs_cond_resched(inode_sb(inode));
 
-		retval = search_for_position_by_key(inode->i_sb, &key, &path);
+		retval = search_for_position_by_key(inode_sb(inode), &key,
+						    &path);
 		if (retval == IO_ERROR) {
 			retval = -EIO;
 			goto failure;
 		}
 		if (retval == POSITION_FOUND) {
-			reiserfs_warning(inode->i_sb, "vs-825",
+			reiserfs_warning(inode_sb(inode), "vs-825",
 					 "%K should not be found", &key);
 			retval = -EEXIST;
 			if (allocated_block_nr)
@@ -1154,7 +1159,7 @@ int reiserfs_get_block(struct inode *inode, sector_t block,
 			retval = err;
 	}
 
-	reiserfs_write_unlock(inode->i_sb);
+	reiserfs_write_unlock(inode_sb(inode));
 	reiserfs_check_path(&path);
 	return retval;
 }
@@ -1174,7 +1179,7 @@ reiserfs_readpages(struct file *file, struct address_space *mapping,
 static int real_space_diff(struct inode *inode, int sd_size)
 {
 	int bytes;
-	loff_t blocksize = inode->i_sb->s_blocksize;
+	loff_t blocksize = inode_sb(inode)->s_blocksize;
 
 	if (S_ISLNK(inode->i_mode) || S_ISDIR(inode->i_mode))
 		return sd_size;
@@ -1190,7 +1195,7 @@ static int real_space_diff(struct inode *inode, int sd_size)
 	 */
 	bytes =
 	    ((inode->i_size +
-	      (blocksize - 1)) >> inode->i_sb->s_blocksize_bits) * UNFM_P_SIZE +
+	      (blocksize - 1)) >> inode_sb(inode)->s_blocksize_bits) * UNFM_P_SIZE +
 	    sd_size;
 	return bytes;
 }
@@ -1276,7 +1281,7 @@ static void init_inode(struct inode *inode, struct treepath *path)
 		inode->i_blocks = sd_v1_blocks(sd);
 		inode->i_generation = le32_to_cpu(INODE_PKEY(inode)->k_dir_id);
 		blocks = (inode->i_size + 511) >> 9;
-		blocks = _ROUND_UP(blocks, inode->i_sb->s_blocksize >> 9);
+		blocks = _ROUND_UP(blocks, inode_sb(inode)->s_blocksize >> 9);
 
 		/*
 		 * there was a bug in <=3.5.23 when i_blocks could take
@@ -1430,7 +1435,8 @@ static void update_stat_data(struct treepath *path, struct inode *inode,
 	ih = tp_item_head(path);
 
 	if (!is_statdata_le_ih(ih))
-		reiserfs_panic(inode->i_sb, "vs-13065", "key %k, found item %h",
+		reiserfs_panic(inode_sb(inode), "vs-13065",
+			       "key %k, found item %h",
 			       INODE_PKEY(inode), ih);
 
 	/* path points to old stat data */
@@ -1461,9 +1467,9 @@ void reiserfs_update_sd_size(struct reiserfs_transaction_handle *th,
 	for (;;) {
 		int pos;
 		/* look for the object's stat data */
-		retval = search_item(inode->i_sb, &key, &path);
+		retval = search_item(inode_sb(inode), &key, &path);
 		if (retval == IO_ERROR) {
-			reiserfs_error(inode->i_sb, "vs-13050",
+			reiserfs_error(inode_sb(inode), "vs-13050",
 				       "i/o failure occurred trying to "
 				       "update %K stat data", &key);
 			return;
@@ -1472,10 +1478,10 @@ void reiserfs_update_sd_size(struct reiserfs_transaction_handle *th,
 			pos = PATH_LAST_POSITION(&path);
 			pathrelse(&path);
 			if (inode->i_nlink == 0) {
-				/*reiserfs_warning (inode->i_sb, "vs-13050: reiserfs_update_sd: i_nlink == 0, stat data not found"); */
+				/*reiserfs_warning (inode_sb(inode), "vs-13050: reiserfs_update_sd: i_nlink == 0, stat data not found"); */
 				return;
 			}
-			reiserfs_warning(inode->i_sb, "vs-13060",
+			reiserfs_warning(inode_sb(inode), "vs-13060",
 					 "stat data of object %k (nlink == %d) "
 					 "not found (pos %d)",
 					 INODE_PKEY(inode), inode->i_nlink,
@@ -1492,13 +1498,13 @@ void reiserfs_update_sd_size(struct reiserfs_transaction_handle *th,
 		bh = get_last_bh(&path);
 		ih = tp_item_head(&path);
 		copy_item_head(&tmp_ih, ih);
-		fs_gen = get_generation(inode->i_sb);
-		reiserfs_prepare_for_journal(inode->i_sb, bh, 1);
+		fs_gen = get_generation(inode_sb(inode));
+		reiserfs_prepare_for_journal(inode_sb(inode), bh, 1);
 
 		/* Stat_data item has been moved after scheduling. */
-		if (fs_changed(fs_gen, inode->i_sb)
+		if (fs_changed(fs_gen, inode_sb(inode))
 		    && item_moved(&tmp_ih, &path)) {
-			reiserfs_restore_prepared_buffer(inode->i_sb, bh);
+			reiserfs_restore_prepared_buffer(inode_sb(inode), bh);
 			continue;
 		}
 		break;
@@ -1559,9 +1565,9 @@ void reiserfs_read_locked_inode(struct inode *inode,
 	key.on_disk_key.k_type = 0;
 
 	/* look for the object's stat data */
-	retval = search_item(inode->i_sb, &key, &path_to_sd);
+	retval = search_item(inode_sb(inode), &key, &path_to_sd);
 	if (retval == IO_ERROR) {
-		reiserfs_error(inode->i_sb, "vs-13070",
+		reiserfs_error(inode_sb(inode), "vs-13070",
 			       "i/o failure occurred trying to find "
 			       "stat data of %K", &key);
 		reiserfs_make_bad_inode(inode);
@@ -1598,8 +1604,8 @@ void reiserfs_read_locked_inode(struct inode *inode,
 	 * during mount (fs/reiserfs/super.c:finish_unfinished()).
 	 */
 	if ((inode->i_nlink == 0) &&
-	    !REISERFS_SB(inode->i_sb)->s_is_unlinked_ok) {
-		reiserfs_warning(inode->i_sb, "vs-13075",
+	    !REISERFS_SB(inode_sb(inode))->s_is_unlinked_ok) {
+		reiserfs_warning(inode_sb(inode), "vs-13075",
 				 "dead inode read from disk %K. "
 				 "This is likely to be race with knfsd. Ignore",
 				 &key);
@@ -1776,7 +1782,7 @@ int reiserfs_write_inode(struct inode *inode, struct writeback_control *wbc)
 	struct reiserfs_transaction_handle th;
 	int jbegin_count = 1;
 
-	if (sb_rdonly(inode->i_sb))
+	if (sb_rdonly(inode_sb(inode)))
 		return -EROFS;
 	/*
 	 * memory pressure can sometimes initiate write_inode calls with
@@ -1786,12 +1792,12 @@ int reiserfs_write_inode(struct inode *inode, struct writeback_control *wbc)
 	 * ignored because the altered inode has already been logged.
 	 */
 	if (wbc->sync_mode == WB_SYNC_ALL && !(current->flags & PF_MEMALLOC)) {
-		reiserfs_write_lock(inode->i_sb);
-		if (!journal_begin(&th, inode->i_sb, jbegin_count)) {
+		reiserfs_write_lock(inode_sb(inode));
+		if (!journal_begin(&th, inode_sb(inode), jbegin_count)) {
 			reiserfs_update_sd(&th, inode);
 			journal_end_sync(&th);
 		}
-		reiserfs_write_unlock(inode->i_sb);
+		reiserfs_write_unlock(inode_sb(inode));
 	}
 	return 0;
 }
@@ -1930,7 +1936,7 @@ int reiserfs_new_inode(struct reiserfs_transaction_handle *th,
 		       struct inode *inode,
 		       struct reiserfs_security_handle *security)
 {
-	struct super_block *sb = dir->i_sb;
+	struct super_block *sb = inode_sb(dir);
 	struct reiserfs_iget_args args;
 	INITIALIZE_PATH(path_to_key);
 	struct cpu_key key;
@@ -1969,10 +1975,10 @@ int reiserfs_new_inode(struct reiserfs_transaction_handle *th,
 	memcpy(INODE_PKEY(inode), &ih.ih_key, KEY_SIZE);
 	args.dirid = le32_to_cpu(ih.ih_key.k_dir_id);
 
-	depth = reiserfs_write_unlock_nested(inode->i_sb);
+	depth = reiserfs_write_unlock_nested(inode_sb(inode));
 	err = insert_inode_locked4(inode, args.objectid,
 			     reiserfs_find_actor, &args);
-	reiserfs_write_lock_nested(inode->i_sb, depth);
+	reiserfs_write_lock_nested(inode_sb(inode), depth);
 	if (err) {
 		err = -EINVAL;
 		goto out_bad_inode;
@@ -2096,27 +2102,27 @@ int reiserfs_new_inode(struct reiserfs_transaction_handle *th,
 		goto out_inserted_sd;
 	}
 
-	if (reiserfs_posixacl(inode->i_sb)) {
-		reiserfs_write_unlock(inode->i_sb);
+	if (reiserfs_posixacl(inode_sb(inode))) {
+		reiserfs_write_unlock(inode_sb(inode));
 		retval = reiserfs_inherit_default_acl(th, dir, dentry, inode);
-		reiserfs_write_lock(inode->i_sb);
+		reiserfs_write_lock(inode_sb(inode));
 		if (retval) {
 			err = retval;
 			reiserfs_check_path(&path_to_key);
 			journal_end(th);
 			goto out_inserted_sd;
 		}
-	} else if (inode->i_sb->s_flags & SB_POSIXACL) {
-		reiserfs_warning(inode->i_sb, "jdm-13090",
+	} else if (inode_sb(inode)->s_flags & SB_POSIXACL) {
+		reiserfs_warning(inode_sb(inode), "jdm-13090",
 				 "ACLs aren't enabled in the fs, "
 				 "but vfs thinks they are!");
 	} else if (IS_PRIVATE(dir))
 		inode->i_flags |= S_PRIVATE;
 
 	if (security->name) {
-		reiserfs_write_unlock(inode->i_sb);
+		reiserfs_write_unlock(inode_sb(inode));
 		retval = reiserfs_security_write(th, inode, security);
-		reiserfs_write_lock(inode->i_sb);
+		reiserfs_write_lock(inode_sb(inode));
 		if (retval) {
 			err = retval;
 			reiserfs_check_path(&path_to_key);
@@ -2137,9 +2143,9 @@ int reiserfs_new_inode(struct reiserfs_transaction_handle *th,
 	INODE_PKEY(inode)->k_objectid = 0;
 
 	/* Quota change must be inside a transaction for journaling */
-	depth = reiserfs_write_unlock_nested(inode->i_sb);
+	depth = reiserfs_write_unlock_nested(inode_sb(inode));
 	dquot_free_inode(inode);
-	reiserfs_write_lock_nested(inode->i_sb, depth);
+	reiserfs_write_lock_nested(inode_sb(inode), depth);
 
 out_end_trans:
 	journal_end(th);
@@ -2147,9 +2153,9 @@ int reiserfs_new_inode(struct reiserfs_transaction_handle *th,
 	 * Drop can be outside and it needs more credits so it's better
 	 * to have it outside
 	 */
-	depth = reiserfs_write_unlock_nested(inode->i_sb);
+	depth = reiserfs_write_unlock_nested(inode_sb(inode));
 	dquot_drop(inode);
-	reiserfs_write_lock_nested(inode->i_sb, depth);
+	reiserfs_write_lock_nested(inode_sb(inode), depth);
 	inode->i_flags |= S_NOQUOTA;
 	make_bad_inode(inode);
 
@@ -2186,7 +2192,7 @@ static int grab_tail_page(struct inode *inode,
 	unsigned long index = (inode->i_size - 1) >> PAGE_SHIFT;
 	unsigned long pos = 0;
 	unsigned long start = 0;
-	unsigned long blocksize = inode->i_sb->s_blocksize;
+	unsigned long blocksize = inode_sb(inode)->s_blocksize;
 	unsigned long offset = (inode->i_size) & (PAGE_SIZE - 1);
 	struct buffer_head *bh;
 	struct buffer_head *head;
@@ -2232,7 +2238,7 @@ static int grab_tail_page(struct inode *inode,
 		 * date, I've screwed up the code to find the buffer, or the
 		 * code to call prepare_write
 		 */
-		reiserfs_error(inode->i_sb, "clm-6000",
+		reiserfs_error(inode_sb(inode), "clm-6000",
 			       "error reading block %lu", bh->b_blocknr);
 		error = -EIO;
 		goto unlock;
@@ -2260,14 +2266,14 @@ int reiserfs_truncate_file(struct inode *inode, int update_timestamps)
 	struct reiserfs_transaction_handle th;
 	/* we want the offset for the first byte after the end of the file */
 	unsigned long offset = inode->i_size & (PAGE_SIZE - 1);
-	unsigned blocksize = inode->i_sb->s_blocksize;
+	unsigned blocksize = inode_sb(inode)->s_blocksize;
 	unsigned length;
 	struct page *page = NULL;
 	int error;
 	struct buffer_head *bh = NULL;
 	int err2;
 
-	reiserfs_write_lock(inode->i_sb);
+	reiserfs_write_lock(inode_sb(inode));
 
 	if (inode->i_size > 0) {
 		error = grab_tail_page(inode, &page, &bh);
@@ -2278,7 +2284,7 @@ int reiserfs_truncate_file(struct inode *inode, int update_timestamps)
 			 * block to read in, which is ok.
 			 */
 			if (error != -ENOENT)
-				reiserfs_error(inode->i_sb, "clm-6001",
+				reiserfs_error(inode_sb(inode), "clm-6001",
 					       "grab_tail_page failed %d",
 					       error);
 			page = NULL;
@@ -2298,7 +2304,7 @@ int reiserfs_truncate_file(struct inode *inode, int update_timestamps)
 	 * one for "save" link adding and another for the first
 	 * cut_from_item. 1 is for update_sd
 	 */
-	error = journal_begin(&th, inode->i_sb,
+	error = journal_begin(&th, inode_sb(inode),
 			      JOURNAL_PER_BALANCE_CNT * 2 + 1);
 	if (error)
 		goto out;
@@ -2342,7 +2348,7 @@ int reiserfs_truncate_file(struct inode *inode, int update_timestamps)
 		put_page(page);
 	}
 
-	reiserfs_write_unlock(inode->i_sb);
+	reiserfs_write_unlock(inode_sb(inode));
 
 	return 0;
 out:
@@ -2351,7 +2357,7 @@ int reiserfs_truncate_file(struct inode *inode, int update_timestamps)
 		put_page(page);
 	}
 
-	reiserfs_write_unlock(inode->i_sb);
+	reiserfs_write_unlock(inode_sb(inode));
 
 	return error;
 }
@@ -2370,7 +2376,7 @@ static int map_block_for_writepage(struct inode *inode,
 	INITIALIZE_PATH(path);
 	int pos_in_item;
 	int jbegin_count = JOURNAL_PER_BALANCE_CNT;
-	loff_t byte_offset = ((loff_t)block << inode->i_sb->s_blocksize_bits)+1;
+	loff_t byte_offset = ((loff_t)block << inode_sb(inode)->s_blocksize_bits)+1;
 	int retval;
 	int use_get_block = 0;
 	int bytes_copied = 0;
@@ -2389,11 +2395,11 @@ static int map_block_for_writepage(struct inode *inode,
 
 	kmap(bh_result->b_page);
 start_over:
-	reiserfs_write_lock(inode->i_sb);
+	reiserfs_write_lock(inode_sb(inode));
 	make_cpu_key(&key, inode, byte_offset, TYPE_ANY, 3);
 
 research:
-	retval = search_for_position_by_key(inode->i_sb, &key, &path);
+	retval = search_for_position_by_key(inode_sb(inode), &key, &path);
 	if (retval != POSITION_FOUND) {
 		use_get_block = 1;
 		goto out;
@@ -2407,7 +2413,7 @@ static int map_block_for_writepage(struct inode *inode,
 	/* we've found an unformatted node */
 	if (indirect_item_found(retval, ih)) {
 		if (bytes_copied > 0) {
-			reiserfs_warning(inode->i_sb, "clm-6002",
+			reiserfs_warning(inode_sb(inode), "clm-6002",
 					 "bytes_copied %d", bytes_copied);
 		}
 		if (!get_block_num(item, pos_in_item)) {
@@ -2423,29 +2429,30 @@ static int map_block_for_writepage(struct inode *inode,
 		p += (byte_offset - 1) & (PAGE_SIZE - 1);
 		copy_size = ih_item_len(ih) - pos_in_item;
 
-		fs_gen = get_generation(inode->i_sb);
+		fs_gen = get_generation(inode_sb(inode));
 		copy_item_head(&tmp_ih, ih);
 
 		if (!trans_running) {
 			/* vs-3050 is gone, no need to drop the path */
-			retval = journal_begin(&th, inode->i_sb, jbegin_count);
+			retval = journal_begin(&th, inode_sb(inode),
+					       jbegin_count);
 			if (retval)
 				goto out;
 			reiserfs_update_inode_transaction(inode);
 			trans_running = 1;
-			if (fs_changed(fs_gen, inode->i_sb)
+			if (fs_changed(fs_gen, inode_sb(inode))
 			    && item_moved(&tmp_ih, &path)) {
-				reiserfs_restore_prepared_buffer(inode->i_sb,
+				reiserfs_restore_prepared_buffer(inode_sb(inode),
 								 bh);
 				goto research;
 			}
 		}
 
-		reiserfs_prepare_for_journal(inode->i_sb, bh, 1);
+		reiserfs_prepare_for_journal(inode_sb(inode), bh, 1);
 
-		if (fs_changed(fs_gen, inode->i_sb)
+		if (fs_changed(fs_gen, inode_sb(inode))
 		    && item_moved(&tmp_ih, &path)) {
-			reiserfs_restore_prepared_buffer(inode->i_sb, bh);
+			reiserfs_restore_prepared_buffer(inode_sb(inode), bh);
 			goto research;
 		}
 
@@ -2465,7 +2472,7 @@ static int map_block_for_writepage(struct inode *inode,
 			goto research;
 		}
 	} else {
-		reiserfs_warning(inode->i_sb, "clm-6003",
+		reiserfs_warning(inode_sb(inode), "clm-6003",
 				 "bad item inode %lu", inode->i_ino);
 		retval = -EIO;
 		goto out;
@@ -2480,7 +2487,7 @@ static int map_block_for_writepage(struct inode *inode,
 			retval = err;
 		trans_running = 0;
 	}
-	reiserfs_write_unlock(inode->i_sb);
+	reiserfs_write_unlock(inode_sb(inode));
 
 	/* this is where we fill in holes in the file. */
 	if (use_get_block) {
@@ -2528,7 +2535,7 @@ static int reiserfs_write_full_page(struct page *page,
 	int nr = 0;
 	int checked = PageChecked(page);
 	struct reiserfs_transaction_handle th;
-	struct super_block *s = inode->i_sb;
+	struct super_block *s = inode_sb(inode);
 	int bh_per_page = PAGE_SIZE / s->s_blocksize;
 	th.t_trans_id = 0;
 
@@ -2739,7 +2746,7 @@ static int reiserfs_readpage(struct file *f, struct page *page)
 static int reiserfs_writepage(struct page *page, struct writeback_control *wbc)
 {
 	struct inode *inode = page->mapping->host;
-	reiserfs_wait_on_write_block(inode->i_sb);
+	reiserfs_wait_on_write_block(inode_sb(inode));
 	return reiserfs_write_full_page(page, wbc);
 }
 
@@ -2763,7 +2770,7 @@ static int reiserfs_write_begin(struct file *file,
  	inode = mapping->host;
 	*fsdata = NULL;
  	if (flags & AOP_FLAG_CONT_EXPAND &&
- 	    (pos & (inode->i_sb->s_blocksize - 1)) == 0) {
+ 	    (pos & (inode_sb(inode)->s_blocksize - 1)) == 0) {
  		pos ++;
 		*fsdata = (void *)(unsigned long)flags;
 	}
@@ -2774,9 +2781,9 @@ static int reiserfs_write_begin(struct file *file,
 		return -ENOMEM;
 	*pagep = page;
 
-	reiserfs_wait_on_write_block(inode->i_sb);
+	reiserfs_wait_on_write_block(inode_sb(inode));
 	fix_tail_page_for_writing(page);
-	if (reiserfs_transaction_running(inode->i_sb)) {
+	if (reiserfs_transaction_running(inode_sb(inode))) {
 		struct reiserfs_transaction_handle *th;
 		th = (struct reiserfs_transaction_handle *)current->
 		    journal_info;
@@ -2786,7 +2793,7 @@ static int reiserfs_write_begin(struct file *file,
 		th->t_refcount++;
 	}
 	ret = __block_write_begin(page, pos, len, reiserfs_get_block);
-	if (ret && reiserfs_transaction_running(inode->i_sb)) {
+	if (ret && reiserfs_transaction_running(inode_sb(inode))) {
 		struct reiserfs_transaction_handle *th = current->journal_info;
 		/*
 		 * this gets a little ugly.  If reiserfs_get_block returned an
@@ -2806,9 +2813,9 @@ static int reiserfs_write_begin(struct file *file,
 				th->t_refcount--;
 			else {
 				int err;
-				reiserfs_write_lock(inode->i_sb);
+				reiserfs_write_lock(inode_sb(inode));
 				err = reiserfs_end_persistent_transaction(th);
-				reiserfs_write_unlock(inode->i_sb);
+				reiserfs_write_unlock(inode_sb(inode));
 				if (err)
 					ret = err;
 			}
@@ -2830,12 +2837,12 @@ int __reiserfs_write_begin(struct page *page, unsigned from, unsigned len)
 	int old_ref = 0;
 	int depth;
 
-	depth = reiserfs_write_unlock_nested(inode->i_sb);
-	reiserfs_wait_on_write_block(inode->i_sb);
-	reiserfs_write_lock_nested(inode->i_sb, depth);
+	depth = reiserfs_write_unlock_nested(inode_sb(inode));
+	reiserfs_wait_on_write_block(inode_sb(inode));
+	reiserfs_write_lock_nested(inode_sb(inode), depth);
 
 	fix_tail_page_for_writing(page);
-	if (reiserfs_transaction_running(inode->i_sb)) {
+	if (reiserfs_transaction_running(inode_sb(inode))) {
 		struct reiserfs_transaction_handle *th;
 		th = (struct reiserfs_transaction_handle *)current->
 		    journal_info;
@@ -2846,7 +2853,7 @@ int __reiserfs_write_begin(struct page *page, unsigned from, unsigned len)
 	}
 
 	ret = __block_write_begin(page, from, len, reiserfs_get_block);
-	if (ret && reiserfs_transaction_running(inode->i_sb)) {
+	if (ret && reiserfs_transaction_running(inode_sb(inode))) {
 		struct reiserfs_transaction_handle *th = current->journal_info;
 		/*
 		 * this gets a little ugly.  If reiserfs_get_block returned an
@@ -2866,9 +2873,9 @@ int __reiserfs_write_begin(struct page *page, unsigned from, unsigned len)
 				th->t_refcount--;
 			else {
 				int err;
-				reiserfs_write_lock(inode->i_sb);
+				reiserfs_write_lock(inode_sb(inode));
 				err = reiserfs_end_persistent_transaction(th);
-				reiserfs_write_unlock(inode->i_sb);
+				reiserfs_write_unlock(inode_sb(inode));
 				if (err)
 					ret = err;
 			}
@@ -2897,8 +2904,8 @@ static int reiserfs_write_end(struct file *file, struct address_space *mapping,
 	if ((unsigned long)fsdata & AOP_FLAG_CONT_EXPAND)
 		pos ++;
 
-	reiserfs_wait_on_write_block(inode->i_sb);
-	if (reiserfs_transaction_running(inode->i_sb))
+	reiserfs_wait_on_write_block(inode_sb(inode));
+	if (reiserfs_transaction_running(inode_sb(inode)))
 		th = current->journal_info;
 	else
 		th = NULL;
@@ -2921,20 +2928,20 @@ static int reiserfs_write_end(struct file *file, struct address_space *mapping,
 	 */
 	if (pos + copied > inode->i_size) {
 		struct reiserfs_transaction_handle myth;
-		reiserfs_write_lock(inode->i_sb);
+		reiserfs_write_lock(inode_sb(inode));
 		locked = true;
 		/*
 		 * If the file have grown beyond the border where it
 		 * can have a tail, unmark it as needing a tail
 		 * packing
 		 */
-		if ((have_large_tails(inode->i_sb)
+		if ((have_large_tails(inode_sb(inode))
 		     && inode->i_size > i_block_size(inode) * 4)
-		    || (have_small_tails(inode->i_sb)
+		    || (have_small_tails(inode_sb(inode))
 			&& inode->i_size > i_block_size(inode)))
 			REISERFS_I(inode)->i_flags &= ~i_pack_on_close_mask;
 
-		ret = journal_begin(&myth, inode->i_sb, 1);
+		ret = journal_begin(&myth, inode_sb(inode), 1);
 		if (ret)
 			goto journal_error;
 
@@ -2954,7 +2961,7 @@ static int reiserfs_write_end(struct file *file, struct address_space *mapping,
 	}
 	if (th) {
 		if (!locked) {
-			reiserfs_write_lock(inode->i_sb);
+			reiserfs_write_lock(inode_sb(inode));
 			locked = true;
 		}
 		if (!update_sd)
@@ -2966,7 +2973,7 @@ static int reiserfs_write_end(struct file *file, struct address_space *mapping,
 
 out:
 	if (locked)
-		reiserfs_write_unlock(inode->i_sb);
+		reiserfs_write_unlock(inode_sb(inode));
 	unlock_page(page);
 	put_page(page);
 
@@ -2976,7 +2983,7 @@ static int reiserfs_write_end(struct file *file, struct address_space *mapping,
 	return ret == 0 ? copied : ret;
 
 journal_error:
-	reiserfs_write_unlock(inode->i_sb);
+	reiserfs_write_unlock(inode_sb(inode));
 	locked = false;
 	if (th) {
 		if (!update_sd)
@@ -2996,11 +3003,11 @@ int reiserfs_commit_write(struct file *f, struct page *page,
 	struct reiserfs_transaction_handle *th = NULL;
 	int depth;
 
-	depth = reiserfs_write_unlock_nested(inode->i_sb);
-	reiserfs_wait_on_write_block(inode->i_sb);
-	reiserfs_write_lock_nested(inode->i_sb, depth);
+	depth = reiserfs_write_unlock_nested(inode_sb(inode));
+	reiserfs_wait_on_write_block(inode_sb(inode));
+	reiserfs_write_lock_nested(inode_sb(inode), depth);
 
-	if (reiserfs_transaction_running(inode->i_sb)) {
+	if (reiserfs_transaction_running(inode_sb(inode))) {
 		th = current->journal_info;
 	}
 	reiserfs_commit_page(inode, page, from, to);
@@ -3017,13 +3024,13 @@ int reiserfs_commit_write(struct file *f, struct page *page,
 		 * can have a tail, unmark it as needing a tail
 		 * packing
 		 */
-		if ((have_large_tails(inode->i_sb)
+		if ((have_large_tails(inode_sb(inode))
 		     && inode->i_size > i_block_size(inode) * 4)
-		    || (have_small_tails(inode->i_sb)
+		    || (have_small_tails(inode_sb(inode))
 			&& inode->i_size > i_block_size(inode)))
 			REISERFS_I(inode)->i_flags &= ~i_pack_on_close_mask;
 
-		ret = journal_begin(&myth, inode->i_sb, 1);
+		ret = journal_begin(&myth, inode_sb(inode), 1);
 		if (ret)
 			goto journal_error;
 
@@ -3064,7 +3071,7 @@ int reiserfs_commit_write(struct file *f, struct page *page,
 
 void sd_attrs_to_i_attrs(__u16 sd_attrs, struct inode *inode)
 {
-	if (reiserfs_attrs(inode->i_sb)) {
+	if (reiserfs_attrs(inode_sb(inode))) {
 		if (sd_attrs & REISERFS_SYNC_FL)
 			inode->i_flags |= S_SYNC;
 		else
@@ -3095,7 +3102,7 @@ void sd_attrs_to_i_attrs(__u16 sd_attrs, struct inode *inode)
 static int invalidatepage_can_drop(struct inode *inode, struct buffer_head *bh)
 {
 	int ret = 1;
-	struct reiserfs_journal *j = SB_JOURNAL(inode->i_sb);
+	struct reiserfs_journal *j = SB_JOURNAL(inode_sb(inode));
 
 	lock_buffer(bh);
 	spin_lock(&j->j_dirty_buffers_lock);
@@ -3133,7 +3140,7 @@ static int invalidatepage_can_drop(struct inode *inode, struct buffer_head *bh)
 		 * transaction, we need to leave it around
 		 */
 		if (jh && (jl = jh->jl)
-		    && jl != SB_JOURNAL(inode->i_sb)->j_current_jl)
+		    && jl != SB_JOURNAL(inode_sb(inode))->j_current_jl)
 			ret = 0;
 	}
 free_jh:
@@ -3221,7 +3228,7 @@ static int reiserfs_set_page_dirty(struct page *page)
 static int reiserfs_releasepage(struct page *page, gfp_t unused_gfp_flags)
 {
 	struct inode *inode = page->mapping->host;
-	struct reiserfs_journal *j = SB_JOURNAL(inode->i_sb);
+	struct reiserfs_journal *j = SB_JOURNAL(inode_sb(inode));
 	struct buffer_head *head;
 	struct buffer_head *bh;
 	int ret = 1;
@@ -3296,7 +3303,7 @@ int reiserfs_setattr(struct dentry *dentry, struct iattr *attr)
 		if (error)
 			return error;
 	}
-	reiserfs_write_lock(inode->i_sb);
+	reiserfs_write_lock(inode_sb(inode));
 	if (attr->ia_valid & ATTR_SIZE) {
 		/*
 		 * version 2 items will be caught by the s_maxbytes check
@@ -3304,7 +3311,7 @@ int reiserfs_setattr(struct dentry *dentry, struct iattr *attr)
 		 */
 		if (get_inode_item_key_version(inode) == KEY_FORMAT_3_5 &&
 		    attr->ia_size > MAX_NON_LFS) {
-			reiserfs_write_unlock(inode->i_sb);
+			reiserfs_write_unlock(inode_sb(inode));
 			error = -EFBIG;
 			goto out;
 		}
@@ -3318,7 +3325,7 @@ int reiserfs_setattr(struct dentry *dentry, struct iattr *attr)
 				int err;
 				struct reiserfs_transaction_handle th;
 				/* we're changing at most 2 bitmaps, inode + super */
-				err = journal_begin(&th, inode->i_sb, 4);
+				err = journal_begin(&th, inode_sb(inode), 4);
 				if (!err) {
 					reiserfs_discard_prealloc(&th, inode);
 					err = journal_end(&th);
@@ -3327,7 +3334,7 @@ int reiserfs_setattr(struct dentry *dentry, struct iattr *attr)
 					error = err;
 			}
 			if (error) {
-				reiserfs_write_unlock(inode->i_sb);
+				reiserfs_write_unlock(inode_sb(inode));
 				goto out;
 			}
 			/*
@@ -3337,7 +3344,7 @@ int reiserfs_setattr(struct dentry *dentry, struct iattr *attr)
 			attr->ia_valid |= (ATTR_MTIME | ATTR_CTIME);
 		}
 	}
-	reiserfs_write_unlock(inode->i_sb);
+	reiserfs_write_unlock(inode_sb(inode));
 
 	if ((((attr->ia_valid & ATTR_UID) && (from_kuid(&init_user_ns, attr->ia_uid) & ~0xffff)) ||
 	     ((attr->ia_valid & ATTR_GID) && (from_kgid(&init_user_ns, attr->ia_gid) & ~0xffff))) &&
@@ -3352,8 +3359,8 @@ int reiserfs_setattr(struct dentry *dentry, struct iattr *attr)
 		struct reiserfs_transaction_handle th;
 		int jbegin_count =
 		    2 *
-		    (REISERFS_QUOTA_INIT_BLOCKS(inode->i_sb) +
-		     REISERFS_QUOTA_DEL_BLOCKS(inode->i_sb)) +
+		    (REISERFS_QUOTA_INIT_BLOCKS(inode_sb(inode)) +
+		     REISERFS_QUOTA_DEL_BLOCKS(inode_sb(inode))) +
 		    2;
 
 		error = reiserfs_chown_xattrs(inode, attr);
@@ -3365,16 +3372,16 @@ int reiserfs_setattr(struct dentry *dentry, struct iattr *attr)
 		 * (user+group)*(old+new) structure - we count quota
 		 * info and , inode write (sb, inode)
 		 */
-		reiserfs_write_lock(inode->i_sb);
-		error = journal_begin(&th, inode->i_sb, jbegin_count);
-		reiserfs_write_unlock(inode->i_sb);
+		reiserfs_write_lock(inode_sb(inode));
+		error = journal_begin(&th, inode_sb(inode), jbegin_count);
+		reiserfs_write_unlock(inode_sb(inode));
 		if (error)
 			goto out;
 		error = dquot_transfer(inode, attr);
-		reiserfs_write_lock(inode->i_sb);
+		reiserfs_write_lock(inode_sb(inode));
 		if (error) {
 			journal_end(&th);
-			reiserfs_write_unlock(inode->i_sb);
+			reiserfs_write_unlock(inode_sb(inode));
 			goto out;
 		}
 
@@ -3388,7 +3395,7 @@ int reiserfs_setattr(struct dentry *dentry, struct iattr *attr)
 			inode->i_gid = attr->ia_gid;
 		mark_inode_dirty(inode);
 		error = journal_end(&th);
-		reiserfs_write_unlock(inode->i_sb);
+		reiserfs_write_unlock(inode_sb(inode));
 		if (error)
 			goto out;
 	}
@@ -3413,7 +3420,7 @@ int reiserfs_setattr(struct dentry *dentry, struct iattr *attr)
 		mark_inode_dirty(inode);
 	}
 
-	if (!error && reiserfs_posixacl(inode->i_sb)) {
+	if (!error && reiserfs_posixacl(inode_sb(inode))) {
 		if (attr->ia_valid & ATTR_MODE)
 			error = reiserfs_acl_chmod(inode);
 	}
diff --git a/fs/reiserfs/ioctl.c b/fs/reiserfs/ioctl.c
index acbbaf7a0bb2..122dfdfe69c9 100644
--- a/fs/reiserfs/ioctl.c
+++ b/fs/reiserfs/ioctl.c
@@ -26,7 +26,7 @@ long reiserfs_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
 	unsigned int flags;
 	int err = 0;
 
-	reiserfs_write_lock(inode->i_sb);
+	reiserfs_write_lock(inode_sb(inode));
 
 	switch (cmd) {
 	case REISERFS_IOC_UNPACK:
@@ -41,7 +41,7 @@ long reiserfs_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
 		 * Card (card@masi.ibp.fr)
 		 */
 	case REISERFS_IOC_GETFLAGS:
-		if (!reiserfs_attrs(inode->i_sb)) {
+		if (!reiserfs_attrs(inode_sb(inode))) {
 			err = -ENOTTY;
 			break;
 		}
@@ -50,7 +50,7 @@ long reiserfs_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
 		err = put_user(flags, (int __user *)arg);
 		break;
 	case REISERFS_IOC_SETFLAGS:{
-			if (!reiserfs_attrs(inode->i_sb)) {
+			if (!reiserfs_attrs(inode_sb(inode))) {
 				err = -ENOTTY;
 				break;
 			}
@@ -123,7 +123,7 @@ long reiserfs_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
 		err = -ENOTTY;
 	}
 
-	reiserfs_write_unlock(inode->i_sb);
+	reiserfs_write_unlock(inode_sb(inode));
 
 	return err;
 }
@@ -174,7 +174,7 @@ int reiserfs_unpack(struct inode *inode, struct file *filp)
 	struct page *page;
 	struct address_space *mapping;
 	unsigned long write_from;
-	unsigned long blocksize = inode->i_sb->s_blocksize;
+	unsigned long blocksize = inode_sb(inode)->s_blocksize;
 
 	if (inode->i_size == 0) {
 		REISERFS_I(inode)->i_flags |= i_nopack_mask;
@@ -187,12 +187,12 @@ int reiserfs_unpack(struct inode *inode, struct file *filp)
 
 	/* we need to make sure nobody is changing the file size beneath us */
 {
-	int depth = reiserfs_write_unlock_nested(inode->i_sb);
+	int depth = reiserfs_write_unlock_nested(inode_sb(inode));
 	inode_lock(inode);
-	reiserfs_write_lock_nested(inode->i_sb, depth);
+	reiserfs_write_lock_nested(inode_sb(inode), depth);
 }
 
-	reiserfs_write_lock(inode->i_sb);
+	reiserfs_write_lock(inode_sb(inode));
 
 	write_from = inode->i_size & (blocksize - 1);
 	/* if we are on a block boundary, we are already unpacked.  */
@@ -228,6 +228,6 @@ int reiserfs_unpack(struct inode *inode, struct file *filp)
 
 out:
 	inode_unlock(inode);
-	reiserfs_write_unlock(inode->i_sb);
+	reiserfs_write_unlock(inode_sb(inode));
 	return retval;
 }
diff --git a/fs/reiserfs/journal.c b/fs/reiserfs/journal.c
index 70057359fbaf..aefcb77de3fd 100644
--- a/fs/reiserfs/journal.c
+++ b/fs/reiserfs/journal.c
@@ -782,11 +782,11 @@ static inline int __add_jh(struct reiserfs_journal *j, struct buffer_head *bh,
 
 int reiserfs_add_tail_list(struct inode *inode, struct buffer_head *bh)
 {
-	return __add_jh(SB_JOURNAL(inode->i_sb), bh, 1);
+	return __add_jh(SB_JOURNAL(inode_sb(inode)), bh, 1);
 }
 int reiserfs_add_ordered_list(struct inode *inode, struct buffer_head *bh)
 {
-	return __add_jh(SB_JOURNAL(inode->i_sb), bh, 0);
+	return __add_jh(SB_JOURNAL(inode_sb(inode)), bh, 0);
 }
 
 #define JH_ENTRY(l) list_entry((l), struct reiserfs_jh, list)
@@ -3825,7 +3825,7 @@ int journal_mark_freed(struct reiserfs_transaction_handle *th,
 
 void reiserfs_update_inode_transaction(struct inode *inode)
 {
-	struct reiserfs_journal *journal = SB_JOURNAL(inode->i_sb);
+	struct reiserfs_journal *journal = SB_JOURNAL(inode_sb(inode));
 	REISERFS_I(inode)->i_jl = journal->j_current_jl;
 	REISERFS_I(inode)->i_trans_id = journal->j_trans_id;
 }
@@ -3838,7 +3838,7 @@ static int __commit_trans_jl(struct inode *inode, unsigned long id,
 			     struct reiserfs_journal_list *jl)
 {
 	struct reiserfs_transaction_handle th;
-	struct super_block *sb = inode->i_sb;
+	struct super_block *sb = inode_sb(inode);
 	struct reiserfs_journal *journal = SB_JOURNAL(sb);
 	int ret = 0;
 
@@ -3881,7 +3881,7 @@ static int __commit_trans_jl(struct inode *inode, unsigned long id,
 		 * if we've got a larger transaction id than the oldest list
 		 */
 flush_commit_only:
-		if (journal_list_still_alive(inode->i_sb, id)) {
+		if (journal_list_still_alive(inode_sb(inode), id)) {
 			/*
 			 * we only set ret to 1 when we know for sure
 			 * the barrier hasn't been started yet on the commit
diff --git a/fs/reiserfs/namei.c b/fs/reiserfs/namei.c
index bd39a998843d..70c1da7d9ef1 100644
--- a/fs/reiserfs/namei.c
+++ b/fs/reiserfs/namei.c
@@ -308,20 +308,20 @@ static int reiserfs_find_entry(struct inode *dir, const char *name, int namelen,
 	struct cpu_key key_to_search;
 	int retval;
 
-	if (namelen > REISERFS_MAX_NAME(dir->i_sb->s_blocksize))
+	if (namelen > REISERFS_MAX_NAME(inode_sb(dir)->s_blocksize))
 		return NAME_NOT_FOUND;
 
 	/* we will search for this key in the tree */
 	make_cpu_key(&key_to_search, dir,
-		     get_third_component(dir->i_sb, name, namelen),
+		     get_third_component(inode_sb(dir), name, namelen),
 		     TYPE_DIRENTRY, 3);
 
 	while (1) {
 		retval =
-		    search_by_entry_key(dir->i_sb, &key_to_search,
+		    search_by_entry_key(inode_sb(dir), &key_to_search,
 					path_to_entry, de);
 		if (retval == IO_ERROR) {
-			reiserfs_error(dir->i_sb, "zam-7001", "io error");
+			reiserfs_error(inode_sb(dir), "zam-7001", "io error");
 			return IO_ERROR;
 		}
 
@@ -357,10 +357,10 @@ static struct dentry *reiserfs_lookup(struct inode *dir, struct dentry *dentry,
 	struct reiserfs_dir_entry de;
 	INITIALIZE_PATH(path_to_entry);
 
-	if (REISERFS_MAX_NAME(dir->i_sb->s_blocksize) < dentry->d_name.len)
+	if (REISERFS_MAX_NAME(inode_sb(dir)->s_blocksize) < dentry->d_name.len)
 		return ERR_PTR(-ENAMETOOLONG);
 
-	reiserfs_write_lock(dir->i_sb);
+	reiserfs_write_lock(inode_sb(dir));
 
 	de.de_gen_number_bit_string = NULL;
 	retval =
@@ -368,10 +368,10 @@ static struct dentry *reiserfs_lookup(struct inode *dir, struct dentry *dentry,
 				&path_to_entry, &de);
 	pathrelse(&path_to_entry);
 	if (retval == NAME_FOUND) {
-		inode = reiserfs_iget(dir->i_sb,
+		inode = reiserfs_iget(inode_sb(dir),
 				      (struct cpu_key *)&de.de_dir_id);
 		if (!inode || IS_ERR(inode)) {
-			reiserfs_write_unlock(dir->i_sb);
+			reiserfs_write_unlock(inode_sb(dir));
 			return ERR_PTR(-EACCES);
 		}
 
@@ -382,7 +382,7 @@ static struct dentry *reiserfs_lookup(struct inode *dir, struct dentry *dentry,
 		if (IS_PRIVATE(dir))
 			inode->i_flags |= S_PRIVATE;
 	}
-	reiserfs_write_unlock(dir->i_sb);
+	reiserfs_write_unlock(inode_sb(dir));
 	if (retval == IO_ERROR) {
 		return ERR_PTR(-EIO);
 	}
@@ -407,15 +407,15 @@ struct dentry *reiserfs_get_parent(struct dentry *child)
 	}
 	de.de_gen_number_bit_string = NULL;
 
-	reiserfs_write_lock(dir->i_sb);
+	reiserfs_write_lock(inode_sb(dir));
 	retval = reiserfs_find_entry(dir, "..", 2, &path_to_entry, &de);
 	pathrelse(&path_to_entry);
 	if (retval != NAME_FOUND) {
-		reiserfs_write_unlock(dir->i_sb);
+		reiserfs_write_unlock(inode_sb(dir));
 		return ERR_PTR(-ENOENT);
 	}
-	inode = reiserfs_iget(dir->i_sb, (struct cpu_key *)&de.de_dir_id);
-	reiserfs_write_unlock(dir->i_sb);
+	inode = reiserfs_iget(inode_sb(dir), (struct cpu_key *)&de.de_dir_id);
+	reiserfs_write_unlock(inode_sb(dir));
 
 	return d_obtain_alias(inode);
 }
@@ -453,12 +453,12 @@ static int reiserfs_add_entry(struct reiserfs_transaction_handle *th,
 	if (!namelen)
 		return -EINVAL;
 
-	if (namelen > REISERFS_MAX_NAME(dir->i_sb->s_blocksize))
+	if (namelen > REISERFS_MAX_NAME(inode_sb(dir)->s_blocksize))
 		return -ENAMETOOLONG;
 
 	/* each entry has unique key. compose it */
 	make_cpu_key(&entry_key, dir,
-		     get_third_component(dir->i_sb, name, namelen),
+		     get_third_component(inode_sb(dir), name, namelen),
 		     TYPE_DIRENTRY, 3);
 
 	/* get memory for composing the entry */
@@ -515,7 +515,7 @@ static int reiserfs_add_entry(struct reiserfs_transaction_handle *th,
 		}
 
 		if (retval != NAME_FOUND) {
-			reiserfs_error(dir->i_sb, "zam-7002",
+			reiserfs_error(inode_sb(dir), "zam-7002",
 				       "reiserfs_find_entry() returned "
 				       "unexpected value (%d)", retval);
 		}
@@ -528,7 +528,7 @@ static int reiserfs_add_entry(struct reiserfs_transaction_handle *th,
 				MAX_GENERATION_NUMBER + 1);
 	if (gen_number > MAX_GENERATION_NUMBER) {
 		/* there is no free generation number */
-		reiserfs_warning(dir->i_sb, "reiserfs-7010",
+		reiserfs_warning(inode_sb(dir), "reiserfs-7010",
 				 "Congratulations! we have got hash function "
 				 "screwed up");
 		if (buffer != small_buf)
@@ -545,9 +545,9 @@ static int reiserfs_add_entry(struct reiserfs_transaction_handle *th,
 
 	/* we need to re-search for the insertion point */
 	if (gen_number != 0) {
-		if (search_by_entry_key(dir->i_sb, &entry_key, &path, &de) !=
+		if (search_by_entry_key(inode_sb(dir), &entry_key, &path, &de) !=
 		    NAME_NOT_FOUND) {
-			reiserfs_warning(dir->i_sb, "vs-7032",
+			reiserfs_warning(inode_sb(dir), "vs-7032",
 					 "entry with this key (%K) already "
 					 "exists", &entry_key);
 
@@ -627,8 +627,8 @@ static int reiserfs_create(struct inode *dir, struct dentry *dentry, umode_t mod
 	 */
 	int jbegin_count =
 	    JOURNAL_PER_BALANCE_CNT * 2 +
-	    2 * (REISERFS_QUOTA_INIT_BLOCKS(dir->i_sb) +
-		 REISERFS_QUOTA_TRANS_BLOCKS(dir->i_sb));
+	    2 * (REISERFS_QUOTA_INIT_BLOCKS(inode_sb(dir)) +
+		 REISERFS_QUOTA_TRANS_BLOCKS(inode_sb(dir)));
 	struct reiserfs_transaction_handle th;
 	struct reiserfs_security_handle security;
 
@@ -636,7 +636,7 @@ static int reiserfs_create(struct inode *dir, struct dentry *dentry, umode_t mod
 	if (retval)
 		return retval;
 
-	if (!(inode = new_inode(dir->i_sb))) {
+	if (!(inode = new_inode(inode_sb(dir)))) {
 		return -ENOMEM;
 	}
 	retval = new_inode_init(inode, dir, mode);
@@ -652,9 +652,9 @@ static int reiserfs_create(struct inode *dir, struct dentry *dentry, umode_t mod
 		return retval;
 	}
 	jbegin_count += retval;
-	reiserfs_write_lock(dir->i_sb);
+	reiserfs_write_lock(inode_sb(dir));
 
-	retval = journal_begin(&th, dir->i_sb, jbegin_count);
+	retval = journal_begin(&th, inode_sb(dir), jbegin_count);
 	if (retval) {
 		drop_new_inode(inode);
 		goto out_failed;
@@ -692,7 +692,7 @@ static int reiserfs_create(struct inode *dir, struct dentry *dentry, umode_t mod
 	retval = journal_end(&th);
 
 out_failed:
-	reiserfs_write_unlock(dir->i_sb);
+	reiserfs_write_unlock(inode_sb(dir));
 	return retval;
 }
 
@@ -709,14 +709,14 @@ static int reiserfs_mknod(struct inode *dir, struct dentry *dentry, umode_t mode
 	 */
 	int jbegin_count =
 	    JOURNAL_PER_BALANCE_CNT * 3 +
-	    2 * (REISERFS_QUOTA_INIT_BLOCKS(dir->i_sb) +
-		 REISERFS_QUOTA_TRANS_BLOCKS(dir->i_sb));
+	    2 * (REISERFS_QUOTA_INIT_BLOCKS(inode_sb(dir)) +
+		 REISERFS_QUOTA_TRANS_BLOCKS(inode_sb(dir)));
 
 	retval = dquot_initialize(dir);
 	if (retval)
 		return retval;
 
-	if (!(inode = new_inode(dir->i_sb))) {
+	if (!(inode = new_inode(inode_sb(dir)))) {
 		return -ENOMEM;
 	}
 	retval = new_inode_init(inode, dir, mode);
@@ -732,9 +732,9 @@ static int reiserfs_mknod(struct inode *dir, struct dentry *dentry, umode_t mode
 		return retval;
 	}
 	jbegin_count += retval;
-	reiserfs_write_lock(dir->i_sb);
+	reiserfs_write_lock(inode_sb(dir));
 
-	retval = journal_begin(&th, dir->i_sb, jbegin_count);
+	retval = journal_begin(&th, inode_sb(dir), jbegin_count);
 	if (retval) {
 		drop_new_inode(inode);
 		goto out_failed;
@@ -776,7 +776,7 @@ static int reiserfs_mknod(struct inode *dir, struct dentry *dentry, umode_t mode
 	retval = journal_end(&th);
 
 out_failed:
-	reiserfs_write_unlock(dir->i_sb);
+	reiserfs_write_unlock(inode_sb(dir));
 	return retval;
 }
 
@@ -792,8 +792,8 @@ static int reiserfs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode
 	 */
 	int jbegin_count =
 	    JOURNAL_PER_BALANCE_CNT * 3 +
-	    2 * (REISERFS_QUOTA_INIT_BLOCKS(dir->i_sb) +
-		 REISERFS_QUOTA_TRANS_BLOCKS(dir->i_sb));
+	    2 * (REISERFS_QUOTA_INIT_BLOCKS(inode_sb(dir)) +
+		 REISERFS_QUOTA_TRANS_BLOCKS(inode_sb(dir)));
 
 	retval = dquot_initialize(dir);
 	if (retval)
@@ -807,7 +807,7 @@ static int reiserfs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode
 	REISERFS_I(dir)->new_packing_locality = 1;
 #endif
 	mode = S_IFDIR | mode;
-	if (!(inode = new_inode(dir->i_sb))) {
+	if (!(inode = new_inode(inode_sb(dir)))) {
 		return -ENOMEM;
 	}
 	retval = new_inode_init(inode, dir, mode);
@@ -823,9 +823,9 @@ static int reiserfs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode
 		return retval;
 	}
 	jbegin_count += retval;
-	reiserfs_write_lock(dir->i_sb);
+	reiserfs_write_lock(inode_sb(dir));
 
-	retval = journal_begin(&th, dir->i_sb, jbegin_count);
+	retval = journal_begin(&th, inode_sb(dir), jbegin_count);
 	if (retval) {
 		drop_new_inode(inode);
 		goto out_failed;
@@ -838,7 +838,7 @@ static int reiserfs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode
 	INC_DIR_INODE_NLINK(dir)
 
 	    retval = reiserfs_new_inode(&th, dir, mode, NULL /*symlink */ ,
-					old_format_only(dir->i_sb) ?
+					old_format_only(inode_sb(dir)) ?
 					EMPTY_DIR_SIZE_V1 : EMPTY_DIR_SIZE,
 					dentry, inode, &security);
 	if (retval) {
@@ -875,7 +875,7 @@ static int reiserfs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode
 	d_instantiate(dentry, inode);
 	retval = journal_end(&th);
 out_failed:
-	reiserfs_write_unlock(dir->i_sb);
+	reiserfs_write_unlock(inode_sb(dir));
 	return retval;
 }
 
@@ -911,14 +911,14 @@ static int reiserfs_rmdir(struct inode *dir, struct dentry *dentry)
 	 */
 	jbegin_count =
 	    JOURNAL_PER_BALANCE_CNT * 2 + 2 +
-	    4 * REISERFS_QUOTA_TRANS_BLOCKS(dir->i_sb);
+	    4 * REISERFS_QUOTA_TRANS_BLOCKS(inode_sb(dir));
 
 	retval = dquot_initialize(dir);
 	if (retval)
 		return retval;
 
-	reiserfs_write_lock(dir->i_sb);
-	retval = journal_begin(&th, dir->i_sb, jbegin_count);
+	reiserfs_write_lock(inode_sb(dir));
+	retval = journal_begin(&th, inode_sb(dir), jbegin_count);
 	if (retval)
 		goto out_rmdir;
 
@@ -958,7 +958,7 @@ static int reiserfs_rmdir(struct inode *dir, struct dentry *dentry)
 		goto end_rmdir;
 
 	if (inode->i_nlink != 2 && inode->i_nlink != 1)
-		reiserfs_error(inode->i_sb, "reiserfs-7040",
+		reiserfs_error(inode_sb(inode), "reiserfs-7040",
 			       "empty directory has nlink != 2 (%d)",
 			       inode->i_nlink);
 
@@ -976,7 +976,7 @@ static int reiserfs_rmdir(struct inode *dir, struct dentry *dentry)
 	retval = journal_end(&th);
 	reiserfs_check_path(&path);
 out_rmdir:
-	reiserfs_write_unlock(dir->i_sb);
+	reiserfs_write_unlock(inode_sb(dir));
 	return retval;
 
 end_rmdir:
@@ -987,7 +987,7 @@ static int reiserfs_rmdir(struct inode *dir, struct dentry *dentry)
 	 */
 	pathrelse(&path);
 	err = journal_end(&th);
-	reiserfs_write_unlock(dir->i_sb);
+	reiserfs_write_unlock(inode_sb(dir));
 	return err ? err : retval;
 }
 
@@ -1016,10 +1016,10 @@ static int reiserfs_unlink(struct inode *dir, struct dentry *dentry)
 	 */
 	jbegin_count =
 	    JOURNAL_PER_BALANCE_CNT * 2 + 2 +
-	    4 * REISERFS_QUOTA_TRANS_BLOCKS(dir->i_sb);
+	    4 * REISERFS_QUOTA_TRANS_BLOCKS(inode_sb(dir));
 
-	reiserfs_write_lock(dir->i_sb);
-	retval = journal_begin(&th, dir->i_sb, jbegin_count);
+	reiserfs_write_lock(inode_sb(dir));
+	retval = journal_begin(&th, inode_sb(dir), jbegin_count);
 	if (retval)
 		goto out_unlink;
 
@@ -1046,7 +1046,7 @@ static int reiserfs_unlink(struct inode *dir, struct dentry *dentry)
 	}
 
 	if (!inode->i_nlink) {
-		reiserfs_warning(inode->i_sb, "reiserfs-7042",
+		reiserfs_warning(inode_sb(inode), "reiserfs-7042",
 				 "deleting nonexistent file (%lu), %d",
 				 inode->i_ino, inode->i_nlink);
 		set_nlink(inode, 1);
@@ -1080,7 +1080,7 @@ static int reiserfs_unlink(struct inode *dir, struct dentry *dentry)
 
 	retval = journal_end(&th);
 	reiserfs_check_path(&path);
-	reiserfs_write_unlock(dir->i_sb);
+	reiserfs_write_unlock(inode_sb(dir));
 	return retval;
 
 end_unlink:
@@ -1090,7 +1090,7 @@ static int reiserfs_unlink(struct inode *dir, struct dentry *dentry)
 	if (err)
 		retval = err;
 out_unlink:
-	reiserfs_write_unlock(dir->i_sb);
+	reiserfs_write_unlock(inode_sb(dir));
 	return retval;
 }
 
@@ -1110,14 +1110,14 @@ static int reiserfs_symlink(struct inode *parent_dir,
 	 */
 	int jbegin_count =
 	    JOURNAL_PER_BALANCE_CNT * 3 +
-	    2 * (REISERFS_QUOTA_INIT_BLOCKS(parent_dir->i_sb) +
-		 REISERFS_QUOTA_TRANS_BLOCKS(parent_dir->i_sb));
+	    2 * (REISERFS_QUOTA_INIT_BLOCKS(inode_sb(parent_dir)) +
+		 REISERFS_QUOTA_TRANS_BLOCKS(inode_sb(parent_dir)));
 
 	retval = dquot_initialize(parent_dir);
 	if (retval)
 		return retval;
 
-	if (!(inode = new_inode(parent_dir->i_sb))) {
+	if (!(inode = new_inode(inode_sb(parent_dir)))) {
 		return -ENOMEM;
 	}
 	retval = new_inode_init(inode, parent_dir, mode);
@@ -1134,9 +1134,9 @@ static int reiserfs_symlink(struct inode *parent_dir,
 	}
 	jbegin_count += retval;
 
-	reiserfs_write_lock(parent_dir->i_sb);
+	reiserfs_write_lock(inode_sb(parent_dir));
 	item_len = ROUND_UP(strlen(symname));
-	if (item_len > MAX_DIRECT_ITEM_LEN(parent_dir->i_sb->s_blocksize)) {
+	if (item_len > MAX_DIRECT_ITEM_LEN(inode_sb(parent_dir)->s_blocksize)) {
 		retval = -ENAMETOOLONG;
 		drop_new_inode(inode);
 		goto out_failed;
@@ -1151,7 +1151,7 @@ static int reiserfs_symlink(struct inode *parent_dir,
 	memcpy(name, symname, strlen(symname));
 	padd_item(name, item_len, strlen(symname));
 
-	retval = journal_begin(&th, parent_dir->i_sb, jbegin_count);
+	retval = journal_begin(&th, inode_sb(parent_dir), jbegin_count);
 	if (retval) {
 		drop_new_inode(inode);
 		kfree(name);
@@ -1191,7 +1191,7 @@ static int reiserfs_symlink(struct inode *parent_dir,
 	d_instantiate(dentry, inode);
 	retval = journal_end(&th);
 out_failed:
-	reiserfs_write_unlock(parent_dir->i_sb);
+	reiserfs_write_unlock(inode_sb(parent_dir));
 	return retval;
 }
 
@@ -1207,26 +1207,26 @@ static int reiserfs_link(struct dentry *old_dentry, struct inode *dir,
 	 */
 	int jbegin_count =
 	    JOURNAL_PER_BALANCE_CNT * 3 +
-	    2 * REISERFS_QUOTA_TRANS_BLOCKS(dir->i_sb);
+	    2 * REISERFS_QUOTA_TRANS_BLOCKS(inode_sb(dir));
 
 	retval = dquot_initialize(dir);
 	if (retval)
 		return retval;
 
-	reiserfs_write_lock(dir->i_sb);
+	reiserfs_write_lock(inode_sb(dir));
 	if (inode->i_nlink >= REISERFS_LINK_MAX) {
 		/* FIXME: sd_nlink is 32 bit for new files */
-		reiserfs_write_unlock(dir->i_sb);
+		reiserfs_write_unlock(inode_sb(dir));
 		return -EMLINK;
 	}
 
 	/* inc before scheduling so reiserfs_unlink knows we are here */
 	inc_nlink(inode);
 
-	retval = journal_begin(&th, dir->i_sb, jbegin_count);
+	retval = journal_begin(&th, inode_sb(dir), jbegin_count);
 	if (retval) {
 		drop_nlink(inode);
-		reiserfs_write_unlock(dir->i_sb);
+		reiserfs_write_unlock(inode_sb(dir));
 		return retval;
 	}
 
@@ -1242,7 +1242,7 @@ static int reiserfs_link(struct dentry *old_dentry, struct inode *dir,
 		int err;
 		drop_nlink(inode);
 		err = journal_end(&th);
-		reiserfs_write_unlock(dir->i_sb);
+		reiserfs_write_unlock(inode_sb(dir));
 		return err ? err : retval;
 	}
 
@@ -1252,7 +1252,7 @@ static int reiserfs_link(struct dentry *old_dentry, struct inode *dir,
 	ihold(inode);
 	d_instantiate(dentry, inode);
 	retval = journal_end(&th);
-	reiserfs_write_unlock(dir->i_sb);
+	reiserfs_write_unlock(inode_sb(dir));
 	return retval;
 }
 
@@ -1279,7 +1279,7 @@ static int entry_points_to_object(const char *name, int len,
 
 	if (inode) {
 		if (!de_visible(de->de_deh + de->de_entry_num))
-			reiserfs_panic(inode->i_sb, "vs-7042",
+			reiserfs_panic(inode_sb(inode), "vs-7042",
 				       "entry must be visible");
 		return (de->de_objectid == inode->i_ino) ? 1 : 0;
 	}
@@ -1337,7 +1337,7 @@ static int reiserfs_rename(struct inode *old_dir, struct dentry *old_dentry,
 	 */
 	jbegin_count =
 	    JOURNAL_PER_BALANCE_CNT * 3 + 5 +
-	    4 * REISERFS_QUOTA_TRANS_BLOCKS(old_dir->i_sb);
+	    4 * REISERFS_QUOTA_TRANS_BLOCKS(inode_sb(old_dir));
 
 	retval = dquot_initialize(old_dir);
 	if (retval)
@@ -1354,19 +1354,19 @@ static int reiserfs_rename(struct inode *old_dir, struct dentry *old_dentry,
 	 * are going to rename
 	 */
 	old_de.de_gen_number_bit_string = NULL;
-	reiserfs_write_lock(old_dir->i_sb);
+	reiserfs_write_lock(inode_sb(old_dir));
 	retval =
 	    reiserfs_find_entry(old_dir, old_dentry->d_name.name,
 				old_dentry->d_name.len, &old_entry_path,
 				&old_de);
 	pathrelse(&old_entry_path);
 	if (retval == IO_ERROR) {
-		reiserfs_write_unlock(old_dir->i_sb);
+		reiserfs_write_unlock(inode_sb(old_dir));
 		return -EIO;
 	}
 
 	if (retval != NAME_FOUND || old_de.de_objectid != old_inode->i_ino) {
-		reiserfs_write_unlock(old_dir->i_sb);
+		reiserfs_write_unlock(inode_sb(old_dir));
 		return -ENOENT;
 	}
 
@@ -1379,7 +1379,7 @@ static int reiserfs_rename(struct inode *old_dir, struct dentry *old_dentry,
 		 */
 		if (new_dentry_inode) {
 			if (!reiserfs_empty_dir(new_dentry_inode)) {
-				reiserfs_write_unlock(old_dir->i_sb);
+				reiserfs_write_unlock(inode_sb(old_dir));
 				return -ENOTEMPTY;
 			}
 		}
@@ -1394,20 +1394,20 @@ static int reiserfs_rename(struct inode *old_dir, struct dentry *old_dentry,
 					&dot_dot_de);
 		pathrelse(&dot_dot_entry_path);
 		if (retval != NAME_FOUND) {
-			reiserfs_write_unlock(old_dir->i_sb);
+			reiserfs_write_unlock(inode_sb(old_dir));
 			return -EIO;
 		}
 
 		/* inode number of .. must equal old_dir->i_ino */
 		if (dot_dot_de.de_objectid != old_dir->i_ino) {
-			reiserfs_write_unlock(old_dir->i_sb);
+			reiserfs_write_unlock(inode_sb(old_dir));
 			return -EIO;
 		}
 	}
 
-	retval = journal_begin(&th, old_dir->i_sb, jbegin_count);
+	retval = journal_begin(&th, inode_sb(old_dir), jbegin_count);
 	if (retval) {
-		reiserfs_write_unlock(old_dir->i_sb);
+		reiserfs_write_unlock(inode_sb(old_dir));
 		return retval;
 	}
 
@@ -1417,12 +1417,12 @@ static int reiserfs_rename(struct inode *old_dir, struct dentry *old_dentry,
 			       new_dentry->d_name.len, old_inode, 0);
 	if (retval == -EEXIST) {
 		if (!new_dentry_inode) {
-			reiserfs_panic(old_dir->i_sb, "vs-7050",
+			reiserfs_panic(inode_sb(old_dir), "vs-7050",
 				       "new entry is found, new inode == 0");
 		}
 	} else if (retval) {
 		int err = journal_end(&th);
-		reiserfs_write_unlock(old_dir->i_sb);
+		reiserfs_write_unlock(inode_sb(old_dir));
 		return err ? err : retval;
 	}
 
@@ -1444,18 +1444,19 @@ static int reiserfs_rename(struct inode *old_dir, struct dentry *old_dentry,
 		 * (found by reiserfs_find_entry)
 		 */
 		if ((retval =
-		     search_by_entry_key(new_dir->i_sb, &old_de.de_entry_key,
+		     search_by_entry_key(inode_sb(new_dir), &old_de.de_entry_key,
 					 &old_entry_path,
 					 &old_de)) != NAME_FOUND) {
 			pathrelse(&old_entry_path);
 			journal_end(&th);
-			reiserfs_write_unlock(old_dir->i_sb);
+			reiserfs_write_unlock(inode_sb(old_dir));
 			return -EIO;
 		}
 
 		copy_item_head(&old_entry_ih, tp_item_head(&old_entry_path));
 
-		reiserfs_prepare_for_journal(old_inode->i_sb, old_de.de_bh, 1);
+		reiserfs_prepare_for_journal(inode_sb(old_inode),
+					     old_de.de_bh, 1);
 
 		/* look for new name by reiserfs_find_entry */
 		new_de.de_gen_number_bit_string = NULL;
@@ -1473,17 +1474,18 @@ static int reiserfs_rename(struct inode *old_dir, struct dentry *old_dentry,
 			pathrelse(&new_entry_path);
 			pathrelse(&old_entry_path);
 			journal_end(&th);
-			reiserfs_write_unlock(old_dir->i_sb);
+			reiserfs_write_unlock(inode_sb(old_dir));
 			return -EIO;
 		}
 
 		copy_item_head(&new_entry_ih, tp_item_head(&new_entry_path));
 
-		reiserfs_prepare_for_journal(old_inode->i_sb, new_de.de_bh, 1);
+		reiserfs_prepare_for_journal(inode_sb(old_inode),
+					     new_de.de_bh, 1);
 
 		if (S_ISDIR(old_inode->i_mode)) {
 			if ((retval =
-			     search_by_entry_key(new_dir->i_sb,
+			     search_by_entry_key(inode_sb(new_dir),
 						 &dot_dot_de.de_entry_key,
 						 &dot_dot_entry_path,
 						 &dot_dot_de)) != NAME_FOUND) {
@@ -1491,13 +1493,13 @@ static int reiserfs_rename(struct inode *old_dir, struct dentry *old_dentry,
 				pathrelse(&new_entry_path);
 				pathrelse(&old_entry_path);
 				journal_end(&th);
-				reiserfs_write_unlock(old_dir->i_sb);
+				reiserfs_write_unlock(inode_sb(old_dir));
 				return -EIO;
 			}
 			copy_item_head(&dot_dot_ih,
 				       tp_item_head(&dot_dot_entry_path));
 			/* node containing ".." gets into transaction */
-			reiserfs_prepare_for_journal(old_inode->i_sb,
+			reiserfs_prepare_for_journal(inode_sb(old_inode),
 						     dot_dot_de.de_bh, 1);
 		}
 		/*
@@ -1525,13 +1527,12 @@ static int reiserfs_rename(struct inode *old_dir, struct dentry *old_dentry,
 		    !entry_points_to_object(old_dentry->d_name.name,
 					    old_dentry->d_name.len,
 					    &old_de, old_inode)) {
-			reiserfs_restore_prepared_buffer(old_inode->i_sb,
+			reiserfs_restore_prepared_buffer(inode_sb(old_inode),
 							 new_de.de_bh);
-			reiserfs_restore_prepared_buffer(old_inode->i_sb,
+			reiserfs_restore_prepared_buffer(inode_sb(old_inode),
 							 old_de.de_bh);
 			if (S_ISDIR(old_inode_mode))
-				reiserfs_restore_prepared_buffer(old_inode->
-								 i_sb,
+				reiserfs_restore_prepared_buffer(inode_sb(old_inode),
 								 dot_dot_de.
 								 de_bh);
 			continue;
@@ -1540,14 +1541,11 @@ static int reiserfs_rename(struct inode *old_dir, struct dentry *old_dentry,
 			if (item_moved(&dot_dot_ih, &dot_dot_entry_path) ||
 			    !entry_points_to_object("..", 2, &dot_dot_de,
 						    old_dir)) {
-				reiserfs_restore_prepared_buffer(old_inode->
-								 i_sb,
+				reiserfs_restore_prepared_buffer(inode_sb(old_inode),
 								 old_de.de_bh);
-				reiserfs_restore_prepared_buffer(old_inode->
-								 i_sb,
+				reiserfs_restore_prepared_buffer(inode_sb(old_inode),
 								 new_de.de_bh);
-				reiserfs_restore_prepared_buffer(old_inode->
-								 i_sb,
+				reiserfs_restore_prepared_buffer(inode_sb(old_inode),
 								 dot_dot_de.
 								 de_bh);
 				continue;
@@ -1621,7 +1619,7 @@ static int reiserfs_rename(struct inode *old_dir, struct dentry *old_dentry,
 	if (reiserfs_cut_from_item
 	    (&th, &old_entry_path, &old_de.de_entry_key, old_dir, NULL,
 	     0) < 0)
-		reiserfs_error(old_dir->i_sb, "vs-7060",
+		reiserfs_error(inode_sb(old_dir), "vs-7060",
 			       "couldn't not cut old name. Fsck later?");
 
 	old_dir->i_size -= DEH_SIZE + old_de.de_entrylen;
@@ -1638,7 +1636,7 @@ static int reiserfs_rename(struct inode *old_dir, struct dentry *old_dentry,
 	}
 
 	retval = journal_end(&th);
-	reiserfs_write_unlock(old_dir->i_sb);
+	reiserfs_write_unlock(inode_sb(old_dir));
 	return retval;
 }
 
diff --git a/fs/reiserfs/reiserfs.h b/fs/reiserfs/reiserfs.h
index 48835a659948..2523d838588c 100644
--- a/fs/reiserfs/reiserfs.h
+++ b/fs/reiserfs/reiserfs.h
@@ -2886,7 +2886,7 @@ int journal_mark_dirty(struct reiserfs_transaction_handle *,
 
 static inline int reiserfs_file_data_log(struct inode *inode)
 {
-	if (reiserfs_data_log(inode->i_sb) ||
+	if (reiserfs_data_log(inode_sb(inode)) ||
 	    (REISERFS_I(inode)->i_flags & i_data_log))
 		return 1;
 	return 0;
@@ -3042,12 +3042,12 @@ int reiserfs_do_truncate(struct reiserfs_transaction_handle *th,
 			 struct inode *inode, struct page *,
 			 int update_timestamps);
 
-#define i_block_size(inode) ((inode)->i_sb->s_blocksize)
+#define i_block_size(inode) (inode_sb((inode))->s_blocksize)
 #define file_size(inode) ((inode)->i_size)
 #define tail_size(inode) (file_size (inode) & (i_block_size (inode) - 1))
 
-#define tail_has_to_be_packed(inode) (have_large_tails ((inode)->i_sb)?\
-!STORE_TAIL_IN_UNFM_S1(file_size (inode), tail_size(inode), inode->i_sb->s_blocksize):have_small_tails ((inode)->i_sb)?!STORE_TAIL_IN_UNFM_S2(file_size (inode), tail_size(inode), inode->i_sb->s_blocksize):0 )
+#define tail_has_to_be_packed(inode) (have_large_tails (inode_sb((inode)))?\
+!STORE_TAIL_IN_UNFM_S1(file_size (inode), tail_size(inode), inode_sb(inode)->s_blocksize):have_small_tails (inode_sb((inode)))?!STORE_TAIL_IN_UNFM_S2(file_size (inode), tail_size(inode), inode_sb(inode)->s_blocksize):0 )
 
 void padd_item(char *item, int total_length, int length);
 
diff --git a/fs/reiserfs/stree.c b/fs/reiserfs/stree.c
index 0037aea97d39..a69a974ef362 100644
--- a/fs/reiserfs/stree.c
+++ b/fs/reiserfs/stree.c
@@ -1029,7 +1029,7 @@ static char prepare_for_delete_or_cut(struct reiserfs_transaction_handle *th,
 				      unsigned long long new_file_length
     )
 {
-	struct super_block *sb = inode->i_sb;
+	struct super_block *sb = inode_sb(inode);
 	struct item_head *p_le_ih = tp_item_head(path);
 	struct buffer_head *bh = PATH_PLAST_BUFFER(path);
 
@@ -1235,7 +1235,7 @@ int reiserfs_delete_item(struct reiserfs_transaction_handle *th,
 			 struct treepath *path, const struct cpu_key *item_key,
 			 struct inode *inode, struct buffer_head *un_bh)
 {
-	struct super_block *sb = inode->i_sb;
+	struct super_block *sb = inode_sb(inode);
 	struct tree_balance s_del_balance;
 	struct item_head s_ih;
 	struct item_head *q_ih;
@@ -1358,9 +1358,9 @@ int reiserfs_delete_item(struct reiserfs_transaction_handle *th,
 		       "reiserquota delete_item(): freeing %u, id=%u type=%c",
 		       quota_cut_bytes, inode->i_uid, head2type(&s_ih));
 #endif
-	depth = reiserfs_write_unlock_nested(inode->i_sb);
+	depth = reiserfs_write_unlock_nested(inode_sb(inode));
 	dquot_free_space_nodirty(inode, quota_cut_bytes);
-	reiserfs_write_lock_nested(inode->i_sb, depth);
+	reiserfs_write_lock_nested(inode_sb(inode), depth);
 
 	/* Return deleted body length */
 	return ret_value;
@@ -1544,7 +1544,7 @@ static int maybe_indirect_to_direct(struct reiserfs_transaction_handle *th,
 				    const struct cpu_key *item_key,
 				    loff_t new_file_size, char *mode)
 {
-	struct super_block *sb = inode->i_sb;
+	struct super_block *sb = inode_sb(inode);
 	int block_size = sb->s_blocksize;
 	int cut_bytes;
 	BUG_ON(!th->t_trans_id);
@@ -1589,12 +1589,12 @@ static void indirect_to_direct_roll_back(struct reiserfs_transaction_handle *th,
 	tail_key.key_length = 4;
 
 	tail_len =
-	    (cpu_key_k_offset(&tail_key) & (inode->i_sb->s_blocksize - 1)) - 1;
+	    (cpu_key_k_offset(&tail_key) & (inode_sb(inode)->s_blocksize - 1)) - 1;
 	while (tail_len) {
 		/* look for the last byte of the tail */
-		if (search_for_position_by_key(inode->i_sb, &tail_key, path) ==
+		if (search_for_position_by_key(inode_sb(inode), &tail_key, path) ==
 		    POSITION_NOT_FOUND)
-			reiserfs_panic(inode->i_sb, "vs-5615",
+			reiserfs_panic(inode_sb(inode), "vs-5615",
 				       "found invalid item");
 		RFALSE(path->pos_in_item !=
 		       ih_item_len(tp_item_head(path)) - 1,
@@ -1612,7 +1612,8 @@ static void indirect_to_direct_roll_back(struct reiserfs_transaction_handle *th,
 		set_cpu_key_k_offset(&tail_key,
 				     cpu_key_k_offset(&tail_key) - removed);
 	}
-	reiserfs_warning(inode->i_sb, "reiserfs-5091", "indirect_to_direct "
+	reiserfs_warning(inode_sb(inode), "reiserfs-5091",
+			 "indirect_to_direct "
 			 "conversion has been rolled back due to "
 			 "lack of disk space");
 	mark_inode_dirty(inode);
@@ -1625,7 +1626,7 @@ int reiserfs_cut_from_item(struct reiserfs_transaction_handle *th,
 			   struct inode *inode,
 			   struct page *page, loff_t new_file_size)
 {
-	struct super_block *sb = inode->i_sb;
+	struct super_block *sb = inode_sb(inode);
 	/*
 	 * Every function which is going to call do_balance must first
 	 * create a tree_balance structure.  Then it must fill up this
@@ -1646,7 +1647,7 @@ int reiserfs_cut_from_item(struct reiserfs_transaction_handle *th,
 
 	BUG_ON(!th->t_trans_id);
 
-	init_tb_struct(th, &s_cut_balance, inode->i_sb, path,
+	init_tb_struct(th, &s_cut_balance, inode_sb(inode), path,
 		       cut_size);
 
 	/*
@@ -1830,7 +1831,7 @@ int reiserfs_cut_from_item(struct reiserfs_transaction_handle *th,
 		REISERFS_I(inode)->i_flags &= ~i_pack_on_close_mask;
 	}
 #ifdef REISERQUOTA_DEBUG
-	reiserfs_debug(inode->i_sb, REISERFS_DEBUG_CODE,
+	reiserfs_debug(inode_sb(inode), REISERFS_DEBUG_CODE,
 		       "reiserquota cut_from_item(): freeing %u id=%u type=%c",
 		       quota_cut_bytes, inode->i_uid, '?');
 #endif
@@ -1845,7 +1846,7 @@ static void truncate_directory(struct reiserfs_transaction_handle *th,
 {
 	BUG_ON(!th->t_trans_id);
 	if (inode->i_nlink)
-		reiserfs_error(inode->i_sb, "vs-5655", "link count != 0");
+		reiserfs_error(inode_sb(inode), "vs-5655", "link count != 0");
 
 	set_le_key_k_offset(KEY_FORMAT_3_5, INODE_PKEY(inode), DOT_OFFSET);
 	set_le_key_k_type(KEY_FORMAT_3_5, INODE_PKEY(inode), TYPE_DIRENTRY);
@@ -1900,17 +1901,17 @@ int reiserfs_do_truncate(struct reiserfs_transaction_handle *th,
 		     TYPE_DIRECT, 3);
 
 	retval =
-	    search_for_position_by_key(inode->i_sb, &s_item_key,
+	    search_for_position_by_key(inode_sb(inode), &s_item_key,
 				       &s_search_path);
 	if (retval == IO_ERROR) {
-		reiserfs_error(inode->i_sb, "vs-5657",
+		reiserfs_error(inode_sb(inode), "vs-5657",
 			       "i/o failure occurred trying to truncate %K",
 			       &s_item_key);
 		err = -EIO;
 		goto out;
 	}
 	if (retval == POSITION_FOUND || retval == FILE_NOT_FOUND) {
-		reiserfs_error(inode->i_sb, "PAP-5660",
+		reiserfs_error(inode_sb(inode), "PAP-5660",
 			       "wrong result %d of search for %K", retval,
 			       &s_item_key);
 
@@ -1927,7 +1928,7 @@ int reiserfs_do_truncate(struct reiserfs_transaction_handle *th,
 	else {
 		loff_t offset = le_ih_k_offset(p_le_ih);
 		int bytes =
-		    op_bytes_number(p_le_ih, inode->i_sb->s_blocksize);
+		    op_bytes_number(p_le_ih, inode_sb(inode)->s_blocksize);
 
 		/*
 		 * this may mismatch with real file size: if last direct item
@@ -1956,7 +1957,7 @@ int reiserfs_do_truncate(struct reiserfs_transaction_handle *th,
 		    reiserfs_cut_from_item(th, &s_search_path, &s_item_key,
 					   inode, page, new_file_size);
 		if (deleted < 0) {
-			reiserfs_warning(inode->i_sb, "vs-5665",
+			reiserfs_warning(inode_sb(inode), "vs-5665",
 					 "reiserfs_cut_from_item failed");
 			reiserfs_check_path(&s_search_path);
 			return 0;
@@ -1996,14 +1997,14 @@ int reiserfs_do_truncate(struct reiserfs_transaction_handle *th,
 			err = journal_end(th);
 			if (err)
 				goto out;
-			err = journal_begin(th, inode->i_sb,
+			err = journal_begin(th, inode_sb(inode),
 					    JOURNAL_FOR_FREE_BLOCK_AND_UPDATE_SD + JOURNAL_PER_BALANCE_CNT * 4) ;
 			if (err)
 				goto out;
 			reiserfs_update_inode_transaction(inode);
 		}
 	} while (file_size > ROUND_UP(new_file_size) &&
-		 search_for_position_by_key(inode->i_sb, &s_item_key,
+		 search_for_position_by_key(inode_sb(inode), &s_item_key,
 					    &s_search_path) == POSITION_FOUND);
 
 	RFALSE(file_size > ROUND_UP(new_file_size),
@@ -2074,7 +2075,7 @@ int reiserfs_paste_into_item(struct reiserfs_transaction_handle *th,
 			     /* Size of pasted bytes. */
 			     int pasted_size)
 {
-	struct super_block *sb = inode->i_sb;
+	struct super_block *sb = inode_sb(inode);
 	struct tree_balance s_paste_balance;
 	int retval;
 	int fs_gen;
@@ -2082,10 +2083,10 @@ int reiserfs_paste_into_item(struct reiserfs_transaction_handle *th,
 
 	BUG_ON(!th->t_trans_id);
 
-	fs_gen = get_generation(inode->i_sb);
+	fs_gen = get_generation(inode_sb(inode));
 
 #ifdef REISERQUOTA_DEBUG
-	reiserfs_debug(inode->i_sb, REISERFS_DEBUG_CODE,
+	reiserfs_debug(inode_sb(inode), REISERFS_DEBUG_CODE,
 		       "reiserquota paste_into_item(): allocating %u id=%u type=%c",
 		       pasted_size, inode->i_uid,
 		       key2type(&key->on_disk_key));
@@ -2105,7 +2106,7 @@ int reiserfs_paste_into_item(struct reiserfs_transaction_handle *th,
 #endif
 
 	/* DQUOT_* can schedule, must check before the fix_nodes */
-	if (fs_changed(fs_gen, inode->i_sb)) {
+	if (fs_changed(fs_gen, inode_sb(inode))) {
 		goto search_again;
 	}
 
@@ -2123,7 +2124,7 @@ int reiserfs_paste_into_item(struct reiserfs_transaction_handle *th,
 			goto error_out;
 		}
 		if (retval == POSITION_FOUND) {
-			reiserfs_warning(inode->i_sb, "PAP-5710",
+			reiserfs_warning(inode_sb(inode), "PAP-5710",
 					 "entry or pasted byte (%K) exists",
 					 key);
 			retval = -EEXIST;
@@ -2147,7 +2148,7 @@ int reiserfs_paste_into_item(struct reiserfs_transaction_handle *th,
 	/* this also releases the path */
 	unfix_nodes(&s_paste_balance);
 #ifdef REISERQUOTA_DEBUG
-	reiserfs_debug(inode->i_sb, REISERFS_DEBUG_CODE,
+	reiserfs_debug(inode_sb(inode), REISERFS_DEBUG_CODE,
 		       "reiserquota paste_into_item(): freeing %u id=%u type=%c",
 		       pasted_size, inode->i_uid,
 		       key2type(&key->on_disk_key));
@@ -2179,7 +2180,7 @@ int reiserfs_insert_item(struct reiserfs_transaction_handle *th,
 
 	if (inode) {		/* Do we count quotas for item? */
 		int depth;
-		fs_gen = get_generation(inode->i_sb);
+		fs_gen = get_generation(inode_sb(inode));
 		quota_bytes = ih_item_len(ih);
 
 		/*
@@ -2188,9 +2189,9 @@ int reiserfs_insert_item(struct reiserfs_transaction_handle *th,
 		 * so there's no guessing needed
 		 */
 		if (!S_ISLNK(inode->i_mode) && is_direct_le_ih(ih))
-			quota_bytes = inode->i_sb->s_blocksize + UNFM_P_SIZE;
+			quota_bytes = inode_sb(inode)->s_blocksize + UNFM_P_SIZE;
 #ifdef REISERQUOTA_DEBUG
-		reiserfs_debug(inode->i_sb, REISERFS_DEBUG_CODE,
+		reiserfs_debug(inode_sb(inode), REISERFS_DEBUG_CODE,
 			       "reiserquota insert_item(): allocating %u id=%u type=%c",
 			       quota_bytes, inode->i_uid, head2type(ih));
 #endif
@@ -2198,9 +2199,9 @@ int reiserfs_insert_item(struct reiserfs_transaction_handle *th,
 		 * We can't dirty inode here. It would be immediately
 		 * written but appropriate stat item isn't inserted yet...
 		 */
-		depth = reiserfs_write_unlock_nested(inode->i_sb);
+		depth = reiserfs_write_unlock_nested(inode_sb(inode));
 		retval = dquot_alloc_space_nodirty(inode, quota_bytes);
-		reiserfs_write_lock_nested(inode->i_sb, depth);
+		reiserfs_write_lock_nested(inode_sb(inode), depth);
 		if (retval) {
 			pathrelse(path);
 			return retval;
@@ -2215,7 +2216,7 @@ int reiserfs_insert_item(struct reiserfs_transaction_handle *th,
 	 * DQUOT_* can schedule, must check to be sure calling
 	 * fix_nodes is safe
 	 */
-	if (inode && fs_changed(fs_gen, inode->i_sb)) {
+	if (inode && fs_changed(fs_gen, inode_sb(inode))) {
 		goto search_again;
 	}
 
@@ -2255,9 +2256,9 @@ int reiserfs_insert_item(struct reiserfs_transaction_handle *th,
 		       quota_bytes, inode->i_uid, head2type(ih));
 #endif
 	if (inode) {
-		int depth = reiserfs_write_unlock_nested(inode->i_sb);
+		int depth = reiserfs_write_unlock_nested(inode_sb(inode));
 		dquot_free_space_nodirty(inode, quota_bytes);
-		reiserfs_write_lock_nested(inode->i_sb, depth);
+		reiserfs_write_lock_nested(inode_sb(inode), depth);
 	}
 	return retval;
 }
diff --git a/fs/reiserfs/super.c b/fs/reiserfs/super.c
index 1fc934d24459..031010fe79f9 100644
--- a/fs/reiserfs/super.c
+++ b/fs/reiserfs/super.c
@@ -340,9 +340,9 @@ static int finish_unfinished(struct super_block *s)
 			retval = remove_save_link_only(s, &save_link_key, 0);
 			continue;
 		}
-		depth = reiserfs_write_unlock_nested(inode->i_sb);
+		depth = reiserfs_write_unlock_nested(inode_sb(inode));
 		dquot_initialize(inode);
-		reiserfs_write_lock_nested(inode->i_sb, depth);
+		reiserfs_write_lock_nested(inode_sb(inode), depth);
 
 		if (truncate && S_ISDIR(inode->i_mode)) {
 			/*
@@ -453,17 +453,18 @@ void add_save_link(struct reiserfs_transaction_handle *th,
 	key.on_disk_key.k_objectid = inode->i_ino;
 	if (!truncate) {
 		/* unlink, rmdir, rename */
-		set_cpu_key_k_offset(&key, 1 + inode->i_sb->s_blocksize);
+		set_cpu_key_k_offset(&key, 1 + inode_sb(inode)->s_blocksize);
 		set_cpu_key_k_type(&key, TYPE_DIRECT);
 
 		/* item head of "safe" link */
 		make_le_item_head(&ih, &key, key.version,
-				  1 + inode->i_sb->s_blocksize, TYPE_DIRECT,
+				  1 + inode_sb(inode)->s_blocksize,
+				  TYPE_DIRECT,
 				  4 /*length */ , 0xffff /*free space */ );
 	} else {
 		/* truncate */
 		if (S_ISDIR(inode->i_mode))
-			reiserfs_warning(inode->i_sb, "green-2102",
+			reiserfs_warning(inode_sb(inode), "green-2102",
 					 "Adding a truncate savelink for "
 					 "a directory %k! Please report",
 					 INODE_PKEY(inode));
@@ -477,10 +478,10 @@ void add_save_link(struct reiserfs_transaction_handle *th,
 	key.key_length = 3;
 
 	/* look for its place in the tree */
-	retval = search_item(inode->i_sb, &key, &path);
+	retval = search_item(inode_sb(inode), &key, &path);
 	if (retval != ITEM_NOT_FOUND) {
 		if (retval != -ENOSPC)
-			reiserfs_error(inode->i_sb, "vs-2100",
+			reiserfs_error(inode_sb(inode), "vs-2100",
 				       "search_by_key (%K) returned %d", &key,
 				       retval);
 		pathrelse(&path);
@@ -495,7 +496,7 @@ void add_save_link(struct reiserfs_transaction_handle *th,
 	    reiserfs_insert_item(th, &path, &key, &ih, NULL, (char *)&link);
 	if (retval) {
 		if (retval != -ENOSPC)
-			reiserfs_error(inode->i_sb, "vs-2120",
+			reiserfs_error(inode_sb(inode), "vs-2120",
 				       "insert_item returned %d", retval);
 	} else {
 		if (truncate)
@@ -514,7 +515,7 @@ int remove_save_link(struct inode *inode, int truncate)
 	int err;
 
 	/* we are going to do one balancing only */
-	err = journal_begin(&th, inode->i_sb, JOURNAL_PER_BALANCE_CNT);
+	err = journal_begin(&th, inode_sb(inode), JOURNAL_PER_BALANCE_CNT);
 	if (err)
 		return err;
 
@@ -524,7 +525,7 @@ int remove_save_link(struct inode *inode, int truncate)
 	if (!truncate) {
 		/* unlink, rmdir, rename */
 		set_le_key_k_offset(KEY_FORMAT_3_5, &key,
-				    1 + inode->i_sb->s_blocksize);
+				    1 + inode_sb(inode)->s_blocksize);
 		set_le_key_k_type(KEY_FORMAT_3_5, &key, TYPE_DIRECT);
 	} else {
 		/* truncate */
@@ -700,19 +701,19 @@ static void reiserfs_dirty_inode(struct inode *inode, int flags)
 
 	int err = 0;
 
-	if (sb_rdonly(inode->i_sb)) {
-		reiserfs_warning(inode->i_sb, "clm-6006",
+	if (sb_rdonly(inode_sb(inode))) {
+		reiserfs_warning(inode_sb(inode), "clm-6006",
 				 "writing inode %lu on readonly FS",
 				 inode->i_ino);
 		return;
 	}
-	reiserfs_write_lock(inode->i_sb);
+	reiserfs_write_lock(inode_sb(inode));
 
 	/*
 	 * this is really only used for atime updates, so they don't have
 	 * to be included in O_SYNC or fsync
 	 */
-	err = journal_begin(&th, inode->i_sb, 1);
+	err = journal_begin(&th, inode_sb(inode), 1);
 	if (err)
 		goto out;
 
@@ -720,7 +721,7 @@ static void reiserfs_dirty_inode(struct inode *inode, int flags)
 	journal_end(&th);
 
 out:
-	reiserfs_write_unlock(inode->i_sb);
+	reiserfs_write_unlock(inode_sb(inode));
 }
 
 static int reiserfs_show_options(struct seq_file *seq, struct dentry *root)
diff --git a/fs/reiserfs/tail_conversion.c b/fs/reiserfs/tail_conversion.c
index b0ae088dffc7..a6635188890a 100644
--- a/fs/reiserfs/tail_conversion.c
+++ b/fs/reiserfs/tail_conversion.c
@@ -26,7 +26,7 @@ int direct2indirect(struct reiserfs_transaction_handle *th, struct inode *inode,
 		    struct treepath *path, struct buffer_head *unbh,
 		    loff_t tail_offset)
 {
-	struct super_block *sb = inode->i_sb;
+	struct super_block *sb = inode_sb(inode);
 	struct buffer_head *up_to_date_bh;
 	struct item_head *p_le_ih = tp_item_head(path);
 	unsigned long total_tail = 0;
@@ -178,7 +178,7 @@ void reiserfs_unmap_buffer(struct buffer_head *bh)
 	 */
 	if ((!list_empty(&bh->b_assoc_buffers) || bh->b_private) && bh->b_page) {
 		struct inode *inode = bh->b_page->mapping->host;
-		struct reiserfs_journal *j = SB_JOURNAL(inode->i_sb);
+		struct reiserfs_journal *j = SB_JOURNAL(inode_sb(inode));
 		spin_lock(&j->j_dirty_buffers_lock);
 		list_del_init(&bh->b_assoc_buffers);
 		reiserfs_free_jh(bh);
@@ -208,7 +208,7 @@ int indirect2direct(struct reiserfs_transaction_handle *th,
 		    loff_t n_new_file_size,	/* New file size. */
 		    char *mode)
 {
-	struct super_block *sb = inode->i_sb;
+	struct super_block *sb = inode_sb(inode);
 	struct item_head s_ih;
 	unsigned long block_size = sb->s_blocksize;
 	char *tail;
diff --git a/fs/reiserfs/xattr.c b/fs/reiserfs/xattr.c
index 5dbf5324bdda..e73afd1703ef 100644
--- a/fs/reiserfs/xattr.c
+++ b/fs/reiserfs/xattr.c
@@ -149,7 +149,7 @@ static struct dentry *open_xa_dir(const struct inode *inode, int flags)
 	struct dentry *xaroot, *xadir;
 	char namebuf[17];
 
-	xaroot = open_xa_root(inode->i_sb, flags);
+	xaroot = open_xa_root(inode_sb(inode), flags);
 	if (IS_ERR(xaroot))
 		return xaroot;
 
@@ -290,21 +290,21 @@ static int reiserfs_for_each_xattr(struct inode *inode,
 		 * outer transaction.
 		 */
 		int blocks = JOURNAL_PER_BALANCE_CNT * 2 + 2 +
-			     4 * REISERFS_QUOTA_TRANS_BLOCKS(inode->i_sb);
+			     4 * REISERFS_QUOTA_TRANS_BLOCKS(inode_sb(inode));
 		struct reiserfs_transaction_handle th;
 
-		reiserfs_write_lock(inode->i_sb);
-		err = journal_begin(&th, inode->i_sb, blocks);
-		reiserfs_write_unlock(inode->i_sb);
+		reiserfs_write_lock(inode_sb(inode));
+		err = journal_begin(&th, inode_sb(inode), blocks);
+		reiserfs_write_unlock(inode_sb(inode));
 		if (!err) {
 			int jerror;
 
 			inode_lock_nested(d_inode(dir->d_parent),
 					  I_MUTEX_XATTR);
 			err = action(dir, data);
-			reiserfs_write_lock(inode->i_sb);
+			reiserfs_write_lock(inode_sb(inode));
 			jerror = journal_end(&th);
-			reiserfs_write_unlock(inode->i_sb);
+			reiserfs_write_unlock(inode_sb(inode));
 			inode_unlock(d_inode(dir->d_parent));
 			err = jerror ?: err;
 		}
@@ -353,7 +353,7 @@ int reiserfs_delete_xattrs(struct inode *inode)
 	int err = reiserfs_for_each_xattr(inode, delete_one_xattr, NULL);
 
 	if (err)
-		reiserfs_warning(inode->i_sb, "jdm-20004",
+		reiserfs_warning(inode_sb(inode), "jdm-20004",
 				 "Couldn't delete all xattrs (%d)\n", err);
 	return err;
 }
@@ -364,7 +364,7 @@ int reiserfs_chown_xattrs(struct inode *inode, struct iattr *attrs)
 	int err = reiserfs_for_each_xattr(inode, chown_one_xattr, attrs);
 
 	if (err)
-		reiserfs_warning(inode->i_sb, "jdm-20007",
+		reiserfs_warning(inode_sb(inode), "jdm-20007",
 				 "Couldn't chown all xattrs (%d)\n", err);
 	return err;
 }
@@ -554,7 +554,7 @@ reiserfs_xattr_set_handle(struct reiserfs_transaction_handle *th,
 			rxh->h_hash = cpu_to_le32(xahash);
 		}
 
-		reiserfs_write_lock(inode->i_sb);
+		reiserfs_write_lock(inode_sb(inode));
 		err = __reiserfs_write_begin(page, page_offset, chunk + skip);
 		if (!err) {
 			if (buffer)
@@ -563,7 +563,7 @@ reiserfs_xattr_set_handle(struct reiserfs_transaction_handle *th,
 						    page_offset + chunk +
 						    skip);
 		}
-		reiserfs_write_unlock(inode->i_sb);
+		reiserfs_write_unlock(inode_sb(inode));
 		unlock_page(page);
 		reiserfs_put_page(page);
 		buffer_pos += chunk;
@@ -606,9 +606,9 @@ int reiserfs_xattr_set(struct inode *inode, const char *name,
 	if (!(flags & XATTR_REPLACE))
 		jbegin_count += reiserfs_xattr_jcreate_nblocks(inode);
 
-	reiserfs_write_lock(inode->i_sb);
-	error = journal_begin(&th, inode->i_sb, jbegin_count);
-	reiserfs_write_unlock(inode->i_sb);
+	reiserfs_write_lock(inode_sb(inode));
+	error = journal_begin(&th, inode_sb(inode), jbegin_count);
+	reiserfs_write_unlock(inode_sb(inode));
 	if (error) {
 		return error;
 	}
@@ -616,9 +616,9 @@ int reiserfs_xattr_set(struct inode *inode, const char *name,
 	error = reiserfs_xattr_set_handle(&th, inode, name,
 					  buffer, buffer_size, flags);
 
-	reiserfs_write_lock(inode->i_sb);
+	reiserfs_write_lock(inode_sb(inode));
 	error2 = journal_end(&th);
-	reiserfs_write_unlock(inode->i_sb);
+	reiserfs_write_unlock(inode_sb(inode));
 	if (error == 0)
 		error = error2;
 
@@ -698,7 +698,7 @@ reiserfs_xattr_get(struct inode *inode, const char *name, void *buffer,
 			if (rxh->h_magic != cpu_to_le32(REISERFS_XATTR_MAGIC)) {
 				unlock_page(page);
 				reiserfs_put_page(page);
-				reiserfs_warning(inode->i_sb, "jdm-20001",
+				reiserfs_warning(inode_sb(inode), "jdm-20001",
 						 "Invalid magic for xattr (%s) "
 						 "associated with %k", name,
 						 INODE_PKEY(inode));
@@ -718,7 +718,7 @@ reiserfs_xattr_get(struct inode *inode, const char *name, void *buffer,
 
 	if (xattr_hash(buffer, isize - sizeof(struct reiserfs_xattr_header)) !=
 	    hash) {
-		reiserfs_warning(inode->i_sb, "jdm-20002",
+		reiserfs_warning(inode_sb(inode), "jdm-20002",
 				 "Invalid hash for xattr (%s) associated "
 				 "with %k", name, INODE_PKEY(inode));
 		err = -EIO;
diff --git a/fs/reiserfs/xattr.h b/fs/reiserfs/xattr.h
index c764352447ba..7b7c55d603a6 100644
--- a/fs/reiserfs/xattr.h
+++ b/fs/reiserfs/xattr.h
@@ -51,8 +51,9 @@ static inline loff_t reiserfs_xattr_nblocks(struct inode *inode, loff_t size)
 {
 	loff_t ret = 0;
 	if (reiserfs_file_data_log(inode)) {
-		ret = _ROUND_UP(xattr_size(size), inode->i_sb->s_blocksize);
-		ret >>= inode->i_sb->s_blocksize_bits;
+		ret = _ROUND_UP(xattr_size(size),
+				inode_sb(inode)->s_blocksize);
+		ret >>= inode_sb(inode)->s_blocksize_bits;
 	}
 	return ret;
 }
@@ -71,12 +72,12 @@ static inline loff_t reiserfs_xattr_nblocks(struct inode *inode, loff_t size)
  */
 static inline size_t reiserfs_xattr_jcreate_nblocks(struct inode *inode)
 {
-	size_t nblocks = JOURNAL_BLOCKS_PER_OBJECT(inode->i_sb);
+	size_t nblocks = JOURNAL_BLOCKS_PER_OBJECT(inode_sb(inode));
 
 	if ((REISERFS_I(inode)->i_flags & i_has_xattr_dir) == 0) {
-		nblocks += JOURNAL_BLOCKS_PER_OBJECT(inode->i_sb);
-		if (d_really_is_negative(REISERFS_SB(inode->i_sb)->xattr_root))
-			nblocks += JOURNAL_BLOCKS_PER_OBJECT(inode->i_sb);
+		nblocks += JOURNAL_BLOCKS_PER_OBJECT(inode_sb(inode));
+		if (d_really_is_negative(REISERFS_SB(inode_sb(inode))->xattr_root))
+			nblocks += JOURNAL_BLOCKS_PER_OBJECT(inode_sb(inode));
 	}
 
 	return nblocks;
diff --git a/fs/reiserfs/xattr_acl.c b/fs/reiserfs/xattr_acl.c
index aa9380bac196..3bebe8b2064b 100644
--- a/fs/reiserfs/xattr_acl.c
+++ b/fs/reiserfs/xattr_acl.c
@@ -35,9 +35,9 @@ reiserfs_set_acl(struct inode *inode, struct posix_acl *acl, int type)
 	jcreate_blocks = reiserfs_xattr_jcreate_nblocks(inode) +
 			 reiserfs_xattr_nblocks(inode, size) * 2;
 
-	reiserfs_write_lock(inode->i_sb);
-	error = journal_begin(&th, inode->i_sb, jcreate_blocks);
-	reiserfs_write_unlock(inode->i_sb);
+	reiserfs_write_lock(inode_sb(inode));
+	error = journal_begin(&th, inode_sb(inode), jcreate_blocks);
+	reiserfs_write_unlock(inode_sb(inode));
 	if (error == 0) {
 		if (type == ACL_TYPE_ACCESS && acl) {
 			error = posix_acl_update_mode(inode, &mode, &acl);
@@ -49,9 +49,9 @@ reiserfs_set_acl(struct inode *inode, struct posix_acl *acl, int type)
 		if (!error && update_mode)
 			inode->i_mode = mode;
 unlock:
-		reiserfs_write_lock(inode->i_sb);
+		reiserfs_write_lock(inode_sb(inode));
 		error2 = journal_end(&th);
-		reiserfs_write_unlock(inode->i_sb);
+		reiserfs_write_unlock(inode_sb(inode));
 		if (error2)
 			error = error2;
 	}
@@ -378,7 +378,7 @@ int reiserfs_cache_default_acl(struct inode *inode)
 		 * we need to create the tree to the xattrs, and then we
 		 * just want two files. */
 		nblocks = reiserfs_xattr_jcreate_nblocks(inode);
-		nblocks += JOURNAL_BLOCKS_PER_OBJECT(inode->i_sb);
+		nblocks += JOURNAL_BLOCKS_PER_OBJECT(inode_sb(inode));
 
 		REISERFS_I(inode)->i_flags |= i_has_xattr_dir;
 
@@ -398,7 +398,7 @@ int reiserfs_acl_chmod(struct inode *inode)
 	if (IS_PRIVATE(inode))
 		return 0;
 	if (get_inode_sd_version(inode) == STAT_DATA_V1 ||
-	    !reiserfs_posixacl(inode->i_sb))
+	    !reiserfs_posixacl(inode_sb(inode)))
 		return 0;
 
 	return posix_acl_chmod(inode, inode->i_mode);
diff --git a/fs/reiserfs/xattr_security.c b/fs/reiserfs/xattr_security.c
index 20be9a0e5870..c0a096637536 100644
--- a/fs/reiserfs/xattr_security.c
+++ b/fs/reiserfs/xattr_security.c
@@ -66,7 +66,7 @@ int reiserfs_security_init(struct inode *dir, struct inode *inode,
 		return error;
 	}
 
-	if (sec->length && reiserfs_xattrs_initialized(inode->i_sb)) {
+	if (sec->length && reiserfs_xattrs_initialized(inode_sb(inode))) {
 		blocks = reiserfs_xattr_jcreate_nblocks(inode) +
 			 reiserfs_xattr_nblocks(inode, sec->length);
 		/* We don't want to count the directories twice if we have
diff --git a/fs/reiserfs/xattr_user.c b/fs/reiserfs/xattr_user.c
index a573ca45bacc..baf8f21dd844 100644
--- a/fs/reiserfs/xattr_user.c
+++ b/fs/reiserfs/xattr_user.c
@@ -11,7 +11,7 @@ static int
 user_get(const struct xattr_handler *handler, struct dentry *unused,
 	 struct inode *inode, const char *name, void *buffer, size_t size)
 {
-	if (!reiserfs_xattrs_user(inode->i_sb))
+	if (!reiserfs_xattrs_user(inode_sb(inode)))
 		return -EOPNOTSUPP;
 	return reiserfs_xattr_get(inode, xattr_full_name(handler, name),
 				  buffer, size);
@@ -22,7 +22,7 @@ user_set(const struct xattr_handler *handler, struct dentry *unused,
 	 struct inode *inode, const char *name, const void *buffer,
 	 size_t size, int flags)
 {
-	if (!reiserfs_xattrs_user(inode->i_sb))
+	if (!reiserfs_xattrs_user(inode_sb(inode)))
 		return -EOPNOTSUPP;
 	return reiserfs_xattr_set(inode,
 				  xattr_full_name(handler, name),
-- 
2.15.1

^ permalink raw reply related	[flat|nested] 88+ messages in thread

* [PATCH 66/76] fs/romfs: Use inode_sb() helper instead of inode->i_sb
  2018-05-08 18:03 [RFC][PATCH 0/76] vfs: 'views' for filesystems with more than one root Mark Fasheh
                   ` (64 preceding siblings ...)
  2018-05-08 18:04 ` [PATCH 65/76] fs/reiserfs: " Mark Fasheh
@ 2018-05-08 18:04 ` Mark Fasheh
  2018-05-08 18:04 ` [PATCH 67/76] fs/squashfs: " Mark Fasheh
                   ` (10 subsequent siblings)
  76 siblings, 0 replies; 88+ messages in thread
From: Mark Fasheh @ 2018-05-08 18:04 UTC (permalink / raw)
  To: linux-fsdevel; +Cc: linux-kernel, linux-btrfs, Mark Fasheh

Signed-off-by: Mark Fasheh <mfasheh@suse.de>
---
 fs/romfs/mmap-nommu.c |  4 ++--
 fs/romfs/super.c      | 24 +++++++++++++-----------
 2 files changed, 15 insertions(+), 13 deletions(-)

diff --git a/fs/romfs/mmap-nommu.c b/fs/romfs/mmap-nommu.c
index 1118a0dc6b45..0dbf9be30283 100644
--- a/fs/romfs/mmap-nommu.c
+++ b/fs/romfs/mmap-nommu.c
@@ -26,7 +26,7 @@ static unsigned long romfs_get_unmapped_area(struct file *file,
 					     unsigned long flags)
 {
 	struct inode *inode = file->f_mapping->host;
-	struct mtd_info *mtd = inode->i_sb->s_mtd;
+	struct mtd_info *mtd = inode_sb(inode)->s_mtd;
 	unsigned long isize, offset, maxpages, lpages;
 	int ret;
 
@@ -72,7 +72,7 @@ static int romfs_mmap(struct file *file, struct vm_area_struct *vma)
 
 static unsigned romfs_mmap_capabilities(struct file *file)
 {
-	struct mtd_info *mtd = file_inode(file)->i_sb->s_mtd;
+	struct mtd_info *mtd = inode_sb(file_inode(file))->s_mtd;
 
 	if (!mtd)
 		return NOMMU_MAP_COPY;
diff --git a/fs/romfs/super.c b/fs/romfs/super.c
index 8f06fd1f3d69..eb0b7d3775bb 100644
--- a/fs/romfs/super.c
+++ b/fs/romfs/super.c
@@ -122,7 +122,7 @@ static int romfs_readpage(struct file *file, struct page *page)
 
 		pos = ROMFS_I(inode)->i_dataoffset + offset;
 
-		ret = romfs_dev_read(inode->i_sb, pos, buf, fillsize);
+		ret = romfs_dev_read(inode_sb(inode), pos, buf, fillsize);
 		if (ret < 0) {
 			SetPageError(page);
 			fillsize = 0;
@@ -157,12 +157,12 @@ static int romfs_readdir(struct file *file, struct dir_context *ctx)
 	char fsname[ROMFS_MAXFN];	/* XXX dynamic? */
 	int ret;
 
-	maxoff = romfs_maxsize(i->i_sb);
+	maxoff = romfs_maxsize(inode_sb(i));
 
 	offset = ctx->pos;
 	if (!offset) {
 		offset = i->i_ino & ROMFH_MASK;
-		ret = romfs_dev_read(i->i_sb, offset, &ri, ROMFH_SIZE);
+		ret = romfs_dev_read(inode_sb(i), offset, &ri, ROMFH_SIZE);
 		if (ret < 0)
 			goto out;
 		offset = be32_to_cpu(ri.spec) & ROMFH_MASK;
@@ -178,16 +178,17 @@ static int romfs_readdir(struct file *file, struct dir_context *ctx)
 		ctx->pos = offset;
 
 		/* Fetch inode info */
-		ret = romfs_dev_read(i->i_sb, offset, &ri, ROMFH_SIZE);
+		ret = romfs_dev_read(inode_sb(i), offset, &ri, ROMFH_SIZE);
 		if (ret < 0)
 			goto out;
 
-		j = romfs_dev_strnlen(i->i_sb, offset + ROMFH_SIZE,
+		j = romfs_dev_strnlen(inode_sb(i), offset + ROMFH_SIZE,
 				      sizeof(fsname) - 1);
 		if (j < 0)
 			goto out;
 
-		ret = romfs_dev_read(i->i_sb, offset + ROMFH_SIZE, fsname, j);
+		ret = romfs_dev_read(inode_sb(i), offset + ROMFH_SIZE, fsname,
+				     j);
 		if (ret < 0)
 			goto out;
 		fsname[j] = '\0';
@@ -219,13 +220,13 @@ static struct dentry *romfs_lookup(struct inode *dir, struct dentry *dentry,
 	int len, ret;
 
 	offset = dir->i_ino & ROMFH_MASK;
-	ret = romfs_dev_read(dir->i_sb, offset, &ri, ROMFH_SIZE);
+	ret = romfs_dev_read(inode_sb(dir), offset, &ri, ROMFH_SIZE);
 	if (ret < 0)
 		goto error;
 
 	/* search all the file entries in the list starting from the one
 	 * pointed to by the directory's special data */
-	maxoff = romfs_maxsize(dir->i_sb);
+	maxoff = romfs_maxsize(inode_sb(dir));
 	offset = be32_to_cpu(ri.spec) & ROMFH_MASK;
 
 	name = dentry->d_name.name;
@@ -235,12 +236,13 @@ static struct dentry *romfs_lookup(struct inode *dir, struct dentry *dentry,
 		if (!offset || offset >= maxoff)
 			goto out0;
 
-		ret = romfs_dev_read(dir->i_sb, offset, &ri, sizeof(ri));
+		ret = romfs_dev_read(inode_sb(dir), offset, &ri, sizeof(ri));
 		if (ret < 0)
 			goto error;
 
 		/* try to match the first 16 bytes of name */
-		ret = romfs_dev_strcmp(dir->i_sb, offset + ROMFH_SIZE, name,
+		ret = romfs_dev_strcmp(inode_sb(dir), offset + ROMFH_SIZE,
+				       name,
 				       len);
 		if (ret < 0)
 			goto error;
@@ -255,7 +257,7 @@ static struct dentry *romfs_lookup(struct inode *dir, struct dentry *dentry,
 	if ((be32_to_cpu(ri.next) & ROMFH_TYPE) == ROMFH_HRD)
 		offset = be32_to_cpu(ri.spec) & ROMFH_MASK;
 
-	inode = romfs_iget(dir->i_sb, offset);
+	inode = romfs_iget(inode_sb(dir), offset);
 	if (IS_ERR(inode)) {
 		ret = PTR_ERR(inode);
 		goto error;
-- 
2.15.1

^ permalink raw reply related	[flat|nested] 88+ messages in thread

* [PATCH 67/76] fs/squashfs: Use inode_sb() helper instead of inode->i_sb
  2018-05-08 18:03 [RFC][PATCH 0/76] vfs: 'views' for filesystems with more than one root Mark Fasheh
                   ` (65 preceding siblings ...)
  2018-05-08 18:04 ` [PATCH 66/76] fs/romfs: " Mark Fasheh
@ 2018-05-08 18:04 ` Mark Fasheh
  2018-05-08 18:04 ` [PATCH 68/76] fs/sysv: " Mark Fasheh
                   ` (9 subsequent siblings)
  76 siblings, 0 replies; 88+ messages in thread
From: Mark Fasheh @ 2018-05-08 18:04 UTC (permalink / raw)
  To: linux-fsdevel; +Cc: linux-kernel, linux-btrfs, Mark Fasheh

Signed-off-by: Mark Fasheh <mfasheh@suse.de>
---
 fs/squashfs/dir.c         | 26 ++++++++++++++------------
 fs/squashfs/export.c      |  2 +-
 fs/squashfs/file.c        | 34 ++++++++++++++++++----------------
 fs/squashfs/file_cache.c  |  5 +++--
 fs/squashfs/file_direct.c |  9 +++++----
 fs/squashfs/inode.c       |  2 +-
 fs/squashfs/namei.c       | 28 ++++++++++++++++------------
 fs/squashfs/symlink.c     |  2 +-
 fs/squashfs/xattr.c       |  4 ++--
 9 files changed, 61 insertions(+), 51 deletions(-)

diff --git a/fs/squashfs/dir.c b/fs/squashfs/dir.c
index a5845f94a2a1..c184017e4e70 100644
--- a/fs/squashfs/dir.c
+++ b/fs/squashfs/dir.c
@@ -110,7 +110,7 @@ static int get_dir_index_using_offset(struct super_block *sb,
 static int squashfs_readdir(struct file *file, struct dir_context *ctx)
 {
 	struct inode *inode = file_inode(file);
-	struct squashfs_sb_info *msblk = inode->i_sb->s_fs_info;
+	struct squashfs_sb_info *msblk = inode_sb(inode)->s_fs_info;
 	u64 block = squashfs_i(inode)->start + msblk->directory_table;
 	int offset = squashfs_i(inode)->offset, length, err;
 	unsigned int inode_number, dir_count, size, type;
@@ -154,18 +154,18 @@ static int squashfs_readdir(struct file *file, struct dir_context *ctx)
 		ctx->pos += size;
 	}
 
-	length = get_dir_index_using_offset(inode->i_sb, &block, &offset,
-				squashfs_i(inode)->dir_idx_start,
-				squashfs_i(inode)->dir_idx_offset,
-				squashfs_i(inode)->dir_idx_cnt,
-				ctx->pos);
+	length = get_dir_index_using_offset(inode_sb(inode), &block, &offset,
+					    squashfs_i(inode)->dir_idx_start,
+					    squashfs_i(inode)->dir_idx_offset,
+					    squashfs_i(inode)->dir_idx_cnt,
+					    ctx->pos);
 
 	while (length < i_size_read(inode)) {
 		/*
 		 * Read directory header
 		 */
-		err = squashfs_read_metadata(inode->i_sb, &dirh, &block,
-					&offset, sizeof(dirh));
+		err = squashfs_read_metadata(inode_sb(inode), &dirh, &block,
+					     &offset, sizeof(dirh));
 		if (err < 0)
 			goto failed_read;
 
@@ -180,8 +180,9 @@ static int squashfs_readdir(struct file *file, struct dir_context *ctx)
 			/*
 			 * Read directory entry.
 			 */
-			err = squashfs_read_metadata(inode->i_sb, dire, &block,
-					&offset, sizeof(*dire));
+			err = squashfs_read_metadata(inode_sb(inode), dire,
+						     &block,
+						     &offset, sizeof(*dire));
 			if (err < 0)
 				goto failed_read;
 
@@ -191,8 +192,9 @@ static int squashfs_readdir(struct file *file, struct dir_context *ctx)
 			if (size > SQUASHFS_NAME_LEN)
 				goto failed_read;
 
-			err = squashfs_read_metadata(inode->i_sb, dire->name,
-					&block, &offset, size);
+			err = squashfs_read_metadata(inode_sb(inode),
+						     dire->name,
+						     &block, &offset, size);
 			if (err < 0)
 				goto failed_read;
 
diff --git a/fs/squashfs/export.c b/fs/squashfs/export.c
index 8073b6532cf0..ce7615f66d5c 100644
--- a/fs/squashfs/export.c
+++ b/fs/squashfs/export.c
@@ -113,7 +113,7 @@ static struct dentry *squashfs_get_parent(struct dentry *child)
 	struct inode *inode = d_inode(child);
 	unsigned int parent_ino = squashfs_i(inode)->parent;
 
-	return squashfs_export_iget(inode->i_sb, parent_ino);
+	return squashfs_export_iget(inode_sb(inode), parent_ino);
 }
 
 
diff --git a/fs/squashfs/file.c b/fs/squashfs/file.c
index 13d80947bf9e..afad108e0d36 100644
--- a/fs/squashfs/file.c
+++ b/fs/squashfs/file.c
@@ -61,7 +61,7 @@ static struct meta_index *locate_meta_index(struct inode *inode, int offset,
 				int index)
 {
 	struct meta_index *meta = NULL;
-	struct squashfs_sb_info *msblk = inode->i_sb->s_fs_info;
+	struct squashfs_sb_info *msblk = inode_sb(inode)->s_fs_info;
 	int i;
 
 	mutex_lock(&msblk->meta_index_mutex);
@@ -99,7 +99,7 @@ static struct meta_index *locate_meta_index(struct inode *inode, int offset,
 static struct meta_index *empty_meta_index(struct inode *inode, int offset,
 				int skip)
 {
-	struct squashfs_sb_info *msblk = inode->i_sb->s_fs_info;
+	struct squashfs_sb_info *msblk = inode_sb(inode)->s_fs_info;
 	struct meta_index *meta = NULL;
 	int i;
 
@@ -159,7 +159,7 @@ static struct meta_index *empty_meta_index(struct inode *inode, int offset,
 
 static void release_meta_index(struct inode *inode, struct meta_index *meta)
 {
-	struct squashfs_sb_info *msblk = inode->i_sb->s_fs_info;
+	struct squashfs_sb_info *msblk = inode_sb(inode)->s_fs_info;
 	mutex_lock(&msblk->meta_index_mutex);
 	meta->locked = 0;
 	mutex_unlock(&msblk->meta_index_mutex);
@@ -236,7 +236,7 @@ static inline int calculate_skip(int blocks)
 static int fill_meta_index(struct inode *inode, int index,
 		u64 *index_block, int *index_offset, u64 *data_block)
 {
-	struct squashfs_sb_info *msblk = inode->i_sb->s_fs_info;
+	struct squashfs_sb_info *msblk = inode_sb(inode)->s_fs_info;
 	int skip = calculate_skip(i_size_read(inode) >> msblk->block_log);
 	int offset = 0;
 	struct meta_index *meta;
@@ -282,8 +282,9 @@ static int fill_meta_index(struct inode *inode, int index,
 		for (i = meta->offset + meta->entries; i <= index &&
 				i < meta->offset + SQUASHFS_META_ENTRIES; i++) {
 			int blocks = skip * SQUASHFS_META_INDEXES;
-			long long res = read_indexes(inode->i_sb, blocks,
-					&cur_index_block, &cur_offset);
+			long long res = read_indexes(inode_sb(inode), blocks,
+						     &cur_index_block,
+						     &cur_offset);
 
 			if (res < 0) {
 				if (meta->entries == 0)
@@ -354,7 +355,8 @@ static int read_blocklist(struct inode *inode, int index, u64 *block)
 	 * extra block indexes needed.
 	 */
 	if (res < index) {
-		blks = read_indexes(inode->i_sb, index - res, &start, &offset);
+		blks = read_indexes(inode_sb(inode), index - res, &start,
+				    &offset);
 		if (blks < 0)
 			return (int) blks;
 		*block += blks;
@@ -363,8 +365,8 @@ static int read_blocklist(struct inode *inode, int index, u64 *block)
 	/*
 	 * Read length of block specified by index.
 	 */
-	res = squashfs_read_metadata(inode->i_sb, &size, &start, &offset,
-			sizeof(size));
+	res = squashfs_read_metadata(inode_sb(inode), &size, &start, &offset,
+				     sizeof(size));
 	if (res < 0)
 		return res;
 	return le32_to_cpu(size);
@@ -375,7 +377,7 @@ void squashfs_copy_cache(struct page *page, struct squashfs_cache_entry *buffer,
 	int bytes, int offset)
 {
 	struct inode *inode = page->mapping->host;
-	struct squashfs_sb_info *msblk = inode->i_sb->s_fs_info;
+	struct squashfs_sb_info *msblk = inode_sb(inode)->s_fs_info;
 	void *pageaddr;
 	int i, mask = (1 << (msblk->block_log - PAGE_SHIFT)) - 1;
 	int start_index = page->index & ~mask, end_index = start_index | mask;
@@ -419,10 +421,10 @@ void squashfs_copy_cache(struct page *page, struct squashfs_cache_entry *buffer,
 static int squashfs_readpage_fragment(struct page *page)
 {
 	struct inode *inode = page->mapping->host;
-	struct squashfs_sb_info *msblk = inode->i_sb->s_fs_info;
-	struct squashfs_cache_entry *buffer = squashfs_get_fragment(inode->i_sb,
-		squashfs_i(inode)->fragment_block,
-		squashfs_i(inode)->fragment_size);
+	struct squashfs_sb_info *msblk = inode_sb(inode)->s_fs_info;
+	struct squashfs_cache_entry *buffer = squashfs_get_fragment(inode_sb(inode),
+								    squashfs_i(inode)->fragment_block,
+								    squashfs_i(inode)->fragment_size);
 	int res = buffer->error;
 
 	if (res)
@@ -441,7 +443,7 @@ static int squashfs_readpage_fragment(struct page *page)
 static int squashfs_readpage_sparse(struct page *page, int index, int file_end)
 {
 	struct inode *inode = page->mapping->host;
-	struct squashfs_sb_info *msblk = inode->i_sb->s_fs_info;
+	struct squashfs_sb_info *msblk = inode_sb(inode)->s_fs_info;
 	int bytes = index == file_end ?
 			(i_size_read(inode) & (msblk->block_size - 1)) :
 			 msblk->block_size;
@@ -453,7 +455,7 @@ static int squashfs_readpage_sparse(struct page *page, int index, int file_end)
 static int squashfs_readpage(struct file *file, struct page *page)
 {
 	struct inode *inode = page->mapping->host;
-	struct squashfs_sb_info *msblk = inode->i_sb->s_fs_info;
+	struct squashfs_sb_info *msblk = inode_sb(inode)->s_fs_info;
 	int index = page->index >> (msblk->block_log - PAGE_SHIFT);
 	int file_end = i_size_read(inode) >> msblk->block_log;
 	int res;
diff --git a/fs/squashfs/file_cache.c b/fs/squashfs/file_cache.c
index f2310d2a2019..7aedf57d500d 100644
--- a/fs/squashfs/file_cache.c
+++ b/fs/squashfs/file_cache.c
@@ -23,8 +23,9 @@
 int squashfs_readpage_block(struct page *page, u64 block, int bsize)
 {
 	struct inode *i = page->mapping->host;
-	struct squashfs_cache_entry *buffer = squashfs_get_datablock(i->i_sb,
-		block, bsize);
+	struct squashfs_cache_entry *buffer = squashfs_get_datablock(inode_sb(i),
+								     block,
+								     bsize);
 	int res = buffer->error;
 
 	if (res)
diff --git a/fs/squashfs/file_direct.c b/fs/squashfs/file_direct.c
index cb485d8e0e91..b336f6872816 100644
--- a/fs/squashfs/file_direct.c
+++ b/fs/squashfs/file_direct.c
@@ -28,7 +28,7 @@ int squashfs_readpage_block(struct page *target_page, u64 block, int bsize)
 
 {
 	struct inode *inode = target_page->mapping->host;
-	struct squashfs_sb_info *msblk = inode->i_sb->s_fs_info;
+	struct squashfs_sb_info *msblk = inode_sb(inode)->s_fs_info;
 
 	int file_end = (i_size_read(inode) - 1) >> PAGE_SHIFT;
 	int mask = (1 << (msblk->block_log - PAGE_SHIFT)) - 1;
@@ -91,7 +91,7 @@ int squashfs_readpage_block(struct page *target_page, u64 block, int bsize)
 	}
 
 	/* Decompress directly into the page cache buffers */
-	res = squashfs_read_data(inode->i_sb, block, bsize, NULL, actor);
+	res = squashfs_read_data(inode_sb(inode), block, bsize, NULL, actor);
 	if (res < 0)
 		goto mark_errored;
 
@@ -141,8 +141,9 @@ static int squashfs_read_cache(struct page *target_page, u64 block, int bsize,
 	int pages, struct page **page)
 {
 	struct inode *i = target_page->mapping->host;
-	struct squashfs_cache_entry *buffer = squashfs_get_datablock(i->i_sb,
-						 block, bsize);
+	struct squashfs_cache_entry *buffer = squashfs_get_datablock(inode_sb(i),
+								     block,
+								     bsize);
 	int bytes = buffer->length, res = buffer->error, n, offset = 0;
 	void *pageaddr;
 
diff --git a/fs/squashfs/inode.c b/fs/squashfs/inode.c
index e9793b1e49a5..686083434be3 100644
--- a/fs/squashfs/inode.c
+++ b/fs/squashfs/inode.c
@@ -112,7 +112,7 @@ struct inode *squashfs_iget(struct super_block *sb, long long ino,
  */
 int squashfs_read_inode(struct inode *inode, long long ino)
 {
-	struct super_block *sb = inode->i_sb;
+	struct super_block *sb = inode_sb(inode);
 	struct squashfs_sb_info *msblk = sb->s_fs_info;
 	u64 block = SQUASHFS_INODE_BLK(ino) + msblk->inode_table;
 	int err, type, offset = SQUASHFS_INODE_OFFSET(ino);
diff --git a/fs/squashfs/namei.c b/fs/squashfs/namei.c
index 40c10d9974c9..82bd0f01630b 100644
--- a/fs/squashfs/namei.c
+++ b/fs/squashfs/namei.c
@@ -142,7 +142,7 @@ static struct dentry *squashfs_lookup(struct inode *dir, struct dentry *dentry,
 	const unsigned char *name = dentry->d_name.name;
 	int len = dentry->d_name.len;
 	struct inode *inode = NULL;
-	struct squashfs_sb_info *msblk = dir->i_sb->s_fs_info;
+	struct squashfs_sb_info *msblk = inode_sb(dir)->s_fs_info;
 	struct squashfs_dir_header dirh;
 	struct squashfs_dir_entry *dire;
 	u64 block = squashfs_i(dir)->start + msblk->directory_table;
@@ -163,17 +163,18 @@ static struct dentry *squashfs_lookup(struct inode *dir, struct dentry *dentry,
 		goto failed;
 	}
 
-	length = get_dir_index_using_name(dir->i_sb, &block, &offset,
-				squashfs_i(dir)->dir_idx_start,
-				squashfs_i(dir)->dir_idx_offset,
-				squashfs_i(dir)->dir_idx_cnt, name, len);
+	length = get_dir_index_using_name(inode_sb(dir), &block, &offset,
+					  squashfs_i(dir)->dir_idx_start,
+					  squashfs_i(dir)->dir_idx_offset,
+					  squashfs_i(dir)->dir_idx_cnt, name,
+					  len);
 
 	while (length < i_size_read(dir)) {
 		/*
 		 * Read directory header.
 		 */
-		err = squashfs_read_metadata(dir->i_sb, &dirh, &block,
-				&offset, sizeof(dirh));
+		err = squashfs_read_metadata(inode_sb(dir), &dirh, &block,
+					     &offset, sizeof(dirh));
 		if (err < 0)
 			goto read_failure;
 
@@ -188,8 +189,9 @@ static struct dentry *squashfs_lookup(struct inode *dir, struct dentry *dentry,
 			/*
 			 * Read directory entry.
 			 */
-			err = squashfs_read_metadata(dir->i_sb, dire, &block,
-					&offset, sizeof(*dire));
+			err = squashfs_read_metadata(inode_sb(dir), dire,
+						     &block,
+						     &offset, sizeof(*dire));
 			if (err < 0)
 				goto read_failure;
 
@@ -199,8 +201,9 @@ static struct dentry *squashfs_lookup(struct inode *dir, struct dentry *dentry,
 			if (size > SQUASHFS_NAME_LEN)
 				goto data_error;
 
-			err = squashfs_read_metadata(dir->i_sb, dire->name,
-					&block, &offset, size);
+			err = squashfs_read_metadata(inode_sb(dir),
+						     dire->name,
+						     &block, &offset, size);
 			if (err < 0)
 				goto read_failure;
 
@@ -222,7 +225,8 @@ static struct dentry *squashfs_lookup(struct inode *dir, struct dentry *dentry,
 					"entry %s, inode  %x:%x, %d\n", name,
 					blk, off, ino_num);
 
-				inode = squashfs_iget(dir->i_sb, ino, ino_num);
+				inode = squashfs_iget(inode_sb(dir), ino,
+						      ino_num);
 				goto exit_lookup;
 			}
 		}
diff --git a/fs/squashfs/symlink.c b/fs/squashfs/symlink.c
index befeba0fa70a..76a5af382016 100644
--- a/fs/squashfs/symlink.c
+++ b/fs/squashfs/symlink.c
@@ -46,7 +46,7 @@
 static int squashfs_symlink_readpage(struct file *file, struct page *page)
 {
 	struct inode *inode = page->mapping->host;
-	struct super_block *sb = inode->i_sb;
+	struct super_block *sb = inode_sb(inode);
 	struct squashfs_sb_info *msblk = sb->s_fs_info;
 	int index = page->index << PAGE_SHIFT;
 	u64 block = squashfs_i(inode)->start;
diff --git a/fs/squashfs/xattr.c b/fs/squashfs/xattr.c
index 1548b3784548..b6eec3779af4 100644
--- a/fs/squashfs/xattr.c
+++ b/fs/squashfs/xattr.c
@@ -40,7 +40,7 @@ ssize_t squashfs_listxattr(struct dentry *d, char *buffer,
 	size_t buffer_size)
 {
 	struct inode *inode = d_inode(d);
-	struct super_block *sb = inode->i_sb;
+	struct super_block *sb = inode_sb(inode);
 	struct squashfs_sb_info *msblk = sb->s_fs_info;
 	u64 start = SQUASHFS_XATTR_BLK(squashfs_i(inode)->xattr)
 						 + msblk->xattr_table;
@@ -118,7 +118,7 @@ ssize_t squashfs_listxattr(struct dentry *d, char *buffer,
 static int squashfs_xattr_get(struct inode *inode, int name_index,
 	const char *name, void *buffer, size_t buffer_size)
 {
-	struct super_block *sb = inode->i_sb;
+	struct super_block *sb = inode_sb(inode);
 	struct squashfs_sb_info *msblk = sb->s_fs_info;
 	u64 start = SQUASHFS_XATTR_BLK(squashfs_i(inode)->xattr)
 						 + msblk->xattr_table;
-- 
2.15.1

^ permalink raw reply related	[flat|nested] 88+ messages in thread

* [PATCH 68/76] fs/sysv: Use inode_sb() helper instead of inode->i_sb
  2018-05-08 18:03 [RFC][PATCH 0/76] vfs: 'views' for filesystems with more than one root Mark Fasheh
                   ` (66 preceding siblings ...)
  2018-05-08 18:04 ` [PATCH 67/76] fs/squashfs: " Mark Fasheh
@ 2018-05-08 18:04 ` Mark Fasheh
  2018-05-08 18:04 ` [PATCH 69/76] fs/ubifs: " Mark Fasheh
                   ` (8 subsequent siblings)
  76 siblings, 0 replies; 88+ messages in thread
From: Mark Fasheh @ 2018-05-08 18:04 UTC (permalink / raw)
  To: linux-fsdevel; +Cc: linux-kernel, linux-btrfs, Mark Fasheh

Signed-off-by: Mark Fasheh <mfasheh@suse.de>
---
 fs/sysv/dir.c    | 12 ++++++------
 fs/sysv/ialloc.c |  8 ++++----
 fs/sysv/inode.c  |  6 +++---
 fs/sysv/itree.c  | 29 +++++++++++++++--------------
 fs/sysv/namei.c  |  4 ++--
 5 files changed, 30 insertions(+), 29 deletions(-)

diff --git a/fs/sysv/dir.c b/fs/sysv/dir.c
index 88e38cd8f5c9..84a11fda6a28 100644
--- a/fs/sysv/dir.c
+++ b/fs/sysv/dir.c
@@ -65,7 +65,7 @@ static int sysv_readdir(struct file *file, struct dir_context *ctx)
 {
 	unsigned long pos = ctx->pos;
 	struct inode *inode = file_inode(file);
-	struct super_block *sb = inode->i_sb;
+	struct super_block *sb = inode_sb(inode);
 	unsigned long npages = dir_pages(inode);
 	unsigned offset;
 	unsigned long n;
@@ -214,7 +214,7 @@ int sysv_add_link(struct dentry *dentry, struct inode *inode)
 		goto out_unlock;
 	memcpy (de->name, name, namelen);
 	memset (de->name + namelen, 0, SYSV_DIRSIZE - namelen - 2);
-	de->inode = cpu_to_fs16(SYSV_SB(inode->i_sb), inode->i_ino);
+	de->inode = cpu_to_fs16(SYSV_SB(inode_sb(inode)), inode->i_ino);
 	err = dir_commit_chunk(page, pos, SYSV_DIRSIZE);
 	dir->i_mtime = dir->i_ctime = current_time(dir);
 	mark_inode_dirty(dir);
@@ -265,10 +265,10 @@ int sysv_make_empty(struct inode *inode, struct inode *dir)
 	memset(base, 0, PAGE_SIZE);
 
 	de = (struct sysv_dir_entry *) base;
-	de->inode = cpu_to_fs16(SYSV_SB(inode->i_sb), inode->i_ino);
+	de->inode = cpu_to_fs16(SYSV_SB(inode_sb(inode)), inode->i_ino);
 	strcpy(de->name,".");
 	de++;
-	de->inode = cpu_to_fs16(SYSV_SB(inode->i_sb), dir->i_ino);
+	de->inode = cpu_to_fs16(SYSV_SB(inode_sb(inode)), dir->i_ino);
 	strcpy(de->name,"..");
 
 	kunmap(page);
@@ -283,7 +283,7 @@ int sysv_make_empty(struct inode *inode, struct inode *dir)
  */
 int sysv_empty_dir(struct inode * inode)
 {
-	struct super_block *sb = inode->i_sb;
+	struct super_block *sb = inode_sb(inode);
 	struct page *page = NULL;
 	unsigned long i, npages = dir_pages(inode);
 
@@ -335,7 +335,7 @@ void sysv_set_link(struct sysv_dir_entry *de, struct page *page,
 	lock_page(page);
 	err = sysv_prepare_chunk(page, pos, SYSV_DIRSIZE);
 	BUG_ON(err);
-	de->inode = cpu_to_fs16(SYSV_SB(inode->i_sb), inode->i_ino);
+	de->inode = cpu_to_fs16(SYSV_SB(inode_sb(inode)), inode->i_ino);
 	err = dir_commit_chunk(page, pos, SYSV_DIRSIZE);
 	dir_put_page(page);
 	dir->i_mtime = dir->i_ctime = current_time(dir);
diff --git a/fs/sysv/ialloc.c b/fs/sysv/ialloc.c
index 6c9801986af6..2515367bf047 100644
--- a/fs/sysv/ialloc.c
+++ b/fs/sysv/ialloc.c
@@ -100,14 +100,14 @@ static int refill_free_cache(struct super_block *sb)
 
 void sysv_free_inode(struct inode * inode)
 {
-	struct super_block *sb = inode->i_sb;
+	struct super_block *sb = inode_sb(inode);
 	struct sysv_sb_info *sbi = SYSV_SB(sb);
 	unsigned int ino;
 	struct buffer_head * bh;
 	struct sysv_inode * raw_inode;
 	unsigned count;
 
-	sb = inode->i_sb;
+	sb = inode_sb(inode);
 	ino = inode->i_ino;
 	if (ino <= SYSV_ROOT_INO || ino > sbi->s_ninodes) {
 		printk("sysv_free_inode: inode 0,1,2 or nonexistent inode\n");
@@ -116,7 +116,7 @@ void sysv_free_inode(struct inode * inode)
 	raw_inode = sysv_raw_inode(sb, ino, &bh);
 	if (!raw_inode) {
 		printk("sysv_free_inode: unable to read inode block on device "
-		       "%s\n", inode->i_sb->s_id);
+		       "%s\n", inode_sb(inode)->s_id);
 		return;
 	}
 	mutex_lock(&sbi->s_lock);
@@ -135,7 +135,7 @@ void sysv_free_inode(struct inode * inode)
 
 struct inode * sysv_new_inode(const struct inode * dir, umode_t mode)
 {
-	struct super_block *sb = dir->i_sb;
+	struct super_block *sb = inode_sb(dir);
 	struct sysv_sb_info *sbi = SYSV_SB(sb);
 	struct inode *inode;
 	sysv_ino_t ino;
diff --git a/fs/sysv/inode.c b/fs/sysv/inode.c
index bec9f79adb25..9d04a4a2c248 100644
--- a/fs/sysv/inode.c
+++ b/fs/sysv/inode.c
@@ -192,7 +192,7 @@ struct inode *sysv_iget(struct super_block *sb, unsigned int ino)
 	raw_inode = sysv_raw_inode(sb, ino, &bh);
 	if (!raw_inode) {
 		printk("Major problem: unable to read inode from dev %s\n",
-		       inode->i_sb->s_id);
+		       inode_sb(inode)->s_id);
 		goto bad_inode;
 	}
 	/* SystemV FS: kludge permissions if ino==SYSV_ROOT_INO ?? */
@@ -230,7 +230,7 @@ struct inode *sysv_iget(struct super_block *sb, unsigned int ino)
 
 static int __sysv_write_inode(struct inode *inode, int wait)
 {
-	struct super_block * sb = inode->i_sb;
+	struct super_block * sb = inode_sb(inode);
 	struct sysv_sb_info * sbi = SYSV_SB(sb);
 	struct buffer_head * bh;
 	struct sysv_inode * raw_inode;
@@ -241,7 +241,7 @@ static int __sysv_write_inode(struct inode *inode, int wait)
 	ino = inode->i_ino;
 	if (!ino || ino > sbi->s_ninodes) {
 		printk("Bad inode number on dev %s: %d is out of range\n",
-		       inode->i_sb->s_id, ino);
+		       inode_sb(inode)->s_id, ino);
 		return -EIO;
 	}
 	raw_inode = sysv_raw_inode(sb, ino, &bh);
diff --git a/fs/sysv/itree.c b/fs/sysv/itree.c
index bcb67b0cabe7..f69d30bc4217 100644
--- a/fs/sysv/itree.c
+++ b/fs/sysv/itree.c
@@ -22,7 +22,7 @@ static inline void dirty_indirect(struct buffer_head *bh, struct inode *inode)
 
 static int block_to_path(struct inode *inode, long block, int offsets[DEPTH])
 {
-	struct super_block *sb = inode->i_sb;
+	struct super_block *sb = inode_sb(inode);
 	struct sysv_sb_info *sbi = SYSV_SB(sb);
 	int ptrs_bits = sbi->s_ind_per_block_bits;
 	unsigned long	indirect_blocks = sbi->s_ind_per_block,
@@ -91,7 +91,7 @@ static Indirect *get_branch(struct inode *inode,
 			    Indirect chain[],
 			    int *err)
 {
-	struct super_block *sb = inode->i_sb;
+	struct super_block *sb = inode_sb(inode);
 	Indirect *p = chain;
 	struct buffer_head *bh;
 
@@ -127,24 +127,25 @@ static int alloc_branch(struct inode *inode,
 			int *offsets,
 			Indirect *branch)
 {
-	int blocksize = inode->i_sb->s_blocksize;
+	int blocksize = inode_sb(inode)->s_blocksize;
 	int n = 0;
 	int i;
 
-	branch[0].key = sysv_new_block(inode->i_sb);
+	branch[0].key = sysv_new_block(inode_sb(inode));
 	if (branch[0].key) for (n = 1; n < num; n++) {
 		struct buffer_head *bh;
 		int parent;
 		/* Allocate the next block */
-		branch[n].key = sysv_new_block(inode->i_sb);
+		branch[n].key = sysv_new_block(inode_sb(inode));
 		if (!branch[n].key)
 			break;
 		/*
 		 * Get buffer_head for parent block, zero it out and set 
 		 * the pointer to new one, then send parent to disk.
 		 */
-		parent = block_to_cpu(SYSV_SB(inode->i_sb), branch[n-1].key);
-		bh = sb_getblk(inode->i_sb, parent);
+		parent = block_to_cpu(SYSV_SB(inode_sb(inode)),
+				      branch[n-1].key);
+		bh = sb_getblk(inode_sb(inode), parent);
 		lock_buffer(bh);
 		memset(bh->b_data, 0, blocksize);
 		branch[n].bh = bh;
@@ -161,7 +162,7 @@ static int alloc_branch(struct inode *inode,
 	for (i = 1; i < n; i++)
 		bforget(branch[i].bh);
 	for (i = 0; i < n; i++)
-		sysv_free_block(inode->i_sb, branch[i].key);
+		sysv_free_block(inode_sb(inode), branch[i].key);
 	return -ENOSPC;
 }
 
@@ -196,7 +197,7 @@ static inline int splice_branch(struct inode *inode,
 	for (i = 1; i < num; i++)
 		bforget(where[i].bh);
 	for (i = 0; i < num; i++)
-		sysv_free_block(inode->i_sb, where[i].key);
+		sysv_free_block(inode_sb(inode), where[i].key);
 	return -EAGAIN;
 }
 
@@ -205,7 +206,7 @@ static int get_block(struct inode *inode, sector_t iblock, struct buffer_head *b
 	int err = -EIO;
 	int offsets[DEPTH];
 	Indirect chain[DEPTH];
-	struct super_block *sb = inode->i_sb;
+	struct super_block *sb = inode_sb(inode);
 	Indirect *partial;
 	int left;
 	int depth = block_to_path(inode, iblock, offsets);
@@ -329,7 +330,7 @@ static inline void free_data(struct inode *inode, sysv_zone_t *p, sysv_zone_t *q
 		sysv_zone_t nr = *p;
 		if (nr) {
 			*p = 0;
-			sysv_free_block(inode->i_sb, nr);
+			sysv_free_block(inode_sb(inode), nr);
 			mark_inode_dirty(inode);
 		}
 	}
@@ -338,7 +339,7 @@ static inline void free_data(struct inode *inode, sysv_zone_t *p, sysv_zone_t *q
 static void free_branches(struct inode *inode, sysv_zone_t *p, sysv_zone_t *q, int depth)
 {
 	struct buffer_head * bh;
-	struct super_block *sb = inode->i_sb;
+	struct super_block *sb = inode_sb(inode);
 
 	if (depth--) {
 		for ( ; p < q ; p++) {
@@ -376,9 +377,9 @@ void sysv_truncate (struct inode * inode)
 	    S_ISLNK(inode->i_mode)))
 		return;
 
-	blocksize = inode->i_sb->s_blocksize;
+	blocksize = inode_sb(inode)->s_blocksize;
 	iblock = (inode->i_size + blocksize-1)
-					>> inode->i_sb->s_blocksize_bits;
+					>> inode_sb(inode)->s_blocksize_bits;
 
 	block_truncate_page(inode->i_mapping, inode->i_size, get_block);
 
diff --git a/fs/sysv/namei.c b/fs/sysv/namei.c
index 250b0755b908..31f0fa48e273 100644
--- a/fs/sysv/namei.c
+++ b/fs/sysv/namei.c
@@ -53,7 +53,7 @@ static struct dentry *sysv_lookup(struct inode * dir, struct dentry * dentry, un
 	ino = sysv_inode_by_name(dentry);
 
 	if (ino) {
-		inode = sysv_iget(dir->i_sb, ino);
+		inode = sysv_iget(inode_sb(dir), ino);
 		if (IS_ERR(inode))
 			return ERR_CAST(inode);
 	}
@@ -92,7 +92,7 @@ static int sysv_symlink(struct inode * dir, struct dentry * dentry,
 	int l = strlen(symname)+1;
 	struct inode * inode;
 
-	if (l > dir->i_sb->s_blocksize)
+	if (l > inode_sb(dir)->s_blocksize)
 		goto out;
 
 	inode = sysv_new_inode(dir, S_IFLNK|0777);
-- 
2.15.1

^ permalink raw reply related	[flat|nested] 88+ messages in thread

* [PATCH 69/76] fs/ubifs: Use inode_sb() helper instead of inode->i_sb
  2018-05-08 18:03 [RFC][PATCH 0/76] vfs: 'views' for filesystems with more than one root Mark Fasheh
                   ` (67 preceding siblings ...)
  2018-05-08 18:04 ` [PATCH 68/76] fs/sysv: " Mark Fasheh
@ 2018-05-08 18:04 ` Mark Fasheh
  2018-05-08 18:04 ` [PATCH 70/76] fs/udf: " Mark Fasheh
                   ` (7 subsequent siblings)
  76 siblings, 0 replies; 88+ messages in thread
From: Mark Fasheh @ 2018-05-08 18:04 UTC (permalink / raw)
  To: linux-fsdevel; +Cc: linux-kernel, linux-btrfs, Mark Fasheh

Signed-off-by: Mark Fasheh <mfasheh@suse.de>
---
 fs/ubifs/crypto.c |  4 ++--
 fs/ubifs/dir.c    | 30 +++++++++++++++---------------
 fs/ubifs/file.c   | 42 +++++++++++++++++++++---------------------
 fs/ubifs/ioctl.c  |  4 ++--
 fs/ubifs/super.c  |  4 ++--
 fs/ubifs/xattr.c  | 10 +++++-----
 6 files changed, 47 insertions(+), 47 deletions(-)

diff --git a/fs/ubifs/crypto.c b/fs/ubifs/crypto.c
index 616a688f5d8f..3c8122065ed5 100644
--- a/fs/ubifs/crypto.c
+++ b/fs/ubifs/crypto.c
@@ -35,7 +35,7 @@ static unsigned int ubifs_crypt_max_namelen(struct inode *inode)
 int ubifs_encrypt(const struct inode *inode, struct ubifs_data_node *dn,
 		  unsigned int in_len, unsigned int *out_len, int block)
 {
-	struct ubifs_info *c = inode->i_sb->s_fs_info;
+	struct ubifs_info *c = inode_sb(inode)->s_fs_info;
 	void *p = &dn->data;
 	struct page *ret;
 	unsigned int pad_len = round_up(in_len, UBIFS_CIPHER_BLOCK_SIZE);
@@ -61,7 +61,7 @@ int ubifs_encrypt(const struct inode *inode, struct ubifs_data_node *dn,
 int ubifs_decrypt(const struct inode *inode, struct ubifs_data_node *dn,
 		  unsigned int *out_len, int block)
 {
-	struct ubifs_info *c = inode->i_sb->s_fs_info;
+	struct ubifs_info *c = inode_sb(inode)->s_fs_info;
 	int err;
 	unsigned int clen = le16_to_cpu(dn->compr_size);
 	unsigned int dlen = *out_len;
diff --git a/fs/ubifs/dir.c b/fs/ubifs/dir.c
index 9d7fb88e172e..6d168f5cc8ff 100644
--- a/fs/ubifs/dir.c
+++ b/fs/ubifs/dir.c
@@ -215,7 +215,7 @@ static struct dentry *ubifs_lookup(struct inode *dir, struct dentry *dentry,
 	union ubifs_key key;
 	struct inode *inode = NULL;
 	struct ubifs_dent_node *dent;
-	struct ubifs_info *c = dir->i_sb->s_fs_info;
+	struct ubifs_info *c = inode_sb(dir)->s_fs_info;
 	struct fscrypt_name nm;
 
 	dbg_gen("'%pd' in dir ino %lu", dentry, dir->i_ino);
@@ -262,7 +262,7 @@ static struct dentry *ubifs_lookup(struct inode *dir, struct dentry *dentry,
 		goto out_dent;
 	}
 
-	inode = ubifs_iget(dir->i_sb, le64_to_cpu(dent->inum));
+	inode = ubifs_iget(inode_sb(dir), le64_to_cpu(dent->inum));
 	if (IS_ERR(inode)) {
 		/*
 		 * This should not happen. Probably the file-system needs
@@ -307,7 +307,7 @@ static int ubifs_create(struct inode *dir, struct dentry *dentry, umode_t mode,
 			bool excl)
 {
 	struct inode *inode;
-	struct ubifs_info *c = dir->i_sb->s_fs_info;
+	struct ubifs_info *c = inode_sb(dir)->s_fs_info;
 	struct ubifs_budget_req req = { .new_ino = 1, .new_dent = 1,
 					.dirtied_ino = 1 };
 	struct ubifs_inode *dir_ui = ubifs_inode(dir);
@@ -376,7 +376,7 @@ static int do_tmpfile(struct inode *dir, struct dentry *dentry,
 		      umode_t mode, struct inode **whiteout)
 {
 	struct inode *inode;
-	struct ubifs_info *c = dir->i_sb->s_fs_info;
+	struct ubifs_info *c = inode_sb(dir)->s_fs_info;
 	struct ubifs_budget_req req = { .new_ino = 1, .new_dent = 1};
 	struct ubifs_budget_req ino_req = { .dirtied_ino = 1 };
 	struct ubifs_inode *ui, *dir_ui = ubifs_inode(dir);
@@ -525,7 +525,7 @@ static int ubifs_readdir(struct file *file, struct dir_context *ctx)
 	union ubifs_key key;
 	struct ubifs_dent_node *dent;
 	struct inode *dir = file_inode(file);
-	struct ubifs_info *c = dir->i_sb->s_fs_info;
+	struct ubifs_info *c = inode_sb(dir)->s_fs_info;
 	bool encrypted = ubifs_crypt_is_encrypted(dir);
 
 	dbg_gen("dir ino %lu, f_pos %#llx", dir->i_ino, ctx->pos);
@@ -712,7 +712,7 @@ static void unlock_2_inodes(struct inode *inode1, struct inode *inode2)
 static int ubifs_link(struct dentry *old_dentry, struct inode *dir,
 		      struct dentry *dentry)
 {
-	struct ubifs_info *c = dir->i_sb->s_fs_info;
+	struct ubifs_info *c = inode_sb(dir)->s_fs_info;
 	struct inode *inode = d_inode(old_dentry);
 	struct ubifs_inode *ui = ubifs_inode(inode);
 	struct ubifs_inode *dir_ui = ubifs_inode(dir);
@@ -786,7 +786,7 @@ static int ubifs_link(struct dentry *old_dentry, struct inode *dir,
 
 static int ubifs_unlink(struct inode *dir, struct dentry *dentry)
 {
-	struct ubifs_info *c = dir->i_sb->s_fs_info;
+	struct ubifs_info *c = inode_sb(dir)->s_fs_info;
 	struct inode *inode = d_inode(dentry);
 	struct ubifs_inode *dir_ui = ubifs_inode(dir);
 	int err, sz_change, budgeted = 1;
@@ -873,7 +873,7 @@ static int ubifs_unlink(struct inode *dir, struct dentry *dentry)
  */
 int ubifs_check_dir_empty(struct inode *dir)
 {
-	struct ubifs_info *c = dir->i_sb->s_fs_info;
+	struct ubifs_info *c = inode_sb(dir)->s_fs_info;
 	struct fscrypt_name nm = { 0 };
 	struct ubifs_dent_node *dent;
 	union ubifs_key key;
@@ -894,7 +894,7 @@ int ubifs_check_dir_empty(struct inode *dir)
 
 static int ubifs_rmdir(struct inode *dir, struct dentry *dentry)
 {
-	struct ubifs_info *c = dir->i_sb->s_fs_info;
+	struct ubifs_info *c = inode_sb(dir)->s_fs_info;
 	struct inode *inode = d_inode(dentry);
 	int err, sz_change, budgeted = 1;
 	struct ubifs_inode *dir_ui = ubifs_inode(dir);
@@ -973,7 +973,7 @@ static int ubifs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode)
 {
 	struct inode *inode;
 	struct ubifs_inode *dir_ui = ubifs_inode(dir);
-	struct ubifs_info *c = dir->i_sb->s_fs_info;
+	struct ubifs_info *c = inode_sb(dir)->s_fs_info;
 	int err, sz_change;
 	struct ubifs_budget_req req = { .new_ino = 1, .new_dent = 1 };
 	struct fscrypt_name nm;
@@ -1046,7 +1046,7 @@ static int ubifs_mknod(struct inode *dir, struct dentry *dentry,
 	struct inode *inode;
 	struct ubifs_inode *ui;
 	struct ubifs_inode *dir_ui = ubifs_inode(dir);
-	struct ubifs_info *c = dir->i_sb->s_fs_info;
+	struct ubifs_info *c = inode_sb(dir)->s_fs_info;
 	union ubifs_dev_desc *dev = NULL;
 	int sz_change;
 	int err, devlen = 0;
@@ -1135,7 +1135,7 @@ static int ubifs_symlink(struct inode *dir, struct dentry *dentry,
 	struct inode *inode;
 	struct ubifs_inode *ui;
 	struct ubifs_inode *dir_ui = ubifs_inode(dir);
-	struct ubifs_info *c = dir->i_sb->s_fs_info;
+	struct ubifs_info *c = inode_sb(dir)->s_fs_info;
 	int err, len = strlen(symname);
 	int sz_change = CALC_DENT_SIZE(len);
 	struct fscrypt_str disk_link;
@@ -1276,7 +1276,7 @@ static int do_rename(struct inode *old_dir, struct dentry *old_dentry,
 		     struct inode *new_dir, struct dentry *new_dentry,
 		     unsigned int flags)
 {
-	struct ubifs_info *c = old_dir->i_sb->s_fs_info;
+	struct ubifs_info *c = inode_sb(old_dir)->s_fs_info;
 	struct inode *old_inode = d_inode(old_dentry);
 	struct inode *new_inode = d_inode(new_dentry);
 	struct inode *whiteout = NULL;
@@ -1470,7 +1470,7 @@ static int do_rename(struct inode *old_dir, struct dentry *old_dentry,
 	if (release)
 		ubifs_release_budget(c, &ino_req);
 	if (IS_SYNC(old_inode))
-		err = old_inode->i_sb->s_op->write_inode(old_inode, NULL);
+		err = inode_sb(old_inode)->s_op->write_inode(old_inode, NULL);
 
 	fscrypt_free_filename(&old_nm);
 	fscrypt_free_filename(&new_nm);
@@ -1511,7 +1511,7 @@ static int do_rename(struct inode *old_dir, struct dentry *old_dentry,
 static int ubifs_xrename(struct inode *old_dir, struct dentry *old_dentry,
 			struct inode *new_dir, struct dentry *new_dentry)
 {
-	struct ubifs_info *c = old_dir->i_sb->s_fs_info;
+	struct ubifs_info *c = inode_sb(old_dir)->s_fs_info;
 	struct ubifs_budget_req req = { .new_dent = 1, .mod_dent = 1,
 				.dirtied_ino = 2 };
 	int sync = IS_DIRSYNC(old_dir) || IS_DIRSYNC(new_dir);
diff --git a/fs/ubifs/file.c b/fs/ubifs/file.c
index cf348ba99238..c2bf005a576b 100644
--- a/fs/ubifs/file.c
+++ b/fs/ubifs/file.c
@@ -57,7 +57,7 @@
 static int read_block(struct inode *inode, void *addr, unsigned int block,
 		      struct ubifs_data_node *dn)
 {
-	struct ubifs_info *c = inode->i_sb->s_fs_info;
+	struct ubifs_info *c = inode_sb(inode)->s_fs_info;
 	int err, len, out_len;
 	union ubifs_key key;
 	unsigned int dlen;
@@ -167,7 +167,7 @@ static int do_readpage(struct page *page)
 		addr += UBIFS_BLOCK_SIZE;
 	}
 	if (err) {
-		struct ubifs_info *c = inode->i_sb->s_fs_info;
+		struct ubifs_info *c = inode_sb(inode)->s_fs_info;
 		if (err == -ENOENT) {
 			/* Not found, so it must be a hole */
 			SetPageChecked(page);
@@ -230,7 +230,7 @@ static int write_begin_slow(struct address_space *mapping,
 			    unsigned flags)
 {
 	struct inode *inode = mapping->host;
-	struct ubifs_info *c = inode->i_sb->s_fs_info;
+	struct ubifs_info *c = inode_sb(inode)->s_fs_info;
 	pgoff_t index = pos >> PAGE_SHIFT;
 	struct ubifs_budget_req req = { .new_page = 1 };
 	int uninitialized_var(err), appending = !!(pos + len > inode->i_size);
@@ -434,7 +434,7 @@ static int ubifs_write_begin(struct file *file, struct address_space *mapping,
 			     struct page **pagep, void **fsdata)
 {
 	struct inode *inode = mapping->host;
-	struct ubifs_info *c = inode->i_sb->s_fs_info;
+	struct ubifs_info *c = inode_sb(inode)->s_fs_info;
 	struct ubifs_inode *ui = ubifs_inode(inode);
 	pgoff_t index = pos >> PAGE_SHIFT;
 	int uninitialized_var(err), appending = !!(pos + len > inode->i_size);
@@ -550,7 +550,7 @@ static int ubifs_write_end(struct file *file, struct address_space *mapping,
 {
 	struct inode *inode = mapping->host;
 	struct ubifs_inode *ui = ubifs_inode(inode);
-	struct ubifs_info *c = inode->i_sb->s_fs_info;
+	struct ubifs_info *c = inode_sb(inode)->s_fs_info;
 	loff_t end_pos = pos + len;
 	int appending = !!(end_pos > inode->i_size);
 
@@ -836,7 +836,7 @@ static int ubifs_do_bulk_read(struct ubifs_info *c, struct bu_info *bu,
 static int ubifs_bulk_read(struct page *page)
 {
 	struct inode *inode = page->mapping->host;
-	struct ubifs_info *c = inode->i_sb->s_fs_info;
+	struct ubifs_info *c = inode_sb(inode)->s_fs_info;
 	struct ubifs_inode *ui = ubifs_inode(inode);
 	pgoff_t index = page->index, last_page_read = ui->last_page_read;
 	struct bu_info *bu;
@@ -915,7 +915,7 @@ static int do_writepage(struct page *page, int len)
 	void *addr;
 	union ubifs_key key;
 	struct inode *inode = page->mapping->host;
-	struct ubifs_info *c = inode->i_sb->s_fs_info;
+	struct ubifs_info *c = inode_sb(inode)->s_fs_info;
 
 #ifdef UBIFS_DEBUG
 	struct ubifs_inode *ui = ubifs_inode(inode);
@@ -1037,7 +1037,7 @@ static int ubifs_writepage(struct page *page, struct writeback_control *wbc)
 	/* Is the page fully inside @i_size? */
 	if (page->index < end_index) {
 		if (page->index >= synced_i_size >> PAGE_SHIFT) {
-			err = inode->i_sb->s_op->write_inode(inode, NULL);
+			err = inode_sb(inode)->s_op->write_inode(inode, NULL);
 			if (err)
 				goto out_unlock;
 			/*
@@ -1065,7 +1065,7 @@ static int ubifs_writepage(struct page *page, struct writeback_control *wbc)
 	kunmap_atomic(kaddr);
 
 	if (i_size > synced_i_size) {
-		err = inode->i_sb->s_op->write_inode(inode, NULL);
+		err = inode_sb(inode)->s_op->write_inode(inode, NULL);
 		if (err)
 			goto out_unlock;
 	}
@@ -1090,13 +1090,13 @@ static void do_attr_changes(struct inode *inode, const struct iattr *attr)
 		inode->i_gid = attr->ia_gid;
 	if (attr->ia_valid & ATTR_ATIME)
 		inode->i_atime = timespec_trunc(attr->ia_atime,
-						inode->i_sb->s_time_gran);
+						inode_sb(inode)->s_time_gran);
 	if (attr->ia_valid & ATTR_MTIME)
 		inode->i_mtime = timespec_trunc(attr->ia_mtime,
-						inode->i_sb->s_time_gran);
+						inode_sb(inode)->s_time_gran);
 	if (attr->ia_valid & ATTR_CTIME)
 		inode->i_ctime = timespec_trunc(attr->ia_ctime,
-						inode->i_sb->s_time_gran);
+						inode_sb(inode)->s_time_gran);
 	if (attr->ia_valid & ATTR_MODE) {
 		umode_t mode = attr->ia_mode;
 
@@ -1264,7 +1264,7 @@ static int do_setattr(struct ubifs_info *c, struct inode *inode,
 	if (release)
 		ubifs_release_budget(c, &req);
 	if (IS_SYNC(inode))
-		err = inode->i_sb->s_op->write_inode(inode, NULL);
+		err = inode_sb(inode)->s_op->write_inode(inode, NULL);
 	return err;
 }
 
@@ -1272,7 +1272,7 @@ int ubifs_setattr(struct dentry *dentry, struct iattr *attr)
 {
 	int err;
 	struct inode *inode = d_inode(dentry);
-	struct ubifs_info *c = inode->i_sb->s_fs_info;
+	struct ubifs_info *c = inode_sb(inode)->s_fs_info;
 
 	dbg_gen("ino %lu, mode %#x, ia_valid %#x",
 		inode->i_ino, inode->i_mode, attr->ia_valid);
@@ -1301,7 +1301,7 @@ static void ubifs_invalidatepage(struct page *page, unsigned int offset,
 				 unsigned int length)
 {
 	struct inode *inode = page->mapping->host;
-	struct ubifs_info *c = inode->i_sb->s_fs_info;
+	struct ubifs_info *c = inode_sb(inode)->s_fs_info;
 
 	ubifs_assert(PagePrivate(page));
 	if (offset || length < PAGE_SIZE)
@@ -1321,7 +1321,7 @@ static void ubifs_invalidatepage(struct page *page, unsigned int offset,
 int ubifs_fsync(struct file *file, loff_t start, loff_t end, int datasync)
 {
 	struct inode *inode = file->f_mapping->host;
-	struct ubifs_info *c = inode->i_sb->s_fs_info;
+	struct ubifs_info *c = inode_sb(inode)->s_fs_info;
 	int err;
 
 	dbg_gen("syncing inode %lu", inode->i_ino);
@@ -1340,7 +1340,7 @@ int ubifs_fsync(struct file *file, loff_t start, loff_t end, int datasync)
 
 	/* Synchronize the inode unless this is a 'datasync()' call. */
 	if (!datasync || (inode->i_state & I_DIRTY_DATASYNC)) {
-		err = inode->i_sb->s_op->write_inode(inode, NULL);
+		err = inode_sb(inode)->s_op->write_inode(inode, NULL);
 		if (err)
 			goto out;
 	}
@@ -1384,7 +1384,7 @@ int ubifs_update_time(struct inode *inode, struct timespec *time,
 			     int flags)
 {
 	struct ubifs_inode *ui = ubifs_inode(inode);
-	struct ubifs_info *c = inode->i_sb->s_fs_info;
+	struct ubifs_info *c = inode_sb(inode)->s_fs_info;
 	struct ubifs_budget_req req = { .dirtied_ino = 1,
 			.dirtied_ino_d = ALIGN(ui->data_len, 8) };
 	int iflags = I_DIRTY_TIME;
@@ -1402,7 +1402,7 @@ int ubifs_update_time(struct inode *inode, struct timespec *time,
 	if (flags & S_MTIME)
 		inode->i_mtime = *time;
 
-	if (!(inode->i_sb->s_flags & SB_LAZYTIME))
+	if (!(inode_sb(inode)->s_flags & SB_LAZYTIME))
 		iflags |= I_DIRTY_SYNC;
 
 	release = ui->dirty;
@@ -1426,7 +1426,7 @@ static int update_mctime(struct inode *inode)
 {
 	struct timespec now = current_time(inode);
 	struct ubifs_inode *ui = ubifs_inode(inode);
-	struct ubifs_info *c = inode->i_sb->s_fs_info;
+	struct ubifs_info *c = inode_sb(inode)->s_fs_info;
 
 	if (mctime_update_needed(inode, &now)) {
 		int err, release;
@@ -1517,7 +1517,7 @@ static int ubifs_vm_page_mkwrite(struct vm_fault *vmf)
 {
 	struct page *page = vmf->page;
 	struct inode *inode = file_inode(vmf->vma->vm_file);
-	struct ubifs_info *c = inode->i_sb->s_fs_info;
+	struct ubifs_info *c = inode_sb(inode)->s_fs_info;
 	struct timespec now = current_time(inode);
 	struct ubifs_budget_req req = { .new_page = 1 };
 	int err, update_time;
diff --git a/fs/ubifs/ioctl.c b/fs/ubifs/ioctl.c
index 0164bcc827f8..78859adf6302 100644
--- a/fs/ubifs/ioctl.c
+++ b/fs/ubifs/ioctl.c
@@ -106,7 +106,7 @@ static int setflags(struct inode *inode, int flags)
 {
 	int oldflags, err, release;
 	struct ubifs_inode *ui = ubifs_inode(inode);
-	struct ubifs_info *c = inode->i_sb->s_fs_info;
+	struct ubifs_info *c = inode_sb(inode)->s_fs_info;
 	struct ubifs_budget_req req = { .dirtied_ino = 1,
 					.dirtied_ino_d = ui->data_len };
 
@@ -186,7 +186,7 @@ long ubifs_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
 	}
 	case FS_IOC_SET_ENCRYPTION_POLICY: {
 #ifdef CONFIG_UBIFS_FS_ENCRYPTION
-		struct ubifs_info *c = inode->i_sb->s_fs_info;
+		struct ubifs_info *c = inode_sb(inode)->s_fs_info;
 
 		err = ubifs_enable_encryption(c);
 		if (err)
diff --git a/fs/ubifs/super.c b/fs/ubifs/super.c
index b16ef162344a..6568653ee596 100644
--- a/fs/ubifs/super.c
+++ b/fs/ubifs/super.c
@@ -293,7 +293,7 @@ static void ubifs_destroy_inode(struct inode *inode)
 static int ubifs_write_inode(struct inode *inode, struct writeback_control *wbc)
 {
 	int err = 0;
-	struct ubifs_info *c = inode->i_sb->s_fs_info;
+	struct ubifs_info *c = inode_sb(inode)->s_fs_info;
 	struct ubifs_inode *ui = ubifs_inode(inode);
 
 	ubifs_assert(!ui->xattr);
@@ -337,7 +337,7 @@ static int ubifs_write_inode(struct inode *inode, struct writeback_control *wbc)
 static void ubifs_evict_inode(struct inode *inode)
 {
 	int err;
-	struct ubifs_info *c = inode->i_sb->s_fs_info;
+	struct ubifs_info *c = inode_sb(inode)->s_fs_info;
 	struct ubifs_inode *ui = ubifs_inode(inode);
 
 	if (ui->xattr)
diff --git a/fs/ubifs/xattr.c b/fs/ubifs/xattr.c
index 759f1a209dbb..2e2de2f3f290 100644
--- a/fs/ubifs/xattr.c
+++ b/fs/ubifs/xattr.c
@@ -284,7 +284,7 @@ int ubifs_xattr_set(struct inode *host, const char *name, const void *value,
 		    size_t size, int flags, bool check_lock)
 {
 	struct inode *inode;
-	struct ubifs_info *c = host->i_sb->s_fs_info;
+	struct ubifs_info *c = inode_sb(host)->s_fs_info;
 	struct fscrypt_name nm = { .disk_name = FSTR_INIT((char *)name, strlen(name))};
 	struct ubifs_dent_node *xent;
 	union ubifs_key key;
@@ -345,7 +345,7 @@ ssize_t ubifs_xattr_get(struct inode *host, const char *name, void *buf,
 			size_t size)
 {
 	struct inode *inode;
-	struct ubifs_info *c = host->i_sb->s_fs_info;
+	struct ubifs_info *c = inode_sb(host)->s_fs_info;
 	struct fscrypt_name nm = { .disk_name = FSTR_INIT((char *)name, strlen(name))};
 	struct ubifs_inode *ui;
 	struct ubifs_dent_node *xent;
@@ -415,7 +415,7 @@ ssize_t ubifs_listxattr(struct dentry *dentry, char *buffer, size_t size)
 {
 	union ubifs_key key;
 	struct inode *host = d_inode(dentry);
-	struct ubifs_info *c = host->i_sb->s_fs_info;
+	struct ubifs_info *c = inode_sb(host)->s_fs_info;
 	struct ubifs_inode *host_ui = ubifs_inode(host);
 	struct ubifs_dent_node *xent, *pxent = NULL;
 	int err, len, written = 0;
@@ -532,7 +532,7 @@ void ubifs_evict_xattr_inode(struct ubifs_info *c, ino_t xattr_inum)
 static int ubifs_xattr_remove(struct inode *host, const char *name)
 {
 	struct inode *inode;
-	struct ubifs_info *c = host->i_sb->s_fs_info;
+	struct ubifs_info *c = inode_sb(host)->s_fs_info;
 	struct fscrypt_name nm = { .disk_name = FSTR_INIT((char *)name, strlen(name))};
 	struct ubifs_dent_node *xent;
 	union ubifs_key key;
@@ -614,7 +614,7 @@ int ubifs_init_security(struct inode *dentry, struct inode *inode,
 	err = security_inode_init_security(inode, dentry, qstr,
 					   &init_xattrs, 0);
 	if (err) {
-		struct ubifs_info *c = dentry->i_sb->s_fs_info;
+		struct ubifs_info *c = inode_sb(dentry)->s_fs_info;
 		ubifs_err(c, "cannot initialize security for inode %lu, error %d",
 			  inode->i_ino, err);
 	}
-- 
2.15.1

^ permalink raw reply related	[flat|nested] 88+ messages in thread

* [PATCH 70/76] fs/udf: Use inode_sb() helper instead of inode->i_sb
  2018-05-08 18:03 [RFC][PATCH 0/76] vfs: 'views' for filesystems with more than one root Mark Fasheh
                   ` (68 preceding siblings ...)
  2018-05-08 18:04 ` [PATCH 69/76] fs/ubifs: " Mark Fasheh
@ 2018-05-08 18:04 ` Mark Fasheh
  2018-05-08 18:04 ` [PATCH 71/76] fs/ufs: " Mark Fasheh
                   ` (6 subsequent siblings)
  76 siblings, 0 replies; 88+ messages in thread
From: Mark Fasheh @ 2018-05-08 18:04 UTC (permalink / raw)
  To: linux-fsdevel; +Cc: linux-kernel, linux-btrfs, Mark Fasheh

Signed-off-by: Mark Fasheh <mfasheh@suse.de>
---
 fs/udf/dir.c       |   2 +-
 fs/udf/directory.c |  30 ++++----
 fs/udf/file.c      |   6 +-
 fs/udf/ialloc.c    |  24 +++---
 fs/udf/inode.c     | 209 +++++++++++++++++++++++++++--------------------------
 fs/udf/misc.c      |   4 +-
 fs/udf/namei.c     |  76 ++++++++++---------
 fs/udf/partition.c |   2 +-
 fs/udf/super.c     |   2 +-
 fs/udf/symlink.c   |   7 +-
 fs/udf/truncate.c  |  26 +++----
 11 files changed, 199 insertions(+), 189 deletions(-)

diff --git a/fs/udf/dir.c b/fs/udf/dir.c
index c19dba45aa20..ef5b632da782 100644
--- a/fs/udf/dir.c
+++ b/fs/udf/dir.c
@@ -57,7 +57,7 @@ static int udf_readdir(struct file *file, struct dir_context *ctx)
 	sector_t offset;
 	int i, num, ret = 0;
 	struct extent_position epos = { NULL, 0, {0, 0} };
-	struct super_block *sb = dir->i_sb;
+	struct super_block *sb = inode_sb(dir);
 
 	if (ctx->pos == 0) {
 		if (!dir_emit_dot(file, ctx))
diff --git a/fs/udf/directory.c b/fs/udf/directory.c
index 0a98a2369738..d5d490eaba6c 100644
--- a/fs/udf/directory.c
+++ b/fs/udf/directory.c
@@ -38,7 +38,7 @@ struct fileIdentDesc *udf_fileident_read(struct inode *dir, loff_t *nf_pos,
 				       (iinfo->i_efe ?
 					sizeof(struct extendedFileEntry) :
 					sizeof(struct fileEntry)),
-				       dir->i_sb->s_blocksize,
+				       inode_sb(dir)->s_blocksize,
 				       &(fibh->eoffset));
 		if (!fi)
 			return NULL;
@@ -51,15 +51,15 @@ struct fileIdentDesc *udf_fileident_read(struct inode *dir, loff_t *nf_pos,
 		return fi;
 	}
 
-	if (fibh->eoffset == dir->i_sb->s_blocksize) {
+	if (fibh->eoffset == inode_sb(dir)->s_blocksize) {
 		uint32_t lextoffset = epos->offset;
-		unsigned char blocksize_bits = dir->i_sb->s_blocksize_bits;
+		unsigned char blocksize_bits = inode_sb(dir)->s_blocksize_bits;
 
 		if (udf_next_aext(dir, epos, eloc, elen, 1) !=
 		    (EXT_RECORDED_ALLOCATED >> 30))
 			return NULL;
 
-		block = udf_get_lb_pblock(dir->i_sb, eloc, *offset);
+		block = udf_get_lb_pblock(inode_sb(dir), eloc, *offset);
 
 		(*offset)++;
 
@@ -69,7 +69,7 @@ struct fileIdentDesc *udf_fileident_read(struct inode *dir, loff_t *nf_pos,
 			epos->offset = lextoffset;
 
 		brelse(fibh->sbh);
-		fibh->sbh = fibh->ebh = udf_tread(dir->i_sb, block);
+		fibh->sbh = fibh->ebh = udf_tread(inode_sb(dir), block);
 		if (!fibh->sbh)
 			return NULL;
 		fibh->soffset = fibh->eoffset = 0;
@@ -79,9 +79,9 @@ struct fileIdentDesc *udf_fileident_read(struct inode *dir, loff_t *nf_pos,
 			if (i + *offset > (*elen >> blocksize_bits))
 				i = (*elen >> blocksize_bits)-*offset;
 			for (num = 0; i > 0; i--) {
-				block = udf_get_lb_pblock(dir->i_sb, eloc,
+				block = udf_get_lb_pblock(inode_sb(dir), eloc,
 							  *offset + i);
-				tmp = udf_tgetblk(dir->i_sb, block);
+				tmp = udf_tgetblk(inode_sb(dir), block);
 				if (tmp && !buffer_uptodate(tmp) &&
 						!buffer_locked(tmp))
 					bha[num++] = tmp;
@@ -99,7 +99,7 @@ struct fileIdentDesc *udf_fileident_read(struct inode *dir, loff_t *nf_pos,
 		fibh->sbh = fibh->ebh;
 	}
 
-	fi = udf_get_fileident(fibh->sbh->b_data, dir->i_sb->s_blocksize,
+	fi = udf_get_fileident(fibh->sbh->b_data, inode_sb(dir)->s_blocksize,
 			       &(fibh->eoffset));
 
 	if (!fi)
@@ -107,29 +107,29 @@ struct fileIdentDesc *udf_fileident_read(struct inode *dir, loff_t *nf_pos,
 
 	*nf_pos += fibh->eoffset - fibh->soffset;
 
-	if (fibh->eoffset <= dir->i_sb->s_blocksize) {
+	if (fibh->eoffset <= inode_sb(dir)->s_blocksize) {
 		memcpy((uint8_t *)cfi, (uint8_t *)fi,
 		       sizeof(struct fileIdentDesc));
-	} else if (fibh->eoffset > dir->i_sb->s_blocksize) {
+	} else if (fibh->eoffset > inode_sb(dir)->s_blocksize) {
 		uint32_t lextoffset = epos->offset;
 
 		if (udf_next_aext(dir, epos, eloc, elen, 1) !=
 		    (EXT_RECORDED_ALLOCATED >> 30))
 			return NULL;
 
-		block = udf_get_lb_pblock(dir->i_sb, eloc, *offset);
+		block = udf_get_lb_pblock(inode_sb(dir), eloc, *offset);
 
 		(*offset)++;
 
-		if ((*offset << dir->i_sb->s_blocksize_bits) >= *elen)
+		if ((*offset << inode_sb(dir)->s_blocksize_bits) >= *elen)
 			*offset = 0;
 		else
 			epos->offset = lextoffset;
 
-		fibh->soffset -= dir->i_sb->s_blocksize;
-		fibh->eoffset -= dir->i_sb->s_blocksize;
+		fibh->soffset -= inode_sb(dir)->s_blocksize;
+		fibh->eoffset -= inode_sb(dir)->s_blocksize;
 
-		fibh->ebh = udf_tread(dir->i_sb, block);
+		fibh->ebh = udf_tread(inode_sb(dir), block);
 		if (!fibh->ebh)
 			return NULL;
 
diff --git a/fs/udf/file.c b/fs/udf/file.c
index 356c2bf148a5..d28bb49a2d87 100644
--- a/fs/udf/file.c
+++ b/fs/udf/file.c
@@ -151,7 +151,7 @@ static ssize_t udf_file_write_iter(struct kiocb *iocb, struct iov_iter *from)
 	if (iinfo->i_alloc_type == ICBTAG_FLAG_AD_IN_ICB) {
 		loff_t end = iocb->ki_pos + iov_iter_count(from);
 
-		if (inode->i_sb->s_blocksize <
+		if (inode_sb(inode)->s_blocksize <
 				(udf_file_entry_alloc_offset(inode) + end)) {
 			err = udf_expand_file_adinicb(inode);
 			if (err) {
@@ -198,7 +198,7 @@ long udf_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
 	switch (cmd) {
 	case UDF_GETVOLIDENT:
 		if (copy_to_user((char __user *)arg,
-				 UDF_SB(inode->i_sb)->s_volume_ident, 32))
+				 UDF_SB(inode_sb(inode))->s_volume_ident, 32))
 			return -EFAULT;
 		return 0;
 	case UDF_RELOCATE_BLOCKS:
@@ -206,7 +206,7 @@ long udf_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
 			return -EPERM;
 		if (get_user(old_block, (long __user *)arg))
 			return -EFAULT;
-		result = udf_relocate_blocks(inode->i_sb,
+		result = udf_relocate_blocks(inode_sb(inode),
 						old_block, &new_block);
 		if (result == 0)
 			result = put_user(new_block, (long __user *)arg);
diff --git a/fs/udf/ialloc.c b/fs/udf/ialloc.c
index b6e420c1bfeb..eb37faceb405 100644
--- a/fs/udf/ialloc.c
+++ b/fs/udf/ialloc.c
@@ -28,7 +28,7 @@
 
 void udf_free_inode(struct inode *inode)
 {
-	struct super_block *sb = inode->i_sb;
+	struct super_block *sb = inode_sb(inode);
 	struct udf_sb_info *sbi = UDF_SB(sb);
 	struct logicalVolIntegrityDescImpUse *lvidiu = udf_sb_lvidiu(sb);
 
@@ -47,7 +47,7 @@ void udf_free_inode(struct inode *inode)
 
 struct inode *udf_new_inode(struct inode *dir, umode_t mode)
 {
-	struct super_block *sb = dir->i_sb;
+	struct super_block *sb = inode_sb(dir);
 	struct udf_sb_info *sbi = UDF_SB(sb);
 	struct inode *inode;
 	udf_pblk_t block;
@@ -63,18 +63,18 @@ struct inode *udf_new_inode(struct inode *dir, umode_t mode)
 		return ERR_PTR(-ENOMEM);
 
 	iinfo = UDF_I(inode);
-	if (UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_USE_EXTENDED_FE)) {
+	if (UDF_QUERY_FLAG(inode_sb(inode), UDF_FLAG_USE_EXTENDED_FE)) {
 		iinfo->i_efe = 1;
 		if (UDF_VERS_USE_EXTENDED_FE > sbi->s_udfrev)
 			sbi->s_udfrev = UDF_VERS_USE_EXTENDED_FE;
-		iinfo->i_ext.i_data = kzalloc(inode->i_sb->s_blocksize -
-					    sizeof(struct extendedFileEntry),
-					    GFP_KERNEL);
+		iinfo->i_ext.i_data = kzalloc(inode_sb(inode)->s_blocksize -
+					      sizeof(struct extendedFileEntry),
+					      GFP_KERNEL);
 	} else {
 		iinfo->i_efe = 0;
-		iinfo->i_ext.i_data = kzalloc(inode->i_sb->s_blocksize -
-					    sizeof(struct fileEntry),
-					    GFP_KERNEL);
+		iinfo->i_ext.i_data = kzalloc(inode_sb(inode)->s_blocksize -
+					      sizeof(struct fileEntry),
+					      GFP_KERNEL);
 	}
 	if (!iinfo->i_ext.i_data) {
 		iput(inode);
@@ -82,7 +82,7 @@ struct inode *udf_new_inode(struct inode *dir, umode_t mode)
 	}
 
 	err = -ENOSPC;
-	block = udf_new_block(dir->i_sb, NULL,
+	block = udf_new_block(inode_sb(dir), NULL,
 			      dinfo->i_location.partitionReferenceNum,
 			      start, &err);
 	if (err) {
@@ -114,9 +114,9 @@ struct inode *udf_new_inode(struct inode *dir, umode_t mode)
 	iinfo->i_lenAlloc = 0;
 	iinfo->i_use = 0;
 	iinfo->i_checkpoint = 1;
-	if (UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_USE_AD_IN_ICB))
+	if (UDF_QUERY_FLAG(inode_sb(inode), UDF_FLAG_USE_AD_IN_ICB))
 		iinfo->i_alloc_type = ICBTAG_FLAG_AD_IN_ICB;
-	else if (UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_USE_SHORT_AD))
+	else if (UDF_QUERY_FLAG(inode_sb(inode), UDF_FLAG_USE_SHORT_AD))
 		iinfo->i_alloc_type = ICBTAG_FLAG_AD_SHORT;
 	else
 		iinfo->i_alloc_type = ICBTAG_FLAG_AD_LONG;
diff --git a/fs/udf/inode.c b/fs/udf/inode.c
index c23744d5ae5c..397d4ea29232 100644
--- a/fs/udf/inode.c
+++ b/fs/udf/inode.c
@@ -142,7 +142,8 @@ void udf_evict_inode(struct inode *inode)
 	clear_inode(inode);
 	if (iinfo->i_alloc_type != ICBTAG_FLAG_AD_IN_ICB &&
 	    inode->i_size != iinfo->i_lenExtents) {
-		udf_warn(inode->i_sb, "Inode %lu (mode %o) has inode size %llu different from extent length %llu. Filesystem need not be standards compliant.\n",
+		udf_warn(inode_sb(inode),
+			 "Inode %lu (mode %o) has inode size %llu different from extent length %llu. Filesystem need not be standards compliant.\n",
 			 inode->i_ino, inode->i_mode,
 			 (unsigned long long)inode->i_size,
 			 (unsigned long long)iinfo->i_lenExtents);
@@ -255,7 +256,7 @@ int udf_expand_file_adinicb(struct inode *inode)
 
 	WARN_ON_ONCE(!inode_is_locked(inode));
 	if (!iinfo->i_lenAlloc) {
-		if (UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_USE_SHORT_AD))
+		if (UDF_QUERY_FLAG(inode_sb(inode), UDF_FLAG_USE_SHORT_AD))
 			iinfo->i_alloc_type = ICBTAG_FLAG_AD_SHORT;
 		else
 			iinfo->i_alloc_type = ICBTAG_FLAG_AD_LONG;
@@ -289,7 +290,7 @@ int udf_expand_file_adinicb(struct inode *inode)
 	memset(iinfo->i_ext.i_data + iinfo->i_lenEAttr, 0x00,
 	       iinfo->i_lenAlloc);
 	iinfo->i_lenAlloc = 0;
-	if (UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_USE_SHORT_AD))
+	if (UDF_QUERY_FLAG(inode_sb(inode), UDF_FLAG_USE_SHORT_AD))
 		iinfo->i_alloc_type = ICBTAG_FLAG_AD_SHORT;
 	else
 		iinfo->i_alloc_type = ICBTAG_FLAG_AD_LONG;
@@ -331,7 +332,7 @@ struct buffer_head *udf_expand_dir_adinicb(struct inode *inode,
 	struct fileIdentDesc cfi, *sfi, *dfi;
 	struct udf_inode_info *iinfo = UDF_I(inode);
 
-	if (UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_USE_SHORT_AD))
+	if (UDF_QUERY_FLAG(inode_sb(inode), UDF_FLAG_USE_SHORT_AD))
 		alloctype = ICBTAG_FLAG_AD_SHORT;
 	else
 		alloctype = ICBTAG_FLAG_AD_LONG;
@@ -343,27 +344,27 @@ struct buffer_head *udf_expand_dir_adinicb(struct inode *inode,
 	}
 
 	/* alloc block, and copy data to it */
-	*block = udf_new_block(inode->i_sb, inode,
+	*block = udf_new_block(inode_sb(inode), inode,
 			       iinfo->i_location.partitionReferenceNum,
 			       iinfo->i_location.logicalBlockNum, err);
 	if (!(*block))
 		return NULL;
-	newblock = udf_get_pblock(inode->i_sb, *block,
+	newblock = udf_get_pblock(inode_sb(inode), *block,
 				  iinfo->i_location.partitionReferenceNum,
 				0);
 	if (!newblock)
 		return NULL;
-	dbh = udf_tgetblk(inode->i_sb, newblock);
+	dbh = udf_tgetblk(inode_sb(inode), newblock);
 	if (!dbh)
 		return NULL;
 	lock_buffer(dbh);
-	memset(dbh->b_data, 0x00, inode->i_sb->s_blocksize);
+	memset(dbh->b_data, 0x00, inode_sb(inode)->s_blocksize);
 	set_buffer_uptodate(dbh);
 	unlock_buffer(dbh);
 	mark_buffer_dirty_inode(dbh, inode);
 
 	sfibh.soffset = sfibh.eoffset =
-			f_pos & (inode->i_sb->s_blocksize - 1);
+			f_pos & (inode_sb(inode)->s_blocksize - 1);
 	sfibh.sbh = sfibh.ebh = NULL;
 	dfibh.soffset = dfibh.eoffset = 0;
 	dfibh.sbh = dfibh.ebh = dbh;
@@ -418,7 +419,7 @@ static int udf_get_block(struct inode *inode, sector_t block,
 	if (!create) {
 		phys = udf_block_map(inode, block);
 		if (phys)
-			map_bh(bh_result, inode->i_sb, phys);
+			map_bh(bh_result, inode_sb(inode), phys);
 		return 0;
 	}
 
@@ -439,7 +440,7 @@ static int udf_get_block(struct inode *inode, sector_t block,
 
 	if (new)
 		set_buffer_new(bh_result);
-	map_bh(bh_result, inode->i_sb, phys);
+	map_bh(bh_result, inode_sb(inode), phys);
 
 abort:
 	up_write(&iinfo->i_data_sem);
@@ -456,10 +457,10 @@ static struct buffer_head *udf_getblk(struct inode *inode, udf_pblk_t block,
 	dummy.b_blocknr = -1000;
 	*err = udf_get_block(inode, block, &dummy, create);
 	if (!*err && buffer_mapped(&dummy)) {
-		bh = sb_getblk(inode->i_sb, dummy.b_blocknr);
+		bh = sb_getblk(inode_sb(inode), dummy.b_blocknr);
 		if (buffer_new(&dummy)) {
 			lock_buffer(bh);
-			memset(bh->b_data, 0x00, inode->i_sb->s_blocksize);
+			memset(bh->b_data, 0x00, inode_sb(inode)->s_blocksize);
 			set_buffer_uptodate(bh);
 			unlock_buffer(bh);
 			mark_buffer_dirty_inode(bh, inode);
@@ -478,7 +479,7 @@ static int udf_do_extend_file(struct inode *inode,
 {
 	sector_t add;
 	int count = 0, fake = !(last_ext->extLength & UDF_EXTENT_LENGTH_MASK);
-	struct super_block *sb = inode->i_sb;
+	struct super_block *sb = inode_sb(inode);
 	struct kernel_lb_addr prealloc_loc = {};
 	uint32_t prealloc_len = 0;
 	struct udf_inode_info *iinfo;
@@ -603,7 +604,7 @@ static int udf_extend_file(struct inode *inode, loff_t newsize)
 	struct kernel_lb_addr eloc;
 	uint32_t elen;
 	int8_t etype;
-	struct super_block *sb = inode->i_sb;
+	struct super_block *sb = inode_sb(inode);
 	sector_t first_block = newsize >> sb->s_blocksize_bits, offset;
 	int adsize;
 	struct udf_inode_info *iinfo = UDF_I(inode);
@@ -677,7 +678,7 @@ static sector_t inode_getblk(struct inode *inode, sector_t block,
 	prev_epos.block = iinfo->i_location;
 	prev_epos.bh = NULL;
 	cur_epos = next_epos = prev_epos;
-	b_off = (loff_t)block << inode->i_sb->s_blocksize_bits;
+	b_off = (loff_t)block << inode_sb(inode)->s_blocksize_bits;
 
 	/* find the extent which contains the block we are looking for.
 	   alternate between laarr[0] and laarr[1] for locations of the
@@ -713,14 +714,14 @@ static sector_t inode_getblk(struct inode *inode, sector_t block,
 
 		if (etype != (EXT_NOT_RECORDED_NOT_ALLOCATED >> 30))
 			pgoal = eloc.logicalBlockNum +
-				((elen + inode->i_sb->s_blocksize - 1) >>
-				 inode->i_sb->s_blocksize_bits);
+				((elen + inode_sb(inode)->s_blocksize - 1) >>
+				 inode_sb(inode)->s_blocksize_bits);
 
 		count++;
 	} while (lbcount + elen <= b_off);
 
 	b_off -= lbcount;
-	offset = b_off >> inode->i_sb->s_blocksize_bits;
+	offset = b_off >> inode_sb(inode)->s_blocksize_bits;
 	/*
 	 * Move prev_epos and cur_epos into indirect extent if we are at
 	 * the pointer to it
@@ -732,13 +733,13 @@ static sector_t inode_getblk(struct inode *inode, sector_t block,
 	   if the extent is not a multiple of the blocksize, round up */
 
 	if (etype == (EXT_RECORDED_ALLOCATED >> 30)) {
-		if (elen & (inode->i_sb->s_blocksize - 1)) {
+		if (elen & (inode_sb(inode)->s_blocksize - 1)) {
 			elen = EXT_RECORDED_ALLOCATED |
-				((elen + inode->i_sb->s_blocksize - 1) &
-				 ~(inode->i_sb->s_blocksize - 1));
+				((elen + inode_sb(inode)->s_blocksize - 1) &
+				 ~(inode_sb(inode)->s_blocksize - 1));
 			udf_write_aext(inode, &cur_epos, &eloc, elen, 1);
 		}
-		newblock = udf_get_lb_pblock(inode->i_sb, &eloc, offset);
+		newblock = udf_get_lb_pblock(inode_sb(inode), &eloc, offset);
 		goto out_free;
 	}
 
@@ -777,7 +778,7 @@ static sector_t inode_getblk(struct inode *inode, sector_t block,
 			if (count)
 				c = !c;
 			laarr[c].extLength = EXT_NOT_RECORDED_NOT_ALLOCATED |
-				inode->i_sb->s_blocksize;
+				inode_sb(inode)->s_blocksize;
 			memset(&laarr[c].extLocation, 0x00,
 				sizeof(struct kernel_lb_addr));
 			count++;
@@ -823,16 +824,16 @@ static sector_t inode_getblk(struct inode *inode, sector_t block,
 				goal = iinfo->i_location.logicalBlockNum + 1;
 		}
 
-		newblocknum = udf_new_block(inode->i_sb, inode,
-				iinfo->i_location.partitionReferenceNum,
-				goal, err);
+		newblocknum = udf_new_block(inode_sb(inode), inode,
+					    iinfo->i_location.partitionReferenceNum,
+					    goal, err);
 		if (!newblocknum) {
 			*err = -ENOSPC;
 			newblock = 0;
 			goto out_free;
 		}
 		if (isBeyondEOF)
-			iinfo->i_lenExtents += inode->i_sb->s_blocksize;
+			iinfo->i_lenExtents += inode_sb(inode)->s_blocksize;
 	}
 
 	/* if the extent the requsted block is located in contains multiple
@@ -856,8 +857,8 @@ static sector_t inode_getblk(struct inode *inode, sector_t block,
 	 * the new number of extents is less than the old number */
 	udf_update_extents(inode, laarr, startnum, endnum, &prev_epos);
 
-	newblock = udf_get_pblock(inode->i_sb, newblocknum,
-				iinfo->i_location.partitionReferenceNum, 0);
+	newblock = udf_get_pblock(inode_sb(inode), newblocknum,
+				  iinfo->i_location.partitionReferenceNum, 0);
 	if (!newblock) {
 		*err = -EIO;
 		goto out_free;
@@ -882,8 +883,8 @@ static void udf_split_extents(struct inode *inode, int *c, int offset,
 			       udf_pblk_t newblocknum,
 			       struct kernel_long_ad *laarr, int *endnum)
 {
-	unsigned long blocksize = inode->i_sb->s_blocksize;
-	unsigned char blocksize_bits = inode->i_sb->s_blocksize_bits;
+	unsigned long blocksize = inode_sb(inode)->s_blocksize;
+	unsigned char blocksize_bits = inode_sb(inode)->s_blocksize_bits;
 
 	if ((laarr[*c].extLength >> 30) == (EXT_NOT_RECORDED_ALLOCATED >> 30) ||
 	    (laarr[*c].extLength >> 30) ==
@@ -905,7 +906,7 @@ static void udf_split_extents(struct inode *inode, int *c, int offset,
 
 		if (offset) {
 			if (etype == (EXT_NOT_RECORDED_ALLOCATED >> 30)) {
-				udf_free_blocks(inode->i_sb, inode,
+				udf_free_blocks(inode_sb(inode), inode,
 						&laarr[curr].extLocation,
 						0, offset);
 				laarr[curr].extLength =
@@ -960,8 +961,8 @@ static void udf_prealloc_extents(struct inode *inode, int c, int lastblock,
 			length = currlength =
 				(((laarr[c + 1].extLength &
 					UDF_EXTENT_LENGTH_MASK) +
-				inode->i_sb->s_blocksize - 1) >>
-				inode->i_sb->s_blocksize_bits);
+				inode_sb(inode)->s_blocksize - 1) >>
+				 inode_sb(inode)->s_blocksize_bits);
 		} else
 			start = c;
 	}
@@ -974,8 +975,8 @@ static void udf_prealloc_extents(struct inode *inode, int c, int lastblock,
 				(EXT_NOT_RECORDED_NOT_ALLOCATED >> 30)) {
 			length += (((laarr[i].extLength &
 						UDF_EXTENT_LENGTH_MASK) +
-				    inode->i_sb->s_blocksize - 1) >>
-				    inode->i_sb->s_blocksize_bits);
+				    inode_sb(inode)->s_blocksize - 1) >>
+				    inode_sb(inode)->s_blocksize_bits);
 		} else
 			break;
 	}
@@ -983,18 +984,18 @@ static void udf_prealloc_extents(struct inode *inode, int c, int lastblock,
 	if (length) {
 		int next = laarr[start].extLocation.logicalBlockNum +
 			(((laarr[start].extLength & UDF_EXTENT_LENGTH_MASK) +
-			  inode->i_sb->s_blocksize - 1) >>
-			  inode->i_sb->s_blocksize_bits);
-		int numalloc = udf_prealloc_blocks(inode->i_sb, inode,
-				laarr[start].extLocation.partitionReferenceNum,
-				next, (UDF_DEFAULT_PREALLOC_BLOCKS > length ?
-				length : UDF_DEFAULT_PREALLOC_BLOCKS) -
-				currlength);
+			  inode_sb(inode)->s_blocksize - 1) >>
+			  inode_sb(inode)->s_blocksize_bits);
+		int numalloc = udf_prealloc_blocks(inode_sb(inode), inode,
+						   laarr[start].extLocation.partitionReferenceNum,
+						   next, (UDF_DEFAULT_PREALLOC_BLOCKS > length ?
+							  length : UDF_DEFAULT_PREALLOC_BLOCKS) -
+						   currlength);
 		if (numalloc) 	{
 			if (start == (c + 1))
 				laarr[start].extLength +=
 					(numalloc <<
-					 inode->i_sb->s_blocksize_bits);
+					 inode_sb(inode)->s_blocksize_bits);
 			else {
 				memmove(&laarr[c + 2], &laarr[c + 1],
 					sizeof(struct long_ad) * (*endnum - (c + 1)));
@@ -1006,20 +1007,20 @@ static void udf_prealloc_extents(struct inode *inode, int c, int lastblock,
 				laarr[c + 1].extLength =
 					EXT_NOT_RECORDED_ALLOCATED |
 					(numalloc <<
-					 inode->i_sb->s_blocksize_bits);
+					 inode_sb(inode)->s_blocksize_bits);
 				start = c + 1;
 			}
 
 			for (i = start + 1; numalloc && i < *endnum; i++) {
 				int elen = ((laarr[i].extLength &
 						UDF_EXTENT_LENGTH_MASK) +
-					    inode->i_sb->s_blocksize - 1) >>
-					    inode->i_sb->s_blocksize_bits;
+					    inode_sb(inode)->s_blocksize - 1) >>
+					    inode_sb(inode)->s_blocksize_bits;
 
 				if (elen > numalloc) {
 					laarr[i].extLength -=
 						(numalloc <<
-						 inode->i_sb->s_blocksize_bits);
+						 inode_sb(inode)->s_blocksize_bits);
 					numalloc = 0;
 				} else {
 					numalloc -= elen;
@@ -1033,7 +1034,7 @@ static void udf_prealloc_extents(struct inode *inode, int c, int lastblock,
 				}
 			}
 			UDF_I(inode)->i_lenExtents +=
-				numalloc << inode->i_sb->s_blocksize_bits;
+				numalloc << inode_sb(inode)->s_blocksize_bits;
 		}
 	}
 }
@@ -1042,8 +1043,8 @@ static void udf_merge_extents(struct inode *inode, struct kernel_long_ad *laarr,
 			      int *endnum)
 {
 	int i;
-	unsigned long blocksize = inode->i_sb->s_blocksize;
-	unsigned char blocksize_bits = inode->i_sb->s_blocksize_bits;
+	unsigned long blocksize = inode_sb(inode)->s_blocksize;
+	unsigned char blocksize_bits = inode_sb(inode)->s_blocksize_bits;
 
 	for (i = 0; i < (*endnum - 1); i++) {
 		struct kernel_long_ad *li /*l[i]*/ = &laarr[i];
@@ -1090,7 +1091,8 @@ static void udf_merge_extents(struct inode *inode, struct kernel_long_ad *laarr,
 				(EXT_NOT_RECORDED_ALLOCATED >> 30)) &&
 			   ((lip1->extLength >> 30) ==
 				(EXT_NOT_RECORDED_NOT_ALLOCATED >> 30))) {
-			udf_free_blocks(inode->i_sb, inode, &li->extLocation, 0,
+			udf_free_blocks(inode_sb(inode), inode,
+					&li->extLocation, 0,
 					((li->extLength &
 					  UDF_EXTENT_LENGTH_MASK) +
 					 blocksize - 1) >> blocksize_bits);
@@ -1123,7 +1125,7 @@ static void udf_merge_extents(struct inode *inode, struct kernel_long_ad *laarr,
 			}
 		} else if ((li->extLength >> 30) ==
 					(EXT_NOT_RECORDED_ALLOCATED >> 30)) {
-			udf_free_blocks(inode->i_sb, inode,
+			udf_free_blocks(inode_sb(inode), inode,
 					&li->extLocation, 0,
 					((li->extLength &
 						UDF_EXTENT_LENGTH_MASK) +
@@ -1269,11 +1271,11 @@ static int udf_read_inode(struct inode *inode, bool hidden_inode)
 	struct extendedFileEntry *efe;
 	uint16_t ident;
 	struct udf_inode_info *iinfo = UDF_I(inode);
-	struct udf_sb_info *sbi = UDF_SB(inode->i_sb);
+	struct udf_sb_info *sbi = UDF_SB(inode_sb(inode));
 	struct kernel_lb_addr *iloc = &iinfo->i_location;
 	unsigned int link_count;
 	unsigned int indirections = 0;
-	int bs = inode->i_sb->s_blocksize;
+	int bs = inode_sb(inode)->s_blocksize;
 	int ret = -EIO;
 
 reread:
@@ -1302,15 +1304,16 @@ static int udf_read_inode(struct inode *inode, bool hidden_inode)
 	 *      i_nlink = 1
 	 *      i_op = NULL;
 	 */
-	bh = udf_read_ptagged(inode->i_sb, iloc, 0, &ident);
+	bh = udf_read_ptagged(inode_sb(inode), iloc, 0, &ident);
 	if (!bh) {
-		udf_err(inode->i_sb, "(ino %lu) failed !bh\n", inode->i_ino);
+		udf_err(inode_sb(inode), "(ino %lu) failed !bh\n",
+			inode->i_ino);
 		return -EIO;
 	}
 
 	if (ident != TAG_IDENT_FE && ident != TAG_IDENT_EFE &&
 	    ident != TAG_IDENT_USE) {
-		udf_err(inode->i_sb, "(ino %lu) failed ident=%u\n",
+		udf_err(inode_sb(inode), "(ino %lu) failed ident=%u\n",
 			inode->i_ino, ident);
 		goto out;
 	}
@@ -1321,7 +1324,7 @@ static int udf_read_inode(struct inode *inode, bool hidden_inode)
 	if (fe->icbTag.strategyType == cpu_to_le16(4096)) {
 		struct buffer_head *ibh;
 
-		ibh = udf_read_ptagged(inode->i_sb, iloc, 1, &ident);
+		ibh = udf_read_ptagged(inode_sb(inode), iloc, 1, &ident);
 		if (ident == TAG_IDENT_IE && ibh) {
 			struct kernel_lb_addr loc;
 			struct indirectEntry *ie;
@@ -1334,7 +1337,7 @@ static int udf_read_inode(struct inode *inode, bool hidden_inode)
 				memcpy(&iinfo->i_location, &loc,
 				       sizeof(struct kernel_lb_addr));
 				if (++indirections > UDF_MAX_ICB_NESTING) {
-					udf_err(inode->i_sb,
+					udf_err(inode_sb(inode),
 						"too many ICBs in ICB hierarchy"
 						" (max %d supported)\n",
 						UDF_MAX_ICB_NESTING);
@@ -1346,7 +1349,7 @@ static int udf_read_inode(struct inode *inode, bool hidden_inode)
 		}
 		brelse(ibh);
 	} else if (fe->icbTag.strategyType != cpu_to_le16(4)) {
-		udf_err(inode->i_sb, "unsupported strategy type: %u\n",
+		udf_err(inode_sb(inode), "unsupported strategy type: %u\n",
 			le16_to_cpu(fe->icbTag.strategyType));
 		goto out;
 	}
@@ -1402,15 +1405,15 @@ static int udf_read_inode(struct inode *inode, bool hidden_inode)
 	read_lock(&sbi->s_cred_lock);
 	i_uid_write(inode, le32_to_cpu(fe->uid));
 	if (!uid_valid(inode->i_uid) ||
-	    UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_UID_IGNORE) ||
-	    UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_UID_SET))
-		inode->i_uid = UDF_SB(inode->i_sb)->s_uid;
+	    UDF_QUERY_FLAG(inode_sb(inode), UDF_FLAG_UID_IGNORE) ||
+	    UDF_QUERY_FLAG(inode_sb(inode), UDF_FLAG_UID_SET))
+		inode->i_uid = UDF_SB(inode_sb(inode))->s_uid;
 
 	i_gid_write(inode, le32_to_cpu(fe->gid));
 	if (!gid_valid(inode->i_gid) ||
-	    UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_GID_IGNORE) ||
-	    UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_GID_SET))
-		inode->i_gid = UDF_SB(inode->i_sb)->s_gid;
+	    UDF_QUERY_FLAG(inode_sb(inode), UDF_FLAG_GID_IGNORE) ||
+	    UDF_QUERY_FLAG(inode_sb(inode), UDF_FLAG_GID_SET))
+		inode->i_gid = UDF_SB(inode_sb(inode))->s_gid;
 
 	if (fe->icbTag.fileType != ICBTAG_FILE_TYPE_DIRECTORY &&
 			sbi->s_fmode != UDF_INVALID_MODE)
@@ -1438,7 +1441,7 @@ static int udf_read_inode(struct inode *inode, bool hidden_inode)
 
 	if (iinfo->i_efe == 0) {
 		inode->i_blocks = le64_to_cpu(fe->logicalBlocksRecorded) <<
-			(inode->i_sb->s_blocksize_bits - 9);
+			(inode_sb(inode)->s_blocksize_bits - 9);
 
 		if (!udf_disk_stamp_to_time(&inode->i_atime, fe->accessTime))
 			inode->i_atime = sbi->s_record_time;
@@ -1456,7 +1459,7 @@ static int udf_read_inode(struct inode *inode, bool hidden_inode)
 		iinfo->i_checkpoint = le32_to_cpu(fe->checkpoint);
 	} else {
 		inode->i_blocks = le64_to_cpu(efe->logicalBlocksRecorded) <<
-		    (inode->i_sb->s_blocksize_bits - 9);
+		    (inode_sb(inode)->s_blocksize_bits - 9);
 
 		if (!udf_disk_stamp_to_time(&inode->i_atime, efe->accessTime))
 			inode->i_atime = sbi->s_record_time;
@@ -1547,7 +1550,8 @@ static int udf_read_inode(struct inode *inode, bool hidden_inode)
 		udf_debug("METADATA BITMAP FILE-----\n");
 		break;
 	default:
-		udf_err(inode->i_sb, "(ino %lu) failed unknown file type=%u\n",
+		udf_err(inode_sb(inode),
+			"(ino %lu) failed unknown file type=%u\n",
 			inode->i_ino, fe->icbTag.fileType);
 		goto out;
 	}
@@ -1624,19 +1628,19 @@ static int udf_update_inode(struct inode *inode, int do_sync)
 	uint16_t icbflags;
 	uint16_t crclen;
 	int err = 0;
-	struct udf_sb_info *sbi = UDF_SB(inode->i_sb);
-	unsigned char blocksize_bits = inode->i_sb->s_blocksize_bits;
+	struct udf_sb_info *sbi = UDF_SB(inode_sb(inode));
+	unsigned char blocksize_bits = inode_sb(inode)->s_blocksize_bits;
 	struct udf_inode_info *iinfo = UDF_I(inode);
 
-	bh = udf_tgetblk(inode->i_sb,
-			udf_get_lb_pblock(inode->i_sb, &iinfo->i_location, 0));
+	bh = udf_tgetblk(inode_sb(inode),
+			 udf_get_lb_pblock(inode_sb(inode), &iinfo->i_location, 0));
 	if (!bh) {
 		udf_debug("getblk failure\n");
 		return -EIO;
 	}
 
 	lock_buffer(bh);
-	memset(bh->b_data, 0, inode->i_sb->s_blocksize);
+	memset(bh->b_data, 0, inode_sb(inode)->s_blocksize);
 	fe = (struct fileEntry *)bh->b_data;
 	efe = (struct extendedFileEntry *)bh->b_data;
 
@@ -1646,20 +1650,20 @@ static int udf_update_inode(struct inode *inode, int do_sync)
 
 		use->lengthAllocDescs = cpu_to_le32(iinfo->i_lenAlloc);
 		memcpy(bh->b_data + sizeof(struct unallocSpaceEntry),
-		       iinfo->i_ext.i_data, inode->i_sb->s_blocksize -
-					sizeof(struct unallocSpaceEntry));
+		       iinfo->i_ext.i_data, inode_sb(inode)->s_blocksize -
+		       sizeof(struct unallocSpaceEntry));
 		use->descTag.tagIdent = cpu_to_le16(TAG_IDENT_USE);
 		crclen = sizeof(struct unallocSpaceEntry);
 
 		goto finish;
 	}
 
-	if (UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_UID_FORGET))
+	if (UDF_QUERY_FLAG(inode_sb(inode), UDF_FLAG_UID_FORGET))
 		fe->uid = cpu_to_le32(-1);
 	else
 		fe->uid = cpu_to_le32(i_uid_read(inode));
 
-	if (UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_GID_FORGET))
+	if (UDF_QUERY_FLAG(inode_sb(inode), UDF_FLAG_GID_FORGET))
 		fe->gid = cpu_to_le32(-1);
 	else
 		fe->gid = cpu_to_le32(i_gid_read(inode));
@@ -1716,7 +1720,7 @@ static int udf_update_inode(struct inode *inode, int do_sync)
 	if (iinfo->i_efe == 0) {
 		memcpy(bh->b_data + sizeof(struct fileEntry),
 		       iinfo->i_ext.i_data,
-		       inode->i_sb->s_blocksize - sizeof(struct fileEntry));
+		       inode_sb(inode)->s_blocksize - sizeof(struct fileEntry));
 		fe->logicalBlocksRecorded = cpu_to_le64(lb_recorded);
 
 		udf_time_to_disk_stamp(&fe->accessTime, inode->i_atime);
@@ -1735,8 +1739,8 @@ static int udf_update_inode(struct inode *inode, int do_sync)
 	} else {
 		memcpy(bh->b_data + sizeof(struct extendedFileEntry),
 		       iinfo->i_ext.i_data,
-		       inode->i_sb->s_blocksize -
-					sizeof(struct extendedFileEntry));
+		       inode_sb(inode)->s_blocksize -
+		       sizeof(struct extendedFileEntry));
 		efe->objectSize = cpu_to_le64(inode->i_size);
 		efe->logicalBlocksRecorded = cpu_to_le64(lb_recorded);
 
@@ -1818,7 +1822,8 @@ static int udf_update_inode(struct inode *inode, int do_sync)
 	if (do_sync) {
 		sync_dirty_buffer(bh);
 		if (buffer_write_io_error(bh)) {
-			udf_warn(inode->i_sb, "IO error syncing udf inode [%08lx]\n",
+			udf_warn(inode_sb(inode),
+				 "IO error syncing udf inode [%08lx]\n",
 				 inode->i_ino);
 			err = -EIO;
 		}
@@ -1855,7 +1860,7 @@ struct inode *__udf_iget(struct super_block *sb, struct kernel_lb_addr *ino,
 int udf_setup_indirect_aext(struct inode *inode, udf_pblk_t block,
 			    struct extent_position *epos)
 {
-	struct super_block *sb = inode->i_sb;
+	struct super_block *sb = inode_sb(inode);
 	struct buffer_head *bh;
 	struct allocExtDesc *aed;
 	struct extent_position nepos;
@@ -1951,7 +1956,7 @@ int __udf_add_aext(struct inode *inode, struct extent_position *epos,
 		aed = (struct allocExtDesc *)epos->bh->b_data;
 		WARN_ON(le32_to_cpu(aed->lengthAllocDescs) !=
 			epos->offset - sizeof(struct allocExtDesc));
-		WARN_ON(epos->offset + adsize > inode->i_sb->s_blocksize);
+		WARN_ON(epos->offset + adsize > inode_sb(inode)->s_blocksize);
 	}
 
 	udf_write_aext(inode, epos, eloc, elen, inc);
@@ -1962,8 +1967,8 @@ int __udf_add_aext(struct inode *inode, struct extent_position *epos,
 	} else {
 		aed = (struct allocExtDesc *)epos->bh->b_data;
 		le32_add_cpu(&aed->lengthAllocDescs, adsize);
-		if (!UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_STRICT) ||
-				UDF_SB(inode->i_sb)->s_udfrev >= 0x0201)
+		if (!UDF_QUERY_FLAG(inode_sb(inode), UDF_FLAG_STRICT) ||
+				UDF_SB(inode_sb(inode))->s_udfrev >= 0x0201)
 			udf_update_tag(epos->bh->b_data,
 					epos->offset + (inc ? 0 : adsize));
 		else
@@ -1983,7 +1988,7 @@ int udf_add_aext(struct inode *inode, struct extent_position *epos,
 		 struct kernel_lb_addr *eloc, uint32_t elen, int inc)
 {
 	int adsize;
-	struct super_block *sb = inode->i_sb;
+	struct super_block *sb = inode_sb(inode);
 
 	if (UDF_I(inode)->i_alloc_type == ICBTAG_FLAG_AD_SHORT)
 		adsize = sizeof(struct short_ad);
@@ -2045,8 +2050,8 @@ void udf_write_aext(struct inode *inode, struct extent_position *epos,
 	}
 
 	if (epos->bh) {
-		if (!UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_STRICT) ||
-		    UDF_SB(inode->i_sb)->s_udfrev >= 0x0201) {
+		if (!UDF_QUERY_FLAG(inode_sb(inode), UDF_FLAG_STRICT) ||
+		    UDF_SB(inode_sb(inode))->s_udfrev >= 0x0201) {
 			struct allocExtDesc *aed =
 				(struct allocExtDesc *)epos->bh->b_data;
 			udf_update_tag(epos->bh->b_data,
@@ -2079,7 +2084,7 @@ int8_t udf_next_aext(struct inode *inode, struct extent_position *epos,
 		udf_pblk_t block;
 
 		if (++indirections > UDF_MAX_INDIR_EXTS) {
-			udf_err(inode->i_sb,
+			udf_err(inode_sb(inode),
 				"too many indirect extents in inode %lu\n",
 				inode->i_ino);
 			return -1;
@@ -2088,8 +2093,8 @@ int8_t udf_next_aext(struct inode *inode, struct extent_position *epos,
 		epos->block = *eloc;
 		epos->offset = sizeof(struct allocExtDesc);
 		brelse(epos->bh);
-		block = udf_get_lb_pblock(inode->i_sb, &epos->block, 0);
-		epos->bh = udf_tread(inode->i_sb, block);
+		block = udf_get_lb_pblock(inode_sb(inode), &epos->block, 0);
+		epos->bh = udf_tread(inode_sb(inode), block);
 		if (!epos->bh) {
 			udf_debug("reading block %u failed!\n", block);
 			return -1;
@@ -2214,7 +2219,7 @@ int8_t udf_delete_aext(struct inode *inode, struct extent_position epos,
 	elen = 0;
 
 	if (epos.bh != oepos.bh) {
-		udf_free_blocks(inode->i_sb, inode, &epos.block, 0, 1);
+		udf_free_blocks(inode_sb(inode), inode, &epos.block, 0, 1);
 		udf_write_aext(inode, &oepos, &eloc, elen, 1);
 		udf_write_aext(inode, &oepos, &eloc, elen, 1);
 		if (!oepos.bh) {
@@ -2223,8 +2228,8 @@ int8_t udf_delete_aext(struct inode *inode, struct extent_position epos,
 		} else {
 			aed = (struct allocExtDesc *)oepos.bh->b_data;
 			le32_add_cpu(&aed->lengthAllocDescs, -(2 * adsize));
-			if (!UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_STRICT) ||
-			    UDF_SB(inode->i_sb)->s_udfrev >= 0x0201)
+			if (!UDF_QUERY_FLAG(inode_sb(inode), UDF_FLAG_STRICT) ||
+			    UDF_SB(inode_sb(inode))->s_udfrev >= 0x0201)
 				udf_update_tag(oepos.bh->b_data,
 						oepos.offset - (2 * adsize));
 			else
@@ -2240,8 +2245,8 @@ int8_t udf_delete_aext(struct inode *inode, struct extent_position epos,
 		} else {
 			aed = (struct allocExtDesc *)oepos.bh->b_data;
 			le32_add_cpu(&aed->lengthAllocDescs, -adsize);
-			if (!UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_STRICT) ||
-			    UDF_SB(inode->i_sb)->s_udfrev >= 0x0201)
+			if (!UDF_QUERY_FLAG(inode_sb(inode), UDF_FLAG_STRICT) ||
+			    UDF_SB(inode_sb(inode))->s_udfrev >= 0x0201)
 				udf_update_tag(oepos.bh->b_data,
 						epos.offset - adsize);
 			else
@@ -2261,7 +2266,7 @@ int8_t inode_bmap(struct inode *inode, sector_t block,
 		  struct extent_position *pos, struct kernel_lb_addr *eloc,
 		  uint32_t *elen, sector_t *offset)
 {
-	unsigned char blocksize_bits = inode->i_sb->s_blocksize_bits;
+	unsigned char blocksize_bits = inode_sb(inode)->s_blocksize_bits;
 	loff_t lbcount = 0, bcount = (loff_t) block << blocksize_bits;
 	int8_t etype;
 	struct udf_inode_info *iinfo;
@@ -2301,14 +2306,14 @@ udf_pblk_t udf_block_map(struct inode *inode, sector_t block)
 
 	if (inode_bmap(inode, block, &epos, &eloc, &elen, &offset) ==
 						(EXT_RECORDED_ALLOCATED >> 30))
-		ret = udf_get_lb_pblock(inode->i_sb, &eloc, offset);
+		ret = udf_get_lb_pblock(inode_sb(inode), &eloc, offset);
 	else
 		ret = 0;
 
 	up_read(&UDF_I(inode)->i_data_sem);
 	brelse(epos.bh);
 
-	if (UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_VARCONV))
+	if (UDF_QUERY_FLAG(inode_sb(inode), UDF_FLAG_VARCONV))
 		return udf_fixed_to_variable(ret);
 	else
 		return ret;
diff --git a/fs/udf/misc.c b/fs/udf/misc.c
index 401e64cde1be..9aaae9329f27 100644
--- a/fs/udf/misc.c
+++ b/fs/udf/misc.c
@@ -60,7 +60,7 @@ struct genericFormat *udf_add_extendedattr(struct inode *inode, uint32_t size,
 		size += sizeof(struct extendedAttrHeaderDesc);
 	}
 
-	offset = inode->i_sb->s_blocksize - udf_file_entry_alloc_offset(inode) -
+	offset = inode_sb(inode)->s_blocksize - udf_file_entry_alloc_offset(inode) -
 		iinfo->i_lenAlloc;
 
 	/* TODO - Check for FreeEASpace */
@@ -80,7 +80,7 @@ struct genericFormat *udf_add_extendedattr(struct inode *inode, uint32_t size,
 					iinfo->i_location.logicalBlockNum)
 				return NULL;
 		} else {
-			struct udf_sb_info *sbi = UDF_SB(inode->i_sb);
+			struct udf_sb_info *sbi = UDF_SB(inode_sb(inode));
 
 			size -= sizeof(struct extendedAttrHeaderDesc);
 			iinfo->i_lenEAttr +=
diff --git a/fs/udf/namei.c b/fs/udf/namei.c
index 0458dd47e105..a6bd6fa95d7d 100644
--- a/fs/udf/namei.c
+++ b/fs/udf/namei.c
@@ -178,7 +178,7 @@ static struct fileIdentDesc *udf_find_entry(struct inode *dir,
 	struct udf_inode_info *dinfo = UDF_I(dir);
 	int isdotdot = child->len == 2 &&
 		child->name[0] == '.' && child->name[1] == '.';
-	struct super_block *sb = dir->i_sb;
+	struct super_block *sb = inode_sb(dir);
 
 	size = udf_ext0_offset(dir) + dir->i_size;
 	f_pos = udf_ext0_offset(dir);
@@ -313,7 +313,7 @@ static struct dentry *udf_lookup(struct inode *dir, struct dentry *dentry,
 				simple_strtoul(dentry->d_name.name + 3,
 						NULL, 0),
 		};
-		inode = udf_iget(dir->i_sb, lb);
+		inode = udf_iget(inode_sb(dir), lb);
 		if (IS_ERR(inode))
 			return inode;
 	} else
@@ -331,7 +331,7 @@ static struct dentry *udf_lookup(struct inode *dir, struct dentry *dentry,
 		brelse(fibh.sbh);
 
 		loc = lelb_to_cpu(cfi.icb.extLocation);
-		inode = udf_iget(dir->i_sb, &loc);
+		inode = udf_iget(inode_sb(dir), &loc);
 		if (IS_ERR(inode))
 			return ERR_CAST(inode);
 	}
@@ -344,7 +344,7 @@ static struct fileIdentDesc *udf_add_entry(struct inode *dir,
 					   struct udf_fileident_bh *fibh,
 					   struct fileIdentDesc *cfi, int *err)
 {
-	struct super_block *sb = dir->i_sb;
+	struct super_block *sb = inode_sb(dir);
 	struct fileIdentDesc *fi = NULL;
 	unsigned char *name = NULL;
 	int namelen;
@@ -387,18 +387,18 @@ static struct fileIdentDesc *udf_add_entry(struct inode *dir,
 
 	f_pos = udf_ext0_offset(dir);
 
-	fibh->soffset = fibh->eoffset = f_pos & (dir->i_sb->s_blocksize - 1);
+	fibh->soffset = fibh->eoffset = f_pos & (inode_sb(dir)->s_blocksize - 1);
 	dinfo = UDF_I(dir);
 	if (dinfo->i_alloc_type != ICBTAG_FLAG_AD_IN_ICB) {
-		if (inode_bmap(dir, f_pos >> dir->i_sb->s_blocksize_bits, &epos,
-		    &eloc, &elen, &offset) != (EXT_RECORDED_ALLOCATED >> 30)) {
-			block = udf_get_lb_pblock(dir->i_sb,
-					&dinfo->i_location, 0);
+		if (inode_bmap(dir, f_pos >> inode_sb(dir)->s_blocksize_bits, &epos,
+			       &eloc, &elen, &offset) != (EXT_RECORDED_ALLOCATED >> 30)) {
+			block = udf_get_lb_pblock(inode_sb(dir),
+						  &dinfo->i_location, 0);
 			fibh->soffset = fibh->eoffset = sb->s_blocksize;
 			goto add;
 		}
-		block = udf_get_lb_pblock(dir->i_sb, &eloc, offset);
-		if ((++offset << dir->i_sb->s_blocksize_bits) < elen) {
+		block = udf_get_lb_pblock(inode_sb(dir), &eloc, offset);
+		if ((++offset << inode_sb(dir)->s_blocksize_bits) < elen) {
 			if (dinfo->i_alloc_type == ICBTAG_FLAG_AD_SHORT)
 				epos.offset -= sizeof(struct short_ad);
 			else if (dinfo->i_alloc_type == ICBTAG_FLAG_AD_LONG)
@@ -406,7 +406,7 @@ static struct fileIdentDesc *udf_add_entry(struct inode *dir,
 		} else
 			offset = 0;
 
-		fibh->sbh = fibh->ebh = udf_tread(dir->i_sb, block);
+		fibh->sbh = fibh->ebh = udf_tread(inode_sb(dir), block);
 		if (!fibh->sbh) {
 			*err = -EIO;
 			goto out_err;
@@ -488,7 +488,7 @@ static struct fileIdentDesc *udf_add_entry(struct inode *dir,
 		} else {
 			block = eloc.logicalBlockNum +
 					((elen - 1) >>
-						dir->i_sb->s_blocksize_bits);
+						inode_sb(dir)->s_blocksize_bits);
 			fi = (struct fileIdentDesc *)
 				(fibh->sbh->b_data + fibh->soffset);
 		}
@@ -511,9 +511,10 @@ static struct fileIdentDesc *udf_add_entry(struct inode *dir,
 		}
 
 		block = eloc.logicalBlockNum + ((elen - 1) >>
-						dir->i_sb->s_blocksize_bits);
+						inode_sb(dir)->s_blocksize_bits);
 		fibh->ebh = udf_bread(dir,
-				f_pos >> dir->i_sb->s_blocksize_bits, 1, err);
+				f_pos >> inode_sb(dir)->s_blocksize_bits, 1,
+				err);
 		if (!fibh->ebh)
 			goto out_err;
 		/* Extents could have been merged, invalidate our position */
@@ -528,7 +529,7 @@ static struct fileIdentDesc *udf_add_entry(struct inode *dir,
 				(EXT_RECORDED_ALLOCATED >> 30))
 				;
 			block = eloc.logicalBlockNum + ((elen - 1) >>
-					dir->i_sb->s_blocksize_bits);
+					inode_sb(dir)->s_blocksize_bits);
 			brelse(fibh->sbh);
 			fibh->sbh = fibh->ebh;
 			fi = (struct fileIdentDesc *)(fibh->sbh->b_data);
@@ -591,7 +592,7 @@ static int udf_delete_entry(struct inode *inode, struct fileIdentDesc *fi,
 {
 	cfi->fileCharacteristics |= FID_FILE_CHAR_DELETED;
 
-	if (UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_STRICT))
+	if (UDF_QUERY_FLAG(inode_sb(inode), UDF_FLAG_STRICT))
 		memset(&(cfi->icb), 0x00, sizeof(struct long_ad));
 
 	return udf_write_fi(inode, cfi, fi, fibh, NULL, NULL);
@@ -612,7 +613,7 @@ static int udf_add_nondir(struct dentry *dentry, struct inode *inode)
 		iput(inode);
 		return err;
 	}
-	cfi.icb.extLength = cpu_to_le32(inode->i_sb->s_blocksize);
+	cfi.icb.extLength = cpu_to_le32(inode_sb(inode)->s_blocksize);
 	cfi.icb.extLocation = cpu_to_lelb(iinfo->i_location);
 	*(__le32 *)((struct allocDescImpUse *)cfi.icb.impUse)->impUse =
 		cpu_to_le32(iinfo->i_unique & 0x00000000FFFFFFFFUL);
@@ -706,7 +707,7 @@ static int udf_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode)
 		goto out;
 	}
 	set_nlink(inode, 2);
-	cfi.icb.extLength = cpu_to_le32(inode->i_sb->s_blocksize);
+	cfi.icb.extLength = cpu_to_le32(inode_sb(inode)->s_blocksize);
 	cfi.icb.extLocation = cpu_to_lelb(dinfo->i_location);
 	*(__le32 *)((struct allocDescImpUse *)cfi.icb.impUse)->impUse =
 		cpu_to_le32(dinfo->i_unique & 0x00000000FFFFFFFFUL);
@@ -724,7 +725,7 @@ static int udf_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode)
 		iput(inode);
 		goto out;
 	}
-	cfi.icb.extLength = cpu_to_le32(inode->i_sb->s_blocksize);
+	cfi.icb.extLength = cpu_to_le32(inode_sb(inode)->s_blocksize);
 	cfi.icb.extLocation = cpu_to_lelb(iinfo->i_location);
 	*(__le32 *)((struct allocDescImpUse *)cfi.icb.impUse)->impUse =
 		cpu_to_le32(iinfo->i_unique & 0x00000000FFFFFFFFUL);
@@ -758,15 +759,15 @@ static int empty_dir(struct inode *dir)
 	struct udf_inode_info *dinfo = UDF_I(dir);
 
 	f_pos = udf_ext0_offset(dir);
-	fibh.soffset = fibh.eoffset = f_pos & (dir->i_sb->s_blocksize - 1);
+	fibh.soffset = fibh.eoffset = f_pos & (inode_sb(dir)->s_blocksize - 1);
 
 	if (dinfo->i_alloc_type == ICBTAG_FLAG_AD_IN_ICB)
 		fibh.sbh = fibh.ebh = NULL;
-	else if (inode_bmap(dir, f_pos >> dir->i_sb->s_blocksize_bits,
+	else if (inode_bmap(dir, f_pos >> inode_sb(dir)->s_blocksize_bits,
 			      &epos, &eloc, &elen, &offset) ==
 					(EXT_RECORDED_ALLOCATED >> 30)) {
-		block = udf_get_lb_pblock(dir->i_sb, &eloc, offset);
-		if ((++offset << dir->i_sb->s_blocksize_bits) < elen) {
+		block = udf_get_lb_pblock(inode_sb(dir), &eloc, offset);
+		if ((++offset << inode_sb(dir)->s_blocksize_bits) < elen) {
 			if (dinfo->i_alloc_type == ICBTAG_FLAG_AD_SHORT)
 				epos.offset -= sizeof(struct short_ad);
 			else if (dinfo->i_alloc_type == ICBTAG_FLAG_AD_LONG)
@@ -774,7 +775,7 @@ static int empty_dir(struct inode *dir)
 		} else
 			offset = 0;
 
-		fibh.sbh = fibh.ebh = udf_tread(dir->i_sb, block);
+		fibh.sbh = fibh.ebh = udf_tread(inode_sb(dir), block);
 		if (!fibh.sbh) {
 			brelse(epos.bh);
 			return 0;
@@ -831,7 +832,7 @@ static int udf_rmdir(struct inode *dir, struct dentry *dentry)
 
 	retval = -EIO;
 	tloc = lelb_to_cpu(cfi.icb.extLocation);
-	if (udf_get_lb_pblock(dir->i_sb, &tloc, 0) != inode->i_ino)
+	if (udf_get_lb_pblock(inode_sb(dir), &tloc, 0) != inode->i_ino)
 		goto end_rmdir;
 	retval = -ENOTEMPTY;
 	if (!empty_dir(inode))
@@ -840,7 +841,8 @@ static int udf_rmdir(struct inode *dir, struct dentry *dentry)
 	if (retval)
 		goto end_rmdir;
 	if (inode->i_nlink != 2)
-		udf_warn(inode->i_sb, "empty directory has nlink != 2 (%u)\n",
+		udf_warn(inode_sb(inode),
+			 "empty directory has nlink != 2 (%u)\n",
 			 inode->i_nlink);
 	clear_nlink(inode);
 	inode->i_size = 0;
@@ -878,7 +880,7 @@ static int udf_unlink(struct inode *dir, struct dentry *dentry)
 
 	retval = -EIO;
 	tloc = lelb_to_cpu(cfi.icb.extLocation);
-	if (udf_get_lb_pblock(dir->i_sb, &tloc, 0) != inode->i_ino)
+	if (udf_get_lb_pblock(inode_sb(dir), &tloc, 0) != inode->i_ino)
 		goto end_unlink;
 
 	if (!inode->i_nlink) {
@@ -918,7 +920,7 @@ static int udf_symlink(struct inode *dir, struct dentry *dentry,
 	unsigned char *name = NULL;
 	int namelen;
 	struct udf_inode_info *iinfo;
-	struct super_block *sb = dir->i_sb;
+	struct super_block *sb = inode_sb(dir);
 
 	if (IS_ERR(inode))
 		return PTR_ERR(inode);
@@ -1066,11 +1068,11 @@ static int udf_link(struct dentry *old_dentry, struct inode *dir,
 	if (!fi) {
 		return err;
 	}
-	cfi.icb.extLength = cpu_to_le32(inode->i_sb->s_blocksize);
+	cfi.icb.extLength = cpu_to_le32(inode_sb(inode)->s_blocksize);
 	cfi.icb.extLocation = cpu_to_lelb(UDF_I(inode)->i_location);
-	if (UDF_SB(inode->i_sb)->s_lvid_bh) {
+	if (UDF_SB(inode_sb(inode))->s_lvid_bh) {
 		*(__le32 *)((struct allocDescImpUse *)cfi.icb.impUse)->impUse =
-			cpu_to_le32(lvid_get_unique_id(inode->i_sb));
+			cpu_to_le32(lvid_get_unique_id(inode_sb(inode)));
 	}
 	udf_write_fi(dir, &cfi, fi, &fibh, NULL, NULL);
 	if (UDF_I(dir)->i_alloc_type == ICBTAG_FLAG_AD_IN_ICB)
@@ -1121,7 +1123,7 @@ static int udf_rename(struct inode *old_dir, struct dentry *old_dentry,
 
 	brelse(ofibh.sbh);
 	tloc = lelb_to_cpu(ocfi.icb.extLocation);
-	if (!ofi || udf_get_lb_pblock(old_dir->i_sb, &tloc, 0)
+	if (!ofi || udf_get_lb_pblock(inode_sb(old_dir), &tloc, 0)
 	    != old_inode->i_ino)
 		goto end_rename;
 
@@ -1151,18 +1153,20 @@ static int udf_rename(struct inode *old_dir, struct dentry *old_dentry,
 					  (old_iinfo->i_efe ?
 					   sizeof(struct extendedFileEntry) :
 					   sizeof(struct fileEntry)),
-					old_inode->i_sb->s_blocksize, &offset);
+					inode_sb(old_inode)->s_blocksize,
+					&offset);
 		} else {
 			dir_bh = udf_bread(old_inode, 0, 0, &retval);
 			if (!dir_bh)
 				goto end_rename;
 			dir_fi = udf_get_fileident(dir_bh->b_data,
-					old_inode->i_sb->s_blocksize, &offset);
+					inode_sb(old_inode)->s_blocksize,
+					&offset);
 		}
 		if (!dir_fi)
 			goto end_rename;
 		tloc = lelb_to_cpu(dir_fi->icb.extLocation);
-		if (udf_get_lb_pblock(old_inode->i_sb, &tloc, 0) !=
+		if (udf_get_lb_pblock(inode_sb(old_inode), &tloc, 0) !=
 				old_dir->i_ino)
 			goto end_rename;
 	}
diff --git a/fs/udf/partition.c b/fs/udf/partition.c
index 090baff83990..ed7e8a9503da 100644
--- a/fs/udf/partition.c
+++ b/fs/udf/partition.c
@@ -280,7 +280,7 @@ int udf_relocate_blocks(struct super_block *sb, long old_block, long *new_block)
 static uint32_t udf_try_read_meta(struct inode *inode, uint32_t block,
 					uint16_t partition, uint32_t offset)
 {
-	struct super_block *sb = inode->i_sb;
+	struct super_block *sb = inode_sb(inode);
 	struct udf_part_map *map;
 	struct kernel_lb_addr eloc;
 	uint32_t elen;
diff --git a/fs/udf/super.c b/fs/udf/super.c
index f73239a9a97d..41f42951126a 100644
--- a/fs/udf/super.c
+++ b/fs/udf/super.c
@@ -2451,7 +2451,7 @@ static unsigned int udf_count_free_table(struct super_block *sb,
 	epos.bh = NULL;
 
 	while ((etype = udf_next_aext(table, &epos, &eloc, &elen, 1)) != -1)
-		accum += (elen >> table->i_sb->s_blocksize_bits);
+		accum += (elen >> inode_sb(table)->s_blocksize_bits);
 
 	brelse(epos.bh);
 	mutex_unlock(&UDF_SB(sb)->s_alloc_mutex);
diff --git a/fs/udf/symlink.c b/fs/udf/symlink.c
index 6023c97c6da2..22b521053b5d 100644
--- a/fs/udf/symlink.c
+++ b/fs/udf/symlink.c
@@ -112,7 +112,7 @@ static int udf_symlink_filler(struct file *file, struct page *page)
 	uint32_t pos;
 
 	/* We don't support symlinks longer than one block */
-	if (inode->i_size > inode->i_sb->s_blocksize) {
+	if (inode->i_size > inode_sb(inode)->s_blocksize) {
 		err = -ENAMETOOLONG;
 		goto out_unmap;
 	}
@@ -124,7 +124,7 @@ static int udf_symlink_filler(struct file *file, struct page *page)
 	if (iinfo->i_alloc_type == ICBTAG_FLAG_AD_IN_ICB) {
 		symlink = iinfo->i_ext.i_data + iinfo->i_lenEAttr;
 	} else {
-		bh = sb_bread(inode->i_sb, pos);
+		bh = sb_bread(inode_sb(inode), pos);
 
 		if (!bh) {
 			err = -EIO;
@@ -134,7 +134,8 @@ static int udf_symlink_filler(struct file *file, struct page *page)
 		symlink = bh->b_data;
 	}
 
-	err = udf_pc_to_char(inode->i_sb, symlink, inode->i_size, p, PAGE_SIZE);
+	err = udf_pc_to_char(inode_sb(inode), symlink, inode->i_size, p,
+			     PAGE_SIZE);
 	brelse(bh);
 	if (err)
 		goto out_unlock_inode;
diff --git a/fs/udf/truncate.c b/fs/udf/truncate.c
index b647f0bd150c..cbb31c433908 100644
--- a/fs/udf/truncate.c
+++ b/fs/udf/truncate.c
@@ -31,14 +31,14 @@ static void extent_trunc(struct inode *inode, struct extent_position *epos,
 			 uint32_t nelen)
 {
 	struct kernel_lb_addr neloc = {};
-	int last_block = (elen + inode->i_sb->s_blocksize - 1) >>
-		inode->i_sb->s_blocksize_bits;
-	int first_block = (nelen + inode->i_sb->s_blocksize - 1) >>
-		inode->i_sb->s_blocksize_bits;
+	int last_block = (elen + inode_sb(inode)->s_blocksize - 1) >>
+		inode_sb(inode)->s_blocksize_bits;
+	int first_block = (nelen + inode_sb(inode)->s_blocksize - 1) >>
+		inode_sb(inode)->s_blocksize_bits;
 
 	if (nelen) {
 		if (etype == (EXT_NOT_RECORDED_ALLOCATED >> 30)) {
-			udf_free_blocks(inode->i_sb, inode, eloc, 0,
+			udf_free_blocks(inode_sb(inode), inode, eloc, 0,
 					last_block);
 			etype = (EXT_NOT_RECORDED_NOT_ALLOCATED >> 30);
 		} else
@@ -53,7 +53,7 @@ static void extent_trunc(struct inode *inode, struct extent_position *epos,
 				mark_inode_dirty(inode);
 
 			if (etype != (EXT_NOT_RECORDED_NOT_ALLOCATED >> 30))
-				udf_free_blocks(inode->i_sb, inode, eloc,
+				udf_free_blocks(inode_sb(inode), inode, eloc,
 						first_block,
 						last_block - first_block);
 		}
@@ -93,8 +93,8 @@ void udf_truncate_tail_extent(struct inode *inode)
 		etype = netype;
 		lbcount += elen;
 		if (lbcount > inode->i_size) {
-			if (lbcount - inode->i_size >= inode->i_sb->s_blocksize)
-				udf_warn(inode->i_sb,
+			if (lbcount - inode->i_size >= inode_sb(inode)->s_blocksize)
+				udf_warn(inode_sb(inode),
 					 "Too long extent after EOF in inode %u: i_size: %lld lbcount: %lld extent %u+%u\n",
 					 (unsigned)inode->i_ino,
 					 (long long)inode->i_size,
@@ -106,7 +106,7 @@ void udf_truncate_tail_extent(struct inode *inode)
 			extent_trunc(inode, &epos, &eloc, etype, elen, nelen);
 			epos.offset += adsize;
 			if (udf_next_aext(inode, &epos, &eloc, &elen, 1) != -1)
-				udf_err(inode->i_sb,
+				udf_err(inode_sb(inode),
 					"Extent after EOF in inode %u\n",
 					(unsigned)inode->i_ino);
 			break;
@@ -161,8 +161,8 @@ void udf_discard_prealloc(struct inode *inode)
 			aed->lengthAllocDescs =
 				cpu_to_le32(epos.offset -
 					    sizeof(struct allocExtDesc));
-			if (!UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_STRICT) ||
-			    UDF_SB(inode->i_sb)->s_udfrev >= 0x0201)
+			if (!UDF_QUERY_FLAG(inode_sb(inode), UDF_FLAG_STRICT) ||
+			    UDF_SB(inode_sb(inode))->s_udfrev >= 0x0201)
 				udf_update_tag(epos.bh->b_data, epos.offset);
 			else
 				udf_update_tag(epos.bh->b_data,
@@ -180,7 +180,7 @@ static void udf_update_alloc_ext_desc(struct inode *inode,
 				      struct extent_position *epos,
 				      u32 lenalloc)
 {
-	struct super_block *sb = inode->i_sb;
+	struct super_block *sb = inode_sb(inode);
 	struct udf_sb_info *sbi = UDF_SB(sb);
 
 	struct allocExtDesc *aed = (struct allocExtDesc *) (epos->bh->b_data);
@@ -205,7 +205,7 @@ void udf_truncate_extents(struct inode *inode)
 	struct kernel_lb_addr eloc, neloc = {};
 	uint32_t elen, nelen = 0, indirect_ext_len = 0, lenalloc;
 	int8_t etype;
-	struct super_block *sb = inode->i_sb;
+	struct super_block *sb = inode_sb(inode);
 	sector_t first_block = inode->i_size >> sb->s_blocksize_bits, offset;
 	loff_t byte_offset;
 	int adsize;
-- 
2.15.1

^ permalink raw reply related	[flat|nested] 88+ messages in thread

* [PATCH 71/76] fs/ufs: Use inode_sb() helper instead of inode->i_sb
  2018-05-08 18:03 [RFC][PATCH 0/76] vfs: 'views' for filesystems with more than one root Mark Fasheh
                   ` (69 preceding siblings ...)
  2018-05-08 18:04 ` [PATCH 70/76] fs/udf: " Mark Fasheh
@ 2018-05-08 18:04 ` Mark Fasheh
  2018-05-08 18:04 ` [PATCH 72/76] fs/xfs: " Mark Fasheh
                   ` (5 subsequent siblings)
  76 siblings, 0 replies; 88+ messages in thread
From: Mark Fasheh @ 2018-05-08 18:04 UTC (permalink / raw)
  To: linux-fsdevel; +Cc: linux-kernel, linux-btrfs, Mark Fasheh

Signed-off-by: Mark Fasheh <mfasheh@suse.de>
---
 fs/ufs/balloc.c | 23 ++++++++++++-----------
 fs/ufs/dir.c    | 34 +++++++++++++++++-----------------
 fs/ufs/ialloc.c |  4 ++--
 fs/ufs/inode.c  | 37 +++++++++++++++++++------------------
 fs/ufs/namei.c  |  6 +++---
 5 files changed, 53 insertions(+), 51 deletions(-)

diff --git a/fs/ufs/balloc.c b/fs/ufs/balloc.c
index e727ee07dbe4..b6053d9c0e64 100644
--- a/fs/ufs/balloc.c
+++ b/fs/ufs/balloc.c
@@ -45,7 +45,7 @@ void ufs_free_fragments(struct inode *inode, u64 fragment, unsigned count)
 	unsigned cgno, bit, end_bit, bbase, blkmap, i;
 	u64 blkno;
 	
-	sb = inode->i_sb;
+	sb = inode_sb(inode);
 	uspi = UFS_SB(sb)->s_uspi;
 	
 	UFSD("ENTER, fragment %llu, count %u\n",
@@ -141,7 +141,7 @@ void ufs_free_blocks(struct inode *inode, u64 fragment, unsigned count)
 	unsigned overflow, cgno, bit, end_bit, i;
 	u64 blkno;
 	
-	sb = inode->i_sb;
+	sb = inode_sb(inode);
 	uspi = UFS_SB(sb)->s_uspi;
 
 	UFSD("ENTER, fragment %llu, count %u\n",
@@ -268,7 +268,7 @@ static void ufs_change_blocknr(struct inode *inode, sector_t beg,
 			if (!page)/* it was truncated */
 				continue;
 			if (IS_ERR(page)) {/* or EIO */
-				ufs_error(inode->i_sb, __func__,
+				ufs_error(inode_sb(inode), __func__,
 					  "read of page %llu failed\n",
 					  (unsigned long long)index);
 				continue;
@@ -294,12 +294,13 @@ static void ufs_change_blocknr(struct inode *inode, sector_t beg,
 			pos = (i - beg) + j;
 
 			if (!buffer_mapped(bh))
-					map_bh(bh, inode->i_sb, oldb + pos);
+					map_bh(bh, inode_sb(inode),
+					       oldb + pos);
 			if (!buffer_uptodate(bh)) {
 				ll_rw_block(REQ_OP_READ, 0, 1, &bh);
 				wait_on_buffer(bh);
 				if (!buffer_uptodate(bh)) {
-					ufs_error(inode->i_sb, __func__,
+					ufs_error(inode_sb(inode), __func__,
 						  "read of block failed\n");
 					break;
 				}
@@ -329,9 +330,9 @@ static void ufs_clear_frags(struct inode *inode, sector_t beg, unsigned int n,
 	sector_t end = beg + n;
 
 	for (; beg < end; ++beg) {
-		bh = sb_getblk(inode->i_sb, beg);
+		bh = sb_getblk(inode_sb(inode), beg);
 		lock_buffer(bh);
-		memset(bh->b_data, 0, inode->i_sb->s_blocksize);
+		memset(bh->b_data, 0, inode_sb(inode)->s_blocksize);
 		set_buffer_uptodate(bh);
 		mark_buffer_dirty(bh);
 		unlock_buffer(bh);
@@ -355,7 +356,7 @@ u64 ufs_new_fragments(struct inode *inode, void *p, u64 fragment,
 	     inode->i_ino, (unsigned long long)fragment,
 	     (unsigned long long)goal, count);
 	
-	sb = inode->i_sb;
+	sb = inode_sb(inode);
 	uspi = UFS_SB(sb)->s_uspi;
 	usb1 = ubh_get_usb_first(uspi);
 	*err = -ENOSPC;
@@ -517,7 +518,7 @@ static u64 ufs_add_fragments(struct inode *inode, u64 fragment,
 	UFSD("ENTER, fragment %llu, oldcount %u, newcount %u\n",
 	     (unsigned long long)fragment, oldcount, newcount);
 	
-	sb = inode->i_sb;
+	sb = inode_sb(inode);
 	uspi = UFS_SB(sb)->s_uspi;
 	count = newcount - oldcount;
 	
@@ -597,7 +598,7 @@ static u64 ufs_alloc_fragments(struct inode *inode, unsigned cgno,
 	UFSD("ENTER, ino %lu, cgno %u, goal %llu, count %u\n",
 	     inode->i_ino, cgno, (unsigned long long)goal, count);
 
-	sb = inode->i_sb;
+	sb = inode_sb(inode);
 	uspi = UFS_SB(sb)->s_uspi;
 	oldcg = cgno;
 	
@@ -708,7 +709,7 @@ static u64 ufs_alloccg_block(struct inode *inode,
 
 	UFSD("ENTER, goal %llu\n", (unsigned long long)goal);
 
-	sb = inode->i_sb;
+	sb = inode_sb(inode);
 	uspi = UFS_SB(sb)->s_uspi;
 	ucg = ubh_get_ucg(UCPI_UBH(ucpi));
 
diff --git a/fs/ufs/dir.c b/fs/ufs/dir.c
index b721d0bda5e5..ebe0ddc8b708 100644
--- a/fs/ufs/dir.c
+++ b/fs/ufs/dir.c
@@ -75,7 +75,7 @@ ino_t ufs_inode_by_name(struct inode *dir, const struct qstr *qstr)
 	
 	de = ufs_find_entry(dir, qstr, &page);
 	if (de) {
-		res = fs32_to_cpu(dir->i_sb, de->d_ino);
+		res = fs32_to_cpu(inode_sb(dir), de->d_ino);
 		ufs_put_page(page);
 	}
 	return res;
@@ -89,15 +89,15 @@ void ufs_set_link(struct inode *dir, struct ufs_dir_entry *de,
 {
 	loff_t pos = page_offset(page) +
 			(char *) de - (char *) page_address(page);
-	unsigned len = fs16_to_cpu(dir->i_sb, de->d_reclen);
+	unsigned len = fs16_to_cpu(inode_sb(dir), de->d_reclen);
 	int err;
 
 	lock_page(page);
 	err = ufs_prepare_chunk(page, pos, len);
 	BUG_ON(err);
 
-	de->d_ino = cpu_to_fs32(dir->i_sb, inode->i_ino);
-	ufs_set_de_type(dir->i_sb, de, inode->i_mode);
+	de->d_ino = cpu_to_fs32(inode_sb(dir), inode->i_ino);
+	ufs_set_de_type(inode_sb(dir), de, inode->i_mode);
 
 	err = ufs_commit_chunk(page, pos, len);
 	ufs_put_page(page);
@@ -110,7 +110,7 @@ void ufs_set_link(struct inode *dir, struct ufs_dir_entry *de,
 static bool ufs_check_page(struct page *page)
 {
 	struct inode *dir = page->mapping->host;
-	struct super_block *sb = dir->i_sb;
+	struct super_block *sb = inode_sb(dir);
 	char *kaddr = page_address(page);
 	unsigned offs, rec_len;
 	unsigned limit = PAGE_SIZE;
@@ -232,7 +232,7 @@ struct ufs_dir_entry *ufs_dotdot(struct inode *dir, struct page **p)
 	struct ufs_dir_entry *de = NULL;
 
 	if (!IS_ERR(page)) {
-		de = ufs_next_entry(dir->i_sb,
+		de = ufs_next_entry(inode_sb(dir),
 				    (struct ufs_dir_entry *)page_address(page));
 		*p = page;
 	}
@@ -250,7 +250,7 @@ struct ufs_dir_entry *ufs_dotdot(struct inode *dir, struct page **p)
 struct ufs_dir_entry *ufs_find_entry(struct inode *dir, const struct qstr *qstr,
 				     struct page **res_page)
 {
-	struct super_block *sb = dir->i_sb;
+	struct super_block *sb = inode_sb(dir);
 	const unsigned char *name = qstr->name;
 	int namelen = qstr->len;
 	unsigned reclen = UFS_DIR_REC_LEN(namelen);
@@ -307,7 +307,7 @@ int ufs_add_link(struct dentry *dentry, struct inode *inode)
 	struct inode *dir = d_inode(dentry->d_parent);
 	const unsigned char *name = dentry->d_name.name;
 	int namelen = dentry->d_name.len;
-	struct super_block *sb = dir->i_sb;
+	struct super_block *sb = inode_sb(dir);
 	unsigned reclen = UFS_DIR_REC_LEN(namelen);
 	const unsigned int chunk_size = UFS_SB(sb)->s_uspi->s_dirblksize;
 	unsigned short rec_len, name_len;
@@ -348,7 +348,7 @@ int ufs_add_link(struct dentry *dentry, struct inode *inode)
 				goto got_it;
 			}
 			if (de->d_reclen == 0) {
-				ufs_error(dir->i_sb, __func__,
+				ufs_error(inode_sb(dir), __func__,
 					  "zero-length directory entry");
 				err = -EIO;
 				goto out_unlock;
@@ -424,7 +424,7 @@ ufs_readdir(struct file *file, struct dir_context *ctx)
 {
 	loff_t pos = ctx->pos;
 	struct inode *inode = file_inode(file);
-	struct super_block *sb = inode->i_sb;
+	struct super_block *sb = inode_sb(inode);
 	unsigned int offset = pos & ~PAGE_MASK;
 	unsigned long n = pos >> PAGE_SHIFT;
 	unsigned long npages = dir_pages(inode);
@@ -495,7 +495,7 @@ ufs_readdir(struct file *file, struct dir_context *ctx)
 int ufs_delete_entry(struct inode *inode, struct ufs_dir_entry *dir,
 		     struct page * page)
 {
-	struct super_block *sb = inode->i_sb;
+	struct super_block *sb = inode_sb(inode);
 	char *kaddr = page_address(page);
 	unsigned from = ((char*)dir - kaddr) & ~(UFS_SB(sb)->s_uspi->s_dirblksize - 1);
 	unsigned to = ((char*)dir - kaddr) + fs16_to_cpu(sb, dir->d_reclen);
@@ -513,7 +513,7 @@ int ufs_delete_entry(struct inode *inode, struct ufs_dir_entry *dir,
 
 	while ((char*)de < (char*)dir) {
 		if (de->d_reclen == 0) {
-			ufs_error(inode->i_sb, __func__,
+			ufs_error(inode_sb(inode), __func__,
 				  "zero-length directory entry");
 			err = -EIO;
 			goto out;
@@ -542,7 +542,7 @@ int ufs_delete_entry(struct inode *inode, struct ufs_dir_entry *dir,
 
 int ufs_make_empty(struct inode * inode, struct inode *dir)
 {
-	struct super_block * sb = dir->i_sb;
+	struct super_block * sb = inode_sb(dir);
 	struct address_space *mapping = inode->i_mapping;
 	struct page *page = grab_cache_page(mapping, 0);
 	const unsigned int chunk_size = UFS_SB(sb)->s_uspi->s_dirblksize;
@@ -590,7 +590,7 @@ int ufs_make_empty(struct inode * inode, struct inode *dir)
  */
 int ufs_empty_dir(struct inode * inode)
 {
-	struct super_block *sb = inode->i_sb;
+	struct super_block *sb = inode_sb(inode);
 	struct page *page = NULL;
 	unsigned long i, npages = dir_pages(inode);
 
@@ -608,9 +608,9 @@ int ufs_empty_dir(struct inode * inode)
 
 		while ((char *)de <= kaddr) {
 			if (de->d_reclen == 0) {
-				ufs_error(inode->i_sb, __func__,
-					"zero-length directory entry: "
-					"kaddr=%p, de=%p\n", kaddr, de);
+				ufs_error(inode_sb(inode), __func__,
+					  "zero-length directory entry: "
+					  "kaddr=%p, de=%p\n", kaddr, de);
 				goto not_empty;
 			}
 			if (de->d_ino) {
diff --git a/fs/ufs/ialloc.c b/fs/ufs/ialloc.c
index e1ef0f0a1353..077fb36d5f3e 100644
--- a/fs/ufs/ialloc.c
+++ b/fs/ufs/ialloc.c
@@ -65,7 +65,7 @@ void ufs_free_inode (struct inode * inode)
 	
 	UFSD("ENTER, ino %lu\n", inode->i_ino);
 
-	sb = inode->i_sb;
+	sb = inode_sb(inode);
 	uspi = UFS_SB(sb)->s_uspi;
 	
 	ino = inode->i_ino;
@@ -187,7 +187,7 @@ struct inode *ufs_new_inode(struct inode *dir, umode_t mode)
 	/* Cannot create files in a deleted directory */
 	if (!dir || !dir->i_nlink)
 		return ERR_PTR(-EPERM);
-	sb = dir->i_sb;
+	sb = inode_sb(dir);
 	inode = new_inode(sb);
 	if (!inode)
 		return ERR_PTR(-ENOMEM);
diff --git a/fs/ufs/inode.c b/fs/ufs/inode.c
index c843ec858cf7..eb606975737e 100644
--- a/fs/ufs/inode.c
+++ b/fs/ufs/inode.c
@@ -45,7 +45,7 @@
 
 static int ufs_block_to_path(struct inode *inode, sector_t i_block, unsigned offsets[4])
 {
-	struct ufs_sb_private_info *uspi = UFS_SB(inode->i_sb)->s_uspi;
+	struct ufs_sb_private_info *uspi = UFS_SB(inode_sb(inode))->s_uspi;
 	int ptrs = uspi->s_apb;
 	int ptrs_bits = uspi->s_apbshift;
 	const long direct_blocks = UFS_NDADDR,
@@ -70,7 +70,8 @@ static int ufs_block_to_path(struct inode *inode, sector_t i_block, unsigned off
 		offsets[n++] = (i_block >> ptrs_bits) & (ptrs - 1);
 		offsets[n++] = i_block & (ptrs - 1);
 	} else {
-		ufs_warning(inode->i_sb, "ufs_block_to_path", "block > big");
+		ufs_warning(inode_sb(inode), "ufs_block_to_path",
+			    "block > big");
 	}
 	return n;
 }
@@ -124,7 +125,7 @@ static inline int grow_chain64(struct ufs_inode_info *ufsi,
 static u64 ufs_frag_map(struct inode *inode, unsigned offsets[4], int depth)
 {
 	struct ufs_inode_info *ufsi = UFS_I(inode);
-	struct super_block *sb = inode->i_sb;
+	struct super_block *sb = inode_sb(inode);
 	struct ufs_sb_private_info *uspi = UFS_SB(sb)->s_uspi;
 	u64 mask = (u64) uspi->s_apbmask>>uspi->s_fpbshift;
 	int shift = uspi->s_apbshift-uspi->s_fpbshift;
@@ -222,7 +223,7 @@ ufs_extend_tail(struct inode *inode, u64 writes_to,
 		  int *err, struct page *locked_page)
 {
 	struct ufs_inode_info *ufsi = UFS_I(inode);
-	struct super_block *sb = inode->i_sb;
+	struct super_block *sb = inode_sb(inode);
 	struct ufs_sb_private_info *uspi = UFS_SB(sb)->s_uspi;
 	unsigned lastfrag = ufsi->i_lastfrag;	/* it's a short file, so unsigned is enough */
 	unsigned block = ufs_fragstoblks(lastfrag);
@@ -257,7 +258,7 @@ ufs_inode_getfrag(struct inode *inode, unsigned index,
 		  int *new, struct page *locked_page)
 {
 	struct ufs_inode_info *ufsi = UFS_I(inode);
-	struct super_block *sb = inode->i_sb;
+	struct super_block *sb = inode_sb(inode);
 	struct ufs_sb_private_info *uspi = UFS_SB(sb)->s_uspi;
 	u64 tmp, goal, lastfrag;
 	unsigned nfrags = uspi->s_fpb;
@@ -335,7 +336,7 @@ ufs_inode_getblock(struct inode *inode, u64 ind_block,
 		  unsigned index, sector_t new_fragment, int *err,
 		  int *new, struct page *locked_page)
 {
-	struct super_block *sb = inode->i_sb;
+	struct super_block *sb = inode_sb(inode);
 	struct ufs_sb_private_info *uspi = UFS_SB(sb)->s_uspi;
 	int shift = uspi->s_apbshift - uspi->s_fpbshift;
 	u64 tmp = 0, goal;
@@ -395,7 +396,7 @@ ufs_inode_getblock(struct inode *inode, u64 ind_block,
 
 static int ufs_getfrag_block(struct inode *inode, sector_t fragment, struct buffer_head *bh_result, int create)
 {
-	struct super_block *sb = inode->i_sb;
+	struct super_block *sb = inode_sb(inode);
 	struct ufs_sb_private_info *uspi = UFS_SB(sb)->s_uspi;
 	int err = 0, new = 0;
 	unsigned offsets[4];
@@ -554,13 +555,13 @@ static void ufs_set_inode_ops(struct inode *inode)
 		}
 	} else
 		init_special_inode(inode, inode->i_mode,
-				   ufs_get_inode_dev(inode->i_sb, UFS_I(inode)));
+				   ufs_get_inode_dev(inode_sb(inode), UFS_I(inode)));
 }
 
 static int ufs1_read_inode(struct inode *inode, struct ufs_inode *ufs_inode)
 {
 	struct ufs_inode_info *ufsi = UFS_I(inode);
-	struct super_block *sb = inode->i_sb;
+	struct super_block *sb = inode_sb(inode);
 	umode_t mode;
 
 	/*
@@ -605,7 +606,7 @@ static int ufs1_read_inode(struct inode *inode, struct ufs_inode *ufs_inode)
 static int ufs2_read_inode(struct inode *inode, struct ufs2_inode *ufs2_inode)
 {
 	struct ufs_inode_info *ufsi = UFS_I(inode);
-	struct super_block *sb = inode->i_sb;
+	struct super_block *sb = inode_sb(inode);
 	umode_t mode;
 
 	UFSD("Reading ufs2 inode, ino %lu\n", inode->i_ino);
@@ -713,7 +714,7 @@ struct inode *ufs_iget(struct super_block *sb, unsigned long ino)
 
 static void ufs1_update_inode(struct inode *inode, struct ufs_inode *ufs_inode)
 {
-	struct super_block *sb = inode->i_sb;
+	struct super_block *sb = inode_sb(inode);
  	struct ufs_inode_info *ufsi = UFS_I(inode);
 
 	ufs_inode->ui_mode = cpu_to_fs16(sb, inode->i_mode);
@@ -756,7 +757,7 @@ static void ufs1_update_inode(struct inode *inode, struct ufs_inode *ufs_inode)
 
 static void ufs2_update_inode(struct inode *inode, struct ufs2_inode *ufs_inode)
 {
-	struct super_block *sb = inode->i_sb;
+	struct super_block *sb = inode_sb(inode);
  	struct ufs_inode_info *ufsi = UFS_I(inode);
 
 	UFSD("ENTER\n");
@@ -796,7 +797,7 @@ static void ufs2_update_inode(struct inode *inode, struct ufs2_inode *ufs_inode)
 
 static int ufs_update_inode(struct inode * inode, int do_sync)
 {
-	struct super_block *sb = inode->i_sb;
+	struct super_block *sb = inode_sb(inode);
 	struct ufs_sb_private_info *uspi = UFS_SB(sb)->s_uspi;
 	struct buffer_head * bh;
 
@@ -897,7 +898,7 @@ static void ufs_trunc_direct(struct inode *inode)
 
 	UFSD("ENTER: ino %lu\n", inode->i_ino);
 
-	sb = inode->i_sb;
+	sb = inode_sb(inode);
 	uspi = UFS_SB(sb)->s_uspi;
 
 	frag1 = DIRECT_FRAGMENT;
@@ -975,7 +976,7 @@ static void ufs_trunc_direct(struct inode *inode)
 
 static void free_full_branch(struct inode *inode, u64 ind_block, int depth)
 {
-	struct super_block *sb = inode->i_sb;
+	struct super_block *sb = inode_sb(inode);
 	struct ufs_sb_private_info *uspi = UFS_SB(sb)->s_uspi;
 	struct ufs_buffer_head *ubh = ubh_bread(sb, ind_block, uspi->s_bsize);
 	unsigned i;
@@ -1008,7 +1009,7 @@ static void free_full_branch(struct inode *inode, u64 ind_block, int depth)
 
 static void free_branch_tail(struct inode *inode, unsigned from, struct ufs_buffer_head *ubh, int depth)
 {
-	struct super_block *sb = inode->i_sb;
+	struct super_block *sb = inode_sb(inode);
 	struct ufs_sb_private_info *uspi = UFS_SB(sb)->s_uspi;
 	unsigned i;
 
@@ -1048,7 +1049,7 @@ static void free_branch_tail(struct inode *inode, unsigned from, struct ufs_buff
 static int ufs_alloc_lastblock(struct inode *inode, loff_t size)
 {
 	int err = 0;
-	struct super_block *sb = inode->i_sb;
+	struct super_block *sb = inode_sb(inode);
 	struct address_space *mapping = inode->i_mapping;
 	struct ufs_sb_private_info *uspi = UFS_SB(sb)->s_uspi;
 	unsigned i, end;
@@ -1117,7 +1118,7 @@ static int ufs_alloc_lastblock(struct inode *inode, loff_t size)
 static void ufs_truncate_blocks(struct inode *inode)
 {
 	struct ufs_inode_info *ufsi = UFS_I(inode);
-	struct super_block *sb = inode->i_sb;
+	struct super_block *sb = inode_sb(inode);
 	struct ufs_sb_private_info *uspi = UFS_SB(sb)->s_uspi;
 	unsigned offsets[4];
 	int depth;
diff --git a/fs/ufs/namei.c b/fs/ufs/namei.c
index 32545cd00ceb..4a672aca7f53 100644
--- a/fs/ufs/namei.c
+++ b/fs/ufs/namei.c
@@ -59,7 +59,7 @@ static struct dentry *ufs_lookup(struct inode * dir, struct dentry *dentry, unsi
 
 	ino = ufs_inode_by_name(dir, &dentry->d_name);
 	if (ino)
-		inode = ufs_iget(dir->i_sb, ino);
+		inode = ufs_iget(inode_sb(dir), ino);
 	return d_splice_alias(inode, dentry);
 }
 
@@ -99,7 +99,7 @@ static int ufs_mknod(struct inode *dir, struct dentry *dentry, umode_t mode, dev
 	err = PTR_ERR(inode);
 	if (!IS_ERR(inode)) {
 		init_special_inode(inode, mode, rdev);
-		ufs_set_inode_dev(inode->i_sb, UFS_I(inode), rdev);
+		ufs_set_inode_dev(inode_sb(inode), UFS_I(inode), rdev);
 		mark_inode_dirty(inode);
 		err = ufs_add_nondir(dentry, inode);
 	}
@@ -109,7 +109,7 @@ static int ufs_mknod(struct inode *dir, struct dentry *dentry, umode_t mode, dev
 static int ufs_symlink (struct inode * dir, struct dentry * dentry,
 	const char * symname)
 {
-	struct super_block * sb = dir->i_sb;
+	struct super_block * sb = inode_sb(dir);
 	int err;
 	unsigned l = strlen(symname)+1;
 	struct inode * inode;
-- 
2.15.1

^ permalink raw reply related	[flat|nested] 88+ messages in thread

* [PATCH 72/76] fs/xfs: Use inode_sb() helper instead of inode->i_sb
  2018-05-08 18:03 [RFC][PATCH 0/76] vfs: 'views' for filesystems with more than one root Mark Fasheh
                   ` (70 preceding siblings ...)
  2018-05-08 18:04 ` [PATCH 71/76] fs/ufs: " Mark Fasheh
@ 2018-05-08 18:04 ` Mark Fasheh
  2018-05-08 18:04 ` [PATCH 73/76] vfs: Move s_dev to to struct fs_view Mark Fasheh
                   ` (4 subsequent siblings)
  76 siblings, 0 replies; 88+ messages in thread
From: Mark Fasheh @ 2018-05-08 18:04 UTC (permalink / raw)
  To: linux-fsdevel; +Cc: linux-kernel, linux-btrfs, Mark Fasheh

Signed-off-by: Mark Fasheh <mfasheh@suse.de>
---
 fs/xfs/xfs_acl.c    |  2 +-
 fs/xfs/xfs_aops.c   |  4 ++--
 fs/xfs/xfs_export.c |  4 ++--
 fs/xfs/xfs_file.c   | 10 ++++-----
 fs/xfs/xfs_ioctl.c  |  8 +++----
 fs/xfs/xfs_iops.c   |  6 ++---
 fs/xfs/xfs_pnfs.c   |  2 +-
 fs/xfs/xfs_trace.h  | 64 ++++++++++++++++++++++++++---------------------------
 8 files changed, 50 insertions(+), 50 deletions(-)

diff --git a/fs/xfs/xfs_acl.c b/fs/xfs/xfs_acl.c
index 3354140de07e..42b00b01ea1a 100644
--- a/fs/xfs/xfs_acl.c
+++ b/fs/xfs/xfs_acl.c
@@ -255,7 +255,7 @@ xfs_set_acl(struct inode *inode, struct posix_acl *acl, int type)
 		goto set_acl;
 
 	error = -E2BIG;
-	if (acl->a_count > XFS_ACL_MAX_ENTRIES(XFS_M(inode->i_sb)))
+	if (acl->a_count > XFS_ACL_MAX_ENTRIES(XFS_M(inode_sb(inode))))
 		return error;
 
 	if (type == ACL_TYPE_ACCESS) {
diff --git a/fs/xfs/xfs_aops.c b/fs/xfs/xfs_aops.c
index 9c6a830da0ee..951ca9c4ed9e 100644
--- a/fs/xfs/xfs_aops.c
+++ b/fs/xfs/xfs_aops.c
@@ -219,7 +219,7 @@ xfs_setfilesize_trans_alloc(
 	 * We may pass freeze protection with a transaction.  So tell lockdep
 	 * we released it.
 	 */
-	__sb_writers_release(ioend->io_inode->i_sb, SB_FREEZE_FS);
+	__sb_writers_release(inode_sb(ioend->io_inode), SB_FREEZE_FS);
 	/*
 	 * We hand off the transaction to the completion thread now, so
 	 * clear the flag here.
@@ -288,7 +288,7 @@ xfs_setfilesize_ioend(
 	 * Similarly for freeze protection.
 	 */
 	current_set_flags_nested(&tp->t_pflags, PF_MEMALLOC_NOFS);
-	__sb_writers_acquired(VFS_I(ip)->i_sb, SB_FREEZE_FS);
+	__sb_writers_acquired(inode_sb(VFS_I(ip)), SB_FREEZE_FS);
 
 	/* we abort the update if there was an IO error */
 	if (error) {
diff --git a/fs/xfs/xfs_export.c b/fs/xfs/xfs_export.c
index fe1bfee35898..a78f6eb9987b 100644
--- a/fs/xfs/xfs_export.c
+++ b/fs/xfs/xfs_export.c
@@ -78,8 +78,8 @@ xfs_fs_encode_fh(
 	 * large enough filesystem may contain them, thus the slightly
 	 * confusing looking conditional below.
 	 */
-	if (!(XFS_M(inode->i_sb)->m_flags & XFS_MOUNT_SMALL_INUMS) ||
-	    (XFS_M(inode->i_sb)->m_flags & XFS_MOUNT_32BITINODES))
+	if (!(XFS_M(inode_sb(inode))->m_flags & XFS_MOUNT_SMALL_INUMS) ||
+	    (XFS_M(inode_sb(inode))->m_flags & XFS_MOUNT_32BITINODES))
 		fileid_type |= XFS_FILEID_TYPE_64FLAG;
 
 	/*
diff --git a/fs/xfs/xfs_file.c b/fs/xfs/xfs_file.c
index 9ea08326f876..7b805a8a031e 100644
--- a/fs/xfs/xfs_file.c
+++ b/fs/xfs/xfs_file.c
@@ -821,7 +821,7 @@ xfs_file_fallocate(
 		}
 
 		/* check the new inode size does not wrap through zero */
-		if (new_size > inode->i_sb->s_maxbytes) {
+		if (new_size > inode_sb(inode)->s_maxbytes) {
 			error = -EFBIG;
 			goto out_unlock;
 		}
@@ -926,7 +926,7 @@ xfs_file_open(
 {
 	if (!(file->f_flags & O_LARGEFILE) && i_size_read(inode) > MAX_NON_LFS)
 		return -EFBIG;
-	if (XFS_FORCED_SHUTDOWN(XFS_M(inode->i_sb)))
+	if (XFS_FORCED_SHUTDOWN(XFS_M(inode_sb(inode))))
 		return -EIO;
 	file->f_mode |= FMODE_NOWAIT;
 	return 0;
@@ -1014,7 +1014,7 @@ xfs_file_llseek(
 
 	if (offset < 0)
 		return offset;
-	return vfs_setpos(file, offset, inode->i_sb->s_maxbytes);
+	return vfs_setpos(file, offset, inode_sb(inode)->s_maxbytes);
 }
 
 /*
@@ -1040,7 +1040,7 @@ __xfs_filemap_fault(
 	trace_xfs_filemap_fault(ip, pe_size, write_fault);
 
 	if (write_fault) {
-		sb_start_pagefault(inode->i_sb);
+		sb_start_pagefault(inode_sb(inode));
 		file_update_time(vmf->vma->vm_file);
 	}
 
@@ -1060,7 +1060,7 @@ __xfs_filemap_fault(
 	xfs_iunlock(XFS_I(inode), XFS_MMAPLOCK_SHARED);
 
 	if (write_fault)
-		sb_end_pagefault(inode->i_sb);
+		sb_end_pagefault(inode_sb(inode));
 	return ret;
 }
 
diff --git a/fs/xfs/xfs_ioctl.c b/fs/xfs/xfs_ioctl.c
index 89fb1eb80aae..8e492a123815 100644
--- a/fs/xfs/xfs_ioctl.c
+++ b/fs/xfs/xfs_ioctl.c
@@ -98,7 +98,7 @@ xfs_find_handle(
 	 * and only for regular files, directories or symbolic links.
 	 */
 	error = -EINVAL;
-	if (inode->i_sb->s_magic != XFS_SB_MAGIC)
+	if (inode_sb(inode)->s_magic != XFS_SB_MAGIC)
 		goto out_put;
 
 	error = -EBADF;
@@ -688,9 +688,9 @@ xfs_ioc_space(
 	}
 
 	if (bf->l_start < 0 ||
-	    bf->l_start > inode->i_sb->s_maxbytes ||
+	    bf->l_start > inode_sb(inode)->s_maxbytes ||
 	    bf->l_start + bf->l_len < 0 ||
-	    bf->l_start + bf->l_len >= inode->i_sb->s_maxbytes) {
+	    bf->l_start + bf->l_len >= inode_sb(inode)->s_maxbytes) {
 		error = -EINVAL;
 		goto out_unlock;
 	}
@@ -1090,7 +1090,7 @@ xfs_ioctl_setattr_dax_invalidate(
 	int			*join_flags)
 {
 	struct inode		*inode = VFS_I(ip);
-	struct super_block	*sb = inode->i_sb;
+	struct super_block	*sb = inode_sb(inode);
 	int			error;
 
 	*join_flags = 0;
diff --git a/fs/xfs/xfs_iops.c b/fs/xfs/xfs_iops.c
index 56475fcd76f2..7aed2ad33d07 100644
--- a/fs/xfs/xfs_iops.c
+++ b/fs/xfs/xfs_iops.c
@@ -360,7 +360,7 @@ xfs_vn_unlink(
 	 * but still hashed. This is incompatible with case-insensitive
 	 * mode, so invalidate (unhash) the dentry in CI-mode.
 	 */
-	if (xfs_sb_version_hasasciici(&XFS_M(dir->i_sb)->m_sb))
+	if (xfs_sb_version_hasasciici(&XFS_M(inode_sb(dir))->m_sb))
 		d_invalidate(dentry);
 	return 0;
 }
@@ -503,7 +503,7 @@ xfs_vn_getattr(
 		return -EIO;
 
 	stat->size = XFS_ISIZE(ip);
-	stat->dev = inode->i_sb->s_dev;
+	stat->dev = inode_sb(inode)->s_dev;
 	stat->mode = inode->i_mode;
 	stat->nlink = inode->i_nlink;
 	stat->uid = inode->i_uid;
@@ -1275,7 +1275,7 @@ xfs_setup_iops(
 		inode->i_mapping->a_ops = &xfs_address_space_operations;
 		break;
 	case S_IFDIR:
-		if (xfs_sb_version_hasasciici(&XFS_M(inode->i_sb)->m_sb))
+		if (xfs_sb_version_hasasciici(&XFS_M(inode_sb(inode))->m_sb))
 			inode->i_op = &xfs_dir_ci_inode_operations;
 		else
 			inode->i_op = &xfs_dir_inode_operations;
diff --git a/fs/xfs/xfs_pnfs.c b/fs/xfs/xfs_pnfs.c
index aa6c5c193f45..c3e90d20bfcf 100644
--- a/fs/xfs/xfs_pnfs.c
+++ b/fs/xfs/xfs_pnfs.c
@@ -129,7 +129,7 @@ xfs_fs_map_blocks(
 	limit = mp->m_super->s_maxbytes;
 	if (!write)
 		limit = max(limit, round_up(i_size_read(inode),
-				     inode->i_sb->s_blocksize));
+				     inode_sb(inode)->s_blocksize));
 	if (offset > limit)
 		goto out_unlock;
 	if (offset > limit - length)
diff --git a/fs/xfs/xfs_trace.h b/fs/xfs/xfs_trace.h
index 945de08af7ba..633c7cbc097a 100644
--- a/fs/xfs/xfs_trace.h
+++ b/fs/xfs/xfs_trace.h
@@ -60,7 +60,7 @@ DECLARE_EVENT_CLASS(xfs_attr_list_class,
 		__field(int, flags)
 	),
 	TP_fast_assign(
-		__entry->dev = VFS_I(ctx->dp)->i_sb->s_dev;
+		__entry->dev = inode_sb(VFS_I(ctx->dp))->s_dev;
 		__entry->ino = ctx->dp->i_ino;
 		__entry->hashval = ctx->cursor->hashval;
 		__entry->blkno = ctx->cursor->blkno;
@@ -186,7 +186,7 @@ TRACE_EVENT(xfs_attr_list_node_descend,
 		__field(u32, bt_before)
 	),
 	TP_fast_assign(
-		__entry->dev = VFS_I(ctx->dp)->i_sb->s_dev;
+		__entry->dev = inode_sb(VFS_I(ctx->dp))->s_dev;
 		__entry->ino = ctx->dp->i_ino;
 		__entry->hashval = ctx->cursor->hashval;
 		__entry->blkno = ctx->cursor->blkno;
@@ -240,7 +240,7 @@ DECLARE_EVENT_CLASS(xfs_bmap_class,
 
 		ifp = xfs_iext_state_to_fork(ip, state);
 		xfs_iext_get_extent(ifp, cur, &r);
-		__entry->dev = VFS_I(ip)->i_sb->s_dev;
+		__entry->dev = inode_sb(VFS_I(ip))->s_dev;
 		__entry->ino = ip->i_ino;
 		__entry->leaf = cur->leaf;
 		__entry->pos = cur->pos;
@@ -515,7 +515,7 @@ DECLARE_EVENT_CLASS(xfs_filestream_class,
 		__field(int, streams)
 	),
 	TP_fast_assign(
-		__entry->dev = VFS_I(ip)->i_sb->s_dev;
+		__entry->dev = inode_sb(VFS_I(ip))->s_dev;
 		__entry->ino = ip->i_ino;
 		__entry->agno = agno;
 		__entry->streams = xfs_filestream_peek_ag(ip->i_mount, agno);
@@ -547,7 +547,7 @@ TRACE_EVENT(xfs_filestream_pick,
 		__field(int, nscan)
 	),
 	TP_fast_assign(
-		__entry->dev = VFS_I(ip)->i_sb->s_dev;
+		__entry->dev = inode_sb(VFS_I(ip))->s_dev;
 		__entry->ino = ip->i_ino;
 		__entry->agno = agno;
 		__entry->streams = xfs_filestream_peek_ag(ip->i_mount, agno);
@@ -574,7 +574,7 @@ DECLARE_EVENT_CLASS(xfs_lock_class,
 		__field(unsigned long, caller_ip)
 	),
 	TP_fast_assign(
-		__entry->dev = VFS_I(ip)->i_sb->s_dev;
+		__entry->dev = inode_sb(VFS_I(ip))->s_dev;
 		__entry->ino = ip->i_ino;
 		__entry->lock_flags = lock_flags;
 		__entry->caller_ip = caller_ip;
@@ -604,7 +604,7 @@ DECLARE_EVENT_CLASS(xfs_inode_class,
 		__field(xfs_ino_t, ino)
 	),
 	TP_fast_assign(
-		__entry->dev = VFS_I(ip)->i_sb->s_dev;
+		__entry->dev = inode_sb(VFS_I(ip))->s_dev;
 		__entry->ino = ip->i_ino;
 	),
 	TP_printk("dev %d:%d ino 0x%llx",
@@ -665,7 +665,7 @@ TRACE_EVENT(xfs_filemap_fault,
 		__field(bool, write_fault)
 	),
 	TP_fast_assign(
-		__entry->dev = VFS_I(ip)->i_sb->s_dev;
+		__entry->dev = inode_sb(VFS_I(ip))->s_dev;
 		__entry->ino = ip->i_ino;
 		__entry->pe_size = pe_size;
 		__entry->write_fault = write_fault;
@@ -691,7 +691,7 @@ DECLARE_EVENT_CLASS(xfs_iref_class,
 		__field(unsigned long, caller_ip)
 	),
 	TP_fast_assign(
-		__entry->dev = VFS_I(ip)->i_sb->s_dev;
+		__entry->dev = inode_sb(VFS_I(ip))->s_dev;
 		__entry->ino = ip->i_ino;
 		__entry->count = atomic_read(&VFS_I(ip)->i_count);
 		__entry->pincount = atomic_read(&ip->i_pincount);
@@ -717,7 +717,7 @@ TRACE_EVENT(xfs_iomap_prealloc_size,
 		__field(unsigned int, writeio_blocks)
 	),
 	TP_fast_assign(
-		__entry->dev = VFS_I(ip)->i_sb->s_dev;
+		__entry->dev = inode_sb(VFS_I(ip))->s_dev;
 		__entry->ino = ip->i_ino;
 		__entry->blocks = blocks;
 		__entry->shift = shift;
@@ -795,7 +795,7 @@ DECLARE_EVENT_CLASS(xfs_namespace_class,
 		__dynamic_array(char, name, name->len)
 	),
 	TP_fast_assign(
-		__entry->dev = VFS_I(dp)->i_sb->s_dev;
+		__entry->dev = inode_sb(VFS_I(dp))->s_dev;
 		__entry->dp_ino = dp->i_ino;
 		__entry->namelen = name->len;
 		memcpy(__get_str(name), name->name, name->len);
@@ -831,7 +831,7 @@ TRACE_EVENT(xfs_rename,
 		__dynamic_array(char, target_name, target_name->len)
 	),
 	TP_fast_assign(
-		__entry->dev = VFS_I(src_dp)->i_sb->s_dev;
+		__entry->dev = inode_sb(VFS_I(src_dp))->s_dev;
 		__entry->src_dp_ino = src_dp->i_ino;
 		__entry->target_dp_ino = target_dp->i_ino;
 		__entry->src_namelen = src_name->len;
@@ -1132,7 +1132,7 @@ DECLARE_EVENT_CLASS(xfs_file_class,
 		__field(size_t, count)
 	),
 	TP_fast_assign(
-		__entry->dev = VFS_I(ip)->i_sb->s_dev;
+		__entry->dev = inode_sb(VFS_I(ip))->s_dev;
 		__entry->ino = ip->i_ino;
 		__entry->size = ip->i_d.di_size;
 		__entry->offset = offset;
@@ -1176,7 +1176,7 @@ DECLARE_EVENT_CLASS(xfs_page_class,
 
 		if (page_has_buffers(page))
 			xfs_count_page_state(page, &delalloc, &unwritten);
-		__entry->dev = inode->i_sb->s_dev;
+		__entry->dev = inode_sb(inode)->s_dev;
 		__entry->ino = XFS_I(inode)->i_ino;
 		__entry->pgoff = page_offset(page);
 		__entry->size = i_size_read(inode);
@@ -1215,7 +1215,7 @@ DECLARE_EVENT_CLASS(xfs_readpage_class,
 		__field(int, nr_pages)
 	),
 	TP_fast_assign(
-		__entry->dev = inode->i_sb->s_dev;
+		__entry->dev = inode_sb(inode)->s_dev;
 		__entry->ino = inode->i_ino;
 		__entry->nr_pages = nr_pages;
 	),
@@ -1248,7 +1248,7 @@ DECLARE_EVENT_CLASS(xfs_imap_class,
 		__field(xfs_filblks_t, blockcount)
 	),
 	TP_fast_assign(
-		__entry->dev = VFS_I(ip)->i_sb->s_dev;
+		__entry->dev = inode_sb(VFS_I(ip))->s_dev;
 		__entry->ino = ip->i_ino;
 		__entry->size = ip->i_d.di_size;
 		__entry->offset = offset;
@@ -1296,7 +1296,7 @@ DECLARE_EVENT_CLASS(xfs_simple_io_class,
 		__field(size_t, count)
 	),
 	TP_fast_assign(
-		__entry->dev = VFS_I(ip)->i_sb->s_dev;
+		__entry->dev = inode_sb(VFS_I(ip))->s_dev;
 		__entry->ino = ip->i_ino;
 		__entry->isize = VFS_I(ip)->i_size;
 		__entry->disize = ip->i_d.di_size;
@@ -1336,7 +1336,7 @@ DECLARE_EVENT_CLASS(xfs_itrunc_class,
 		__field(xfs_fsize_t, new_size)
 	),
 	TP_fast_assign(
-		__entry->dev = VFS_I(ip)->i_sb->s_dev;
+		__entry->dev = inode_sb(VFS_I(ip))->s_dev;
 		__entry->ino = ip->i_ino;
 		__entry->size = ip->i_d.di_size;
 		__entry->new_size = new_size;
@@ -1366,7 +1366,7 @@ TRACE_EVENT(xfs_pagecache_inval,
 		__field(xfs_off_t, finish)
 	),
 	TP_fast_assign(
-		__entry->dev = VFS_I(ip)->i_sb->s_dev;
+		__entry->dev = inode_sb(VFS_I(ip))->s_dev;
 		__entry->ino = ip->i_ino;
 		__entry->size = ip->i_d.di_size;
 		__entry->start = start;
@@ -1394,7 +1394,7 @@ TRACE_EVENT(xfs_bunmap,
 		__field(int, flags)
 	),
 	TP_fast_assign(
-		__entry->dev = VFS_I(ip)->i_sb->s_dev;
+		__entry->dev = inode_sb(VFS_I(ip))->s_dev;
 		__entry->ino = ip->i_ino;
 		__entry->size = ip->i_d.di_size;
 		__entry->bno = bno;
@@ -1682,7 +1682,7 @@ DECLARE_EVENT_CLASS(xfs_da_class,
 		__field(int, op_flags)
 	),
 	TP_fast_assign(
-		__entry->dev = VFS_I(args->dp)->i_sb->s_dev;
+		__entry->dev = inode_sb(VFS_I(args->dp))->s_dev;
 		__entry->ino = args->dp->i_ino;
 		if (args->namelen)
 			memcpy(__get_str(name), args->name, args->namelen);
@@ -1746,7 +1746,7 @@ DECLARE_EVENT_CLASS(xfs_attr_class,
 		__field(int, op_flags)
 	),
 	TP_fast_assign(
-		__entry->dev = VFS_I(args->dp)->i_sb->s_dev;
+		__entry->dev = inode_sb(VFS_I(args->dp))->s_dev;
 		__entry->ino = args->dp->i_ino;
 		if (args->namelen)
 			memcpy(__get_str(name), args->name, args->namelen);
@@ -1849,7 +1849,7 @@ DECLARE_EVENT_CLASS(xfs_dir2_space_class,
 		__field(int, idx)
 	),
 	TP_fast_assign(
-		__entry->dev = VFS_I(args->dp)->i_sb->s_dev;
+		__entry->dev = inode_sb(VFS_I(args->dp))->s_dev;
 		__entry->ino = args->dp->i_ino;
 		__entry->op_flags = args->op_flags;
 		__entry->idx = idx;
@@ -1882,7 +1882,7 @@ TRACE_EVENT(xfs_dir2_leafn_moveents,
 		__field(int, count)
 	),
 	TP_fast_assign(
-		__entry->dev = VFS_I(args->dp)->i_sb->s_dev;
+		__entry->dev = inode_sb(VFS_I(args->dp))->s_dev;
 		__entry->ino = args->dp->i_ino;
 		__entry->op_flags = args->op_flags;
 		__entry->src_idx = src_idx;
@@ -1922,7 +1922,7 @@ DECLARE_EVENT_CLASS(xfs_swap_extent_class,
 		__field(int, fork_off)
 	),
 	TP_fast_assign(
-		__entry->dev = VFS_I(ip)->i_sb->s_dev;
+		__entry->dev = inode_sb(VFS_I(ip))->s_dev;
 		__entry->which = which;
 		__entry->ino = ip->i_ino;
 		__entry->format = ip->i_d.di_format;
@@ -2972,7 +2972,7 @@ DECLARE_EVENT_CLASS(xfs_inode_error_class,
 		__field(unsigned long, caller_ip)
 	),
 	TP_fast_assign(
-		__entry->dev = VFS_I(ip)->i_sb->s_dev;
+		__entry->dev = inode_sb(VFS_I(ip))->s_dev;
 		__entry->ino = ip->i_ino;
 		__entry->error = error;
 		__entry->caller_ip = caller_ip;
@@ -3010,7 +3010,7 @@ DECLARE_EVENT_CLASS(xfs_double_io_class,
 		__field(loff_t, dest_offset)
 	),
 	TP_fast_assign(
-		__entry->dev = VFS_I(src)->i_sb->s_dev;
+		__entry->dev = inode_sb(VFS_I(src))->s_dev;
 		__entry->src_ino = src->i_ino;
 		__entry->src_isize = VFS_I(src)->i_size;
 		__entry->src_disize = src->i_d.di_size;
@@ -3055,7 +3055,7 @@ DECLARE_EVENT_CLASS(xfs_inode_irec_class,
 		__field(int, state)
 	),
 	TP_fast_assign(
-		__entry->dev = VFS_I(ip)->i_sb->s_dev;
+		__entry->dev = inode_sb(VFS_I(ip))->s_dev;
 		__entry->ino = ip->i_ino;
 		__entry->lblk = irec->br_startoff;
 		__entry->len = irec->br_blockcount;
@@ -3096,7 +3096,7 @@ TRACE_EVENT(xfs_reflink_remap_blocks_loop,
 		__field(xfs_fileoff_t, dest_lblk)
 	),
 	TP_fast_assign(
-		__entry->dev = VFS_I(src)->i_sb->s_dev;
+		__entry->dev = inode_sb(VFS_I(src))->s_dev;
 		__entry->src_ino = src->i_ino;
 		__entry->src_lblk = soffset;
 		__entry->len = len;
@@ -3124,7 +3124,7 @@ TRACE_EVENT(xfs_reflink_punch_range,
 		__field(xfs_extlen_t, len)
 	),
 	TP_fast_assign(
-		__entry->dev = VFS_I(ip)->i_sb->s_dev;
+		__entry->dev = inode_sb(VFS_I(ip))->s_dev;
 		__entry->ino = ip->i_ino;
 		__entry->lblk = lblk;
 		__entry->len = len;
@@ -3147,7 +3147,7 @@ TRACE_EVENT(xfs_reflink_remap,
 		__field(xfs_fsblock_t, new_pblk)
 	),
 	TP_fast_assign(
-		__entry->dev = VFS_I(ip)->i_sb->s_dev;
+		__entry->dev = inode_sb(VFS_I(ip))->s_dev;
 		__entry->ino = ip->i_ino;
 		__entry->lblk = lblk;
 		__entry->len = len;
@@ -3183,7 +3183,7 @@ TRACE_EVENT(xfs_ioctl_clone,
 		__field(loff_t, dest_isize)
 	),
 	TP_fast_assign(
-		__entry->dev = src->i_sb->s_dev;
+		__entry->dev = inode_sb(src)->s_dev;
 		__entry->src_ino = src->i_ino;
 		__entry->src_isize = i_size_read(src);
 		__entry->dest_ino = dest->i_ino;
-- 
2.15.1

^ permalink raw reply related	[flat|nested] 88+ messages in thread

* [PATCH 73/76] vfs: Move s_dev to to struct fs_view
  2018-05-08 18:03 [RFC][PATCH 0/76] vfs: 'views' for filesystems with more than one root Mark Fasheh
                   ` (71 preceding siblings ...)
  2018-05-08 18:04 ` [PATCH 72/76] fs/xfs: " Mark Fasheh
@ 2018-05-08 18:04 ` Mark Fasheh
  2018-05-08 18:04 ` [PATCH 74/76] fs: Use fs_view device from struct inode Mark Fasheh
                   ` (3 subsequent siblings)
  76 siblings, 0 replies; 88+ messages in thread
From: Mark Fasheh @ 2018-05-08 18:04 UTC (permalink / raw)
  To: linux-fsdevel; +Cc: linux-kernel, linux-btrfs, Mark Fasheh

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

^ permalink raw reply related	[flat|nested] 88+ messages in thread

* [PATCH 74/76] fs: Use fs_view device from struct inode.
  2018-05-08 18:03 [RFC][PATCH 0/76] vfs: 'views' for filesystems with more than one root Mark Fasheh
                   ` (72 preceding siblings ...)
  2018-05-08 18:04 ` [PATCH 73/76] vfs: Move s_dev to to struct fs_view Mark Fasheh
@ 2018-05-08 18:04 ` Mark Fasheh
  2018-05-08 18:04 ` [PATCH 75/76] fs: Use fs view device from struct super_block Mark Fasheh
                   ` (2 subsequent siblings)
  76 siblings, 0 replies; 88+ messages in thread
From: Mark Fasheh @ 2018-05-08 18:04 UTC (permalink / raw)
  To: linux-fsdevel; +Cc: linux-kernel, linux-btrfs, Mark Fasheh

Replace calls of inode_sb(inode)->s_dev with inode_view(inode)->v_dev.

Signed-off-by: Mark Fasheh <mfasheh@suse.de>
---
 arch/arc/kernel/troubleshoot.c             |   2 +-
 drivers/staging/lustre/lustre/llite/dir.c  |   2 +-
 drivers/staging/lustre/lustre/llite/file.c |   2 +-
 fs/eventpoll.c                             |   2 +-
 fs/f2fs/trace.c                            |   8 +-
 fs/fuse/dir.c                              |   2 +-
 fs/locks.c                                 |  12 +--
 fs/nfs/nfs4trace.h                         |  36 ++++-----
 fs/nfs/nfstrace.h                          |  42 +++++-----
 fs/nfsd/vfs.c                              |   6 +-
 fs/notify/fdinfo.c                         |   4 +-
 fs/proc/nommu.c                            |   2 +-
 fs/proc/task_mmu.c                         |   2 +-
 fs/proc/task_nommu.c                       |   2 +-
 fs/stat.c                                  |   2 +-
 fs/xfs/xfs_iops.c                          |   2 +-
 fs/xfs/xfs_trace.h                         |  64 ++++++++--------
 include/trace/events/ext4.h                | 118 ++++++++++++++---------------
 include/trace/events/f2fs.h                |  52 ++++++-------
 include/trace/events/filelock.h            |   8 +-
 include/trace/events/filemap.h             |   6 +-
 include/trace/events/fs_dax.h              |  14 ++--
 include/trace/events/jbd2.h                |   2 +-
 include/trace/events/writeback.h           |   2 +-
 kernel/audit.c                             |   2 +-
 kernel/audit_fsnotify.c                    |   2 +-
 kernel/audit_watch.c                       |   4 +-
 kernel/auditsc.c                           |   4 +-
 kernel/bpf/offload.c                       |   4 +-
 kernel/events/core.c                       |   4 +-
 mm/memory-failure.c                        |   2 +-
 security/tomoyo/condition.c                |   2 +-
 32 files changed, 209 insertions(+), 209 deletions(-)

diff --git a/arch/arc/kernel/troubleshoot.c b/arch/arc/kernel/troubleshoot.c
index 18eb4984d555..b3aa20be118e 100644
--- a/arch/arc/kernel/troubleshoot.c
+++ b/arch/arc/kernel/troubleshoot.c
@@ -104,7 +104,7 @@ static void show_faulting_vma(unsigned long address, char *buf)
 		if (file) {
 			nm = file_path(file, buf, PAGE_SIZE - 1);
 			inode = file_inode(vma->vm_file);
-			dev = inode_sb(inode)->s_dev;
+			dev = inode_view(inode)->v_dev;
 			ino = inode->i_ino;
 		}
 		pr_info("    @off 0x%lx in [%s]\n"
diff --git a/drivers/staging/lustre/lustre/llite/dir.c b/drivers/staging/lustre/lustre/llite/dir.c
index 809e493b61da..cb50d04327d4 100644
--- a/drivers/staging/lustre/lustre/llite/dir.c
+++ b/drivers/staging/lustre/lustre/llite/dir.c
@@ -1364,7 +1364,7 @@ static long ll_dir_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
 			struct lov_user_mds_data __user *lmdp;
 			lstat_t st = { 0 };
 
-			st.st_dev     = inode_sb(inode)->s_dev;
+			st.st_dev     = inode_view(inode)->v_dev;
 			st.st_mode    = body->mbo_mode;
 			st.st_nlink   = body->mbo_nlink;
 			st.st_uid     = body->mbo_uid;
diff --git a/drivers/staging/lustre/lustre/llite/file.c b/drivers/staging/lustre/lustre/llite/file.c
index 64df47bd1118..749a74e49e61 100644
--- a/drivers/staging/lustre/lustre/llite/file.c
+++ b/drivers/staging/lustre/lustre/llite/file.c
@@ -2967,7 +2967,7 @@ int ll_getattr(const struct path *path, struct kstat *stat,
 
 	OBD_FAIL_TIMEOUT(OBD_FAIL_GETATTR_DELAY, 30);
 
-	stat->dev = inode_sb(inode)->s_dev;
+	stat->dev = inode_view(inode)->v_dev;
 	if (ll_need_32bit_api(sbi))
 		stat->ino = cl_fid_build_ino(&lli->lli_fid, 1);
 	else
diff --git a/fs/eventpoll.c b/fs/eventpoll.c
index a7e3dbc83bbc..39487ae0eabd 100644
--- a/fs/eventpoll.c
+++ b/fs/eventpoll.c
@@ -955,7 +955,7 @@ static void ep_show_fdinfo(struct seq_file *m, struct file *f)
 			   epi->ffd.fd, epi->event.events,
 			   (long long)epi->event.data,
 			   (long long)epi->ffd.file->f_pos,
-			   inode->i_ino, inode_sb(inode)->s_dev);
+			   inode->i_ino, inode_view(inode)->v_dev);
 		if (seq_has_overflowed(m))
 			break;
 	}
diff --git a/fs/f2fs/trace.c b/fs/f2fs/trace.c
index 235a3bca1f5f..601cf0cb723e 100644
--- a/fs/f2fs/trace.c
+++ b/fs/f2fs/trace.c
@@ -74,8 +74,8 @@ void f2fs_trace_pid(struct page *page)
 	f2fs_radix_tree_insert(&pids, pid, current);
 
 	trace_printk("%3x:%3x %4x %-16s\n",
-			MAJOR(inode_sb(inode)->s_dev),
-			MINOR(inode_sb(inode)->s_dev),
+			MAJOR(inode_view(inode)->v_dev),
+			MINOR(inode_view(inode)->v_dev),
 			pid, current->comm);
 out:
 	mutex_unlock(&pids_lock);
@@ -96,8 +96,8 @@ void f2fs_trace_ios(struct f2fs_io_info *fio, int flush)
 	inode = fio->page->mapping->host;
 	pid = page_private(fio->page);
 
-	major = MAJOR(inode_sb(inode)->s_dev);
-	minor = MINOR(inode_sb(inode)->s_dev);
+	major = MAJOR(inode_view(inode)->v_dev);
+	minor = MINOR(inode_view(inode)->v_dev);
 
 	if (last_io.major == major && last_io.minor == minor &&
 			last_io.pid == pid &&
diff --git a/fs/fuse/dir.c b/fs/fuse/dir.c
index b68adb3bd70d..f3dfca9a59ac 100644
--- a/fs/fuse/dir.c
+++ b/fs/fuse/dir.c
@@ -855,7 +855,7 @@ static void fuse_fillattr(struct inode *inode, struct fuse_attr *attr,
 		attr->ctimensec = inode->i_ctime.tv_nsec;
 	}
 
-	stat->dev = inode_sb(inode)->s_dev;
+	stat->dev = inode_view(inode)->v_dev;
 	stat->ino = attr->ino;
 	stat->mode = (inode->i_mode & S_IFMT) | (attr->mode & 07777);
 	stat->nlink = attr->nlink;
diff --git a/fs/locks.c b/fs/locks.c
index 2a86a18c0523..86ef062c3ea1 100644
--- a/fs/locks.c
+++ b/fs/locks.c
@@ -263,8 +263,8 @@ locks_check_ctx_lists(struct inode *inode)
 		     !list_empty(&ctx->flc_posix) ||
 		     !list_empty(&ctx->flc_lease))) {
 		pr_warn("Leaked locks on dev=0x%x:0x%x ino=0x%lx:\n",
-			MAJOR(inode_sb(inode)->s_dev),
-			MINOR(inode_sb(inode)->s_dev),
+			MAJOR(inode_view(inode)->v_dev),
+			MINOR(inode_view(inode)->v_dev),
 			inode->i_ino);
 		locks_dump_ctx_list(&ctx->flc_flock, "FLOCK");
 		locks_dump_ctx_list(&ctx->flc_posix, "POSIX");
@@ -283,8 +283,8 @@ locks_check_ctx_file_list(struct file *filp, struct list_head *list,
 		if (fl->fl_file == filp)
 			pr_warn("Leaked %s lock on dev=0x%x:0x%x ino=0x%lx "
 				" fl_owner=%p fl_flags=0x%x fl_type=0x%x fl_pid=%u\n",
-				list_type, MAJOR(inode_sb(inode)->s_dev),
-				MINOR(inode_sb(inode)->s_dev), inode->i_ino,
+				list_type, MAJOR(inode_view(inode)->v_dev),
+				MINOR(inode_view(inode)->v_dev), inode->i_ino,
 				fl->fl_owner, fl->fl_flags, fl->fl_type, fl->fl_pid);
 }
 
@@ -2684,8 +2684,8 @@ static void lock_get_status(struct seq_file *f, struct file_lock *fl,
 	if (inode) {
 		/* userspace relies on this representation of dev_t */
 		seq_printf(f, "%d %02x:%02x:%ld ", fl_pid,
-				MAJOR(inode_sb(inode)->s_dev),
-				MINOR(inode_sb(inode)->s_dev), inode->i_ino);
+				MAJOR(inode_view(inode)->v_dev),
+				MINOR(inode_view(inode)->v_dev), inode->i_ino);
 	} else {
 		seq_printf(f, "%d <none>:0 ", fl_pid);
 	}
diff --git a/fs/nfs/nfs4trace.h b/fs/nfs/nfs4trace.h
index 517f3194b055..07f81f981792 100644
--- a/fs/nfs/nfs4trace.h
+++ b/fs/nfs/nfs4trace.h
@@ -488,7 +488,7 @@ TRACE_EVENT(nfs4_cached_open,
 		TP_fast_assign(
 			const struct inode *inode = state->inode;
 
-			__entry->dev = inode_sb(inode)->s_dev;
+			__entry->dev = inode_view(inode)->v_dev;
 			__entry->fileid = NFS_FILEID(inode);
 			__entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
 			__entry->fmode = (__force unsigned int)state->state;
@@ -533,7 +533,7 @@ TRACE_EVENT(nfs4_close,
 		TP_fast_assign(
 			const struct inode *inode = state->inode;
 
-			__entry->dev = inode_sb(inode)->s_dev;
+			__entry->dev = inode_view(inode)->v_dev;
 			__entry->fileid = NFS_FILEID(inode);
 			__entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
 			__entry->fmode = (__force unsigned int)state->state;
@@ -600,7 +600,7 @@ DECLARE_EVENT_CLASS(nfs4_lock_event,
 			__entry->type = request->fl_type;
 			__entry->start = request->fl_start;
 			__entry->end = request->fl_end;
-			__entry->dev = inode_sb(inode)->s_dev;
+			__entry->dev = inode_view(inode)->v_dev;
 			__entry->fileid = NFS_FILEID(inode);
 			__entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
 			__entry->stateid_seq =
@@ -672,7 +672,7 @@ TRACE_EVENT(nfs4_set_lock,
 			__entry->type = request->fl_type;
 			__entry->start = request->fl_start;
 			__entry->end = request->fl_end;
-			__entry->dev = inode_sb(inode)->s_dev;
+			__entry->dev = inode_view(inode)->v_dev;
 			__entry->fileid = NFS_FILEID(inode);
 			__entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
 			__entry->stateid_seq =
@@ -719,7 +719,7 @@ DECLARE_EVENT_CLASS(nfs4_set_delegation_event,
 		),
 
 		TP_fast_assign(
-			__entry->dev = inode_sb(inode)->s_dev;
+			__entry->dev = inode_view(inode)->v_dev;
 			__entry->fileid = NFS_FILEID(inode);
 			__entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
 			__entry->fmode = (__force unsigned int)fmode;
@@ -804,7 +804,7 @@ DECLARE_EVENT_CLASS(nfs4_test_stateid_event,
 			const struct inode *inode = state->inode;
 
 			__entry->error = error;
-			__entry->dev = inode_sb(inode)->s_dev;
+			__entry->dev = inode_view(inode)->v_dev;
 			__entry->fileid = NFS_FILEID(inode);
 			__entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
 			__entry->stateid_seq =
@@ -855,7 +855,7 @@ DECLARE_EVENT_CLASS(nfs4_lookup_event,
 		),
 
 		TP_fast_assign(
-			__entry->dev = inode_sb(dir)->s_dev;
+			__entry->dev = inode_view(dir)->v_dev;
 			__entry->dir = NFS_FILEID(dir);
 			__entry->error = error;
 			__assign_str(name, name->name);
@@ -903,7 +903,7 @@ TRACE_EVENT(nfs4_lookupp,
 		),
 
 		TP_fast_assign(
-			__entry->dev = inode_sb(inode)->s_dev;
+			__entry->dev = inode_view(inode)->v_dev;
 			__entry->ino = NFS_FILEID(inode);
 			__entry->error = error;
 		),
@@ -938,7 +938,7 @@ TRACE_EVENT(nfs4_rename,
 		),
 
 		TP_fast_assign(
-			__entry->dev = inode_sb(olddir)->s_dev;
+			__entry->dev = inode_view(olddir)->v_dev;
 			__entry->olddir = NFS_FILEID(olddir);
 			__entry->newdir = NFS_FILEID(newdir);
 			__entry->error = error;
@@ -976,7 +976,7 @@ DECLARE_EVENT_CLASS(nfs4_inode_event,
 		),
 
 		TP_fast_assign(
-			__entry->dev = inode_sb(inode)->s_dev;
+			__entry->dev = inode_view(inode)->v_dev;
 			__entry->fileid = NFS_FILEID(inode);
 			__entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
 			__entry->error = error;
@@ -1029,7 +1029,7 @@ DECLARE_EVENT_CLASS(nfs4_inode_stateid_event,
 		),
 
 		TP_fast_assign(
-			__entry->dev = inode_sb(inode)->s_dev;
+			__entry->dev = inode_view(inode)->v_dev;
 			__entry->fileid = NFS_FILEID(inode);
 			__entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
 			__entry->error = error;
@@ -1139,7 +1139,7 @@ DECLARE_EVENT_CLASS(nfs4_inode_callback_event,
 			__entry->fhandle = nfs_fhandle_hash(fhandle);
 			if (inode != NULL) {
 				__entry->fileid = NFS_FILEID(inode);
-				__entry->dev = inode_sb(inode)->s_dev;
+				__entry->dev = inode_view(inode)->v_dev;
 			} else {
 				__entry->fileid = 0;
 				__entry->dev = 0;
@@ -1196,7 +1196,7 @@ DECLARE_EVENT_CLASS(nfs4_inode_stateid_callback_event,
 			__entry->fhandle = nfs_fhandle_hash(fhandle);
 			if (inode != NULL) {
 				__entry->fileid = NFS_FILEID(inode);
-				__entry->dev = inode_sb(inode)->s_dev;
+				__entry->dev = inode_view(inode)->v_dev;
 			} else {
 				__entry->fileid = 0;
 				__entry->dev = 0;
@@ -1303,7 +1303,7 @@ DECLARE_EVENT_CLASS(nfs4_read_event,
 			const struct inode *inode = hdr->inode;
 			const struct nfs4_state *state =
 				hdr->args.context->state;
-			__entry->dev = inode_sb(inode)->s_dev;
+			__entry->dev = inode_view(inode)->v_dev;
 			__entry->fileid = NFS_FILEID(inode);
 			__entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
 			__entry->offset = hdr->args.offset;
@@ -1363,7 +1363,7 @@ DECLARE_EVENT_CLASS(nfs4_write_event,
 			const struct inode *inode = hdr->inode;
 			const struct nfs4_state *state =
 				hdr->args.context->state;
-			__entry->dev = inode_sb(inode)->s_dev;
+			__entry->dev = inode_view(inode)->v_dev;
 			__entry->fileid = NFS_FILEID(inode);
 			__entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
 			__entry->offset = hdr->args.offset;
@@ -1420,7 +1420,7 @@ DECLARE_EVENT_CLASS(nfs4_commit_event,
 
 		TP_fast_assign(
 			const struct inode *inode = data->inode;
-			__entry->dev = inode_sb(inode)->s_dev;
+			__entry->dev = inode_view(inode)->v_dev;
 			__entry->fileid = NFS_FILEID(inode);
 			__entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
 			__entry->offset = data->args.offset;
@@ -1485,7 +1485,7 @@ TRACE_EVENT(nfs4_layoutget,
 		TP_fast_assign(
 			const struct inode *inode = d_inode(ctx->dentry);
 			const struct nfs4_state *state = ctx->state;
-			__entry->dev = inode_sb(inode)->s_dev;
+			__entry->dev = inode_view(inode)->v_dev;
 			__entry->fileid = NFS_FILEID(inode);
 			__entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
 			__entry->iomode = args->iomode;
@@ -1567,7 +1567,7 @@ TRACE_EVENT(pnfs_update_layout,
 			__field(enum pnfs_update_layout_reason, reason)
 		),
 		TP_fast_assign(
-			__entry->dev = inode_sb(inode)->s_dev;
+			__entry->dev = inode_view(inode)->v_dev;
 			__entry->fileid = NFS_FILEID(inode);
 			__entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
 			__entry->pos = pos;
diff --git a/fs/nfs/nfstrace.h b/fs/nfs/nfstrace.h
index aeacf2b86260..fc74ac0b729e 100644
--- a/fs/nfs/nfstrace.h
+++ b/fs/nfs/nfstrace.h
@@ -59,7 +59,7 @@ DECLARE_EVENT_CLASS(nfs_inode_event,
 
 		TP_fast_assign(
 			const struct nfs_inode *nfsi = NFS_I(inode);
-			__entry->dev = inode_sb(inode)->s_dev;
+			__entry->dev = inode_view(inode)->v_dev;
 			__entry->fileid = nfsi->fileid;
 			__entry->fhandle = nfs_fhandle_hash(&nfsi->fh);
 			__entry->version = inode_peek_iversion_raw(inode);
@@ -97,7 +97,7 @@ DECLARE_EVENT_CLASS(nfs_inode_event_done,
 		TP_fast_assign(
 			const struct nfs_inode *nfsi = NFS_I(inode);
 			__entry->error = error;
-			__entry->dev = inode_sb(inode)->s_dev;
+			__entry->dev = inode_view(inode)->v_dev;
 			__entry->fileid = nfsi->fileid;
 			__entry->fhandle = nfs_fhandle_hash(&nfsi->fh);
 			__entry->type = nfs_umode_to_dtype(inode->i_mode);
@@ -183,7 +183,7 @@ DECLARE_EVENT_CLASS(nfs_lookup_event,
 		),
 
 		TP_fast_assign(
-			__entry->dev = inode_sb(dir)->s_dev;
+			__entry->dev = inode_view(dir)->v_dev;
 			__entry->dir = NFS_FILEID(dir);
 			__entry->flags = flags;
 			__assign_str(name, dentry->d_name.name);
@@ -227,7 +227,7 @@ DECLARE_EVENT_CLASS(nfs_lookup_event_done,
 		),
 
 		TP_fast_assign(
-			__entry->dev = inode_sb(dir)->s_dev;
+			__entry->dev = inode_view(dir)->v_dev;
 			__entry->dir = NFS_FILEID(dir);
 			__entry->error = error;
 			__entry->flags = flags;
@@ -294,7 +294,7 @@ TRACE_EVENT(nfs_atomic_open_enter,
 		),
 
 		TP_fast_assign(
-			__entry->dev = inode_sb(dir)->s_dev;
+			__entry->dev = inode_view(dir)->v_dev;
 			__entry->dir = NFS_FILEID(dir);
 			__entry->flags = flags;
 			__entry->fmode = (__force unsigned int)ctx->mode;
@@ -333,7 +333,7 @@ TRACE_EVENT(nfs_atomic_open_exit,
 
 		TP_fast_assign(
 			__entry->error = error;
-			__entry->dev = inode_sb(dir)->s_dev;
+			__entry->dev = inode_view(dir)->v_dev;
 			__entry->dir = NFS_FILEID(dir);
 			__entry->flags = flags;
 			__entry->fmode = (__force unsigned int)ctx->mode;
@@ -370,7 +370,7 @@ TRACE_EVENT(nfs_create_enter,
 		),
 
 		TP_fast_assign(
-			__entry->dev = inode_sb(dir)->s_dev;
+			__entry->dev = inode_view(dir)->v_dev;
 			__entry->dir = NFS_FILEID(dir);
 			__entry->flags = flags;
 			__assign_str(name, dentry->d_name.name);
@@ -406,7 +406,7 @@ TRACE_EVENT(nfs_create_exit,
 
 		TP_fast_assign(
 			__entry->error = error;
-			__entry->dev = inode_sb(dir)->s_dev;
+			__entry->dev = inode_view(dir)->v_dev;
 			__entry->dir = NFS_FILEID(dir);
 			__entry->flags = flags;
 			__assign_str(name, dentry->d_name.name);
@@ -438,7 +438,7 @@ DECLARE_EVENT_CLASS(nfs_directory_event,
 		),
 
 		TP_fast_assign(
-			__entry->dev = inode_sb(dir)->s_dev;
+			__entry->dev = inode_view(dir)->v_dev;
 			__entry->dir = NFS_FILEID(dir);
 			__assign_str(name, dentry->d_name.name);
 		),
@@ -476,7 +476,7 @@ DECLARE_EVENT_CLASS(nfs_directory_event_done,
 		),
 
 		TP_fast_assign(
-			__entry->dev = inode_sb(dir)->s_dev;
+			__entry->dev = inode_view(dir)->v_dev;
 			__entry->dir = NFS_FILEID(dir);
 			__entry->error = error;
 			__assign_str(name, dentry->d_name.name);
@@ -530,7 +530,7 @@ TRACE_EVENT(nfs_link_enter,
 		),
 
 		TP_fast_assign(
-			__entry->dev = inode_sb(inode)->s_dev;
+			__entry->dev = inode_view(inode)->v_dev;
 			__entry->fileid = NFS_FILEID(inode);
 			__entry->dir = NFS_FILEID(dir);
 			__assign_str(name, dentry->d_name.name);
@@ -565,7 +565,7 @@ TRACE_EVENT(nfs_link_exit,
 		),
 
 		TP_fast_assign(
-			__entry->dev = inode_sb(inode)->s_dev;
+			__entry->dev = inode_view(inode)->v_dev;
 			__entry->fileid = NFS_FILEID(inode);
 			__entry->dir = NFS_FILEID(dir);
 			__entry->error = error;
@@ -602,7 +602,7 @@ DECLARE_EVENT_CLASS(nfs_rename_event,
 		),
 
 		TP_fast_assign(
-			__entry->dev = inode_sb(old_dir)->s_dev;
+			__entry->dev = inode_view(old_dir)->v_dev;
 			__entry->old_dir = NFS_FILEID(old_dir);
 			__entry->new_dir = NFS_FILEID(new_dir);
 			__assign_str(old_name, old_dentry->d_name.name);
@@ -650,7 +650,7 @@ DECLARE_EVENT_CLASS(nfs_rename_event_done,
 		),
 
 		TP_fast_assign(
-			__entry->dev = inode_sb(old_dir)->s_dev;
+			__entry->dev = inode_view(old_dir)->v_dev;
 			__entry->old_dir = NFS_FILEID(old_dir);
 			__entry->new_dir = NFS_FILEID(new_dir);
 			__entry->error = error;
@@ -705,7 +705,7 @@ TRACE_EVENT(nfs_sillyrename_unlink,
 		TP_fast_assign(
 			struct inode *dir = d_inode(data->dentry->d_parent);
 			size_t len = data->args.name.len;
-			__entry->dev = inode_sb(dir)->s_dev;
+			__entry->dev = inode_view(dir)->v_dev;
 			__entry->dir = NFS_FILEID(dir);
 			__entry->error = error;
 			memcpy(__get_str(name),
@@ -743,7 +743,7 @@ TRACE_EVENT(nfs_initiate_read,
 
 			__entry->offset = offset;
 			__entry->count = count;
-			__entry->dev = inode_sb(inode)->s_dev;
+			__entry->dev = inode_view(inode)->v_dev;
 			__entry->fileid = nfsi->fileid;
 			__entry->fhandle = nfs_fhandle_hash(&nfsi->fh);
 		),
@@ -781,7 +781,7 @@ TRACE_EVENT(nfs_readpage_done,
 			__entry->status = status;
 			__entry->offset = offset;
 			__entry->eof = eof;
-			__entry->dev = inode_sb(inode)->s_dev;
+			__entry->dev = inode_view(inode)->v_dev;
 			__entry->fileid = nfsi->fileid;
 			__entry->fhandle = nfs_fhandle_hash(&nfsi->fh);
 		),
@@ -831,7 +831,7 @@ TRACE_EVENT(nfs_initiate_write,
 			__entry->offset = offset;
 			__entry->count = count;
 			__entry->stable = stable;
-			__entry->dev = inode_sb(inode)->s_dev;
+			__entry->dev = inode_view(inode)->v_dev;
 			__entry->fileid = nfsi->fileid;
 			__entry->fhandle = nfs_fhandle_hash(&nfsi->fh);
 		),
@@ -875,7 +875,7 @@ TRACE_EVENT(nfs_writeback_done,
 			__entry->stable = writeverf->committed;
 			memcpy(&__entry->verifier, &writeverf->verifier,
 			       sizeof(__entry->verifier));
-			__entry->dev = inode_sb(inode)->s_dev;
+			__entry->dev = inode_view(inode)->v_dev;
 			__entry->fileid = nfsi->fileid;
 			__entry->fhandle = nfs_fhandle_hash(&nfsi->fh);
 		),
@@ -914,7 +914,7 @@ TRACE_EVENT(nfs_initiate_commit,
 
 			__entry->offset = data->args.offset;
 			__entry->count = data->args.count;
-			__entry->dev = inode_sb(inode)->s_dev;
+			__entry->dev = inode_view(inode)->v_dev;
 			__entry->fileid = nfsi->fileid;
 			__entry->fhandle = nfs_fhandle_hash(&nfsi->fh);
 		),
@@ -953,7 +953,7 @@ TRACE_EVENT(nfs_commit_done,
 			__entry->offset = data->args.offset;
 			memcpy(&__entry->verifier, &data->verf.verifier,
 			       sizeof(__entry->verifier));
-			__entry->dev = inode_sb(inode)->s_dev;
+			__entry->dev = inode_view(inode)->v_dev;
 			__entry->fileid = nfsi->fileid;
 			__entry->fhandle = nfs_fhandle_hash(&nfsi->fh);
 		),
diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c
index 393159739b95..9ea609b0ca8e 100644
--- a/fs/nfsd/vfs.c
+++ b/fs/nfsd/vfs.c
@@ -786,7 +786,7 @@ struct raparms *
 nfsd_init_raparms(struct file *file)
 {
 	struct inode *inode = file_inode(file);
-	dev_t dev = inode_sb(inode)->s_dev;
+	dev_t dev = inode_view(inode)->v_dev;
 	ino_t ino = inode->i_ino;
 	struct raparms	*ra, **rap, **frap = NULL;
 	int depth = 0;
@@ -943,7 +943,7 @@ static int wait_for_concurrent_writes(struct file *file)
 	int err = 0;
 
 	if (atomic_read(&inode->i_writecount) > 1
-	    || (last_ino == inode->i_ino && last_dev == inode_sb(inode)->s_dev)) {
+	    || (last_ino == inode->i_ino && last_dev == inode_view(inode)->v_dev)) {
 		dprintk("nfsd: write defer %d\n", task_pid_nr(current));
 		msleep(10);
 		dprintk("nfsd: write resume %d\n", task_pid_nr(current));
@@ -954,7 +954,7 @@ static int wait_for_concurrent_writes(struct file *file)
 		err = vfs_fsync(file, 0);
 	}
 	last_ino = inode->i_ino;
-	last_dev = inode_sb(inode)->s_dev;
+	last_dev = inode_view(inode)->v_dev;
 	return err;
 }
 
diff --git a/fs/notify/fdinfo.c b/fs/notify/fdinfo.c
index 857df5ce27ac..9a6ad77fbe6f 100644
--- a/fs/notify/fdinfo.c
+++ b/fs/notify/fdinfo.c
@@ -92,7 +92,7 @@ static void inotify_fdinfo(struct seq_file *m, struct fsnotify_mark *mark)
 		u32 mask = mark->mask & IN_ALL_EVENTS;
 		seq_printf(m, "inotify wd:%x ino:%lx sdev:%x mask:%x ignored_mask:%x ",
 			   inode_mark->wd, inode->i_ino,
-			   inode_sb(inode)->s_dev,
+			   inode_view(inode)->v_dev,
 			   mask, mark->ignored_mask);
 		show_mark_fhandle(m, inode);
 		seq_putc(m, '\n');
@@ -122,7 +122,7 @@ static void fanotify_fdinfo(struct seq_file *m, struct fsnotify_mark *mark)
 		if (!inode)
 			return;
 		seq_printf(m, "fanotify ino:%lx sdev:%x mflags:%x mask:%x ignored_mask:%x ",
-			   inode->i_ino, inode_sb(inode)->s_dev,
+			   inode->i_ino, inode_view(inode)->v_dev,
 			   mflags, mark->mask, mark->ignored_mask);
 		show_mark_fhandle(m, inode);
 		seq_putc(m, '\n');
diff --git a/fs/proc/nommu.c b/fs/proc/nommu.c
index 5c979fc49662..1278548e099f 100644
--- a/fs/proc/nommu.c
+++ b/fs/proc/nommu.c
@@ -46,7 +46,7 @@ static int nommu_region_show(struct seq_file *m, struct vm_region *region)
 
 	if (file) {
 		struct inode *inode = file_inode(region->vm_file);
-		dev = inode_sb(inode)->s_dev;
+		dev = inode_view(inode)->v_dev;
 		ino = inode->i_ino;
 	}
 
diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c
index 27bf744e8da9..10ac40e87939 100644
--- a/fs/proc/task_mmu.c
+++ b/fs/proc/task_mmu.c
@@ -312,7 +312,7 @@ show_map_vma(struct seq_file *m, struct vm_area_struct *vma, int is_pid)
 
 	if (file) {
 		struct inode *inode = file_inode(vma->vm_file);
-		dev = inode_sb(inode)->s_dev;
+		dev = inode_view(inode)->v_dev;
 		ino = inode->i_ino;
 		pgoff = ((loff_t)vma->vm_pgoff) << PAGE_SHIFT;
 	}
diff --git a/fs/proc/task_nommu.c b/fs/proc/task_nommu.c
index d3acd4433d9d..a109df40fa3c 100644
--- a/fs/proc/task_nommu.c
+++ b/fs/proc/task_nommu.c
@@ -157,7 +157,7 @@ static int nommu_vma_show(struct seq_file *m, struct vm_area_struct *vma,
 
 	if (file) {
 		struct inode *inode = file_inode(vma->vm_file);
-		dev = inode_sb(inode)->s_dev;
+		dev = inode_view(inode)->v_dev;
 		ino = inode->i_ino;
 		pgoff = (loff_t)vma->vm_pgoff << PAGE_SHIFT;
 	}
diff --git a/fs/stat.c b/fs/stat.c
index 178b81d4359e..48787ee00e9c 100644
--- a/fs/stat.c
+++ b/fs/stat.c
@@ -32,7 +32,7 @@
  */
 void generic_fillattr(struct inode *inode, struct kstat *stat)
 {
-	stat->dev = inode_sb(inode)->s_dev;
+	stat->dev = inode_view(inode)->v_dev;
 	stat->ino = inode->i_ino;
 	stat->mode = inode->i_mode;
 	stat->nlink = inode->i_nlink;
diff --git a/fs/xfs/xfs_iops.c b/fs/xfs/xfs_iops.c
index 7aed2ad33d07..be323e17a302 100644
--- a/fs/xfs/xfs_iops.c
+++ b/fs/xfs/xfs_iops.c
@@ -503,7 +503,7 @@ xfs_vn_getattr(
 		return -EIO;
 
 	stat->size = XFS_ISIZE(ip);
-	stat->dev = inode_sb(inode)->s_dev;
+	stat->dev = inode_view(inode)->v_dev;
 	stat->mode = inode->i_mode;
 	stat->nlink = inode->i_nlink;
 	stat->uid = inode->i_uid;
diff --git a/fs/xfs/xfs_trace.h b/fs/xfs/xfs_trace.h
index 633c7cbc097a..16065fe0bd4d 100644
--- a/fs/xfs/xfs_trace.h
+++ b/fs/xfs/xfs_trace.h
@@ -60,7 +60,7 @@ DECLARE_EVENT_CLASS(xfs_attr_list_class,
 		__field(int, flags)
 	),
 	TP_fast_assign(
-		__entry->dev = inode_sb(VFS_I(ctx->dp))->s_dev;
+		__entry->dev = inode_view(VFS_I(ctx->dp))->v_dev;
 		__entry->ino = ctx->dp->i_ino;
 		__entry->hashval = ctx->cursor->hashval;
 		__entry->blkno = ctx->cursor->blkno;
@@ -186,7 +186,7 @@ TRACE_EVENT(xfs_attr_list_node_descend,
 		__field(u32, bt_before)
 	),
 	TP_fast_assign(
-		__entry->dev = inode_sb(VFS_I(ctx->dp))->s_dev;
+		__entry->dev = inode_view(VFS_I(ctx->dp))->v_dev;
 		__entry->ino = ctx->dp->i_ino;
 		__entry->hashval = ctx->cursor->hashval;
 		__entry->blkno = ctx->cursor->blkno;
@@ -240,7 +240,7 @@ DECLARE_EVENT_CLASS(xfs_bmap_class,
 
 		ifp = xfs_iext_state_to_fork(ip, state);
 		xfs_iext_get_extent(ifp, cur, &r);
-		__entry->dev = inode_sb(VFS_I(ip))->s_dev;
+		__entry->dev = inode_view(VFS_I(ip))->v_dev;
 		__entry->ino = ip->i_ino;
 		__entry->leaf = cur->leaf;
 		__entry->pos = cur->pos;
@@ -515,7 +515,7 @@ DECLARE_EVENT_CLASS(xfs_filestream_class,
 		__field(int, streams)
 	),
 	TP_fast_assign(
-		__entry->dev = inode_sb(VFS_I(ip))->s_dev;
+		__entry->dev = inode_view(VFS_I(ip))->v_dev;
 		__entry->ino = ip->i_ino;
 		__entry->agno = agno;
 		__entry->streams = xfs_filestream_peek_ag(ip->i_mount, agno);
@@ -547,7 +547,7 @@ TRACE_EVENT(xfs_filestream_pick,
 		__field(int, nscan)
 	),
 	TP_fast_assign(
-		__entry->dev = inode_sb(VFS_I(ip))->s_dev;
+		__entry->dev = inode_view(VFS_I(ip))->v_dev;
 		__entry->ino = ip->i_ino;
 		__entry->agno = agno;
 		__entry->streams = xfs_filestream_peek_ag(ip->i_mount, agno);
@@ -574,7 +574,7 @@ DECLARE_EVENT_CLASS(xfs_lock_class,
 		__field(unsigned long, caller_ip)
 	),
 	TP_fast_assign(
-		__entry->dev = inode_sb(VFS_I(ip))->s_dev;
+		__entry->dev = inode_view(VFS_I(ip))->v_dev;
 		__entry->ino = ip->i_ino;
 		__entry->lock_flags = lock_flags;
 		__entry->caller_ip = caller_ip;
@@ -604,7 +604,7 @@ DECLARE_EVENT_CLASS(xfs_inode_class,
 		__field(xfs_ino_t, ino)
 	),
 	TP_fast_assign(
-		__entry->dev = inode_sb(VFS_I(ip))->s_dev;
+		__entry->dev = inode_view(VFS_I(ip))->v_dev;
 		__entry->ino = ip->i_ino;
 	),
 	TP_printk("dev %d:%d ino 0x%llx",
@@ -665,7 +665,7 @@ TRACE_EVENT(xfs_filemap_fault,
 		__field(bool, write_fault)
 	),
 	TP_fast_assign(
-		__entry->dev = inode_sb(VFS_I(ip))->s_dev;
+		__entry->dev = inode_view(VFS_I(ip))->v_dev;
 		__entry->ino = ip->i_ino;
 		__entry->pe_size = pe_size;
 		__entry->write_fault = write_fault;
@@ -691,7 +691,7 @@ DECLARE_EVENT_CLASS(xfs_iref_class,
 		__field(unsigned long, caller_ip)
 	),
 	TP_fast_assign(
-		__entry->dev = inode_sb(VFS_I(ip))->s_dev;
+		__entry->dev = inode_view(VFS_I(ip))->v_dev;
 		__entry->ino = ip->i_ino;
 		__entry->count = atomic_read(&VFS_I(ip)->i_count);
 		__entry->pincount = atomic_read(&ip->i_pincount);
@@ -717,7 +717,7 @@ TRACE_EVENT(xfs_iomap_prealloc_size,
 		__field(unsigned int, writeio_blocks)
 	),
 	TP_fast_assign(
-		__entry->dev = inode_sb(VFS_I(ip))->s_dev;
+		__entry->dev = inode_view(VFS_I(ip))->v_dev;
 		__entry->ino = ip->i_ino;
 		__entry->blocks = blocks;
 		__entry->shift = shift;
@@ -795,7 +795,7 @@ DECLARE_EVENT_CLASS(xfs_namespace_class,
 		__dynamic_array(char, name, name->len)
 	),
 	TP_fast_assign(
-		__entry->dev = inode_sb(VFS_I(dp))->s_dev;
+		__entry->dev = inode_view(VFS_I(dp))->v_dev;
 		__entry->dp_ino = dp->i_ino;
 		__entry->namelen = name->len;
 		memcpy(__get_str(name), name->name, name->len);
@@ -831,7 +831,7 @@ TRACE_EVENT(xfs_rename,
 		__dynamic_array(char, target_name, target_name->len)
 	),
 	TP_fast_assign(
-		__entry->dev = inode_sb(VFS_I(src_dp))->s_dev;
+		__entry->dev = inode_view(VFS_I(src_dp))->v_dev;
 		__entry->src_dp_ino = src_dp->i_ino;
 		__entry->target_dp_ino = target_dp->i_ino;
 		__entry->src_namelen = src_name->len;
@@ -1132,7 +1132,7 @@ DECLARE_EVENT_CLASS(xfs_file_class,
 		__field(size_t, count)
 	),
 	TP_fast_assign(
-		__entry->dev = inode_sb(VFS_I(ip))->s_dev;
+		__entry->dev = inode_view(VFS_I(ip))->v_dev;
 		__entry->ino = ip->i_ino;
 		__entry->size = ip->i_d.di_size;
 		__entry->offset = offset;
@@ -1176,7 +1176,7 @@ DECLARE_EVENT_CLASS(xfs_page_class,
 
 		if (page_has_buffers(page))
 			xfs_count_page_state(page, &delalloc, &unwritten);
-		__entry->dev = inode_sb(inode)->s_dev;
+		__entry->dev = inode_view(inode)->v_dev;
 		__entry->ino = XFS_I(inode)->i_ino;
 		__entry->pgoff = page_offset(page);
 		__entry->size = i_size_read(inode);
@@ -1215,7 +1215,7 @@ DECLARE_EVENT_CLASS(xfs_readpage_class,
 		__field(int, nr_pages)
 	),
 	TP_fast_assign(
-		__entry->dev = inode_sb(inode)->s_dev;
+		__entry->dev = inode_view(inode)->v_dev;
 		__entry->ino = inode->i_ino;
 		__entry->nr_pages = nr_pages;
 	),
@@ -1248,7 +1248,7 @@ DECLARE_EVENT_CLASS(xfs_imap_class,
 		__field(xfs_filblks_t, blockcount)
 	),
 	TP_fast_assign(
-		__entry->dev = inode_sb(VFS_I(ip))->s_dev;
+		__entry->dev = inode_view(VFS_I(ip))->v_dev;
 		__entry->ino = ip->i_ino;
 		__entry->size = ip->i_d.di_size;
 		__entry->offset = offset;
@@ -1296,7 +1296,7 @@ DECLARE_EVENT_CLASS(xfs_simple_io_class,
 		__field(size_t, count)
 	),
 	TP_fast_assign(
-		__entry->dev = inode_sb(VFS_I(ip))->s_dev;
+		__entry->dev = inode_view(VFS_I(ip))->v_dev;
 		__entry->ino = ip->i_ino;
 		__entry->isize = VFS_I(ip)->i_size;
 		__entry->disize = ip->i_d.di_size;
@@ -1336,7 +1336,7 @@ DECLARE_EVENT_CLASS(xfs_itrunc_class,
 		__field(xfs_fsize_t, new_size)
 	),
 	TP_fast_assign(
-		__entry->dev = inode_sb(VFS_I(ip))->s_dev;
+		__entry->dev = inode_view(VFS_I(ip))->v_dev;
 		__entry->ino = ip->i_ino;
 		__entry->size = ip->i_d.di_size;
 		__entry->new_size = new_size;
@@ -1366,7 +1366,7 @@ TRACE_EVENT(xfs_pagecache_inval,
 		__field(xfs_off_t, finish)
 	),
 	TP_fast_assign(
-		__entry->dev = inode_sb(VFS_I(ip))->s_dev;
+		__entry->dev = inode_view(VFS_I(ip))->v_dev;
 		__entry->ino = ip->i_ino;
 		__entry->size = ip->i_d.di_size;
 		__entry->start = start;
@@ -1394,7 +1394,7 @@ TRACE_EVENT(xfs_bunmap,
 		__field(int, flags)
 	),
 	TP_fast_assign(
-		__entry->dev = inode_sb(VFS_I(ip))->s_dev;
+		__entry->dev = inode_view(VFS_I(ip))->v_dev;
 		__entry->ino = ip->i_ino;
 		__entry->size = ip->i_d.di_size;
 		__entry->bno = bno;
@@ -1682,7 +1682,7 @@ DECLARE_EVENT_CLASS(xfs_da_class,
 		__field(int, op_flags)
 	),
 	TP_fast_assign(
-		__entry->dev = inode_sb(VFS_I(args->dp))->s_dev;
+		__entry->dev = inode_view(VFS_I(args->dp))->v_dev;
 		__entry->ino = args->dp->i_ino;
 		if (args->namelen)
 			memcpy(__get_str(name), args->name, args->namelen);
@@ -1746,7 +1746,7 @@ DECLARE_EVENT_CLASS(xfs_attr_class,
 		__field(int, op_flags)
 	),
 	TP_fast_assign(
-		__entry->dev = inode_sb(VFS_I(args->dp))->s_dev;
+		__entry->dev = inode_view(VFS_I(args->dp))->v_dev;
 		__entry->ino = args->dp->i_ino;
 		if (args->namelen)
 			memcpy(__get_str(name), args->name, args->namelen);
@@ -1849,7 +1849,7 @@ DECLARE_EVENT_CLASS(xfs_dir2_space_class,
 		__field(int, idx)
 	),
 	TP_fast_assign(
-		__entry->dev = inode_sb(VFS_I(args->dp))->s_dev;
+		__entry->dev = inode_view(VFS_I(args->dp))->v_dev;
 		__entry->ino = args->dp->i_ino;
 		__entry->op_flags = args->op_flags;
 		__entry->idx = idx;
@@ -1882,7 +1882,7 @@ TRACE_EVENT(xfs_dir2_leafn_moveents,
 		__field(int, count)
 	),
 	TP_fast_assign(
-		__entry->dev = inode_sb(VFS_I(args->dp))->s_dev;
+		__entry->dev = inode_view(VFS_I(args->dp))->v_dev;
 		__entry->ino = args->dp->i_ino;
 		__entry->op_flags = args->op_flags;
 		__entry->src_idx = src_idx;
@@ -1922,7 +1922,7 @@ DECLARE_EVENT_CLASS(xfs_swap_extent_class,
 		__field(int, fork_off)
 	),
 	TP_fast_assign(
-		__entry->dev = inode_sb(VFS_I(ip))->s_dev;
+		__entry->dev = inode_view(VFS_I(ip))->v_dev;
 		__entry->which = which;
 		__entry->ino = ip->i_ino;
 		__entry->format = ip->i_d.di_format;
@@ -2972,7 +2972,7 @@ DECLARE_EVENT_CLASS(xfs_inode_error_class,
 		__field(unsigned long, caller_ip)
 	),
 	TP_fast_assign(
-		__entry->dev = inode_sb(VFS_I(ip))->s_dev;
+		__entry->dev = inode_view(VFS_I(ip))->v_dev;
 		__entry->ino = ip->i_ino;
 		__entry->error = error;
 		__entry->caller_ip = caller_ip;
@@ -3010,7 +3010,7 @@ DECLARE_EVENT_CLASS(xfs_double_io_class,
 		__field(loff_t, dest_offset)
 	),
 	TP_fast_assign(
-		__entry->dev = inode_sb(VFS_I(src))->s_dev;
+		__entry->dev = inode_view(VFS_I(src))->v_dev;
 		__entry->src_ino = src->i_ino;
 		__entry->src_isize = VFS_I(src)->i_size;
 		__entry->src_disize = src->i_d.di_size;
@@ -3055,7 +3055,7 @@ DECLARE_EVENT_CLASS(xfs_inode_irec_class,
 		__field(int, state)
 	),
 	TP_fast_assign(
-		__entry->dev = inode_sb(VFS_I(ip))->s_dev;
+		__entry->dev = inode_view(VFS_I(ip))->v_dev;
 		__entry->ino = ip->i_ino;
 		__entry->lblk = irec->br_startoff;
 		__entry->len = irec->br_blockcount;
@@ -3096,7 +3096,7 @@ TRACE_EVENT(xfs_reflink_remap_blocks_loop,
 		__field(xfs_fileoff_t, dest_lblk)
 	),
 	TP_fast_assign(
-		__entry->dev = inode_sb(VFS_I(src))->s_dev;
+		__entry->dev = inode_view(VFS_I(src))->v_dev;
 		__entry->src_ino = src->i_ino;
 		__entry->src_lblk = soffset;
 		__entry->len = len;
@@ -3124,7 +3124,7 @@ TRACE_EVENT(xfs_reflink_punch_range,
 		__field(xfs_extlen_t, len)
 	),
 	TP_fast_assign(
-		__entry->dev = inode_sb(VFS_I(ip))->s_dev;
+		__entry->dev = inode_view(VFS_I(ip))->v_dev;
 		__entry->ino = ip->i_ino;
 		__entry->lblk = lblk;
 		__entry->len = len;
@@ -3147,7 +3147,7 @@ TRACE_EVENT(xfs_reflink_remap,
 		__field(xfs_fsblock_t, new_pblk)
 	),
 	TP_fast_assign(
-		__entry->dev = inode_sb(VFS_I(ip))->s_dev;
+		__entry->dev = inode_view(VFS_I(ip))->v_dev;
 		__entry->ino = ip->i_ino;
 		__entry->lblk = lblk;
 		__entry->len = len;
@@ -3183,7 +3183,7 @@ TRACE_EVENT(xfs_ioctl_clone,
 		__field(loff_t, dest_isize)
 	),
 	TP_fast_assign(
-		__entry->dev = inode_sb(src)->s_dev;
+		__entry->dev = inode_view(src)->v_dev;
 		__entry->src_ino = src->i_ino;
 		__entry->src_isize = i_size_read(src);
 		__entry->dest_ino = dest->i_ino;
diff --git a/include/trace/events/ext4.h b/include/trace/events/ext4.h
index 89943e59ae36..500ae412f483 100644
--- a/include/trace/events/ext4.h
+++ b/include/trace/events/ext4.h
@@ -91,7 +91,7 @@ TRACE_EVENT(ext4_other_inode_update_time,
 
 	TP_fast_assign(
 		__entry->orig_ino = orig_ino;
-		__entry->dev	= inode_sb(inode)->s_dev;
+		__entry->dev	= inode_view(inode)->v_dev;
 		__entry->ino	= inode->i_ino;
 		__entry->uid	= i_uid_read(inode);
 		__entry->gid	= i_gid_read(inode);
@@ -120,7 +120,7 @@ TRACE_EVENT(ext4_free_inode,
 	),
 
 	TP_fast_assign(
-		__entry->dev	= inode_sb(inode)->s_dev;
+		__entry->dev	= inode_view(inode)->v_dev;
 		__entry->ino	= inode->i_ino;
 		__entry->uid	= i_uid_read(inode);
 		__entry->gid	= i_gid_read(inode);
@@ -146,7 +146,7 @@ TRACE_EVENT(ext4_request_inode,
 	),
 
 	TP_fast_assign(
-		__entry->dev	= inode_sb(dir)->s_dev;
+		__entry->dev	= inode_view(dir)->v_dev;
 		__entry->dir	= dir->i_ino;
 		__entry->mode	= mode;
 	),
@@ -169,7 +169,7 @@ TRACE_EVENT(ext4_allocate_inode,
 	),
 
 	TP_fast_assign(
-		__entry->dev	= inode_sb(inode)->s_dev;
+		__entry->dev	= inode_view(inode)->v_dev;
 		__entry->ino	= inode->i_ino;
 		__entry->dir	= dir->i_ino;
 		__entry->mode	= mode;
@@ -193,7 +193,7 @@ TRACE_EVENT(ext4_evict_inode,
 	),
 
 	TP_fast_assign(
-		__entry->dev	= inode_sb(inode)->s_dev;
+		__entry->dev	= inode_view(inode)->v_dev;
 		__entry->ino	= inode->i_ino;
 		__entry->nlink	= inode->i_nlink;
 	),
@@ -215,7 +215,7 @@ TRACE_EVENT(ext4_drop_inode,
 	),
 
 	TP_fast_assign(
-		__entry->dev	= inode_sb(inode)->s_dev;
+		__entry->dev	= inode_view(inode)->v_dev;
 		__entry->ino	= inode->i_ino;
 		__entry->drop	= drop;
 	),
@@ -237,7 +237,7 @@ TRACE_EVENT(ext4_mark_inode_dirty,
 	),
 
 	TP_fast_assign(
-		__entry->dev	= inode_sb(inode)->s_dev;
+		__entry->dev	= inode_view(inode)->v_dev;
 		__entry->ino	= inode->i_ino;
 		__entry->ip	= IP;
 	),
@@ -259,7 +259,7 @@ TRACE_EVENT(ext4_begin_ordered_truncate,
 	),
 
 	TP_fast_assign(
-		__entry->dev		= inode_sb(inode)->s_dev;
+		__entry->dev		= inode_view(inode)->v_dev;
 		__entry->ino		= inode->i_ino;
 		__entry->new_size	= new_size;
 	),
@@ -286,7 +286,7 @@ DECLARE_EVENT_CLASS(ext4__write_begin,
 	),
 
 	TP_fast_assign(
-		__entry->dev	= inode_sb(inode)->s_dev;
+		__entry->dev	= inode_view(inode)->v_dev;
 		__entry->ino	= inode->i_ino;
 		__entry->pos	= pos;
 		__entry->len	= len;
@@ -330,7 +330,7 @@ DECLARE_EVENT_CLASS(ext4__write_end,
 	),
 
 	TP_fast_assign(
-		__entry->dev	= inode_sb(inode)->s_dev;
+		__entry->dev	= inode_view(inode)->v_dev;
 		__entry->ino	= inode->i_ino;
 		__entry->pos	= pos;
 		__entry->len	= len;
@@ -386,7 +386,7 @@ TRACE_EVENT(ext4_writepages,
 	),
 
 	TP_fast_assign(
-		__entry->dev		= inode_sb(inode)->s_dev;
+		__entry->dev		= inode_view(inode)->v_dev;
 		__entry->ino		= inode->i_ino;
 		__entry->nr_to_write	= wbc->nr_to_write;
 		__entry->pages_skipped	= wbc->pages_skipped;
@@ -424,7 +424,7 @@ TRACE_EVENT(ext4_da_write_pages,
 	),
 
 	TP_fast_assign(
-		__entry->dev		= inode_sb(inode)->s_dev;
+		__entry->dev		= inode_view(inode)->v_dev;
 		__entry->ino		= inode->i_ino;
 		__entry->first_page	= first_page;
 		__entry->nr_to_write	= wbc->nr_to_write;
@@ -452,7 +452,7 @@ TRACE_EVENT(ext4_da_write_pages_extent,
 	),
 
 	TP_fast_assign(
-		__entry->dev		= inode_sb(inode)->s_dev;
+		__entry->dev		= inode_view(inode)->v_dev;
 		__entry->ino		= inode->i_ino;
 		__entry->lblk		= map->m_lblk;
 		__entry->len		= map->m_len;
@@ -482,7 +482,7 @@ TRACE_EVENT(ext4_writepages_result,
 	),
 
 	TP_fast_assign(
-		__entry->dev		= inode_sb(inode)->s_dev;
+		__entry->dev		= inode_view(inode)->v_dev;
 		__entry->ino		= inode->i_ino;
 		__entry->ret		= ret;
 		__entry->pages_written	= pages_written;
@@ -513,7 +513,7 @@ DECLARE_EVENT_CLASS(ext4__page_op,
 	),
 
 	TP_fast_assign(
-		__entry->dev	= inode_sb(page->mapping->host)->s_dev;
+		__entry->dev	= inode_view(page->mapping->host)->v_dev;
 		__entry->ino	= page->mapping->host->i_ino;
 		__entry->index	= page->index;
 	),
@@ -559,7 +559,7 @@ DECLARE_EVENT_CLASS(ext4_invalidatepage_op,
 	),
 
 	TP_fast_assign(
-		__entry->dev	= inode_sb(page->mapping->host)->s_dev;
+		__entry->dev	= inode_view(page->mapping->host)->v_dev;
 		__entry->ino	= page->mapping->host->i_ino;
 		__entry->index	= page->index;
 		__entry->offset	= offset;
@@ -669,7 +669,7 @@ TRACE_EVENT(ext4_mb_release_inode_pa,
 	),
 
 	TP_fast_assign(
-		__entry->dev		= inode_sb(pa->pa_inode)->s_dev;
+		__entry->dev		= inode_view(pa->pa_inode)->v_dev;
 		__entry->ino		= pa->pa_inode->i_ino;
 		__entry->block		= block;
 		__entry->count		= count;
@@ -716,7 +716,7 @@ TRACE_EVENT(ext4_discard_preallocations,
 	),
 
 	TP_fast_assign(
-		__entry->dev	= inode_sb(inode)->s_dev;
+		__entry->dev	= inode_view(inode)->v_dev;
 		__entry->ino	= inode->i_ino;
 	),
 
@@ -765,7 +765,7 @@ TRACE_EVENT(ext4_request_blocks,
 	),
 
 	TP_fast_assign(
-		__entry->dev	= inode_sb(ar->inode)->s_dev;
+		__entry->dev	= inode_view(ar->inode)->v_dev;
 		__entry->ino	= ar->inode->i_ino;
 		__entry->len	= ar->len;
 		__entry->logical = ar->logical;
@@ -806,7 +806,7 @@ TRACE_EVENT(ext4_allocate_blocks,
 	),
 
 	TP_fast_assign(
-		__entry->dev	= inode_sb(ar->inode)->s_dev;
+		__entry->dev	= inode_view(ar->inode)->v_dev;
 		__entry->ino	= ar->inode->i_ino;
 		__entry->block	= block;
 		__entry->len	= ar->len;
@@ -844,7 +844,7 @@ TRACE_EVENT(ext4_free_blocks,
 	),
 
 	TP_fast_assign(
-		__entry->dev		= inode_sb(inode)->s_dev;
+		__entry->dev		= inode_view(inode)->v_dev;
 		__entry->ino		= inode->i_ino;
 		__entry->block		= block;
 		__entry->count		= count;
@@ -898,7 +898,7 @@ TRACE_EVENT(ext4_sync_file_exit,
 	),
 
 	TP_fast_assign(
-		__entry->dev		= inode_sb(inode)->s_dev;
+		__entry->dev		= inode_view(inode)->v_dev;
 		__entry->ino		= inode->i_ino;
 		__entry->ret		= ret;
 	),
@@ -942,7 +942,7 @@ TRACE_EVENT(ext4_alloc_da_blocks,
 	),
 
 	TP_fast_assign(
-		__entry->dev	= inode_sb(inode)->s_dev;
+		__entry->dev	= inode_view(inode)->v_dev;
 		__entry->ino	= inode->i_ino;
 		__entry->data_blocks = EXT4_I(inode)->i_reserved_data_blocks;
 	),
@@ -982,7 +982,7 @@ TRACE_EVENT(ext4_mballoc_alloc,
 	),
 
 	TP_fast_assign(
-		__entry->dev		= inode_sb(ac->ac_inode)->s_dev;
+		__entry->dev		= inode_view(ac->ac_inode)->v_dev;
 		__entry->ino		= ac->ac_inode->i_ino;
 		__entry->orig_logical	= ac->ac_o_ex.fe_logical;
 		__entry->orig_start	= ac->ac_o_ex.fe_start;
@@ -1039,7 +1039,7 @@ TRACE_EVENT(ext4_mballoc_prealloc,
 	),
 
 	TP_fast_assign(
-		__entry->dev		= inode_sb(ac->ac_inode)->s_dev;
+		__entry->dev		= inode_view(ac->ac_inode)->v_dev;
 		__entry->ino		= ac->ac_inode->i_ino;
 		__entry->orig_logical	= ac->ac_o_ex.fe_logical;
 		__entry->orig_start	= ac->ac_o_ex.fe_start;
@@ -1128,7 +1128,7 @@ TRACE_EVENT(ext4_forget,
 	),
 
 	TP_fast_assign(
-		__entry->dev	= inode_sb(inode)->s_dev;
+		__entry->dev	= inode_view(inode)->v_dev;
 		__entry->ino	= inode->i_ino;
 		__entry->block	= block;
 		__entry->is_metadata = is_metadata;
@@ -1157,7 +1157,7 @@ TRACE_EVENT(ext4_da_update_reserve_space,
 	),
 
 	TP_fast_assign(
-		__entry->dev	= inode_sb(inode)->s_dev;
+		__entry->dev	= inode_view(inode)->v_dev;
 		__entry->ino	= inode->i_ino;
 		__entry->i_blocks = inode->i_blocks;
 		__entry->used_blocks = used_blocks;
@@ -1190,7 +1190,7 @@ TRACE_EVENT(ext4_da_reserve_space,
 	),
 
 	TP_fast_assign(
-		__entry->dev	= inode_sb(inode)->s_dev;
+		__entry->dev	= inode_view(inode)->v_dev;
 		__entry->ino	= inode->i_ino;
 		__entry->i_blocks = inode->i_blocks;
 		__entry->reserved_data_blocks = EXT4_I(inode)->i_reserved_data_blocks;
@@ -1220,7 +1220,7 @@ TRACE_EVENT(ext4_da_release_space,
 	),
 
 	TP_fast_assign(
-		__entry->dev	= inode_sb(inode)->s_dev;
+		__entry->dev	= inode_view(inode)->v_dev;
 		__entry->ino	= inode->i_ino;
 		__entry->i_blocks = inode->i_blocks;
 		__entry->freed_blocks = freed_blocks;
@@ -1299,7 +1299,7 @@ TRACE_EVENT(ext4_direct_IO_enter,
 	),
 
 	TP_fast_assign(
-		__entry->dev	= inode_sb(inode)->s_dev;
+		__entry->dev	= inode_view(inode)->v_dev;
 		__entry->ino	= inode->i_ino;
 		__entry->pos	= offset;
 		__entry->len	= len;
@@ -1328,7 +1328,7 @@ TRACE_EVENT(ext4_direct_IO_exit,
 	),
 
 	TP_fast_assign(
-		__entry->dev	= inode_sb(inode)->s_dev;
+		__entry->dev	= inode_view(inode)->v_dev;
 		__entry->ino	= inode->i_ino;
 		__entry->pos	= offset;
 		__entry->len	= len;
@@ -1357,7 +1357,7 @@ DECLARE_EVENT_CLASS(ext4__fallocate_mode,
 	),
 
 	TP_fast_assign(
-		__entry->dev	= inode_sb(inode)->s_dev;
+		__entry->dev	= inode_view(inode)->v_dev;
 		__entry->ino	= inode->i_ino;
 		__entry->offset	= offset;
 		__entry->len	= len;
@@ -1407,7 +1407,7 @@ TRACE_EVENT(ext4_fallocate_exit,
 	),
 
 	TP_fast_assign(
-		__entry->dev	= inode_sb(inode)->s_dev;
+		__entry->dev	= inode_view(inode)->v_dev;
 		__entry->ino	= inode->i_ino;
 		__entry->pos	= offset;
 		__entry->blocks	= max_blocks;
@@ -1481,7 +1481,7 @@ DECLARE_EVENT_CLASS(ext4__truncate,
 	),
 
 	TP_fast_assign(
-		__entry->dev    = inode_sb(inode)->s_dev;
+		__entry->dev    = inode_view(inode)->v_dev;
 		__entry->ino    = inode->i_ino;
 		__entry->blocks	= inode->i_blocks;
 	),
@@ -1523,7 +1523,7 @@ TRACE_EVENT(ext4_ext_convert_to_initialized_enter,
 	),
 
 	TP_fast_assign(
-		__entry->dev		= inode_sb(inode)->s_dev;
+		__entry->dev		= inode_view(inode)->v_dev;
 		__entry->ino		= inode->i_ino;
 		__entry->m_lblk		= map->m_lblk;
 		__entry->m_len		= map->m_len;
@@ -1564,7 +1564,7 @@ TRACE_EVENT(ext4_ext_convert_to_initialized_fastpath,
 	),
 
 	TP_fast_assign(
-		__entry->dev		= inode_sb(inode)->s_dev;
+		__entry->dev		= inode_view(inode)->v_dev;
 		__entry->ino		= inode->i_ino;
 		__entry->m_lblk		= map->m_lblk;
 		__entry->m_len		= map->m_len;
@@ -1601,7 +1601,7 @@ DECLARE_EVENT_CLASS(ext4__map_blocks_enter,
 	),
 
 	TP_fast_assign(
-		__entry->dev    = inode_sb(inode)->s_dev;
+		__entry->dev    = inode_view(inode)->v_dev;
 		__entry->ino    = inode->i_ino;
 		__entry->lblk	= lblk;
 		__entry->len	= len;
@@ -1646,7 +1646,7 @@ DECLARE_EVENT_CLASS(ext4__map_blocks_exit,
 	),
 
 	TP_fast_assign(
-		__entry->dev    = inode_sb(inode)->s_dev;
+		__entry->dev    = inode_view(inode)->v_dev;
 		__entry->ino    = inode->i_ino;
 		__entry->flags	= flags;
 		__entry->pblk	= map->m_pblk;
@@ -1691,7 +1691,7 @@ TRACE_EVENT(ext4_ext_load_extent,
 	),
 
 	TP_fast_assign(
-		__entry->dev    = inode_sb(inode)->s_dev;
+		__entry->dev    = inode_view(inode)->v_dev;
 		__entry->ino    = inode->i_ino;
 		__entry->pblk	= pblk;
 		__entry->lblk	= lblk;
@@ -1714,7 +1714,7 @@ TRACE_EVENT(ext4_load_inode,
 	),
 
 	TP_fast_assign(
-		__entry->dev		= inode_sb(inode)->s_dev;
+		__entry->dev		= inode_view(inode)->v_dev;
 		__entry->ino		= inode->i_ino;
 	),
 
@@ -1837,7 +1837,7 @@ TRACE_EVENT(ext4_ext_handle_unwritten_extents,
 	),
 
 	TP_fast_assign(
-		__entry->dev		= inode_sb(inode)->s_dev;
+		__entry->dev		= inode_view(inode)->v_dev;
 		__entry->ino		= inode->i_ino;
 		__entry->flags		= flags;
 		__entry->lblk		= map->m_lblk;
@@ -1901,7 +1901,7 @@ TRACE_EVENT(ext4_ext_put_in_cache,
 	),
 
 	TP_fast_assign(
-		__entry->dev	= inode_sb(inode)->s_dev;
+		__entry->dev	= inode_view(inode)->v_dev;
 		__entry->ino	= inode->i_ino;
 		__entry->lblk	= lblk;
 		__entry->len	= len;
@@ -1929,7 +1929,7 @@ TRACE_EVENT(ext4_ext_in_cache,
 	),
 
 	TP_fast_assign(
-		__entry->dev	= inode_sb(inode)->s_dev;
+		__entry->dev	= inode_view(inode)->v_dev;
 		__entry->ino	= inode->i_ino;
 		__entry->lblk	= lblk;
 		__entry->ret	= ret;
@@ -1960,7 +1960,7 @@ TRACE_EVENT(ext4_find_delalloc_range,
 	),
 
 	TP_fast_assign(
-		__entry->dev		= inode_sb(inode)->s_dev;
+		__entry->dev		= inode_view(inode)->v_dev;
 		__entry->ino		= inode->i_ino;
 		__entry->from		= from;
 		__entry->to		= to;
@@ -1991,7 +1991,7 @@ TRACE_EVENT(ext4_get_reserved_cluster_alloc,
 	),
 
 	TP_fast_assign(
-		__entry->dev	= inode_sb(inode)->s_dev;
+		__entry->dev	= inode_view(inode)->v_dev;
 		__entry->ino	= inode->i_ino;
 		__entry->lblk	= lblk;
 		__entry->len	= len;
@@ -2019,7 +2019,7 @@ TRACE_EVENT(ext4_ext_show_extent,
 	),
 
 	TP_fast_assign(
-		__entry->dev	= inode_sb(inode)->s_dev;
+		__entry->dev	= inode_view(inode)->v_dev;
 		__entry->ino	= inode->i_ino;
 		__entry->pblk	= pblk;
 		__entry->lblk	= lblk;
@@ -2053,7 +2053,7 @@ TRACE_EVENT(ext4_remove_blocks,
 	),
 
 	TP_fast_assign(
-		__entry->dev		= inode_sb(inode)->s_dev;
+		__entry->dev		= inode_view(inode)->v_dev;
 		__entry->ino		= inode->i_ino;
 		__entry->from		= from;
 		__entry->to		= to;
@@ -2093,7 +2093,7 @@ TRACE_EVENT(ext4_ext_rm_leaf,
 	),
 
 	TP_fast_assign(
-		__entry->dev		= inode_sb(inode)->s_dev;
+		__entry->dev		= inode_view(inode)->v_dev;
 		__entry->ino		= inode->i_ino;
 		__entry->partial	= partial_cluster;
 		__entry->start		= start;
@@ -2125,7 +2125,7 @@ TRACE_EVENT(ext4_ext_rm_idx,
 	),
 
 	TP_fast_assign(
-		__entry->dev	= inode_sb(inode)->s_dev;
+		__entry->dev	= inode_view(inode)->v_dev;
 		__entry->ino	= inode->i_ino;
 		__entry->pblk	= pblk;
 	),
@@ -2151,7 +2151,7 @@ TRACE_EVENT(ext4_ext_remove_space,
 	),
 
 	TP_fast_assign(
-		__entry->dev	= inode_sb(inode)->s_dev;
+		__entry->dev	= inode_view(inode)->v_dev;
 		__entry->ino	= inode->i_ino;
 		__entry->start	= start;
 		__entry->end	= end;
@@ -2183,7 +2183,7 @@ TRACE_EVENT(ext4_ext_remove_space_done,
 	),
 
 	TP_fast_assign(
-		__entry->dev		= inode_sb(inode)->s_dev;
+		__entry->dev		= inode_view(inode)->v_dev;
 		__entry->ino		= inode->i_ino;
 		__entry->start		= start;
 		__entry->end		= end;
@@ -2218,7 +2218,7 @@ DECLARE_EVENT_CLASS(ext4__es_extent,
 	),
 
 	TP_fast_assign(
-		__entry->dev	= inode_sb(inode)->s_dev;
+		__entry->dev	= inode_view(inode)->v_dev;
 		__entry->ino	= inode->i_ino;
 		__entry->lblk	= es->es_lblk;
 		__entry->len	= es->es_len;
@@ -2258,7 +2258,7 @@ TRACE_EVENT(ext4_es_remove_extent,
 	),
 
 	TP_fast_assign(
-		__entry->dev	= inode_sb(inode)->s_dev;
+		__entry->dev	= inode_view(inode)->v_dev;
 		__entry->ino	= inode->i_ino;
 		__entry->lblk	= lblk;
 		__entry->len	= len;
@@ -2282,7 +2282,7 @@ TRACE_EVENT(ext4_es_find_delayed_extent_range_enter,
 	),
 
 	TP_fast_assign(
-		__entry->dev	= inode_sb(inode)->s_dev;
+		__entry->dev	= inode_view(inode)->v_dev;
 		__entry->ino	= inode->i_ino;
 		__entry->lblk	= lblk;
 	),
@@ -2307,7 +2307,7 @@ TRACE_EVENT(ext4_es_find_delayed_extent_range_exit,
 	),
 
 	TP_fast_assign(
-		__entry->dev	= inode_sb(inode)->s_dev;
+		__entry->dev	= inode_view(inode)->v_dev;
 		__entry->ino	= inode->i_ino;
 		__entry->lblk	= es->es_lblk;
 		__entry->len	= es->es_len;
@@ -2334,7 +2334,7 @@ TRACE_EVENT(ext4_es_lookup_extent_enter,
 	),
 
 	TP_fast_assign(
-		__entry->dev	= inode_sb(inode)->s_dev;
+		__entry->dev	= inode_view(inode)->v_dev;
 		__entry->ino	= inode->i_ino;
 		__entry->lblk	= lblk;
 	),
@@ -2361,7 +2361,7 @@ TRACE_EVENT(ext4_es_lookup_extent_exit,
 	),
 
 	TP_fast_assign(
-		__entry->dev	= inode_sb(inode)->s_dev;
+		__entry->dev	= inode_view(inode)->v_dev;
 		__entry->ino	= inode->i_ino;
 		__entry->lblk	= es->es_lblk;
 		__entry->len	= es->es_len;
@@ -2447,7 +2447,7 @@ TRACE_EVENT(ext4_collapse_range,
 	),
 
 	TP_fast_assign(
-		__entry->dev	= inode_sb(inode)->s_dev;
+		__entry->dev	= inode_view(inode)->v_dev;
 		__entry->ino	= inode->i_ino;
 		__entry->offset	= offset;
 		__entry->len	= len;
@@ -2472,7 +2472,7 @@ TRACE_EVENT(ext4_insert_range,
 	),
 
 	TP_fast_assign(
-		__entry->dev	= inode_sb(inode)->s_dev;
+		__entry->dev	= inode_view(inode)->v_dev;
 		__entry->ino	= inode->i_ino;
 		__entry->offset	= offset;
 		__entry->len	= len;
diff --git a/include/trace/events/f2fs.h b/include/trace/events/f2fs.h
index 8e958dd92412..effb2704f3ae 100644
--- a/include/trace/events/f2fs.h
+++ b/include/trace/events/f2fs.h
@@ -171,7 +171,7 @@ DECLARE_EVENT_CLASS(f2fs__inode,
 	),
 
 	TP_fast_assign(
-		__entry->dev	= inode_sb(inode)->s_dev;
+		__entry->dev	= inode_view(inode)->v_dev;
 		__entry->ino	= inode->i_ino;
 		__entry->pino	= F2FS_I(inode)->i_pino;
 		__entry->mode	= inode->i_mode;
@@ -205,7 +205,7 @@ DECLARE_EVENT_CLASS(f2fs__inode_exit,
 	),
 
 	TP_fast_assign(
-		__entry->dev	= inode_sb(inode)->s_dev;
+		__entry->dev	= inode_view(inode)->v_dev;
 		__entry->ino	= inode->i_ino;
 		__entry->ret	= ret;
 	),
@@ -237,7 +237,7 @@ TRACE_EVENT(f2fs_sync_file_exit,
 	),
 
 	TP_fast_assign(
-		__entry->dev		= inode_sb(inode)->s_dev;
+		__entry->dev		= inode_view(inode)->v_dev;
 		__entry->ino		= inode->i_ino;
 		__entry->cp_reason	= cp_reason;
 		__entry->datasync	= datasync;
@@ -319,7 +319,7 @@ TRACE_EVENT(f2fs_unlink_enter,
 	),
 
 	TP_fast_assign(
-		__entry->dev	= inode_sb(dir)->s_dev;
+		__entry->dev	= inode_view(dir)->v_dev;
 		__entry->ino	= dir->i_ino;
 		__entry->size	= dir->i_size;
 		__entry->blocks	= dir->i_blocks;
@@ -370,7 +370,7 @@ TRACE_EVENT(f2fs_truncate_data_blocks_range,
 	),
 
 	TP_fast_assign(
-		__entry->dev	= inode_sb(inode)->s_dev;
+		__entry->dev	= inode_view(inode)->v_dev;
 		__entry->ino	= inode->i_ino;
 		__entry->nid	= nid;
 		__entry->ofs	= ofs;
@@ -399,7 +399,7 @@ DECLARE_EVENT_CLASS(f2fs__truncate_op,
 	),
 
 	TP_fast_assign(
-		__entry->dev	= inode_sb(inode)->s_dev;
+		__entry->dev	= inode_view(inode)->v_dev;
 		__entry->ino	= inode->i_ino;
 		__entry->size	= inode->i_size;
 		__entry->blocks	= inode->i_blocks;
@@ -456,7 +456,7 @@ DECLARE_EVENT_CLASS(f2fs__truncate_node,
 	),
 
 	TP_fast_assign(
-		__entry->dev		= inode_sb(inode)->s_dev;
+		__entry->dev		= inode_view(inode)->v_dev;
 		__entry->ino		= inode->i_ino;
 		__entry->nid		= nid;
 		__entry->blk_addr	= blk_addr;
@@ -504,7 +504,7 @@ TRACE_EVENT(f2fs_truncate_partial_nodes,
 	),
 
 	TP_fast_assign(
-		__entry->dev	= inode_sb(inode)->s_dev;
+		__entry->dev	= inode_view(inode)->v_dev;
 		__entry->ino	= inode->i_ino;
 		__entry->nid[0]	= nid[0];
 		__entry->nid[1]	= nid[1];
@@ -538,7 +538,7 @@ TRACE_EVENT(f2fs_map_blocks,
 	),
 
 	TP_fast_assign(
-		__entry->dev		= inode_sb(inode)->s_dev;
+		__entry->dev		= inode_view(inode)->v_dev;
 		__entry->ino		= inode->i_ino;
 		__entry->m_lblk		= map->m_lblk;
 		__entry->m_pblk		= map->m_pblk;
@@ -756,7 +756,7 @@ TRACE_EVENT(f2fs_lookup_start,
 	),
 
 	TP_fast_assign(
-		__entry->dev	= inode_sb(dir)->s_dev;
+		__entry->dev	= inode_view(dir)->v_dev;
 		__entry->ino	= dir->i_ino;
 		__entry->name	= dentry->d_name.name;
 		__entry->flags	= flags;
@@ -784,7 +784,7 @@ TRACE_EVENT(f2fs_lookup_end,
 	),
 
 	TP_fast_assign(
-		__entry->dev	= inode_sb(dir)->s_dev;
+		__entry->dev	= inode_view(dir)->v_dev;
 		__entry->ino	= dir->i_ino;
 		__entry->name	= dentry->d_name.name;
 		__entry->cino	= ino;
@@ -813,7 +813,7 @@ TRACE_EVENT(f2fs_readdir,
 	),
 
 	TP_fast_assign(
-		__entry->dev	= inode_sb(dir)->s_dev;
+		__entry->dev	= inode_view(dir)->v_dev;
 		__entry->ino	= dir->i_ino;
 		__entry->start	= start_pos;
 		__entry->end	= end_pos;
@@ -846,7 +846,7 @@ TRACE_EVENT(f2fs_fallocate,
 	),
 
 	TP_fast_assign(
-		__entry->dev	= inode_sb(inode)->s_dev;
+		__entry->dev	= inode_view(inode)->v_dev;
 		__entry->ino	= inode->i_ino;
 		__entry->mode	= mode;
 		__entry->offset	= offset;
@@ -882,7 +882,7 @@ TRACE_EVENT(f2fs_direct_IO_enter,
 	),
 
 	TP_fast_assign(
-		__entry->dev	= inode_sb(inode)->s_dev;
+		__entry->dev	= inode_view(inode)->v_dev;
 		__entry->ino	= inode->i_ino;
 		__entry->pos	= offset;
 		__entry->len	= len;
@@ -913,7 +913,7 @@ TRACE_EVENT(f2fs_direct_IO_exit,
 	),
 
 	TP_fast_assign(
-		__entry->dev	= inode_sb(inode)->s_dev;
+		__entry->dev	= inode_view(inode)->v_dev;
 		__entry->ino	= inode->i_ino;
 		__entry->pos	= offset;
 		__entry->len	= len;
@@ -945,7 +945,7 @@ TRACE_EVENT(f2fs_reserve_new_blocks,
 	),
 
 	TP_fast_assign(
-		__entry->dev	= inode_sb(inode)->s_dev;
+		__entry->dev	= inode_view(inode)->v_dev;
 		__entry->nid	= nid;
 		__entry->ofs_in_node = ofs_in_node;
 		__entry->count = count;
@@ -977,7 +977,7 @@ DECLARE_EVENT_CLASS(f2fs__submit_page_bio,
 	),
 
 	TP_fast_assign(
-		__entry->dev		= inode_sb(page->mapping->host)->s_dev;
+		__entry->dev		= inode_view(page->mapping->host)->v_dev;
 		__entry->ino		= page->mapping->host->i_ino;
 		__entry->index		= page->index;
 		__entry->old_blkaddr	= fio->old_blkaddr;
@@ -1104,7 +1104,7 @@ TRACE_EVENT(f2fs_write_begin,
 	),
 
 	TP_fast_assign(
-		__entry->dev	= inode_sb(inode)->s_dev;
+		__entry->dev	= inode_view(inode)->v_dev;
 		__entry->ino	= inode->i_ino;
 		__entry->pos	= pos;
 		__entry->len	= len;
@@ -1134,7 +1134,7 @@ TRACE_EVENT(f2fs_write_end,
 	),
 
 	TP_fast_assign(
-		__entry->dev	= inode_sb(inode)->s_dev;
+		__entry->dev	= inode_view(inode)->v_dev;
 		__entry->ino	= inode->i_ino;
 		__entry->pos	= pos;
 		__entry->len	= len;
@@ -1165,7 +1165,7 @@ DECLARE_EVENT_CLASS(f2fs__page,
 	),
 
 	TP_fast_assign(
-		__entry->dev	= inode_sb(page->mapping->host)->s_dev;
+		__entry->dev	= inode_view(page->mapping->host)->v_dev;
 		__entry->ino	= page->mapping->host->i_ino;
 		__entry->type	= type;
 		__entry->dir	= S_ISDIR(page->mapping->host->i_mode);
@@ -1259,7 +1259,7 @@ TRACE_EVENT(f2fs_writepages,
 	),
 
 	TP_fast_assign(
-		__entry->dev		= inode_sb(inode)->s_dev;
+		__entry->dev		= inode_view(inode)->v_dev;
 		__entry->ino		= inode->i_ino;
 		__entry->type		= type;
 		__entry->dir		= S_ISDIR(inode->i_mode);
@@ -1311,7 +1311,7 @@ TRACE_EVENT(f2fs_readpages,
 	),
 
 	TP_fast_assign(
-		__entry->dev	= inode_sb(inode)->s_dev;
+		__entry->dev	= inode_view(inode)->v_dev;
 		__entry->ino	= inode->i_ino;
 		__entry->start	= page->index;
 		__entry->nrpage	= nrpage;
@@ -1454,7 +1454,7 @@ TRACE_EVENT(f2fs_lookup_extent_tree_start,
 	),
 
 	TP_fast_assign(
-		__entry->dev = inode_sb(inode)->s_dev;
+		__entry->dev = inode_view(inode)->v_dev;
 		__entry->ino = inode->i_ino;
 		__entry->pgofs = pgofs;
 	),
@@ -1483,7 +1483,7 @@ TRACE_EVENT_CONDITION(f2fs_lookup_extent_tree_end,
 	),
 
 	TP_fast_assign(
-		__entry->dev = inode_sb(inode)->s_dev;
+		__entry->dev = inode_view(inode)->v_dev;
 		__entry->ino = inode->i_ino;
 		__entry->pgofs = pgofs;
 		__entry->fofs = ei->fofs;
@@ -1516,7 +1516,7 @@ TRACE_EVENT(f2fs_update_extent_tree_range,
 	),
 
 	TP_fast_assign(
-		__entry->dev = inode_sb(inode)->s_dev;
+		__entry->dev = inode_view(inode)->v_dev;
 		__entry->ino = inode->i_ino;
 		__entry->pgofs = pgofs;
 		__entry->blk = blkaddr;
@@ -1569,7 +1569,7 @@ TRACE_EVENT(f2fs_destroy_extent_tree,
 	),
 
 	TP_fast_assign(
-		__entry->dev = inode_sb(inode)->s_dev;
+		__entry->dev = inode_view(inode)->v_dev;
 		__entry->ino = inode->i_ino;
 		__entry->node_cnt = node_cnt;
 	),
diff --git a/include/trace/events/filelock.h b/include/trace/events/filelock.h
index 522d2740a56f..cbd545058cf3 100644
--- a/include/trace/events/filelock.h
+++ b/include/trace/events/filelock.h
@@ -48,7 +48,7 @@ TRACE_EVENT(locks_get_lock_context,
 	),
 
 	TP_fast_assign(
-		__entry->s_dev = inode_sb(inode)->s_dev;
+		__entry->s_dev = inode_view(inode)->v_dev;
 		__entry->i_ino = inode->i_ino;
 		__entry->type = type;
 		__entry->ctx = ctx;
@@ -80,7 +80,7 @@ DECLARE_EVENT_CLASS(filelock_lock,
 
 	TP_fast_assign(
 		__entry->fl = fl ? fl : NULL;
-		__entry->s_dev = inode_sb(inode)->s_dev;
+		__entry->s_dev = inode_view(inode)->v_dev;
 		__entry->i_ino = inode->i_ino;
 		__entry->fl_next = fl ? fl->fl_next : NULL;
 		__entry->fl_owner = fl ? fl->fl_owner : NULL;
@@ -132,7 +132,7 @@ DECLARE_EVENT_CLASS(filelock_lease,
 
 	TP_fast_assign(
 		__entry->fl = fl ? fl : NULL;
-		__entry->s_dev = inode_sb(inode)->s_dev;
+		__entry->s_dev = inode_view(inode)->v_dev;
 		__entry->i_ino = inode->i_ino;
 		__entry->fl_next = fl ? fl->fl_next : NULL;
 		__entry->fl_owner = fl ? fl->fl_owner : NULL;
@@ -182,7 +182,7 @@ TRACE_EVENT(generic_add_lease,
 	),
 
 	TP_fast_assign(
-		__entry->s_dev = inode_sb(inode)->s_dev;
+		__entry->s_dev = inode_view(inode)->v_dev;
 		__entry->i_ino = inode->i_ino;
 		__entry->wcount = atomic_read(&inode->i_writecount);
 		__entry->dcount = d_count(fl->fl_file->f_path.dentry);
diff --git a/include/trace/events/filemap.h b/include/trace/events/filemap.h
index 0517759b4b8f..1e32f104ac54 100644
--- a/include/trace/events/filemap.h
+++ b/include/trace/events/filemap.h
@@ -31,7 +31,7 @@ DECLARE_EVENT_CLASS(mm_filemap_op_page_cache,
 		__entry->i_ino = page->mapping->host->i_ino;
 		__entry->index = page->index;
 		if (inode_sb(page->mapping->host))
-			__entry->s_dev = inode_sb(page->mapping->host)->s_dev;
+			__entry->s_dev = inode_view(page->mapping->host)->v_dev;
 		else
 			__entry->s_dev = page->mapping->host->i_rdev;
 	),
@@ -69,7 +69,7 @@ TRACE_EVENT(filemap_set_wb_err,
 			__entry->i_ino = mapping->host->i_ino;
 			__entry->errseq = eseq;
 			if (inode_sb(mapping->host))
-				__entry->s_dev = inode_sb(mapping->host)->s_dev;
+				__entry->s_dev = inode_view(mapping->host)->v_dev;
 			else
 				__entry->s_dev = mapping->host->i_rdev;
 		),
@@ -97,7 +97,7 @@ TRACE_EVENT(file_check_and_advance_wb_err,
 			__entry->i_ino = file->f_mapping->host->i_ino;
 			if (inode_sb(file->f_mapping->host))
 				__entry->s_dev =
-					inode_sb(file->f_mapping->host)->s_dev;
+					inode_view(file->f_mapping->host)->v_dev;
 			else
 				__entry->s_dev =
 					file->f_mapping->host->i_rdev;
diff --git a/include/trace/events/fs_dax.h b/include/trace/events/fs_dax.h
index d3173cae131d..d287a210119a 100644
--- a/include/trace/events/fs_dax.h
+++ b/include/trace/events/fs_dax.h
@@ -24,7 +24,7 @@ DECLARE_EVENT_CLASS(dax_pmd_fault_class,
 		__field(int, result)
 	),
 	TP_fast_assign(
-		__entry->dev = inode_sb(inode)->s_dev;
+		__entry->dev = inode_view(inode)->v_dev;
 		__entry->ino = inode->i_ino;
 		__entry->vm_start = vmf->vma->vm_start;
 		__entry->vm_end = vmf->vma->vm_end;
@@ -74,7 +74,7 @@ DECLARE_EVENT_CLASS(dax_pmd_load_hole_class,
 		__field(dev_t, dev)
 	),
 	TP_fast_assign(
-		__entry->dev = inode_sb(inode)->s_dev;
+		__entry->dev = inode_view(inode)->v_dev;
 		__entry->ino = inode->i_ino;
 		__entry->vm_flags = vmf->vma->vm_flags;
 		__entry->address = vmf->address;
@@ -117,7 +117,7 @@ DECLARE_EVENT_CLASS(dax_pmd_insert_mapping_class,
 		__field(int, write)
 	),
 	TP_fast_assign(
-		__entry->dev = inode_sb(inode)->s_dev;
+		__entry->dev = inode_view(inode)->v_dev;
 		__entry->ino = inode->i_ino;
 		__entry->vm_flags = vmf->vma->vm_flags;
 		__entry->address = vmf->address;
@@ -163,7 +163,7 @@ DECLARE_EVENT_CLASS(dax_pte_fault_class,
 		__field(int, result)
 	),
 	TP_fast_assign(
-		__entry->dev = inode_sb(inode)->s_dev;
+		__entry->dev = inode_view(inode)->v_dev;
 		__entry->ino = inode->i_ino;
 		__entry->vm_flags = vmf->vma->vm_flags;
 		__entry->address = vmf->address;
@@ -206,7 +206,7 @@ TRACE_EVENT(dax_insert_mapping,
 		__field(int, write)
 	),
 	TP_fast_assign(
-		__entry->dev = inode_sb(inode)->s_dev;
+		__entry->dev = inode_view(inode)->v_dev;
 		__entry->ino = inode->i_ino;
 		__entry->vm_flags = vmf->vma->vm_flags;
 		__entry->address = vmf->address;
@@ -234,7 +234,7 @@ DECLARE_EVENT_CLASS(dax_writeback_range_class,
 		__field(dev_t, dev)
 	),
 	TP_fast_assign(
-		__entry->dev = inode_sb(inode)->s_dev;
+		__entry->dev = inode_view(inode)->v_dev;
 		__entry->ino = inode->i_ino;
 		__entry->start_index = start_index;
 		__entry->end_index = end_index;
@@ -266,7 +266,7 @@ TRACE_EVENT(dax_writeback_one,
 		__field(dev_t, dev)
 	),
 	TP_fast_assign(
-		__entry->dev = inode_sb(inode)->s_dev;
+		__entry->dev = inode_view(inode)->v_dev;
 		__entry->ino = inode->i_ino;
 		__entry->pgoff = pgoff;
 		__entry->pglen = pglen;
diff --git a/include/trace/events/jbd2.h b/include/trace/events/jbd2.h
index 95e0cb226d30..9c6b6c595835 100644
--- a/include/trace/events/jbd2.h
+++ b/include/trace/events/jbd2.h
@@ -124,7 +124,7 @@ TRACE_EVENT(jbd2_submit_inode_data,
 	),
 
 	TP_fast_assign(
-		__entry->dev	= inode_sb(inode)->s_dev;
+		__entry->dev	= inode_view(inode)->v_dev;
 		__entry->ino	= inode->i_ino;
 	),
 
diff --git a/include/trace/events/writeback.h b/include/trace/events/writeback.h
index d5ae5ea65bc4..7a5bfa93f938 100644
--- a/include/trace/events/writeback.h
+++ b/include/trace/events/writeback.h
@@ -710,7 +710,7 @@ DECLARE_EVENT_CLASS(writeback_inode_template,
 	),
 
 	TP_fast_assign(
-		__entry->dev	= inode_sb(inode)->s_dev;
+		__entry->dev	= inode_view(inode)->v_dev;
 		__entry->ino	= inode->i_ino;
 		__entry->state	= inode->i_state;
 		__entry->mode	= inode->i_mode;
diff --git a/kernel/audit.c b/kernel/audit.c
index 23159573aafd..b28999994512 100644
--- a/kernel/audit.c
+++ b/kernel/audit.c
@@ -2050,7 +2050,7 @@ void audit_copy_inode(struct audit_names *name, const struct dentry *dentry,
 		      struct inode *inode)
 {
 	name->ino   = inode->i_ino;
-	name->dev   = inode_sb(inode)->s_dev;
+	name->dev   = inode_view(inode)->v_dev;
 	name->mode  = inode->i_mode;
 	name->uid   = inode->i_uid;
 	name->gid   = inode->i_gid;
diff --git a/kernel/audit_fsnotify.c b/kernel/audit_fsnotify.c
index 981432cef19c..5daffedbfd67 100644
--- a/kernel/audit_fsnotify.c
+++ b/kernel/audit_fsnotify.c
@@ -76,7 +76,7 @@ int audit_mark_compare(struct audit_fsnotify_mark *mark, unsigned long ino, dev_
 static void audit_update_mark(struct audit_fsnotify_mark *audit_mark,
 			     const struct inode *inode)
 {
-	audit_mark->dev = inode ? inode_sb(inode)->s_dev : AUDIT_DEV_UNSET;
+	audit_mark->dev = inode ? inode_view(inode)->v_dev : AUDIT_DEV_UNSET;
 	audit_mark->ino = inode ? inode->i_ino : AUDIT_INO_UNSET;
 }
 
diff --git a/kernel/audit_watch.c b/kernel/audit_watch.c
index 3e785d4cf8aa..b9f571cc6a7f 100644
--- a/kernel/audit_watch.c
+++ b/kernel/audit_watch.c
@@ -499,7 +499,7 @@ static int audit_watch_handle_event(struct fsnotify_group *group,
 	}
 
 	if (mask & (FS_CREATE|FS_MOVED_TO) && inode)
-		audit_update_watch(parent, dname, inode_sb(inode)->s_dev,
+		audit_update_watch(parent, dname, inode_view(inode)->v_dev,
 				   inode->i_ino, 0);
 	else if (mask & (FS_DELETE|FS_MOVED_FROM))
 		audit_update_watch(parent, dname, AUDIT_DEV_UNSET, AUDIT_INO_UNSET, 1);
@@ -554,7 +554,7 @@ int audit_exe_compare(struct task_struct *tsk, struct audit_fsnotify_mark *mark)
 	if (!exe_file)
 		return 0;
 	ino = file_inode(exe_file)->i_ino;
-	dev = inode_sb(file_inode(exe_file))->s_dev;
+	dev = inode_view(file_inode(exe_file))->v_dev;
 	fput(exe_file);
 	return audit_mark_compare(mark, ino, dev);
 }
diff --git a/kernel/auditsc.c b/kernel/auditsc.c
index 9cb16a1ebedd..36b7cca89ec5 100644
--- a/kernel/auditsc.c
+++ b/kernel/auditsc.c
@@ -1797,7 +1797,7 @@ void __audit_inode(struct filename *name, const struct dentry *dentry,
 		if (n->ino) {
 			/* valid inode number, use that for the comparison */
 			if (n->ino != inode->i_ino ||
-			    n->dev != inode_sb(inode)->s_dev)
+			    n->dev != inode_view(inode)->v_dev)
 				continue;
 		} else if (n->name) {
 			/* inode number has not been set, check the name */
@@ -1906,7 +1906,7 @@ void __audit_inode_child(struct inode *parent,
 		     n->type != AUDIT_TYPE_UNKNOWN))
 			continue;
 
-		if (n->ino == parent->i_ino && n->dev == inode_sb(parent)->s_dev &&
+		if (n->ino == parent->i_ino && n->dev == inode_view(parent)->v_dev &&
 		    !audit_compare_dname_path(dname,
 					      n->name->name, n->name_len)) {
 			if (n->type == AUDIT_TYPE_UNKNOWN)
diff --git a/kernel/bpf/offload.c b/kernel/bpf/offload.c
index 6ff86b395175..6aed7bade9fd 100644
--- a/kernel/bpf/offload.c
+++ b/kernel/bpf/offload.c
@@ -265,7 +265,7 @@ int bpf_prog_offload_info_fill(struct bpf_prog_info *info,
 	up_read(&bpf_devs_lock);
 
 	ns_inode = ns_path.dentry->d_inode;
-	info->netns_dev = new_encode_dev(inode_sb(ns_inode)->s_dev);
+	info->netns_dev = new_encode_dev(inode_view(ns_inode)->v_dev);
 	info->netns_ino = ns_inode->i_ino;
 	path_put(&ns_path);
 
@@ -461,7 +461,7 @@ int bpf_map_offload_info_fill(struct bpf_map_info *info, struct bpf_map *map)
 	}
 
 	ns_inode = ns_path.dentry->d_inode;
-	info->netns_dev = new_encode_dev(inode_sb(ns_inode)->s_dev);
+	info->netns_dev = new_encode_dev(inode_view(ns_inode)->v_dev);
 	info->netns_ino = ns_inode->i_ino;
 	path_put(&ns_path);
 
diff --git a/kernel/events/core.c b/kernel/events/core.c
index 58c02221e066..9c1e45243007 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -6713,7 +6713,7 @@ static void perf_fill_ns_link_info(struct perf_ns_link_info *ns_link_info,
 	error = ns_get_path(&ns_path, task, ns_ops);
 	if (!error) {
 		ns_inode = ns_path.dentry->d_inode;
-		ns_link_info->dev = new_encode_dev(inode_sb(ns_inode)->s_dev);
+		ns_link_info->dev = new_encode_dev(inode_view(ns_inode)->v_dev);
 		ns_link_info->ino = ns_inode->i_ino;
 		path_put(&ns_path);
 	}
@@ -6918,7 +6918,7 @@ static void perf_event_mmap_event(struct perf_mmap_event *mmap_event)
 			goto cpy_name;
 		}
 		inode = file_inode(vma->vm_file);
-		dev = inode_sb(inode)->s_dev;
+		dev = inode_view(inode)->v_dev;
 		ino = inode->i_ino;
 		gen = inode->i_generation;
 		maj = MAJOR(dev);
diff --git a/mm/memory-failure.c b/mm/memory-failure.c
index 08e2367985f8..64e8626df474 100644
--- a/mm/memory-failure.c
+++ b/mm/memory-failure.c
@@ -98,7 +98,7 @@ static int hwpoison_filter_dev(struct page *p)
 	if (mapping == NULL || mapping->host == NULL)
 		return -EINVAL;
 
-	dev = inode_sb(mapping->host)->s_dev;
+	dev = inode_view(mapping->host)->v_dev;
 	if (hwpoison_filter_dev_major != ~0U &&
 	    hwpoison_filter_dev_major != MAJOR(dev))
 		return -EINVAL;
diff --git a/security/tomoyo/condition.c b/security/tomoyo/condition.c
index 3422f5f57e43..b8419d9ac789 100644
--- a/security/tomoyo/condition.c
+++ b/security/tomoyo/condition.c
@@ -722,7 +722,7 @@ void tomoyo_get_attributes(struct tomoyo_obj_info *obj)
 			stat->gid  = inode->i_gid;
 			stat->ino  = inode->i_ino;
 			stat->mode = inode->i_mode;
-			stat->dev  = inode_sb(inode)->s_dev;
+			stat->dev  = inode_view(inode)->v_dev;
 			stat->rdev = inode->i_rdev;
 			obj->stat_valid[i] = true;
 		}
-- 
2.15.1

^ permalink raw reply related	[flat|nested] 88+ messages in thread

* [PATCH 75/76] fs: Use fs view device from struct super_block
  2018-05-08 18:03 [RFC][PATCH 0/76] vfs: 'views' for filesystems with more than one root Mark Fasheh
                   ` (73 preceding siblings ...)
  2018-05-08 18:04 ` [PATCH 74/76] fs: Use fs_view device from struct inode Mark Fasheh
@ 2018-05-08 18:04 ` Mark Fasheh
  2018-05-08 18:04 ` [PATCH 76/76] btrfs: Use fs_view in roots, point inodes to it Mark Fasheh
  2018-05-08 23:38 ` [RFC][PATCH 0/76] vfs: 'views' for filesystems with more than one root Dave Chinner
  76 siblings, 0 replies; 88+ messages in thread
From: Mark Fasheh @ 2018-05-08 18:04 UTC (permalink / raw)
  To: linux-fsdevel; +Cc: linux-kernel, linux-btrfs, Mark Fasheh

We have some places which access s_dev directly from struct super_block.

Convert those to get v_dev from the default super block view.

Signed-off-by: Mark Fasheh <mfasheh@suse.de>
---
 drivers/mtd/mtdsuper.c                          |  2 +-
 drivers/staging/lustre/lustre/llite/llite_lib.c |  6 +-
 fs/autofs4/autofs_i.h                           |  2 +-
 fs/autofs4/dev-ioctl.c                          | 10 +--
 fs/ceph/super.c                                 |  2 +-
 fs/cramfs/inode.c                               |  4 +-
 fs/exofs/super.c                                |  2 +-
 fs/fuse/inode.c                                 |  2 +-
 fs/gfs2/ops_fstype.c                            |  2 +-
 fs/gfs2/quota.c                                 |  5 +-
 fs/gfs2/sys.c                                   |  3 +-
 fs/gfs2/trace_gfs2.h                            | 30 ++++-----
 fs/nfs/nfs4trace.h                              |  2 +-
 fs/nfs/super.c                                  |  6 +-
 fs/nfsd/nfs3xdr.c                               |  2 +-
 fs/nfsd/nfsfh.c                                 |  6 +-
 fs/nilfs2/super.c                               |  2 +-
 fs/ocfs2/journal.c                              | 13 ++--
 fs/ocfs2/ocfs2_trace.h                          |  4 +-
 fs/ocfs2/super.c                                |  4 +-
 fs/overlayfs/inode.c                            |  4 +-
 fs/overlayfs/readdir.c                          |  4 +-
 fs/proc_namespace.c                             |  2 +-
 fs/quota/dquot.c                                |  2 +-
 fs/reiserfs/journal.c                           |  6 +-
 fs/romfs/super.c                                |  6 +-
 fs/super.c                                      |  8 +--
 fs/xfs/scrub/trace.h                            | 26 ++++----
 fs/xfs/xfs_trace.h                              | 84 ++++++++++++-------------
 fs/xfs/xfs_trans_dquot.c                        |  2 +-
 include/trace/events/ext4.h                     | 36 +++++------
 include/trace/events/f2fs.h                     | 18 +++---
 include/trace/events/writeback.h                |  2 +-
 init/do_mounts.c                                |  2 +-
 kernel/audit_watch.c                            |  2 +-
 net/unix/diag.c                                 |  2 +-
 security/tomoyo/realpath.c                      |  4 +-
 37 files changed, 162 insertions(+), 157 deletions(-)

diff --git a/drivers/mtd/mtdsuper.c b/drivers/mtd/mtdsuper.c
index d58a61c09304..f5346de9b29d 100644
--- a/drivers/mtd/mtdsuper.c
+++ b/drivers/mtd/mtdsuper.c
@@ -51,7 +51,7 @@ static int get_sb_mtd_set(struct super_block *sb, void *_mtd)
 	struct mtd_info *mtd = _mtd;
 
 	sb->s_mtd = mtd;
-	sb->s_dev = MKDEV(MTD_BLOCK_MAJOR, mtd->index);
+	sb->s_view.v_dev = MKDEV(MTD_BLOCK_MAJOR, mtd->index);
 	sb->s_bdi = bdi_get(mtd_bdi);
 
 	return 0;
diff --git a/drivers/staging/lustre/lustre/llite/llite_lib.c b/drivers/staging/lustre/lustre/llite/llite_lib.c
index 6f6df27635d4..ffa6e7d92080 100644
--- a/drivers/staging/lustre/lustre/llite/llite_lib.c
+++ b/drivers/staging/lustre/lustre/llite/llite_lib.c
@@ -524,7 +524,7 @@ static int client_common_fill_super(struct super_block *sb, char *md, char *dt)
 		goto out_lock_cn_cb;
 	}
 
-	sbi->ll_sdev_orig = sb->s_dev;
+	sbi->ll_sdev_orig = sb->s_view.v_dev;
 
 	/* We set sb->s_dev equal on all lustre clients in order to support
 	 * NFS export clustering.  NFSD requires that the FSID be the same
@@ -535,7 +535,7 @@ static int client_common_fill_super(struct super_block *sb, char *md, char *dt)
 	 */
 	uuid = obd_get_uuid(sbi->ll_md_exp);
 	if (uuid) {
-		sb->s_dev = get_uuid2int(uuid->uuid, strlen(uuid->uuid));
+		sb->s_view.v_dev = get_uuid2int(uuid->uuid, strlen(uuid->uuid));
 		get_uuid2fsid(uuid->uuid, strlen(uuid->uuid), &sbi->ll_fsid);
 	}
 
@@ -670,7 +670,7 @@ void ll_kill_super(struct super_block *sb)
 	 * in put_super not affected real removing devices
 	 */
 	if (sbi) {
-		sb->s_dev = sbi->ll_sdev_orig;
+		sb->s_view.v_dev = sbi->ll_sdev_orig;
 		sbi->ll_umounting = 1;
 
 		/* wait running statahead threads to quit */
diff --git a/fs/autofs4/autofs_i.h b/fs/autofs4/autofs_i.h
index 4737615f0eaa..31fcf15108eb 100644
--- a/fs/autofs4/autofs_i.h
+++ b/fs/autofs4/autofs_i.h
@@ -225,7 +225,7 @@ void autofs4_catatonic_mode(struct autofs_sb_info *);
 
 static inline u32 autofs4_get_dev(struct autofs_sb_info *sbi)
 {
-	return new_encode_dev(sbi->sb->s_dev);
+	return new_encode_dev(sbi->sb->s_view.v_dev);
 }
 
 static inline u64 autofs4_get_ino(struct autofs_sb_info *sbi)
diff --git a/fs/autofs4/dev-ioctl.c b/fs/autofs4/dev-ioctl.c
index 6b28b01e5022..6d1f1bc5db06 100644
--- a/fs/autofs4/dev-ioctl.c
+++ b/fs/autofs4/dev-ioctl.c
@@ -231,7 +231,7 @@ static int find_autofs_mount(const char *pathname,
 
 static int test_by_dev(const struct path *path, void *p)
 {
-	return path->dentry->d_sb->s_dev == *(dev_t *)p;
+	return path->dentry->d_sb->s_view.v_dev == *(dev_t *)p;
 }
 
 static int test_by_type(const struct path *path, void *p)
@@ -243,7 +243,7 @@ static int test_by_type(const struct path *path, void *p)
 
 /*
  * Open a file descriptor on the autofs mount point corresponding
- * to the given path and device number (aka. new_encode_dev(sb->s_dev)).
+ * to the given path and device number (aka. new_encode_dev(sb->s_view.v_dev)).
  */
 static int autofs_dev_ioctl_open_mountpoint(const char *name, dev_t devid)
 {
@@ -451,7 +451,7 @@ static int autofs_dev_ioctl_requester(struct file *fp,
 		goto out;
 	}
 
-	devid = sbi->sb->s_dev;
+	devid = sbi->sb->s_view.v_dev;
 
 	param->requester.uid = param->requester.gid = -1;
 
@@ -554,14 +554,14 @@ static int autofs_dev_ioctl_ismountpoint(struct file *fp,
 						test_by_type, &type);
 		if (err)
 			goto out;
-		devid = new_encode_dev(path.dentry->d_sb->s_dev);
+		devid = new_encode_dev(path.dentry->d_sb->s_view.v_dev);
 		err = 0;
 		if (path.mnt->mnt_root == path.dentry) {
 			err = 1;
 			magic = path.dentry->d_sb->s_magic;
 		}
 	} else {
-		dev_t dev = sbi->sb->s_dev;
+		dev_t dev = sbi->sb->s_view.v_dev;
 
 		err = find_autofs_mount(name, &path, test_by_dev, &dev);
 		if (err)
diff --git a/fs/ceph/super.c b/fs/ceph/super.c
index fb2bc9c15a23..2f6c4c16a5ad 100644
--- a/fs/ceph/super.c
+++ b/fs/ceph/super.c
@@ -1055,7 +1055,7 @@ static struct dentry *ceph_mount(struct file_system_type *fs_type,
 static void ceph_kill_sb(struct super_block *s)
 {
 	struct ceph_fs_client *fsc = ceph_sb_to_client(s);
-	dev_t dev = s->s_dev;
+	dev_t dev = s->s_view.v_dev;
 
 	dout("kill_sb %p\n", s);
 
diff --git a/fs/cramfs/inode.c b/fs/cramfs/inode.c
index eb633de7ccbe..239ec223433f 100644
--- a/fs/cramfs/inode.c
+++ b/fs/cramfs/inode.c
@@ -674,8 +674,8 @@ static int cramfs_statfs(struct dentry *dentry, struct kstatfs *buf)
 
 	if (sb->s_bdev)
 		id = huge_encode_dev(sb->s_bdev->bd_dev);
-	else if (sb->s_dev)
-		id = huge_encode_dev(sb->s_dev);
+	else if (sb->s_view.v_dev)
+		id = huge_encode_dev(sb->s_view.v_dev);
 
 	buf->f_type = CRAMFS_MAGIC;
 	buf->f_bsize = PAGE_SIZE;
diff --git a/fs/exofs/super.c b/fs/exofs/super.c
index 179cd5c2f52a..6149c1bc02ff 100644
--- a/fs/exofs/super.c
+++ b/fs/exofs/super.c
@@ -760,7 +760,7 @@ static int exofs_fill_super(struct super_block *sb, void *data, int silent)
 	sb->s_max_links = EXOFS_LINK_MAX;
 	atomic_set(&sbi->s_curr_pending, 0);
 	sb->s_bdev = NULL;
-	sb->s_dev = 0;
+	sb->s_view.v_dev = 0;
 
 	comp.obj.partition = sbi->one_comp.obj.partition;
 	comp.obj.id = EXOFS_SUPER_ID;
diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c
index d6d2fbe6c3ec..3b4d753b8c70 100644
--- a/fs/fuse/inode.c
+++ b/fs/fuse/inode.c
@@ -1103,7 +1103,7 @@ static int fuse_fill_super(struct super_block *sb, void *data, int silent)
 	if (!fud)
 		goto err_put_conn;
 
-	fc->dev = sb->s_dev;
+	fc->dev = sb->s_view.v_dev;
 	fc->sb = sb;
 	err = fuse_bdi_init(fc, sb);
 	if (err)
diff --git a/fs/gfs2/ops_fstype.c b/fs/gfs2/ops_fstype.c
index e6a0a8a89ea7..25a93cacaa1d 100644
--- a/fs/gfs2/ops_fstype.c
+++ b/fs/gfs2/ops_fstype.c
@@ -1222,7 +1222,7 @@ static int fill_super(struct super_block *sb, struct gfs2_args *args, int silent
 static int set_gfs2_super(struct super_block *s, void *data)
 {
 	s->s_bdev = data;
-	s->s_dev = s->s_bdev->bd_dev;
+	s->s_view.v_dev = s->s_bdev->bd_dev;
 	s->s_bdi = bdi_get(s->s_bdev->bd_bdi);
 	return 0;
 }
diff --git a/fs/gfs2/quota.c b/fs/gfs2/quota.c
index 7a98abd340ee..21499dd4ad5c 100644
--- a/fs/gfs2/quota.c
+++ b/fs/gfs2/quota.c
@@ -1227,7 +1227,7 @@ int gfs2_quota_check(struct gfs2_inode *ip, kuid_t uid, kgid_t gid,
 						      &qd->qd_flags)) {
 					print_message(qd, "exceeded");
 					quota_send_warning(qd->qd_id,
-							   sdp->sd_vfs->s_dev,
+							   sdp->sd_vfs->s_view.v_dev,
 							   QUOTA_NL_BHARDWARN);
 				}
 				error = -EDQUOT;
@@ -1238,7 +1238,8 @@ int gfs2_quota_check(struct gfs2_inode *ip, kuid_t uid, kgid_t gid,
 					 gfs2_tune_get(sdp, gt_quota_warn_period)
 					 * HZ)) {
 			quota_send_warning(qd->qd_id,
-					   sdp->sd_vfs->s_dev, QUOTA_NL_BSOFTWARN);
+					   sdp->sd_vfs->s_view.v_dev,
+					   QUOTA_NL_BSOFTWARN);
 			error = print_message(qd, "warning");
 			qd->qd_last_warn = jiffies;
 		}
diff --git a/fs/gfs2/sys.c b/fs/gfs2/sys.c
index c191fa58a1df..d5036ad407b6 100644
--- a/fs/gfs2/sys.c
+++ b/fs/gfs2/sys.c
@@ -63,7 +63,8 @@ static struct kset *gfs2_kset;
 static ssize_t id_show(struct gfs2_sbd *sdp, char *buf)
 {
 	return snprintf(buf, PAGE_SIZE, "%u:%u\n",
-			MAJOR(sdp->sd_vfs->s_dev), MINOR(sdp->sd_vfs->s_dev));
+			MAJOR(sdp->sd_vfs->s_view.v_dev),
+			MINOR(sdp->sd_vfs->s_view.v_dev));
 }
 
 static ssize_t fsname_show(struct gfs2_sbd *sdp, char *buf)
diff --git a/fs/gfs2/trace_gfs2.h b/fs/gfs2/trace_gfs2.h
index b9318b49ff8f..b25112935281 100644
--- a/fs/gfs2/trace_gfs2.h
+++ b/fs/gfs2/trace_gfs2.h
@@ -106,7 +106,7 @@ TRACE_EVENT(gfs2_glock_state_change,
 	),
 
 	TP_fast_assign(
-		__entry->dev		= gl->gl_name.ln_sbd->sd_vfs->s_dev;
+		__entry->dev		= gl->gl_name.ln_sbd->sd_vfs->s_view.v_dev;
 		__entry->glnum		= gl->gl_name.ln_number;
 		__entry->gltype		= gl->gl_name.ln_type;
 		__entry->cur_state	= glock_trace_state(gl->gl_state);
@@ -142,7 +142,7 @@ TRACE_EVENT(gfs2_glock_put,
 	),
 
 	TP_fast_assign(
-		__entry->dev		= gl->gl_name.ln_sbd->sd_vfs->s_dev;
+		__entry->dev		= gl->gl_name.ln_sbd->sd_vfs->s_view.v_dev;
 		__entry->gltype		= gl->gl_name.ln_type;
 		__entry->glnum		= gl->gl_name.ln_number;
 		__entry->cur_state	= glock_trace_state(gl->gl_state);
@@ -176,7 +176,7 @@ TRACE_EVENT(gfs2_demote_rq,
 	),
 
 	TP_fast_assign(
-		__entry->dev		= gl->gl_name.ln_sbd->sd_vfs->s_dev;
+		__entry->dev		= gl->gl_name.ln_sbd->sd_vfs->s_view.v_dev;
 		__entry->gltype		= gl->gl_name.ln_type;
 		__entry->glnum		= gl->gl_name.ln_number;
 		__entry->cur_state	= glock_trace_state(gl->gl_state);
@@ -211,7 +211,7 @@ TRACE_EVENT(gfs2_promote,
 	),
 
 	TP_fast_assign(
-		__entry->dev	= gh->gh_gl->gl_name.ln_sbd->sd_vfs->s_dev;
+		__entry->dev	= gh->gh_gl->gl_name.ln_sbd->sd_vfs->s_view.v_dev;
 		__entry->glnum	= gh->gh_gl->gl_name.ln_number;
 		__entry->gltype	= gh->gh_gl->gl_name.ln_type;
 		__entry->first	= first;
@@ -241,7 +241,7 @@ TRACE_EVENT(gfs2_glock_queue,
 	),
 
 	TP_fast_assign(
-		__entry->dev	= gh->gh_gl->gl_name.ln_sbd->sd_vfs->s_dev;
+		__entry->dev	= gh->gh_gl->gl_name.ln_sbd->sd_vfs->s_view.v_dev;
 		__entry->glnum	= gh->gh_gl->gl_name.ln_number;
 		__entry->gltype	= gh->gh_gl->gl_name.ln_type;
 		__entry->queue	= queue;
@@ -280,7 +280,7 @@ TRACE_EVENT(gfs2_glock_lock_time,
 	),
 
 	TP_fast_assign(
-		__entry->dev            = gl->gl_name.ln_sbd->sd_vfs->s_dev;
+		__entry->dev            = gl->gl_name.ln_sbd->sd_vfs->s_view.v_dev;
 		__entry->glnum          = gl->gl_name.ln_number;
 		__entry->gltype         = gl->gl_name.ln_type;
 		__entry->status		= gl->gl_lksb.sb_status;
@@ -335,7 +335,7 @@ TRACE_EVENT(gfs2_pin,
 	),
 
 	TP_fast_assign(
-		__entry->dev		= bd->bd_gl->gl_name.ln_sbd->sd_vfs->s_dev;
+		__entry->dev		= bd->bd_gl->gl_name.ln_sbd->sd_vfs->s_view.v_dev;
 		__entry->pin		= pin;
 		__entry->len		= bd->bd_bh->b_size;
 		__entry->block		= bd->bd_bh->b_blocknr;
@@ -365,7 +365,7 @@ TRACE_EVENT(gfs2_log_flush,
 	),
 
 	TP_fast_assign(
-		__entry->dev            = sdp->sd_vfs->s_dev;
+		__entry->dev            = sdp->sd_vfs->s_view.v_dev;
 		__entry->start		= start;
 		__entry->log_seq	= sdp->sd_log_sequence;
 		__entry->flags		= flags;
@@ -391,7 +391,7 @@ TRACE_EVENT(gfs2_log_blocks,
 	),
 
 	TP_fast_assign(
-		__entry->dev		= sdp->sd_vfs->s_dev;
+		__entry->dev		= sdp->sd_vfs->s_view.v_dev;
 		__entry->blocks		= blocks;
 	),
 
@@ -414,7 +414,7 @@ TRACE_EVENT(gfs2_ail_flush,
 	),
 
 	TP_fast_assign(
-		__entry->dev		= sdp->sd_vfs->s_dev;
+		__entry->dev		= sdp->sd_vfs->s_view.v_dev;
 		__entry->start		= start;
 		__entry->sync_mode	= wbc->sync_mode;
 		__entry->nr_to_write	= wbc->nr_to_write;
@@ -454,7 +454,7 @@ TRACE_EVENT(gfs2_bmap,
 	),
 
 	TP_fast_assign(
-		__entry->dev            = ip->i_gl->gl_name.ln_sbd->sd_vfs->s_dev;
+		__entry->dev            = ip->i_gl->gl_name.ln_sbd->sd_vfs->s_view.v_dev;
 		__entry->lblock		= lblock;
 		__entry->pblock		= buffer_mapped(bh) ?  bh->b_blocknr : 0;
 		__entry->inum		= ip->i_no_addr;
@@ -490,7 +490,7 @@ TRACE_EVENT(gfs2_iomap_start,
 	),
 
 	TP_fast_assign(
-		__entry->dev            = ip->i_gl->gl_name.ln_sbd->sd_vfs->s_dev;
+		__entry->dev            = ip->i_gl->gl_name.ln_sbd->sd_vfs->s_view.v_dev;
 		__entry->inum		= ip->i_no_addr;
 		__entry->pos		= pos;
 		__entry->length		= length;
@@ -521,7 +521,7 @@ TRACE_EVENT(gfs2_iomap_end,
 	),
 
 	TP_fast_assign(
-		__entry->dev            = ip->i_gl->gl_name.ln_sbd->sd_vfs->s_dev;
+		__entry->dev            = ip->i_gl->gl_name.ln_sbd->sd_vfs->s_view.v_dev;
 		__entry->inum		= ip->i_no_addr;
 		__entry->offset		= iomap->offset;
 		__entry->length		= iomap->length;
@@ -558,7 +558,7 @@ TRACE_EVENT(gfs2_block_alloc,
 	),
 
 	TP_fast_assign(
-		__entry->dev		= rgd->rd_gl->gl_name.ln_sbd->sd_vfs->s_dev;
+		__entry->dev		= rgd->rd_gl->gl_name.ln_sbd->sd_vfs->s_view.v_dev;
 		__entry->start		= block;
 		__entry->inum		= ip->i_no_addr;
 		__entry->len		= len;
@@ -597,7 +597,7 @@ TRACE_EVENT(gfs2_rs,
 	),
 
 	TP_fast_assign(
-		__entry->dev		= rs->rs_rbm.rgd->rd_sbd->sd_vfs->s_dev;
+		__entry->dev		= rs->rs_rbm.rgd->rd_sbd->sd_vfs->s_view.v_dev;
 		__entry->rd_addr	= rs->rs_rbm.rgd->rd_addr;
 		__entry->rd_free_clone	= rs->rs_rbm.rgd->rd_free_clone;
 		__entry->rd_reserved	= rs->rs_rbm.rgd->rd_reserved;
diff --git a/fs/nfs/nfs4trace.h b/fs/nfs/nfs4trace.h
index 07f81f981792..4cdb6e356742 100644
--- a/fs/nfs/nfs4trace.h
+++ b/fs/nfs/nfs4trace.h
@@ -410,7 +410,7 @@ DECLARE_EVENT_CLASS(nfs4_open_event,
 			__entry->error = error;
 			__entry->flags = flags;
 			__entry->fmode = (__force unsigned int)ctx->mode;
-			__entry->dev = ctx->dentry->d_sb->s_dev;
+			__entry->dev = ctx->dentry->d_sb->s_view.v_dev;
 			if (!IS_ERR_OR_NULL(state)) {
 				inode = state->inode;
 				__entry->stateid_seq =
diff --git a/fs/nfs/super.c b/fs/nfs/super.c
index 5e470e233c83..5dc8226409f1 100644
--- a/fs/nfs/super.c
+++ b/fs/nfs/super.c
@@ -2321,7 +2321,7 @@ static void nfs_initialise_sb(struct super_block *sb)
 
 	/* We probably want something more informative here */
 	snprintf(sb->s_id, sizeof(sb->s_id),
-		 "%u:%u", MAJOR(sb->s_dev), MINOR(sb->s_dev));
+		 "%u:%u", MAJOR(sb->s_view.v_dev), MINOR(sb->s_view.v_dev));
 
 	if (sb->s_blocksize == 0)
 		sb->s_blocksize = nfs_block_bits(server->wsize,
@@ -2433,7 +2433,7 @@ static int nfs_set_super(struct super_block *s, void *data)
 	s->s_d_op = server->nfs_client->rpc_ops->dentry_ops;
 	ret = set_anon_super(s, server);
 	if (ret == 0)
-		server->s_dev = s->s_dev;
+		server->s_dev = s->s_view.v_dev;
 	return ret;
 }
 
@@ -2708,7 +2708,7 @@ EXPORT_SYMBOL_GPL(nfs_fs_mount);
 void nfs_kill_super(struct super_block *s)
 {
 	struct nfs_server *server = NFS_SB(s);
-	dev_t dev = s->s_dev;
+	dev_t dev = s->s_view.v_dev;
 
 	generic_shutdown_super(s);
 
diff --git a/fs/nfsd/nfs3xdr.c b/fs/nfsd/nfs3xdr.c
index 1a70581e1cb2..d432f7020d39 100644
--- a/fs/nfsd/nfs3xdr.c
+++ b/fs/nfsd/nfs3xdr.c
@@ -147,7 +147,7 @@ static __be32 *encode_fsid(__be32 *p, struct svc_fh *fhp)
 	default:
 	case FSIDSOURCE_DEV:
 		p = xdr_encode_hyper(p, (u64)huge_encode_dev
-				     (fhp->fh_dentry->d_sb->s_dev));
+				     (fhp->fh_dentry->d_sb->s_view.v_dev));
 		break;
 	case FSIDSOURCE_FSID:
 		p = xdr_encode_hyper(p, (u64) fhp->fh_export->ex_fsid);
diff --git a/fs/nfsd/nfsfh.c b/fs/nfsd/nfsfh.c
index 8aa011820c4a..2f819ae8f47e 100644
--- a/fs/nfsd/nfsfh.c
+++ b/fs/nfsd/nfsfh.c
@@ -440,7 +440,7 @@ static bool fsid_type_ok_for_exp(u8 fsid_type, struct svc_export *exp)
 {
 	switch (fsid_type) {
 	case FSID_DEV:
-		if (!old_valid_dev(exp_sb(exp)->s_dev))
+		if (!old_valid_dev(exp_sb(exp)->s_view.v_dev))
 			return 0;
 		/* FALL THROUGH */
 	case FSID_MAJOR_MINOR:
@@ -505,7 +505,7 @@ static void set_version_and_fsid_type(struct svc_fh *fhp, struct svc_export *exp
 			else
 				fsid_type = FSID_UUID4_INUM;
 		}
-	} else if (!old_valid_dev(exp_sb(exp)->s_dev))
+	} else if (!old_valid_dev(exp_sb(exp)->s_view.v_dev))
 		/* for newer device numbers, we must use a newer fsid format */
 		fsid_type = FSID_ENCODE_DEV;
 	else
@@ -528,7 +528,7 @@ fh_compose(struct svc_fh *fhp, struct svc_export *exp, struct dentry *dentry,
 	 */
 
 	struct inode * inode = d_inode(dentry);
-	dev_t ex_dev = exp_sb(exp)->s_dev;
+	dev_t ex_dev = exp_sb(exp)->s_view.v_dev;
 
 	dprintk("nfsd: fh_compose(exp %02x:%02x/%ld %pd2, ino=%ld)\n",
 		MAJOR(ex_dev), MINOR(ex_dev),
diff --git a/fs/nilfs2/super.c b/fs/nilfs2/super.c
index 6ffeca84d7c3..0239b1b495db 100644
--- a/fs/nilfs2/super.c
+++ b/fs/nilfs2/super.c
@@ -1267,7 +1267,7 @@ static int nilfs_identify(char *data, struct nilfs_super_data *sd)
 static int nilfs_set_bdev_super(struct super_block *s, void *data)
 {
 	s->s_bdev = data;
-	s->s_dev = s->s_bdev->bd_dev;
+	s->s_view.v_dev = s->s_bdev->bd_dev;
 	return 0;
 }
 
diff --git a/fs/ocfs2/journal.c b/fs/ocfs2/journal.c
index e0047816c7b7..520c3cdee1e1 100644
--- a/fs/ocfs2/journal.c
+++ b/fs/ocfs2/journal.c
@@ -1435,7 +1435,8 @@ static int __ocfs2_recovery_thread(void *arg)
 			mlog(ML_ERROR,
 			     "Error %d recovering node %d on device (%u,%u)!\n",
 			     status, node_num,
-			     MAJOR(osb->sb->s_dev), MINOR(osb->sb->s_dev));
+			     MAJOR(osb->sb->s_view.v_dev),
+			     MINOR(osb->sb->s_view.v_dev));
 			mlog(ML_ERROR, "Volume requires unmount.\n");
 		}
 
@@ -1624,8 +1625,9 @@ static int ocfs2_replay_journal(struct ocfs2_super *osb,
 	ocfs2_replay_map_set_state(osb, REPLAY_NEEDED);
 
 	printk(KERN_NOTICE "ocfs2: Begin replay journal (node %d, slot %d) on "\
-	       "device (%u,%u)\n", node_num, slot_num, MAJOR(osb->sb->s_dev),
-	       MINOR(osb->sb->s_dev));
+	       "device (%u,%u)\n", node_num, slot_num,
+	       MAJOR(osb->sb->s_view.v_dev),
+	       MINOR(osb->sb->s_view.v_dev));
 
 	OCFS2_I(inode)->ip_clusters = le32_to_cpu(fe->i_clusters);
 
@@ -1681,8 +1683,9 @@ static int ocfs2_replay_journal(struct ocfs2_super *osb,
 	jbd2_journal_destroy(journal);
 
 	printk(KERN_NOTICE "ocfs2: End replay journal (node %d, slot %d) on "\
-	       "device (%u,%u)\n", node_num, slot_num, MAJOR(osb->sb->s_dev),
-	       MINOR(osb->sb->s_dev));
+	       "device (%u,%u)\n", node_num, slot_num,
+	       MAJOR(osb->sb->s_view.v_dev),
+	       MINOR(osb->sb->s_view.v_dev));
 done:
 	/* drop the lock on this nodes journal */
 	if (got_lock)
diff --git a/fs/ocfs2/ocfs2_trace.h b/fs/ocfs2/ocfs2_trace.h
index e2a11aaece10..cb9b7bd9e0c4 100644
--- a/fs/ocfs2/ocfs2_trace.h
+++ b/fs/ocfs2/ocfs2_trace.h
@@ -700,8 +700,8 @@ TRACE_EVENT(ocfs2_trim_extent,
 		__field(__u64,	count)
 	),
 	TP_fast_assign(
-		__entry->dev_major = MAJOR(sb->s_dev);
-		__entry->dev_minor = MINOR(sb->s_dev);
+		__entry->dev_major = MAJOR(sb->s_view.v_dev);
+		__entry->dev_minor = MINOR(sb->s_view.v_dev);
 		__entry->blk = blk;
 		__entry->count = count;
 	),
diff --git a/fs/ocfs2/super.c b/fs/ocfs2/super.c
index ffa4952d432b..7d9d34c360e4 100644
--- a/fs/ocfs2/super.c
+++ b/fs/ocfs2/super.c
@@ -1973,7 +1973,7 @@ static void ocfs2_dismount_volume(struct super_block *sb, int mnt_err)
 
 	ocfs2_delete_osb(osb);
 	kfree(osb);
-	sb->s_dev = 0;
+	sb->s_view.v_dev = 0;
 	sb->s_fs_info = NULL;
 }
 
@@ -2102,7 +2102,7 @@ static int ocfs2_initialize_super(struct super_block *sb,
 	ocfs2_init_node_maps(osb);
 
 	snprintf(osb->dev_str, sizeof(osb->dev_str), "%u,%u",
-		 MAJOR(osb->sb->s_dev), MINOR(osb->sb->s_dev));
+		 MAJOR(osb->sb->s_view.v_dev), MINOR(osb->sb->s_view.v_dev));
 
 	osb->max_slots = le16_to_cpu(di->id2.i_super.s_max_slots);
 	if (osb->max_slots > OCFS2_MAX_SLOTS || osb->max_slots == 0) {
diff --git a/fs/overlayfs/inode.c b/fs/overlayfs/inode.c
index ebf2a857d547..6169f36337bf 100644
--- a/fs/overlayfs/inode.c
+++ b/fs/overlayfs/inode.c
@@ -132,7 +132,7 @@ int ovl_getattr(const struct path *path, struct kstat *stat,
 			 * number are unique, so we use the overlay st_dev,
 			 * which is friendly to du -x.
 			 */
-			stat->dev = dentry->d_sb->s_dev;
+			stat->dev = dentry->d_sb->s_view.v_dev;
 		} else if (!OVL_TYPE_UPPER(type)) {
 			/*
 			 * For non-samefs setup, to make sure that st_dev/st_ino
@@ -151,7 +151,7 @@ int ovl_getattr(const struct path *path, struct kstat *stat,
 		 * overlay st_dev} is not unique, so use the non persistent
 		 * overlay st_ino for directories.
 		 */
-		stat->dev = dentry->d_sb->s_dev;
+		stat->dev = dentry->d_sb->s_view.v_dev;
 		stat->ino = dentry->d_inode->i_ino;
 	}
 
diff --git a/fs/overlayfs/readdir.c b/fs/overlayfs/readdir.c
index c11f5c0906c3..3b2ce71de48d 100644
--- a/fs/overlayfs/readdir.c
+++ b/fs/overlayfs/readdir.c
@@ -489,7 +489,7 @@ static int ovl_cache_update_ino(struct path *path, struct ovl_cache_entry *p)
 		if (err)
 			goto fail;
 
-		WARN_ON_ONCE(dir->d_sb->s_dev != stat.dev);
+		WARN_ON_ONCE(dir->d_sb->s_view.v_dev != stat.dev);
 		ino = stat.ino;
 	}
 
@@ -660,7 +660,7 @@ static int ovl_iterate_real(struct file *file, struct dir_context *ctx)
 		if (err)
 			return err;
 
-		WARN_ON_ONCE(dir->d_sb->s_dev != stat.dev);
+		WARN_ON_ONCE(dir->d_sb->s_view.v_dev != stat.dev);
 		rdt.parent_ino = stat.ino;
 	}
 
diff --git a/fs/proc_namespace.c b/fs/proc_namespace.c
index e16fb8f2049e..842d6f4fe014 100644
--- a/fs/proc_namespace.c
+++ b/fs/proc_namespace.c
@@ -137,7 +137,7 @@ static int show_mountinfo(struct seq_file *m, struct vfsmount *mnt)
 	int err;
 
 	seq_printf(m, "%i %i %u:%u ", r->mnt_id, r->mnt_parent->mnt_id,
-		   MAJOR(sb->s_dev), MINOR(sb->s_dev));
+		   MAJOR(sb->s_view.v_dev), MINOR(sb->s_view.v_dev));
 	if (sb->s_op->show_path) {
 		err = sb->s_op->show_path(m, mnt->mnt_root);
 		if (err)
diff --git a/fs/quota/dquot.c b/fs/quota/dquot.c
index ba6d549323cb..124f8dff5214 100644
--- a/fs/quota/dquot.c
+++ b/fs/quota/dquot.c
@@ -1242,7 +1242,7 @@ static void flush_warnings(struct dquot_warn *warn)
 		print_warning(&warn[i]);
 #endif
 		quota_send_warning(warn[i].w_dq_id,
-				   warn[i].w_sb->s_dev, warn[i].w_type);
+				   warn[i].w_sb->s_view.v_dev, warn[i].w_type);
 	}
 }
 
diff --git a/fs/reiserfs/journal.c b/fs/reiserfs/journal.c
index aefcb77de3fd..7c20afe62014 100644
--- a/fs/reiserfs/journal.c
+++ b/fs/reiserfs/journal.c
@@ -2613,14 +2613,14 @@ static int journal_init_dev(struct super_block *super,
 
 	journal->j_dev_bd = NULL;
 	jdev = SB_ONDISK_JOURNAL_DEVICE(super) ?
-	    new_decode_dev(SB_ONDISK_JOURNAL_DEVICE(super)) : super->s_dev;
+	    new_decode_dev(SB_ONDISK_JOURNAL_DEVICE(super)) : super->s_view.v_dev;
 
 	if (bdev_read_only(super->s_bdev))
 		blkdev_mode = FMODE_READ;
 
 	/* there is no "jdev" option and journal is on separate device */
 	if ((!jdev_name || !jdev_name[0])) {
-		if (jdev == super->s_dev)
+		if (jdev == super->s_view.v_dev)
 			blkdev_mode &= ~FMODE_EXCL;
 		journal->j_dev_bd = blkdev_get_by_dev(jdev, blkdev_mode,
 						      journal);
@@ -2632,7 +2632,7 @@ static int journal_init_dev(struct super_block *super,
 					 "cannot init journal device '%s': %i",
 					 __bdevname(jdev, b), result);
 			return result;
-		} else if (jdev != super->s_dev)
+		} else if (jdev != super->s_view.v_dev)
 			set_blocksize(journal->j_dev_bd, super->s_blocksize);
 
 		return 0;
diff --git a/fs/romfs/super.c b/fs/romfs/super.c
index eb0b7d3775bb..f9d9d99a32e9 100644
--- a/fs/romfs/super.c
+++ b/fs/romfs/super.c
@@ -433,8 +433,8 @@ static int romfs_statfs(struct dentry *dentry, struct kstatfs *buf)
 	 */
 	if (sb->s_bdev)
 		id = huge_encode_dev(sb->s_bdev->bd_dev);
-	else if (sb->s_dev)
-		id = huge_encode_dev(sb->s_dev);
+	else if (sb->s_view.v_dev)
+		id = huge_encode_dev(sb->s_view.v_dev);
 
 	buf->f_type = ROMFS_MAGIC;
 	buf->f_namelen = ROMFS_MAXFN;
@@ -510,7 +510,7 @@ static int romfs_fill_super(struct super_block *sb, void *data, int silent)
 #ifdef CONFIG_ROMFS_ON_MTD
 	/* Use same dev ID from the underlying mtdblock device */
 	if (sb->s_mtd)
-		sb->s_dev = MKDEV(MTD_BLOCK_MAJOR, sb->s_mtd->index);
+		sb->s_view.v_dev = MKDEV(MTD_BLOCK_MAJOR, sb->s_mtd->index);
 #endif
 	/* read the image superblock and check it */
 	rsb = kmalloc(512, GFP_KERNEL);
diff --git a/fs/super.c b/fs/super.c
index 5258a57d410a..dfb5b1c8ef20 100644
--- a/fs/super.c
+++ b/fs/super.c
@@ -781,7 +781,7 @@ struct super_block *user_get_super(dev_t dev)
 	list_for_each_entry(sb, &super_blocks, s_list) {
 		if (hlist_unhashed(&sb->s_instances))
 			continue;
-		if (sb->s_dev ==  dev) {
+		if (sb->s_view.v_dev ==  dev) {
 			sb->s_count++;
 			spin_unlock(&sb_lock);
 			down_read(&sb->s_umount);
@@ -981,14 +981,14 @@ EXPORT_SYMBOL(free_anon_bdev);
 
 int set_anon_super(struct super_block *s, void *data)
 {
-	return get_anon_bdev(&s->s_dev);
+	return get_anon_bdev(&s->s_view.v_dev);
 }
 
 EXPORT_SYMBOL(set_anon_super);
 
 void kill_anon_super(struct super_block *sb)
 {
-	dev_t dev = sb->s_dev;
+	dev_t dev = sb->s_view.v_dev;
 	generic_shutdown_super(sb);
 	free_anon_bdev(dev);
 }
@@ -1052,7 +1052,7 @@ EXPORT_SYMBOL(mount_ns);
 static int set_bdev_super(struct super_block *s, void *data)
 {
 	s->s_bdev = data;
-	s->s_dev = s->s_bdev->bd_dev;
+	s->s_view.v_dev = s->s_bdev->bd_dev;
 	s->s_bdi = bdi_get(s->s_bdev->bd_bdi);
 
 	return 0;
diff --git a/fs/xfs/scrub/trace.h b/fs/xfs/scrub/trace.h
index 4dc896852bf0..57e6610e29d6 100644
--- a/fs/xfs/scrub/trace.h
+++ b/fs/xfs/scrub/trace.h
@@ -41,7 +41,7 @@ DECLARE_EVENT_CLASS(xfs_scrub_class,
 		__field(int, error)
 	),
 	TP_fast_assign(
-		__entry->dev = ip->i_mount->m_super->s_dev;
+		__entry->dev = ip->i_mount->m_super->s_view.v_dev;
 		__entry->ino = ip->i_ino;
 		__entry->type = sm->sm_type;
 		__entry->agno = sm->sm_agno;
@@ -83,7 +83,7 @@ TRACE_EVENT(xfs_scrub_op_error,
 		__field(void *, ret_ip)
 	),
 	TP_fast_assign(
-		__entry->dev = sc->mp->m_super->s_dev;
+		__entry->dev = sc->mp->m_super->s_view.v_dev;
 		__entry->type = sc->sm->sm_type;
 		__entry->agno = agno;
 		__entry->bno = bno;
@@ -113,7 +113,7 @@ TRACE_EVENT(xfs_scrub_file_op_error,
 		__field(void *, ret_ip)
 	),
 	TP_fast_assign(
-		__entry->dev = sc->ip->i_mount->m_super->s_dev;
+		__entry->dev = sc->ip->i_mount->m_super->s_view.v_dev;
 		__entry->ino = sc->ip->i_ino;
 		__entry->whichfork = whichfork;
 		__entry->type = sc->sm->sm_type;
@@ -150,7 +150,7 @@ DECLARE_EVENT_CLASS(xfs_scrub_block_error_class,
 		agno = XFS_FSB_TO_AGNO(sc->mp, fsbno);
 		bno = XFS_FSB_TO_AGBNO(sc->mp, fsbno);
 
-		__entry->dev = sc->mp->m_super->s_dev;
+		__entry->dev = sc->mp->m_super->s_view.v_dev;
 		__entry->type = sc->sm->sm_type;
 		__entry->agno = agno;
 		__entry->bno = bno;
@@ -200,7 +200,7 @@ DECLARE_EVENT_CLASS(xfs_scrub_ino_error_class,
 					XFS_INO_TO_AGINO(sc->mp, ino));
 		}
 
-		__entry->dev = sc->mp->m_super->s_dev;
+		__entry->dev = sc->mp->m_super->s_view.v_dev;
 		__entry->ino = ino;
 		__entry->type = sc->sm->sm_type;
 		__entry->agno = agno;
@@ -239,7 +239,7 @@ DECLARE_EVENT_CLASS(xfs_scrub_fblock_error_class,
 		__field(void *, ret_ip)
 	),
 	TP_fast_assign(
-		__entry->dev = sc->ip->i_mount->m_super->s_dev;
+		__entry->dev = sc->ip->i_mount->m_super->s_view.v_dev;
 		__entry->ino = sc->ip->i_ino;
 		__entry->whichfork = whichfork;
 		__entry->type = sc->sm->sm_type;
@@ -273,7 +273,7 @@ TRACE_EVENT(xfs_scrub_incomplete,
 		__field(void *, ret_ip)
 	),
 	TP_fast_assign(
-		__entry->dev = sc->mp->m_super->s_dev;
+		__entry->dev = sc->mp->m_super->s_view.v_dev;
 		__entry->type = sc->sm->sm_type;
 		__entry->ret_ip = ret_ip;
 	),
@@ -301,7 +301,7 @@ TRACE_EVENT(xfs_scrub_btree_op_error,
 	TP_fast_assign(
 		xfs_fsblock_t fsbno = xfs_scrub_btree_cur_fsbno(cur, level);
 
-		__entry->dev = sc->mp->m_super->s_dev;
+		__entry->dev = sc->mp->m_super->s_view.v_dev;
 		__entry->type = sc->sm->sm_type;
 		__entry->btnum = cur->bc_btnum;
 		__entry->level = level;
@@ -342,7 +342,7 @@ TRACE_EVENT(xfs_scrub_ifork_btree_op_error,
 	),
 	TP_fast_assign(
 		xfs_fsblock_t fsbno = xfs_scrub_btree_cur_fsbno(cur, level);
-		__entry->dev = sc->mp->m_super->s_dev;
+		__entry->dev = sc->mp->m_super->s_view.v_dev;
 		__entry->ino = sc->ip->i_ino;
 		__entry->whichfork = cur->bc_private.b.whichfork;
 		__entry->type = sc->sm->sm_type;
@@ -384,7 +384,7 @@ TRACE_EVENT(xfs_scrub_btree_error,
 	),
 	TP_fast_assign(
 		xfs_fsblock_t fsbno = xfs_scrub_btree_cur_fsbno(cur, level);
-		__entry->dev = sc->mp->m_super->s_dev;
+		__entry->dev = sc->mp->m_super->s_view.v_dev;
 		__entry->type = sc->sm->sm_type;
 		__entry->btnum = cur->bc_btnum;
 		__entry->level = level;
@@ -422,7 +422,7 @@ TRACE_EVENT(xfs_scrub_ifork_btree_error,
 	),
 	TP_fast_assign(
 		xfs_fsblock_t fsbno = xfs_scrub_btree_cur_fsbno(cur, level);
-		__entry->dev = sc->mp->m_super->s_dev;
+		__entry->dev = sc->mp->m_super->s_view.v_dev;
 		__entry->ino = sc->ip->i_ino;
 		__entry->whichfork = cur->bc_private.b.whichfork;
 		__entry->type = sc->sm->sm_type;
@@ -463,7 +463,7 @@ DECLARE_EVENT_CLASS(xfs_scrub_sbtree_class,
 	TP_fast_assign(
 		xfs_fsblock_t fsbno = xfs_scrub_btree_cur_fsbno(cur, level);
 
-		__entry->dev = sc->mp->m_super->s_dev;
+		__entry->dev = sc->mp->m_super->s_view.v_dev;
 		__entry->type = sc->sm->sm_type;
 		__entry->btnum = cur->bc_btnum;
 		__entry->agno = XFS_FSB_TO_AGNO(cur->bc_mp, fsbno);
@@ -501,7 +501,7 @@ TRACE_EVENT(xfs_scrub_xref_error,
 		__field(void *, ret_ip)
 	),
 	TP_fast_assign(
-		__entry->dev = sc->mp->m_super->s_dev;
+		__entry->dev = sc->mp->m_super->s_view.v_dev;
 		__entry->type = sc->sm->sm_type;
 		__entry->error = error;
 		__entry->ret_ip = ret_ip;
diff --git a/fs/xfs/xfs_trace.h b/fs/xfs/xfs_trace.h
index 16065fe0bd4d..2d650a11890b 100644
--- a/fs/xfs/xfs_trace.h
+++ b/fs/xfs/xfs_trace.h
@@ -114,7 +114,7 @@ DECLARE_EVENT_CLASS(xfs_perag_class,
 		__field(unsigned long, caller_ip)
 	),
 	TP_fast_assign(
-		__entry->dev = mp->m_super->s_dev;
+		__entry->dev = mp->m_super->s_view.v_dev;
 		__entry->agno = agno;
 		__entry->refcount = refcount;
 		__entry->caller_ip = caller_ip;
@@ -149,7 +149,7 @@ DECLARE_EVENT_CLASS(xfs_ag_class,
 		__field(xfs_agnumber_t, agno)
 	),
 	TP_fast_assign(
-		__entry->dev = mp->m_super->s_dev;
+		__entry->dev = mp->m_super->s_view.v_dev;
 		__entry->agno = agno;
 	),
 	TP_printk("dev %d:%d agno %u",
@@ -742,7 +742,7 @@ TRACE_EVENT(xfs_irec_merge_pre,
 		__field(uint16_t, nholemask)
 	),
 	TP_fast_assign(
-		__entry->dev = mp->m_super->s_dev;
+		__entry->dev = mp->m_super->s_view.v_dev;
 		__entry->agno = agno;
 		__entry->agino = agino;
 		__entry->holemask = holemask;
@@ -766,7 +766,7 @@ TRACE_EVENT(xfs_irec_merge_post,
 		__field(uint16_t, holemask)
 	),
 	TP_fast_assign(
-		__entry->dev = mp->m_super->s_dev;
+		__entry->dev = mp->m_super->s_view.v_dev;
 		__entry->agno = agno;
 		__entry->agino = agino;
 		__entry->holemask = holemask;
@@ -868,7 +868,7 @@ DECLARE_EVENT_CLASS(xfs_dquot_class,
 		__field(unsigned long long, ino_softlimit)
 	), \
 	TP_fast_assign(
-		__entry->dev = dqp->q_mount->m_super->s_dev;
+		__entry->dev = dqp->q_mount->m_super->s_view.v_dev;
 		__entry->id = be32_to_cpu(dqp->q_core.d_id);
 		__entry->flags = dqp->dq_flags;
 		__entry->nrefs = dqp->q_nrefs;
@@ -947,7 +947,7 @@ DECLARE_EVENT_CLASS(xfs_loggrant_class,
 		__field(xfs_lsn_t, tail_lsn)
 	),
 	TP_fast_assign(
-		__entry->dev = log->l_mp->m_super->s_dev;
+		__entry->dev = log->l_mp->m_super->s_view.v_dev;
 		__entry->ocnt = tic->t_ocnt;
 		__entry->cnt = tic->t_cnt;
 		__entry->curr_res = tic->t_curr_res;
@@ -1022,7 +1022,7 @@ DECLARE_EVENT_CLASS(xfs_log_item_class,
 		__field(xfs_lsn_t, lsn)
 	),
 	TP_fast_assign(
-		__entry->dev = lip->li_mountp->m_super->s_dev;
+		__entry->dev = lip->li_mountp->m_super->s_view.v_dev;
 		__entry->lip = lip;
 		__entry->type = lip->li_type;
 		__entry->flags = lip->li_flags;
@@ -1045,7 +1045,7 @@ TRACE_EVENT(xfs_log_force,
 		__field(unsigned long, caller_ip)
 	),
 	TP_fast_assign(
-		__entry->dev = mp->m_super->s_dev;
+		__entry->dev = mp->m_super->s_view.v_dev;
 		__entry->lsn = lsn;
 		__entry->caller_ip = caller_ip;
 	),
@@ -1075,7 +1075,7 @@ DECLARE_EVENT_CLASS(xfs_ail_class,
 		__field(xfs_lsn_t, new_lsn)
 	),
 	TP_fast_assign(
-		__entry->dev = lip->li_mountp->m_super->s_dev;
+		__entry->dev = lip->li_mountp->m_super->s_view.v_dev;
 		__entry->lip = lip;
 		__entry->type = lip->li_type;
 		__entry->flags = lip->li_flags;
@@ -1109,7 +1109,7 @@ TRACE_EVENT(xfs_log_assign_tail_lsn,
 		__field(xfs_lsn_t, last_sync_lsn)
 	),
 	TP_fast_assign(
-		__entry->dev = log->l_mp->m_super->s_dev;
+		__entry->dev = log->l_mp->m_super->s_view.v_dev;
 		__entry->new_lsn = new_lsn;
 		__entry->old_lsn = atomic64_read(&log->l_tail_lsn);
 		__entry->last_sync_lsn = atomic64_read(&log->l_last_sync_lsn);
@@ -1425,7 +1425,7 @@ DECLARE_EVENT_CLASS(xfs_extent_busy_class,
 		__field(xfs_extlen_t, len)
 	),
 	TP_fast_assign(
-		__entry->dev = mp->m_super->s_dev;
+		__entry->dev = mp->m_super->s_view.v_dev;
 		__entry->agno = agno;
 		__entry->agbno = agbno;
 		__entry->len = len;
@@ -1461,7 +1461,7 @@ TRACE_EVENT(xfs_extent_busy_trim,
 		__field(xfs_extlen_t, tlen)
 	),
 	TP_fast_assign(
-		__entry->dev = mp->m_super->s_dev;
+		__entry->dev = mp->m_super->s_view.v_dev;
 		__entry->agno = agno;
 		__entry->agbno = agbno;
 		__entry->len = len;
@@ -1498,7 +1498,7 @@ TRACE_EVENT(xfs_agf,
 		__field(unsigned long, caller_ip)
 	),
 	TP_fast_assign(
-		__entry->dev = mp->m_super->s_dev;
+		__entry->dev = mp->m_super->s_view.v_dev;
 		__entry->agno = be32_to_cpu(agf->agf_seqno),
 		__entry->flags = flags;
 		__entry->length = be32_to_cpu(agf->agf_length),
@@ -1549,7 +1549,7 @@ TRACE_EVENT(xfs_free_extent,
 		__field(int, haveright)
 	),
 	TP_fast_assign(
-		__entry->dev = mp->m_super->s_dev;
+		__entry->dev = mp->m_super->s_view.v_dev;
 		__entry->agno = agno;
 		__entry->agbno = agbno;
 		__entry->len = len;
@@ -1594,7 +1594,7 @@ DECLARE_EVENT_CLASS(xfs_alloc_class,
 		__field(xfs_fsblock_t, firstblock)
 	),
 	TP_fast_assign(
-		__entry->dev = args->mp->m_super->s_dev;
+		__entry->dev = args->mp->m_super->s_view.v_dev;
 		__entry->agno = args->agno;
 		__entry->agbno = args->agbno;
 		__entry->minlen = args->minlen;
@@ -1958,7 +1958,7 @@ TRACE_EVENT(xfs_log_recover,
 		__field(xfs_daddr_t, tailblk)
 	),
 	TP_fast_assign(
-		__entry->dev = log->l_mp->m_super->s_dev;
+		__entry->dev = log->l_mp->m_super->s_view.v_dev;
 		__entry->headblk = headblk;
 		__entry->tailblk = tailblk;
 	),
@@ -1978,7 +1978,7 @@ TRACE_EVENT(xfs_log_recover_record,
 		__field(int, pass)
 	),
 	TP_fast_assign(
-		__entry->dev = log->l_mp->m_super->s_dev;
+		__entry->dev = log->l_mp->m_super->s_view.v_dev;
 		__entry->lsn = be64_to_cpu(rhead->h_lsn);
 		__entry->len = be32_to_cpu(rhead->h_len);
 		__entry->num_logops = be32_to_cpu(rhead->h_num_logops);
@@ -2005,7 +2005,7 @@ DECLARE_EVENT_CLASS(xfs_log_recover_item_class,
 		__field(int, total)
 	),
 	TP_fast_assign(
-		__entry->dev = log->l_mp->m_super->s_dev;
+		__entry->dev = log->l_mp->m_super->s_view.v_dev;
 		__entry->item = (unsigned long)item;
 		__entry->tid = trans->r_log_tid;
 		__entry->lsn = trans->r_lsn;
@@ -2050,7 +2050,7 @@ DECLARE_EVENT_CLASS(xfs_log_recover_buf_item_class,
 		__field(unsigned int, map_size)
 	),
 	TP_fast_assign(
-		__entry->dev = log->l_mp->m_super->s_dev;
+		__entry->dev = log->l_mp->m_super->s_view.v_dev;
 		__entry->blkno = buf_f->blf_blkno;
 		__entry->len = buf_f->blf_len;
 		__entry->flags = buf_f->blf_flags;
@@ -2097,7 +2097,7 @@ DECLARE_EVENT_CLASS(xfs_log_recover_ino_item_class,
 		__field(int, boffset)
 	),
 	TP_fast_assign(
-		__entry->dev = log->l_mp->m_super->s_dev;
+		__entry->dev = log->l_mp->m_super->s_view.v_dev;
 		__entry->ino = in_f->ilf_ino;
 		__entry->size = in_f->ilf_size;
 		__entry->fields = in_f->ilf_fields;
@@ -2141,7 +2141,7 @@ DECLARE_EVENT_CLASS(xfs_log_recover_icreate_item_class,
 		__field(unsigned int, gen)
 	),
 	TP_fast_assign(
-		__entry->dev = log->l_mp->m_super->s_dev;
+		__entry->dev = log->l_mp->m_super->s_view.v_dev;
 		__entry->agno = be32_to_cpu(in_f->icl_ag);
 		__entry->agbno = be32_to_cpu(in_f->icl_agbno);
 		__entry->count = be32_to_cpu(in_f->icl_count);
@@ -2173,7 +2173,7 @@ DECLARE_EVENT_CLASS(xfs_discard_class,
 		__field(xfs_extlen_t, len)
 	),
 	TP_fast_assign(
-		__entry->dev = mp->m_super->s_dev;
+		__entry->dev = mp->m_super->s_view.v_dev;
 		__entry->agno = agno;
 		__entry->agbno = agbno;
 		__entry->len = len;
@@ -2208,7 +2208,7 @@ DECLARE_EVENT_CLASS(xfs_btree_cur_class,
 		__field(xfs_daddr_t, daddr)
 	),
 	TP_fast_assign(
-		__entry->dev = cur->bc_mp->m_super->s_dev;
+		__entry->dev = cur->bc_mp->m_super->s_view.v_dev;
 		__entry->btnum = cur->bc_btnum;
 		__entry->level = level;
 		__entry->nlevels = cur->bc_nlevels;
@@ -2245,7 +2245,7 @@ DECLARE_EVENT_CLASS(xfs_defer_class,
 		__field(char, low)
 	),
 	TP_fast_assign(
-		__entry->dev = mp ? mp->m_super->s_dev : 0;
+		__entry->dev = mp ? mp->m_super->s_view.v_dev : 0;
 		__entry->dop = dop;
 		__entry->committed = dop->dop_committed;
 		__entry->low = dop->dop_low;
@@ -2272,7 +2272,7 @@ DECLARE_EVENT_CLASS(xfs_defer_error_class,
 		__field(int, error)
 	),
 	TP_fast_assign(
-		__entry->dev = mp ? mp->m_super->s_dev : 0;
+		__entry->dev = mp ? mp->m_super->s_view.v_dev : 0;
 		__entry->dop = dop;
 		__entry->committed = dop->dop_committed;
 		__entry->low = dop->dop_low;
@@ -2301,7 +2301,7 @@ DECLARE_EVENT_CLASS(xfs_defer_pending_class,
 		__field(int, nr)
 	),
 	TP_fast_assign(
-		__entry->dev = mp ? mp->m_super->s_dev : 0;
+		__entry->dev = mp ? mp->m_super->s_view.v_dev : 0;
 		__entry->type = dfp->dfp_type->type;
 		__entry->intent = dfp->dfp_intent;
 		__entry->committed = dfp->dfp_done != NULL;
@@ -2331,7 +2331,7 @@ DECLARE_EVENT_CLASS(xfs_phys_extent_deferred_class,
 		__field(xfs_extlen_t, len)
 	),
 	TP_fast_assign(
-		__entry->dev = mp->m_super->s_dev;
+		__entry->dev = mp->m_super->s_view.v_dev;
 		__entry->agno = agno;
 		__entry->type = type;
 		__entry->agbno = agbno;
@@ -2374,7 +2374,7 @@ DECLARE_EVENT_CLASS(xfs_map_extent_deferred_class,
 		__field(int, op)
 	),
 	TP_fast_assign(
-		__entry->dev = mp->m_super->s_dev;
+		__entry->dev = mp->m_super->s_view.v_dev;
 		__entry->agno = agno;
 		__entry->ino = ino;
 		__entry->agbno = agbno;
@@ -2443,7 +2443,7 @@ DECLARE_EVENT_CLASS(xfs_rmap_class,
 		__field(unsigned long, flags)
 	),
 	TP_fast_assign(
-		__entry->dev = mp->m_super->s_dev;
+		__entry->dev = mp->m_super->s_view.v_dev;
 		__entry->agno = agno;
 		__entry->agbno = agbno;
 		__entry->len = len;
@@ -2481,7 +2481,7 @@ DECLARE_EVENT_CLASS(xfs_ag_error_class,
 		__field(unsigned long, caller_ip)
 	),
 	TP_fast_assign(
-		__entry->dev = mp->m_super->s_dev;
+		__entry->dev = mp->m_super->s_view.v_dev;
 		__entry->agno = agno;
 		__entry->error = error;
 		__entry->caller_ip = caller_ip;
@@ -2525,7 +2525,7 @@ DECLARE_EVENT_CLASS(xfs_rmapbt_class,
 		__field(unsigned int, flags)
 	),
 	TP_fast_assign(
-		__entry->dev = mp->m_super->s_dev;
+		__entry->dev = mp->m_super->s_view.v_dev;
 		__entry->agno = agno;
 		__entry->agbno = agbno;
 		__entry->len = len;
@@ -2593,7 +2593,7 @@ DECLARE_EVENT_CLASS(xfs_ag_resv_class,
 	TP_fast_assign(
 		struct xfs_ag_resv	*r = xfs_perag_resv(pag, resv);
 
-		__entry->dev = pag->pag_mount->m_super->s_dev;
+		__entry->dev = pag->pag_mount->m_super->s_view.v_dev;
 		__entry->agno = pag->pag_agno;
 		__entry->resv = resv;
 		__entry->freeblks = pag->pagf_freeblks;
@@ -2651,7 +2651,7 @@ DECLARE_EVENT_CLASS(xfs_ag_btree_lookup_class,
 		__field(xfs_lookup_t, dir)
 	),
 	TP_fast_assign(
-		__entry->dev = mp->m_super->s_dev;
+		__entry->dev = mp->m_super->s_view.v_dev;
 		__entry->agno = agno;
 		__entry->agbno = agbno;
 		__entry->dir = dir;
@@ -2683,7 +2683,7 @@ DECLARE_EVENT_CLASS(xfs_refcount_extent_class,
 		__field(xfs_nlink_t, refcount)
 	),
 	TP_fast_assign(
-		__entry->dev = mp->m_super->s_dev;
+		__entry->dev = mp->m_super->s_view.v_dev;
 		__entry->agno = agno;
 		__entry->startblock = irec->rc_startblock;
 		__entry->blockcount = irec->rc_blockcount;
@@ -2717,7 +2717,7 @@ DECLARE_EVENT_CLASS(xfs_refcount_extent_at_class,
 		__field(xfs_agblock_t, agbno)
 	),
 	TP_fast_assign(
-		__entry->dev = mp->m_super->s_dev;
+		__entry->dev = mp->m_super->s_view.v_dev;
 		__entry->agno = agno;
 		__entry->startblock = irec->rc_startblock;
 		__entry->blockcount = irec->rc_blockcount;
@@ -2755,7 +2755,7 @@ DECLARE_EVENT_CLASS(xfs_refcount_double_extent_class,
 		__field(xfs_nlink_t, i2_refcount)
 	),
 	TP_fast_assign(
-		__entry->dev = mp->m_super->s_dev;
+		__entry->dev = mp->m_super->s_view.v_dev;
 		__entry->agno = agno;
 		__entry->i1_startblock = i1->rc_startblock;
 		__entry->i1_blockcount = i1->rc_blockcount;
@@ -2800,7 +2800,7 @@ DECLARE_EVENT_CLASS(xfs_refcount_double_extent_at_class,
 		__field(xfs_agblock_t, agbno)
 	),
 	TP_fast_assign(
-		__entry->dev = mp->m_super->s_dev;
+		__entry->dev = mp->m_super->s_view.v_dev;
 		__entry->agno = agno;
 		__entry->i1_startblock = i1->rc_startblock;
 		__entry->i1_blockcount = i1->rc_blockcount;
@@ -2850,7 +2850,7 @@ DECLARE_EVENT_CLASS(xfs_refcount_triple_extent_class,
 		__field(xfs_nlink_t, i3_refcount)
 	),
 	TP_fast_assign(
-		__entry->dev = mp->m_super->s_dev;
+		__entry->dev = mp->m_super->s_view.v_dev;
 		__entry->agno = agno;
 		__entry->i1_startblock = i1->rc_startblock;
 		__entry->i1_blockcount = i1->rc_blockcount;
@@ -2943,7 +2943,7 @@ TRACE_EVENT(xfs_refcount_finish_one_leftover,
 		__field(xfs_extlen_t, new_len)
 	),
 	TP_fast_assign(
-		__entry->dev = mp->m_super->s_dev;
+		__entry->dev = mp->m_super->s_view.v_dev;
 		__entry->agno = agno;
 		__entry->type = type;
 		__entry->agbno = agbno;
@@ -3247,7 +3247,7 @@ DECLARE_EVENT_CLASS(xfs_fsmap_class,
 		__field(unsigned int, flags)
 	),
 	TP_fast_assign(
-		__entry->dev = mp->m_super->s_dev;
+		__entry->dev = mp->m_super->s_view.v_dev;
 		__entry->keydev = new_decode_dev(keydev);
 		__entry->agno = agno;
 		__entry->bno = rmap->rm_startblock;
@@ -3288,7 +3288,7 @@ DECLARE_EVENT_CLASS(xfs_getfsmap_class,
 		__field(uint64_t, flags)
 	),
 	TP_fast_assign(
-		__entry->dev = mp->m_super->s_dev;
+		__entry->dev = mp->m_super->s_view.v_dev;
 		__entry->keydev = new_decode_dev(fsmap->fmr_device);
 		__entry->block = fsmap->fmr_physical;
 		__entry->len = fsmap->fmr_length;
@@ -3325,7 +3325,7 @@ TRACE_EVENT(xfs_trans_resv_calc,
 		__field(int, logflags)
 	),
 	TP_fast_assign(
-		__entry->dev = mp->m_super->s_dev;
+		__entry->dev = mp->m_super->s_view.v_dev;
 		__entry->type = type;
 		__entry->logres = res->tr_logres;
 		__entry->logcount = res->tr_logcount;
diff --git a/fs/xfs/xfs_trans_dquot.c b/fs/xfs/xfs_trans_dquot.c
index c3d547211d16..be0850fdbe50 100644
--- a/fs/xfs/xfs_trans_dquot.c
+++ b/fs/xfs/xfs_trans_dquot.c
@@ -583,7 +583,7 @@ xfs_quota_warn(
 
 	quota_send_warning(make_kqid(&init_user_ns, qtype,
 				     be32_to_cpu(dqp->q_core.d_id)),
-			   mp->m_super->s_dev, type);
+			   mp->m_super->s_view.v_dev, type);
 }
 
 /*
diff --git a/include/trace/events/ext4.h b/include/trace/events/ext4.h
index 500ae412f483..003844d10b86 100644
--- a/include/trace/events/ext4.h
+++ b/include/trace/events/ext4.h
@@ -599,7 +599,7 @@ TRACE_EVENT(ext4_discard_blocks,
 	),
 
 	TP_fast_assign(
-		__entry->dev	= sb->s_dev;
+		__entry->dev	= sb->s_view.v_dev;
 		__entry->blk	= blk;
 		__entry->count	= count;
 	),
@@ -625,7 +625,7 @@ DECLARE_EVENT_CLASS(ext4__mb_new_pa,
 	),
 
 	TP_fast_assign(
-		__entry->dev		= ac->ac_sb->s_dev;
+		__entry->dev		= ac->ac_sb->s_view.v_dev;
 		__entry->ino		= ac->ac_inode->i_ino;
 		__entry->pa_pstart	= pa->pa_pstart;
 		__entry->pa_lstart	= pa->pa_lstart;
@@ -694,7 +694,7 @@ TRACE_EVENT(ext4_mb_release_group_pa,
 	),
 
 	TP_fast_assign(
-		__entry->dev		= sb->s_dev;
+		__entry->dev		= sb->s_view.v_dev;
 		__entry->pa_pstart	= pa->pa_pstart;
 		__entry->pa_len		= pa->pa_len;
 	),
@@ -737,7 +737,7 @@ TRACE_EVENT(ext4_mb_discard_preallocations,
 	),
 
 	TP_fast_assign(
-		__entry->dev	= sb->s_dev;
+		__entry->dev	= sb->s_view.v_dev;
 		__entry->needed	= needed;
 	),
 
@@ -874,7 +874,7 @@ TRACE_EVENT(ext4_sync_file_enter,
 	TP_fast_assign(
 		struct dentry *dentry = file->f_path.dentry;
 
-		__entry->dev		= dentry->d_sb->s_dev;
+		__entry->dev		= dentry->d_sb->s_view.v_dev;
 		__entry->ino		= d_inode(dentry)->i_ino;
 		__entry->datasync	= datasync;
 		__entry->parent		= d_inode(dentry->d_parent)->i_ino;
@@ -921,7 +921,7 @@ TRACE_EVENT(ext4_sync_fs,
 	),
 
 	TP_fast_assign(
-		__entry->dev	= sb->s_dev;
+		__entry->dev	= sb->s_view.v_dev;
 		__entry->wait	= wait;
 	),
 
@@ -1078,7 +1078,7 @@ DECLARE_EVENT_CLASS(ext4__mballoc,
 	),
 
 	TP_fast_assign(
-		__entry->dev		= sb->s_dev;
+		__entry->dev		= sb->s_view.v_dev;
 		__entry->ino		= inode ? inode->i_ino : 0;
 		__entry->result_start	= start;
 		__entry->result_group	= group;
@@ -1248,7 +1248,7 @@ DECLARE_EVENT_CLASS(ext4__bitmap_load,
 	),
 
 	TP_fast_assign(
-		__entry->dev	= sb->s_dev;
+		__entry->dev	= sb->s_view.v_dev;
 		__entry->group	= group;
 	),
 
@@ -1434,7 +1434,7 @@ TRACE_EVENT(ext4_unlink_enter,
 	),
 
 	TP_fast_assign(
-		__entry->dev		= dentry->d_sb->s_dev;
+		__entry->dev		= dentry->d_sb->s_view.v_dev;
 		__entry->ino		= d_inode(dentry)->i_ino;
 		__entry->parent		= parent->i_ino;
 		__entry->size		= d_inode(dentry)->i_size;
@@ -1458,7 +1458,7 @@ TRACE_EVENT(ext4_unlink_exit,
 	),
 
 	TP_fast_assign(
-		__entry->dev		= dentry->d_sb->s_dev;
+		__entry->dev		= dentry->d_sb->s_view.v_dev;
 		__entry->ino		= d_inode(dentry)->i_ino;
 		__entry->ret		= ret;
 	),
@@ -1737,7 +1737,7 @@ TRACE_EVENT(ext4_journal_start,
 	),
 
 	TP_fast_assign(
-		__entry->dev		 = sb->s_dev;
+		__entry->dev		 = sb->s_view.v_dev;
 		__entry->ip		 = IP;
 		__entry->blocks		 = blocks;
 		__entry->rsv_blocks	 = rsv_blocks;
@@ -1760,7 +1760,7 @@ TRACE_EVENT(ext4_journal_start_reserved,
 	),
 
 	TP_fast_assign(
-		__entry->dev		 = sb->s_dev;
+		__entry->dev		 = sb->s_view.v_dev;
 		__entry->ip		 = IP;
 		__entry->blocks		 = blocks;
 	),
@@ -1787,8 +1787,8 @@ DECLARE_EVENT_CLASS(ext4__trim,
 	),
 
 	TP_fast_assign(
-		__entry->dev_major	= MAJOR(sb->s_dev);
-		__entry->dev_minor	= MINOR(sb->s_dev);
+		__entry->dev_major	= MAJOR(sb->s_view.v_dev);
+		__entry->dev_minor	= MINOR(sb->s_view.v_dev);
 		__entry->group		= group;
 		__entry->start		= start;
 		__entry->len		= len;
@@ -1872,7 +1872,7 @@ TRACE_EVENT(ext4_get_implied_cluster_alloc_exit,
 	),
 
 	TP_fast_assign(
-		__entry->dev	= sb->s_dev;
+		__entry->dev	= sb->s_view.v_dev;
 		__entry->flags	= map->m_flags;
 		__entry->lblk	= map->m_lblk;
 		__entry->pblk	= map->m_pblk;
@@ -2390,7 +2390,7 @@ DECLARE_EVENT_CLASS(ext4__es_shrink_enter,
 	),
 
 	TP_fast_assign(
-		__entry->dev		= sb->s_dev;
+		__entry->dev		= sb->s_view.v_dev;
 		__entry->nr_to_scan	= nr_to_scan;
 		__entry->cache_cnt	= cache_cnt;
 	),
@@ -2424,7 +2424,7 @@ TRACE_EVENT(ext4_es_shrink_scan_exit,
 	),
 
 	TP_fast_assign(
-		__entry->dev		= sb->s_dev;
+		__entry->dev		= sb->s_view.v_dev;
 		__entry->nr_shrunk	= nr_shrunk;
 		__entry->cache_cnt	= cache_cnt;
 	),
@@ -2499,7 +2499,7 @@ TRACE_EVENT(ext4_es_shrink,
 	),
 
 	TP_fast_assign(
-		__entry->dev		= sb->s_dev;
+		__entry->dev		= sb->s_view.v_dev;
 		__entry->nr_shrunk	= nr_shrunk;
 		__entry->scan_time	= div_u64(scan_time, 1000);
 		__entry->nr_skipped	= nr_skipped;
diff --git a/include/trace/events/f2fs.h b/include/trace/events/f2fs.h
index effb2704f3ae..9d67ed3d4dc8 100644
--- a/include/trace/events/f2fs.h
+++ b/include/trace/events/f2fs.h
@@ -265,7 +265,7 @@ TRACE_EVENT(f2fs_sync_fs,
 	),
 
 	TP_fast_assign(
-		__entry->dev	= sb->s_dev;
+		__entry->dev	= sb->s_view.v_dev;
 		__entry->dirty	= is_sbi_flag_set(F2FS_SB(sb), SBI_IS_DIRTY);
 		__entry->wait	= wait;
 	),
@@ -570,7 +570,7 @@ TRACE_EVENT(f2fs_background_gc,
 	),
 
 	TP_fast_assign(
-		__entry->dev		= sb->s_dev;
+		__entry->dev		= sb->s_view.v_dev;
 		__entry->wait_ms	= wait_ms;
 		__entry->prefree	= prefree;
 		__entry->free		= free;
@@ -608,7 +608,7 @@ TRACE_EVENT(f2fs_gc_begin,
 	),
 
 	TP_fast_assign(
-		__entry->dev		= sb->s_dev;
+		__entry->dev		= sb->s_view.v_dev;
 		__entry->sync		= sync;
 		__entry->background	= background;
 		__entry->dirty_nodes	= dirty_nodes;
@@ -661,7 +661,7 @@ TRACE_EVENT(f2fs_gc_end,
 	),
 
 	TP_fast_assign(
-		__entry->dev		= sb->s_dev;
+		__entry->dev		= sb->s_view.v_dev;
 		__entry->ret		= ret;
 		__entry->seg_freed	= seg_freed;
 		__entry->sec_freed	= sec_freed;
@@ -713,7 +713,7 @@ TRACE_EVENT(f2fs_get_victim,
 	),
 
 	TP_fast_assign(
-		__entry->dev		= sb->s_dev;
+		__entry->dev		= sb->s_view.v_dev;
 		__entry->type		= type;
 		__entry->gc_type	= gc_type;
 		__entry->alloc_mode	= p->alloc_mode;
@@ -1034,7 +1034,7 @@ DECLARE_EVENT_CLASS(f2fs__bio,
 	),
 
 	TP_fast_assign(
-		__entry->dev		= sb->s_dev;
+		__entry->dev		= sb->s_view.v_dev;
 		__entry->target		= bio_dev(bio);
 		__entry->op		= bio_op(bio);
 		__entry->op_flags	= bio->bi_opf;
@@ -1336,7 +1336,7 @@ TRACE_EVENT(f2fs_write_checkpoint,
 	),
 
 	TP_fast_assign(
-		__entry->dev		= sb->s_dev;
+		__entry->dev		= sb->s_view.v_dev;
 		__entry->reason		= reason;
 		__entry->msg		= msg;
 	),
@@ -1545,7 +1545,7 @@ TRACE_EVENT(f2fs_shrink_extent_tree,
 	),
 
 	TP_fast_assign(
-		__entry->dev = sbi->sb->s_dev;
+		__entry->dev = sbi->sb->s_view.v_dev;
 		__entry->node_cnt = node_cnt;
 		__entry->tree_cnt = tree_cnt;
 	),
@@ -1592,7 +1592,7 @@ DECLARE_EVENT_CLASS(f2fs_sync_dirty_inodes,
 	),
 
 	TP_fast_assign(
-		__entry->dev	= sb->s_dev;
+		__entry->dev	= sb->s_view.v_dev;
 		__entry->type	= type;
 		__entry->count	= count;
 	),
diff --git a/include/trace/events/writeback.h b/include/trace/events/writeback.h
index 7a5bfa93f938..242d1cc3b58f 100644
--- a/include/trace/events/writeback.h
+++ b/include/trace/events/writeback.h
@@ -223,7 +223,7 @@ DECLARE_EVENT_CLASS(writeback_work_class,
 		strncpy(__entry->name,
 			wb->bdi->dev ? dev_name(wb->bdi->dev) : "(unknown)", 32);
 		__entry->nr_pages = work->nr_pages;
-		__entry->sb_dev = work->sb ? work->sb->s_dev : 0;
+		__entry->sb_dev = work->sb ? work->sb->s_view.v_dev : 0;
 		__entry->sync_mode = work->sync_mode;
 		__entry->for_kupdate = work->for_kupdate;
 		__entry->range_cyclic = work->range_cyclic;
diff --git a/init/do_mounts.c b/init/do_mounts.c
index 7cf4f6dafd5f..724f3b071d62 100644
--- a/init/do_mounts.c
+++ b/init/do_mounts.c
@@ -369,7 +369,7 @@ static int __init do_mount_root(char *name, char *fs, int flags, void *data)
 
 	sys_chdir("/root");
 	s = current->fs->pwd.dentry->d_sb;
-	ROOT_DEV = s->s_dev;
+	ROOT_DEV = s->s_view.v_dev;
 	printk(KERN_INFO
 	       "VFS: Mounted root (%s filesystem)%s on device %u:%u.\n",
 	       s->s_type->name,
diff --git a/kernel/audit_watch.c b/kernel/audit_watch.c
index b9f571cc6a7f..72b82db95ecf 100644
--- a/kernel/audit_watch.c
+++ b/kernel/audit_watch.c
@@ -368,7 +368,7 @@ static int audit_get_nd(struct audit_watch *watch, struct path *parent)
 	inode_unlock(d_backing_inode(parent->dentry));
 	if (d_is_positive(d)) {
 		/* update watch filter fields */
-		watch->dev = d->d_sb->s_dev;
+		watch->dev = d->d_sb->s_view.v_dev;
 		watch->ino = d_backing_inode(d)->i_ino;
 	}
 	dput(d);
diff --git a/net/unix/diag.c b/net/unix/diag.c
index 384c84e83462..26b4486c41da 100644
--- a/net/unix/diag.c
+++ b/net/unix/diag.c
@@ -26,7 +26,7 @@ static int sk_diag_dump_vfs(struct sock *sk, struct sk_buff *nlskb)
 	if (dentry) {
 		struct unix_diag_vfs uv = {
 			.udiag_vfs_ino = d_backing_inode(dentry)->i_ino,
-			.udiag_vfs_dev = dentry->d_sb->s_dev,
+			.udiag_vfs_dev = dentry->d_sb->s_view.v_dev,
 		};
 
 		return nla_put(nlskb, UNIX_DIAG_VFS, sizeof(uv), &uv);
diff --git a/security/tomoyo/realpath.c b/security/tomoyo/realpath.c
index 6ff8c21e4fff..dc7eff734fa9 100644
--- a/security/tomoyo/realpath.c
+++ b/security/tomoyo/realpath.c
@@ -166,7 +166,7 @@ static char *tomoyo_get_local_path(struct dentry *dentry, char * const buffer,
 		goto prepend_filesystem_name;
 	}
 	/* Use filesystem name for unnamed devices. */
-	if (!MAJOR(sb->s_dev))
+	if (!MAJOR(sb->s_view.v_dev))
 		goto prepend_filesystem_name;
 	{
 		struct inode *inode = d_backing_inode(sb->s_root);
@@ -181,7 +181,7 @@ static char *tomoyo_get_local_path(struct dentry *dentry, char * const buffer,
 	{
 		char name[64];
 		int name_len;
-		const dev_t dev = sb->s_dev;
+		const dev_t dev = sb->s_view.v_dev;
 		name[sizeof(name) - 1] = '\0';
 		snprintf(name, sizeof(name) - 1, "dev(%u,%u):", MAJOR(dev),
 			 MINOR(dev));
-- 
2.15.1

^ permalink raw reply related	[flat|nested] 88+ messages in thread

* [PATCH 76/76] btrfs: Use fs_view in roots, point inodes to it
  2018-05-08 18:03 [RFC][PATCH 0/76] vfs: 'views' for filesystems with more than one root Mark Fasheh
                   ` (74 preceding siblings ...)
  2018-05-08 18:04 ` [PATCH 75/76] fs: Use fs view device from struct super_block Mark Fasheh
@ 2018-05-08 18:04 ` Mark Fasheh
  2018-05-08 23:38 ` [RFC][PATCH 0/76] vfs: 'views' for filesystems with more than one root Dave Chinner
  76 siblings, 0 replies; 88+ messages in thread
From: Mark Fasheh @ 2018-05-08 18:04 UTC (permalink / raw)
  To: linux-fsdevel; +Cc: linux-kernel, linux-btrfs, Mark Fasheh

Ensure that our per-subvolume anonymous dev_t gets published to userspace,
instead of the global device in struct super_block. We do this by embedding a
struct fs_view in btrfs_root. The anonymous device number is placed in
view->v_dev. Each inode is then pointed to the view embedded in their owning root.

Signed-off-by: Mark Fasheh <mfasheh@suse.de>
---
 fs/btrfs/ctree.h     |  7 ++-----
 fs/btrfs/disk-io.c   | 14 ++++++++------
 fs/btrfs/disk-io.h   |  2 +-
 fs/btrfs/inode.c     |  5 +++--
 fs/btrfs/root-tree.c |  2 +-
 5 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h
index a3cca35642e2..cffd3aa51e93 100644
--- a/fs/btrfs/ctree.h
+++ b/fs/btrfs/ctree.h
@@ -1216,11 +1216,6 @@ struct btrfs_root {
 	 * protected by inode_lock
 	 */
 	struct radix_tree_root delayed_nodes_tree;
-	/*
-	 * right now this just gets used so that a root has its own devid
-	 * for stat.  It may be used for more later
-	 */
-	dev_t anon_dev;
 
 	spinlock_t root_item_lock;
 	refcount_t refs;
@@ -1262,6 +1257,8 @@ struct btrfs_root {
 
 	/* For qgroup metadata space reserve */
 	atomic64_t qgroup_meta_rsv;
+
+	struct fs_view view; /* fill in and link to inodes for vfs usage */
 };
 
 struct btrfs_file_private {
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
index 334234da997c..c50af14b5856 100644
--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -1191,7 +1191,8 @@ static void __setup_root(struct btrfs_root *root, struct btrfs_fs_info *fs_info,
 	else
 		root->defrag_trans_start = 0;
 	root->root_key.objectid = objectid;
-	root->anon_dev = 0;
+	memset(&root->view, 0, sizeof(struct fs_view));
+	root->view.v_sb = fs_info->sb;
 
 	spin_lock_init(&root->root_item_lock);
 }
@@ -1463,7 +1464,7 @@ struct btrfs_root *btrfs_read_fs_root(struct btrfs_root *tree_root,
 	return root;
 }
 
-int btrfs_init_fs_root(struct btrfs_root *root)
+int btrfs_init_fs_root(struct btrfs_root *root, struct super_block *sb)
 {
 	int ret;
 	struct btrfs_subvolume_writers *writers;
@@ -1487,7 +1488,8 @@ int btrfs_init_fs_root(struct btrfs_root *root)
 	spin_lock_init(&root->ino_cache_lock);
 	init_waitqueue_head(&root->ino_cache_wait);
 
-	ret = get_anon_bdev(&root->anon_dev);
+	root->view.v_sb = sb;
+	ret = get_anon_bdev(&root->view.v_dev);
 	if (ret)
 		goto fail;
 
@@ -1587,7 +1589,7 @@ struct btrfs_root *btrfs_get_fs_root(struct btrfs_fs_info *fs_info,
 		goto fail;
 	}
 
-	ret = btrfs_init_fs_root(root);
+	ret = btrfs_init_fs_root(root, fs_info->sb);
 	if (ret)
 		goto fail;
 
@@ -3603,8 +3605,8 @@ static void free_fs_root(struct btrfs_root *root)
 	WARN_ON(!RB_EMPTY_ROOT(&root->inode_tree));
 	btrfs_free_block_rsv(root->fs_info, root->orphan_block_rsv);
 	root->orphan_block_rsv = NULL;
-	if (root->anon_dev)
-		free_anon_bdev(root->anon_dev);
+	if (root->view.v_dev)
+		free_anon_bdev(root->view.v_dev);
 	if (root->subv_writers)
 		btrfs_free_subvolume_writers(root->subv_writers);
 	free_extent_buffer(root->node);
diff --git a/fs/btrfs/disk-io.h b/fs/btrfs/disk-io.h
index 301151a50ac1..af60e7d76449 100644
--- a/fs/btrfs/disk-io.h
+++ b/fs/btrfs/disk-io.h
@@ -72,7 +72,7 @@ int btrfs_read_dev_one_super(struct block_device *bdev, int copy_num,
 int btrfs_commit_super(struct btrfs_fs_info *fs_info);
 struct btrfs_root *btrfs_read_fs_root(struct btrfs_root *tree_root,
 				      struct btrfs_key *location);
-int btrfs_init_fs_root(struct btrfs_root *root);
+int btrfs_init_fs_root(struct btrfs_root *root, struct super_block *sb);
 struct btrfs_root *btrfs_lookup_fs_root(struct btrfs_fs_info *fs_info,
 					u64 root_id);
 int btrfs_insert_fs_root(struct btrfs_fs_info *fs_info,
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 1d4a28a4763a..17e93fb6d871 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -5705,6 +5705,7 @@ static int btrfs_init_locked_inode(struct inode *inode, void *p)
 	memcpy(&BTRFS_I(inode)->location, args->location,
 	       sizeof(*args->location));
 	BTRFS_I(inode)->root = args->root;
+	inode->i_view = &args->root->view;
 	return 0;
 }
 
@@ -6346,6 +6347,7 @@ static struct inode *btrfs_new_inode(struct btrfs_trans_handle *trans,
 	BTRFS_I(inode)->root = root;
 	BTRFS_I(inode)->generation = trans->transid;
 	inode->i_generation = BTRFS_I(inode)->generation;
+	inode->i_view = &root->view;
 
 	/*
 	 * We could have gotten an inode number from somebody who was fsynced
@@ -9528,8 +9530,7 @@ static int btrfs_getattr(const struct path *path, struct kstat *stat,
 				  STATX_ATTR_NODUMP);
 
 	generic_fillattr(inode, stat);
-	stat->dev = BTRFS_I(inode)->root->anon_dev;
-
+	stat->dev = inode->i_view->v_dev;
 	spin_lock(&BTRFS_I(inode)->lock);
 	delalloc_bytes = BTRFS_I(inode)->new_delalloc_bytes;
 	spin_unlock(&BTRFS_I(inode)->lock);
diff --git a/fs/btrfs/root-tree.c b/fs/btrfs/root-tree.c
index aab0194efe46..1e6f820c0974 100644
--- a/fs/btrfs/root-tree.c
+++ b/fs/btrfs/root-tree.c
@@ -308,7 +308,7 @@ int btrfs_find_orphan_roots(struct btrfs_fs_info *fs_info)
 			continue;
 		}
 
-		err = btrfs_init_fs_root(root);
+		err = btrfs_init_fs_root(root, fs_info->sb);
 		if (err) {
 			btrfs_free_fs_root(root);
 			break;
-- 
2.15.1

^ permalink raw reply related	[flat|nested] 88+ messages in thread

* Re: [RFC][PATCH 0/76] vfs: 'views' for filesystems with more than one root
  2018-05-08 18:03 [RFC][PATCH 0/76] vfs: 'views' for filesystems with more than one root Mark Fasheh
                   ` (75 preceding siblings ...)
  2018-05-08 18:04 ` [PATCH 76/76] btrfs: Use fs_view in roots, point inodes to it Mark Fasheh
@ 2018-05-08 23:38 ` Dave Chinner
  2018-05-09  2:06   ` Jeff Mahoney
  76 siblings, 1 reply; 88+ messages in thread
From: Dave Chinner @ 2018-05-08 23:38 UTC (permalink / raw)
  To: Mark Fasheh; +Cc: linux-fsdevel, linux-kernel, linux-btrfs

On Tue, May 08, 2018 at 11:03:20AM -0700, Mark Fasheh wrote:
> Hi,
> 
> The VFS's super_block covers a variety of filesystem functionality. In
> particular we have a single structure representing both I/O and
> namespace domains.
> 
> There are requirements to de-couple this functionality. For example,
> filesystems with more than one root (such as btrfs subvolumes) can
> have multiple inode namespaces. This starts to confuse userspace when
> it notices multiple inodes with the same inode/device tuple on a
> filesystem.

Devil's Advocate - I'm not looking at the code, I'm commenting on
architectural issues I see here.

The XFS subvolume work I've been doing explicitly uses a superblock
per subvolume. That's because subvolumes are designed to be
completely independent of the backing storage - they know nothing
about the underlying storage except to share a BDI for writeback
purposes and write to whatever block device the remapping layer
gives them at IO time.  Hence XFS subvolumes have (at this point)
their own unique s_dev, on-disk format configuration, journal, space
accounting, etc. i.e. They are fully independent filesystems in
their own right, and as such we do not have multiple inode
namespaces per superblock.

So this doesn't sound like a "subvolume problem" - it's a "how do we
sanely support multiple independent namespaces per superblock"
problem. AFAICT, this same problem exists with bind mounts and mount
namespaces - they are effectively multiple roots on a single
superblock, but it's done at the vfsmount level and so the
superblock knows nothing about them.

So this kinda feel like there's still a impedence mismatch between
btrfs subvolumes being mounted as subtrees on the underlying root
vfsmount rather than being created as truly independent vfs
namespaces that share a superblock. To put that as a question: why
aren't btrfs subvolumes vfsmounts in their own right, and the unique
information subvolume information get stored in (or obtained from)
the vfsmount?

> In addition, it's currently impossible for a filesystem subvolume to
> have a different security context from it's parent. If we could allow
> for subvolumes to optionally specify their own security context, we
> could use them as containers directly instead of having to go through
> an overlay.

Again, XFS subvolumes don't have this problem. So really we need to
frame this discussion in terms of supporting multiple namespaces
within a superblock sanely, not subvolumes.

> I ran into this particular problem with respect to Btrfs some years
> ago and sent out a very naive set of patches which were (rightfully)
> not incorporated:
> 
> https://marc.info/?l=linux-btrfs&m=130074451403261&w=2
> https://marc.info/?l=linux-btrfs&m=130532890824992&w=2
> 
> During the discussion, one question did come up - why can't
> filesystems like Btrfs use a superblock per subvolume? There's a
> couple of problems with that:
> 
> - It's common for a single Btrfs filesystem to have thousands of
>   subvolumes. So keeping a superblock for each subvol in memory would
>   get prohibively expensive - imagine having 8000 copies of struct
>   super_block for a file system just because we wanted some separation
>   of say, s_dev.

That's no different to using individual overlay mounts for the
thousands of containers that are on the system. This doesn't seem to
be a major problem...

> - Writeback would also have to walk all of these superblocks -
>   again not very good for system performance.

Background writeback is backing device focussed, not superblock
focussed. It will only iterate the superblocks that have dirty
inodes on the bdi writeback lists, not all the superblocks on the
bdi. IOWs, this isn't a major problem except for sync() operations
that iterate superblocks.....

> - Anyone wanting to lock down I/O on a filesystem would have to
> freeze all the superblocks. This goes for most things related to
> I/O really - we simply can't afford to have the kernel walking
> thousands of superblocks to sync a single fs.

Not with XFS subvolumes. Freezing the underlying parent filesystem
will effectively stop all IO from the mounted subvolumes by freezing
remapping calls before IO. Sure, those subvolumes aren't in a
consistent state, but we don't freeze userspace so none of the
application data is ever in a consistent state when filesystems are
frozen.

So, again, I'm not sure there's /subvolume/ problem here. There's
definitely a "freeze heirarchy" problem, but that already exists and
it's something we talked about at LSFMM because we need to solve it
for reliable hibernation.

> It's far more efficient then to pull those fields we need for a
> subvolume namespace into their own structure.

I'm not convinced yet - it still feels like it's the wrong layer to
be solving the multiple namespace per superblock problem....

Cheers,

Dave.
-- 
Dave Chinner
david@fromorbit.com

^ permalink raw reply	[flat|nested] 88+ messages in thread

* Re: [RFC][PATCH 0/76] vfs: 'views' for filesystems with more than one root
  2018-05-08 23:38 ` [RFC][PATCH 0/76] vfs: 'views' for filesystems with more than one root Dave Chinner
@ 2018-05-09  2:06   ` Jeff Mahoney
  2018-05-09  6:41     ` Dave Chinner
  0 siblings, 1 reply; 88+ messages in thread
From: Jeff Mahoney @ 2018-05-09  2:06 UTC (permalink / raw)
  To: Dave Chinner, Mark Fasheh; +Cc: linux-fsdevel, linux-kernel, linux-btrfs


[-- Attachment #1.1: Type: text/plain, Size: 8661 bytes --]

On 5/8/18 7:38 PM, Dave Chinner wrote:
> On Tue, May 08, 2018 at 11:03:20AM -0700, Mark Fasheh wrote:
>> Hi,
>>
>> The VFS's super_block covers a variety of filesystem functionality. In
>> particular we have a single structure representing both I/O and
>> namespace domains.
>>
>> There are requirements to de-couple this functionality. For example,
>> filesystems with more than one root (such as btrfs subvolumes) can
>> have multiple inode namespaces. This starts to confuse userspace when
>> it notices multiple inodes with the same inode/device tuple on a
>> filesystem.
> 
> Devil's Advocate - I'm not looking at the code, I'm commenting on
> architectural issues I see here.
> 
> The XFS subvolume work I've been doing explicitly uses a superblock
> per subvolume. That's because subvolumes are designed to be
> completely independent of the backing storage - they know nothing
> about the underlying storage except to share a BDI for writeback
> purposes and write to whatever block device the remapping layer
> gives them at IO time.  Hence XFS subvolumes have (at this point)
> their own unique s_dev, on-disk format configuration, journal, space
> accounting, etc. i.e. They are fully independent filesystems in
> their own right, and as such we do not have multiple inode
> namespaces per superblock.

That's a fundamental difference between how your XFS subvolumes work and
how btrfs subvolumes do.  There is no independence among btrfs
subvolumes.  When a snapshot is created, it has a few new blocks but
otherwise shares the metadata of the source subvolume.  The metadata
trees are shared across all of the subvolumes and there are several
internal trees used to manage all of it.  It's a single storage pool and
a single transaction engine.  There are housekeeping and maintenance
tasks that operate across the entire file system internally.  I
understand that there are several problems you need to solve at the VFS
layer to get your version of subvolumes up and running, but trying to
shoehorn one into the other is bound to fail.

> So this doesn't sound like a "subvolume problem" - it's a "how do we
> sanely support multiple independent namespaces per superblock"
> problem. AFAICT, this same problem exists with bind mounts and mount
> namespaces - they are effectively multiple roots on a single
> superblock, but it's done at the vfsmount level and so the
> superblock knows nothing about them.

In this case, you're talking about the user-visible file system
hierarchy namespace that has no bearing on the underlying file system
outside of per-mount flags.  It makes sense for that to be above the
superblock because the file system doesn't care about them.  We're
interested in the inode namespace, which for every other file system can
be described using an inode and a superblock pair, but btrfs has another
layer in the middle: inode -> btrfs_root -> superblock.  The lifetime
rules for e.g. the s_dev follow that middle layer and a vfsmount can
disappear well before the inode does.

> So this kinda feel like there's still a impedence mismatch between
> btrfs subvolumes being mounted as subtrees on the underlying root
> vfsmount rather than being created as truly independent vfs
> namespaces that share a superblock. To put that as a question: why
> aren't btrfs subvolumes vfsmounts in their own right, and the unique
> information subvolume information get stored in (or obtained from)
> the vfsmount?

Those are two separate problems.   Using a vfsmount to export the
btrfs_root is on my roadmap.  I have a WIP patch set that automounts the
subvolumes when stepping into a new one, but it's to fix a longstanding
UX wart.  Ultimately, vfsmounts are at the wrong level to solve the
inode namespace problem.  Again, there's the lifetime issue.  There are
also many places where we only have an inode and need the s_dev
associated with it.  Most of these sites are well removed from having
access to a vfsmount and pinning one and passing it around carries no
other benefit.

>> In addition, it's currently impossible for a filesystem subvolume to
>> have a different security context from it's parent. If we could allow
>> for subvolumes to optionally specify their own security context, we
>> could use them as containers directly instead of having to go through
>> an overlay.
> 
> Again, XFS subvolumes don't have this problem. So really we need to
> frame this discussion in terms of supporting multiple namespaces
> within a superblock sanely, not subvolumes.
> 
>> I ran into this particular problem with respect to Btrfs some years
>> ago and sent out a very naive set of patches which were (rightfully)
>> not incorporated:
>>
>> https://marc.info/?l=linux-btrfs&m=130074451403261&w=2
>> https://marc.info/?l=linux-btrfs&m=130532890824992&w=2
>>
>> During the discussion, one question did come up - why can't
>> filesystems like Btrfs use a superblock per subvolume? There's a
>> couple of problems with that:
>>
>> - It's common for a single Btrfs filesystem to have thousands of
>>   subvolumes. So keeping a superblock for each subvol in memory would
>>   get prohibively expensive - imagine having 8000 copies of struct
>>   super_block for a file system just because we wanted some separation
>>   of say, s_dev.
> 
> That's no different to using individual overlay mounts for the
> thousands of containers that are on the system. This doesn't seem to
> be a major problem...

Overlay mounts are indepedent of one another and don't need coordination
among them.  The memory usage is relatively unimportant.  The important
part is having a bunch of superblocks that all correspond to the same
resources and coordinating them at the VFS level.  Your assumptions
below follow how your XFS subvolumes work, where there's a clear
hierarchy between the subvolumes and the master filesystem with a
mapping layer between them.  Btrfs subvolumes have no such hierarchy.
Everything is shared.  So while we could use a writeback hierarchy to
merge all of the inode lists before doing writeback on the 'master'
superblock, we'd gain nothing by it.  Handling anything involving
s_umount with a superblock per subvolume would be a nightmare.
Ultimately, it would be a ton of effort that amounts to working around
the VFS instead of with it.

>> - Writeback would also have to walk all of these superblocks -
>>   again not very good for system performance.
> 
> Background writeback is backing device focussed, not superblock
> focussed. It will only iterate the superblocks that have dirty
> inodes on the bdi writeback lists, not all the superblocks on the
> bdi. IOWs, this isn't a major problem except for sync() operations
> that iterate superblocks.....
> 
>> - Anyone wanting to lock down I/O on a filesystem would have to
>> freeze all the superblocks. This goes for most things related to
>> I/O really - we simply can't afford to have the kernel walking
>> thousands of superblocks to sync a single fs.
> 
> Not with XFS subvolumes. Freezing the underlying parent filesystem
> will effectively stop all IO from the mounted subvolumes by freezing
> remapping calls before IO. Sure, those subvolumes aren't in a
> consistent state, but we don't freeze userspace so none of the
> application data is ever in a consistent state when filesystems are
> frozen.
> 
> So, again, I'm not sure there's /subvolume/ problem here. There's
> definitely a "freeze heirarchy" problem, but that already exists and
> it's something we talked about at LSFMM because we need to solve it
> for reliable hibernation.

There's only a freeze hierarchy problem if we have to use multiple
superblocks.  Otherwise, we freeze the whole thing or we don't.  Trying
to freeze a single subvolume would be an illusion for the user since the
underlying file system would still be active underneath it.  Under the
hood, things like relocation don't even look at what subvolume owns a
particular extent until it must.  So it could be coordinating thousands
of superblocks to do what a single lock does now and for what benefit?

>> It's far more efficient then to pull those fields we need for a
>> subvolume namespace into their own structure.
>
> I'm not convinced yet - it still feels like it's the wrong layer to
> be solving the multiple namespace per superblock problem....

It needs to be between the inode and the superblock.  If there are
multiple user-visible namespaces, each will still get the same
underlying file system namespace.

-Jeff

-- 
Jeff Mahoney
SUSE Labs


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 88+ messages in thread

* Re: [RFC][PATCH 0/76] vfs: 'views' for filesystems with more than one root
  2018-05-09  2:06   ` Jeff Mahoney
@ 2018-05-09  6:41     ` Dave Chinner
  2018-06-05 20:17       ` Jeff Mahoney
  0 siblings, 1 reply; 88+ messages in thread
From: Dave Chinner @ 2018-05-09  6:41 UTC (permalink / raw)
  To: Jeff Mahoney; +Cc: Mark Fasheh, linux-fsdevel, linux-kernel, linux-btrfs

On Tue, May 08, 2018 at 10:06:44PM -0400, Jeff Mahoney wrote:
> On 5/8/18 7:38 PM, Dave Chinner wrote:
> > On Tue, May 08, 2018 at 11:03:20AM -0700, Mark Fasheh wrote:
> >> Hi,
> >>
> >> The VFS's super_block covers a variety of filesystem functionality. In
> >> particular we have a single structure representing both I/O and
> >> namespace domains.
> >>
> >> There are requirements to de-couple this functionality. For example,
> >> filesystems with more than one root (such as btrfs subvolumes) can
> >> have multiple inode namespaces. This starts to confuse userspace when
> >> it notices multiple inodes with the same inode/device tuple on a
> >> filesystem.
> > 
> > Devil's Advocate - I'm not looking at the code, I'm commenting on
> > architectural issues I see here.
> > 
> > The XFS subvolume work I've been doing explicitly uses a superblock
> > per subvolume. That's because subvolumes are designed to be
> > completely independent of the backing storage - they know nothing
> > about the underlying storage except to share a BDI for writeback
> > purposes and write to whatever block device the remapping layer
> > gives them at IO time.  Hence XFS subvolumes have (at this point)
> > their own unique s_dev, on-disk format configuration, journal, space
> > accounting, etc. i.e. They are fully independent filesystems in
> > their own right, and as such we do not have multiple inode
> > namespaces per superblock.
> 
> That's a fundamental difference between how your XFS subvolumes work and
> how btrfs subvolumes do.

Yup, you've just proved my point: this is not a "subvolume problem";
but rather a "multiple namespace per root" problem.

> There is no independence among btrfs
> subvolumes.  When a snapshot is created, it has a few new blocks but
> otherwise shares the metadata of the source subvolume.  The metadata
> trees are shared across all of the subvolumes and there are several
> internal trees used to manage all of it.

I don't need btrfs 101 stuff explained to me. :/

> a single transaction engine.  There are housekeeping and maintenance
> tasks that operate across the entire file system internally.  I
> understand that there are several problems you need to solve at the VFS
> layer to get your version of subvolumes up and running, but trying to
> shoehorn one into the other is bound to fail.

Actually, the VFS has provided everything I need for XFS subvolumes
so far without requiring any sort of modifications. That's the
perspective I'm approaching this from - if the VFS can do what we
need for XFS subvolumes, as well as overlay (which are effectively
VFS-based COW subvolumes), then lets see if we can make that work
for btrfs too.

> > So this doesn't sound like a "subvolume problem" - it's a "how do we
> > sanely support multiple independent namespaces per superblock"
> > problem. AFAICT, this same problem exists with bind mounts and mount
> > namespaces - they are effectively multiple roots on a single
> > superblock, but it's done at the vfsmount level and so the
> > superblock knows nothing about them.
> 
> In this case, you're talking about the user-visible file system
> hierarchy namespace that has no bearing on the underlying file system
> outside of per-mount flags.

Except that it tracks and provides infrastructure that allows user
visible  "multiple namespace per root" constructs. Subvolumes - as a
user visible namespace construct - are little different to bind
mounts in behaviour and functionality. 

How the underlying filesystem implements subvolumes is really up to
the filesystem, but we should be trying to implement a clean model
for "multiple namespaces on a single root" at the VFS so we have
consistent behaviour across all filesystems that implement similar
functionality.

FWIW, bind mounts and overlay also have similar inode number
namespace problems to what Mark describes for btrfs subvolumes.
e.g. overlay recently introduce the "xino" mount option to separate
the user presented inode number namespace for overlay inode from the
underlying parent filesystem inodes. How is that different to btrfs
subvolumes needing to present different inode number namespaces from
the underlying parent?

This sort of "namespace shifting" is needed for several different
pieces of information the kernel reports to userspace. The VFS
replacement for shiftfs is an example of this. So is inode number
remapping. I'm sure there's more.

My point is that if we are talking about infrastructure to remap
what userspace sees from different mountpoint views into a
filesystem, then it should be done above the filesystem layers in
the VFS so all filesystems behave the same way. And in this case,
the vfsmount maps exactly to the "fs_view" that Mark has proposed we
add to the superblock.....

> It makes sense for that to be above the
> superblock because the file system doesn't care about them.  We're
> interested in the inode namespace, which for every other file system can
> be described using an inode and a superblock pair, but btrfs has another
> layer in the middle: inode -> btrfs_root -> superblock. 

Which seems to me to be irrelevant if there's a vfsmount per
subvolume that can hold per-subvolume information.

> > So this kinda feel like there's still a impedence mismatch between
> > btrfs subvolumes being mounted as subtrees on the underlying root
> > vfsmount rather than being created as truly independent vfs
> > namespaces that share a superblock. To put that as a question: why
> > aren't btrfs subvolumes vfsmounts in their own right, and the unique
> > information subvolume information get stored in (or obtained from)
> > the vfsmount?
> 
> Those are two separate problems.   Using a vfsmount to export the
> btrfs_root is on my roadmap.  I have a WIP patch set that automounts the
> subvolumes when stepping into a new one, but it's to fix a longstanding
> UX wart.

IMO that's more than a UX wart - th elack of vfsmounts for internal
subvolume mount point traversals could be considered the root cause
of the issues we are discussing here. Extending the mounted
namespace should trigger vfs mounts, not be hidden deep inside the
filesystem. Hence I'd suggest this needs changing before anything
else....

> >> During the discussion, one question did come up - why can't
> >> filesystems like Btrfs use a superblock per subvolume? There's a
> >> couple of problems with that:
> >>
> >> - It's common for a single Btrfs filesystem to have thousands of
> >>   subvolumes. So keeping a superblock for each subvol in memory would
> >>   get prohibively expensive - imagine having 8000 copies of struct
> >>   super_block for a file system just because we wanted some separation
> >>   of say, s_dev.
> > 
> > That's no different to using individual overlay mounts for the
> > thousands of containers that are on the system. This doesn't seem to
> > be a major problem...
> 
> Overlay mounts are indepedent of one another and don't need coordination
> among them.  The memory usage is relatively unimportant.  The important
> part is having a bunch of superblocks that all correspond to the same
> resources and coordinating them at the VFS level.  Your assumptions
> below follow how your XFS subvolumes work, where there's a clear
> hierarchy between the subvolumes and the master filesystem with a
> mapping layer between them.  Btrfs subvolumes have no such hierarchy.
> Everything is shared. 

Yup, that's the impedence mismatch between the VFS infrastructure
and btrfs that I was talking about. What I'm trying to communicate
is that I think the proposal is attacking the impedence mismatch
from the wrong direction.

i.e. The proposal is to modify btrfs code to propagate stuff that
btrfs needs to know to deal with it's internal "everything is
shared" problems up into the VFS where it's probably not useful to
anything other than btrfs. We already have the necessary construct
in the VFS - I think we should be trying to use the information held
by the generic VFS infrastructure to solve the solve the specific
btrfs issue at hand....

> So while we could use a writeback hierarchy to
> merge all of the inode lists before doing writeback on the 'master'
> superblock, we'd gain nothing by it.  Handling anything involving
> s_umount with a superblock per subvolume would be a nightmare.
> Ultimately, it would be a ton of effort that amounts to working around
> the VFS instead of with it.

I'm not suggesting that btrfs needs to use a superblock per
subvolume. Please don't confuse my statements along the lines of
"this doesn't seem to be a problem for others" with "you must change
btrfs to do this". I'm just saying that the problems arising from
using a superblock per subvolume are not as dire as is being
implied.

Cheers,

Dave.
-- 
Dave Chinner
david@fromorbit.com

^ permalink raw reply	[flat|nested] 88+ messages in thread

* Re: [PATCH 32/76] fs/f2fs: Use inode_sb() helper instead of inode->i_sb
  2018-05-08 18:03 ` [PATCH 32/76] fs/f2fs: " Mark Fasheh
@ 2018-05-10 10:10   ` Chao Yu
  0 siblings, 0 replies; 88+ messages in thread
From: Chao Yu @ 2018-05-10 10:10 UTC (permalink / raw)
  To: Mark Fasheh, linux-fsdevel; +Cc: linux-kernel, linux-btrfs

On 2018/5/9 2:03, Mark Fasheh wrote:
> Signed-off-by: Mark Fasheh <mfasheh@suse.de>

Reviewed-by: Chao Yu <yuchao0@huawei.com>

Thanks,

^ permalink raw reply	[flat|nested] 88+ messages in thread

* [RFC][PATCH 0/76] vfs: 'views' for filesystems with more than one root
  2018-05-09  6:41     ` Dave Chinner
@ 2018-06-05 20:17       ` Jeff Mahoney
  2018-06-06  9:49         ` Amir Goldstein
  0 siblings, 1 reply; 88+ messages in thread
From: Jeff Mahoney @ 2018-06-05 20:17 UTC (permalink / raw)
  To: Dave Chinner; +Cc: Mark Fasheh, linux-fsdevel, linux-kernel, linux-btrfs


[-- Attachment #1.1: Type: text/plain, Size: 14291 bytes --]

Sorry, just getting back to this.

On 5/9/18 2:41 AM, Dave Chinner wrote:
> On Tue, May 08, 2018 at 10:06:44PM -0400, Jeff Mahoney wrote:
>> On 5/8/18 7:38 PM, Dave Chinner wrote:
>>> On Tue, May 08, 2018 at 11:03:20AM -0700, Mark Fasheh wrote:
>>>> Hi,
>>>>
>>>> The VFS's super_block covers a variety of filesystem functionality. In
>>>> particular we have a single structure representing both I/O and
>>>> namespace domains.
>>>>
>>>> There are requirements to de-couple this functionality. For example,
>>>> filesystems with more than one root (such as btrfs subvolumes) can
>>>> have multiple inode namespaces. This starts to confuse userspace when
>>>> it notices multiple inodes with the same inode/device tuple on a
>>>> filesystem.
>>>
>>> Devil's Advocate - I'm not looking at the code, I'm commenting on
>>> architectural issues I see here.
>>>
>>> The XFS subvolume work I've been doing explicitly uses a superblock
>>> per subvolume. That's because subvolumes are designed to be
>>> completely independent of the backing storage - they know nothing
>>> about the underlying storage except to share a BDI for writeback
>>> purposes and write to whatever block device the remapping layer
>>> gives them at IO time.  Hence XFS subvolumes have (at this point)
>>> their own unique s_dev, on-disk format configuration, journal, space
>>> accounting, etc. i.e. They are fully independent filesystems in
>>> their own right, and as such we do not have multiple inode
>>> namespaces per superblock.
>>
>> That's a fundamental difference between how your XFS subvolumes work and
>> how btrfs subvolumes do.
> 
> Yup, you've just proved my point: this is not a "subvolume problem";
> but rather a "multiple namespace per root" problem.

Mark framed it as a namespace issue initially.  The btrfs subvolume
problem is the biggest one we're concerned with.  More below.

>> There is no independence among btrfs
>> subvolumes.  When a snapshot is created, it has a few new blocks but
>> otherwise shares the metadata of the source subvolume.  The metadata
>> trees are shared across all of the subvolumes and there are several
>> internal trees used to manage all of it.
> 
> I don't need btrfs 101 stuff explained to me. :/

No offense meant.  This was crossposted to a few lists.

>> a single transaction engine.  There are housekeeping and maintenance
>> tasks that operate across the entire file system internally.  I
>> understand that there are several problems you need to solve at the VFS
>> layer to get your version of subvolumes up and running, but trying to
>> shoehorn one into the other is bound to fail.
> 
> Actually, the VFS has provided everything I need for XFS subvolumes
> so far without requiring any sort of modifications. That's the
> perspective I'm approaching this from - if the VFS can do what we
> need for XFS subvolumes, as well as overlay (which are effectively
> VFS-based COW subvolumes), then lets see if we can make that work
> for btrfs too.

I'm glad that the VFS provides what you need for XFS subvolumes, but
you're effectively creating independent file systems using a backend
storage remapping technique.  That's pretty much exactly what the VFS is
already designed to do.  Overlayfs is definitely not just VFS-based CoW
subvolumes.  I ended up having to wade more deeply into overlayfs than I
would've liked to respond to your email.  I'd say it's better described
as Overlayfs can abuse what the VFS offers just enough to work well in
common cases.  It has a similar disconnect between the superblock and
inode to btrfs except that it's not as easily resolved since the dentry
belongs to overlayfs and the inode belongs to the underlying file
system. There are still places getting this wrong in the kernel.  In
order to reliably present the right inode/dev pair for overlayfs, we
need the dentry to go with it.  We don't always have it and, even if we
did, we'd need both the dentry and inode.

At any rate, anything with a ->getattr that modifies dev or ino so that
it's different from inode->i_sb->s_dev or inode->i_ino will misbehave
somehow.  The question is just how badly, which depends on the context.
It could be something simple like /proc/pid/maps not showing the right
device/ino pair.  Many file systems that use 64-bit inode numbers
already remap them on 32-bit systems, which can already cause collisions
(even inside the kernel) when comparisons are made.  There's no excuse
to not use 64-bit inode numbers everywhere inside the kernel now,
especially since we have the capability to export them as 64-bit inode
numbers on 32-bit systems now via statx.

One thing is clear: If we want to solve the btrfs and overlayfs problems
in the same way, the view approach with a simple static mapping doesn't
work.  Sticking something between the inode and superblock doesn't get
the job done when the belongs to a different file system.  Overlayfs
needs a per-object remapper, which means a callback that takes a path.
Suddenly the way we do things in the SUSE kernel doesn't seem so hacky
anymore.

I'm not sure we need the same solution for btrfs and overlayfs.  It's
not the same problem.  Every object in overlayfs as a unique mapping
already.  If we report s_dev and i_ino from the inode, it still maps to
a unique user-visible object.  It may not map back to the overlayfs
name, but that's a separate issue that's more difficult to solve.  The
btrfs issue isn't one of presenting an alternative namespace to the
user.  Btrfs has multiple internal namespaces and no way to publish them
to the rest of the kernel.

>>> So this doesn't sound like a "subvolume problem" - it's a "how do we
>>> sanely support multiple independent namespaces per superblock"
>>> problem. AFAICT, this same problem exists with bind mounts and mount
>>> namespaces - they are effectively multiple roots on a single
>>> superblock, but it's done at the vfsmount level and so the
>>> superblock knows nothing about them.
>>
>> In this case, you're talking about the user-visible file system
>> hierarchy namespace that has no bearing on the underlying file system
>> outside of per-mount flags.
> 
> Except that it tracks and provides infrastructure that allows user
> visible  "multiple namespace per root" constructs. Subvolumes - as a
> user visible namespace construct - are little different to bind
> mounts in behaviour and functionality. 
> 
> How the underlying filesystem implements subvolumes is really up to
> the filesystem, but we should be trying to implement a clean model
> for "multiple namespaces on a single root" at the VFS so we have
> consistent behaviour across all filesystems that implement similar
> functionality.
> 
> FWIW, bind mounts and overlay also have similar inode number
> namespace problems to what Mark describes for btrfs subvolumes.
> e.g. overlay recently introduce the "xino" mount option to separate
> the user presented inode number namespace for overlay inode from the
> underlying parent filesystem inodes. How is that different to btrfs
> subvolumes needing to present different inode number namespaces from
> the underlying parent?
> 
> This sort of "namespace shifting" is needed for several different
> pieces of information the kernel reports to userspace. The VFS
> replacement for shiftfs is an example of this. So is inode number
> remapping. I'm sure there's more.

Djalal's work?  That rightfully belongs above the file system layer.
The only bit that's needed within the file system is the part that sets
the super flag to enable it.  The different namespaces have nothing to
do with the file system below it.

> My point is that if we are talking about infrastructure to remap
> what userspace sees from different mountpoint views into a
> filesystem, then it should be done above the filesystem layers in
> the VFS so all filesystems behave the same way. And in this case,
> the vfsmount maps exactly to the "fs_view" that Mark has proposed we
> add to the superblock.....

It's proposed to be above the superblock with a default view in the
superblock.  It would sit between the inode and the superblock so we
have access to it anywhere we already have an inode.  That's the main
difference.  We already have the inode everywhere it's needed.  Plumbing
a vfsmount everywhere needed means changing code that only requires an
inode and doesn't need a vfsmount.

The two biggest problem areas:
- Writeback tracepoints print a dev/inode pair.  Do we want to plumb a
vfsmount into __mark_inode_dirty, super_operations->write_inode,
__writeback_single_inode, writeback_sb_inodes, etc?
- Audit.  As it happens, most of audit has a path or file that can be
used.  We do run into problems with fsnotify.  fsnotify_move is called
from vfs_rename which turns into a can of worms pretty quickly.

>> It makes sense for that to be above the
>> superblock because the file system doesn't care about them.  We're
>> interested in the inode namespace, which for every other file system can
>> be described using an inode and a superblock pair, but btrfs has another
>> layer in the middle: inode -> btrfs_root -> superblock. 
> 
> Which seems to me to be irrelevant if there's a vfsmount per
> subvolume that can hold per-subvolume information.

I disagree.  There are a ton of places where we only have access to an
inode and only need access to an inode.  It also doesn't solve the
overlayfs issue.

>>> So this kinda feel like there's still a impedence mismatch between
>>> btrfs subvolumes being mounted as subtrees on the underlying root
>>> vfsmount rather than being created as truly independent vfs
>>> namespaces that share a superblock. To put that as a question: why
>>> aren't btrfs subvolumes vfsmounts in their own right, and the unique
>>> information subvolume information get stored in (or obtained from)
>>> the vfsmount?
>>
>> Those are two separate problems.   Using a vfsmount to export the
>> btrfs_root is on my roadmap.  I have a WIP patch set that automounts the
>> subvolumes when stepping into a new one, but it's to fix a longstanding
>> UX wart.
> 
> IMO that's more than a UX wart - th elack of vfsmounts for internal
> subvolume mount point traversals could be considered the root cause
> of the issues we are discussing here. Extending the mounted
> namespace should trigger vfs mounts, not be hidden deep inside the
> filesystem. Hence I'd suggest this needs changing before anything
> else....

I disagree.  Yes, it would be nice if btrfs did this, but it doesn't get
us the dev/ino pair to places where we need one, like the depths of audit.

>>>> During the discussion, one question did come up - why can't
>>>> filesystems like Btrfs use a superblock per subvolume? There's a
>>>> couple of problems with that:
>>>>
>>>> - It's common for a single Btrfs filesystem to have thousands of
>>>>   subvolumes. So keeping a superblock for each subvol in memory would
>>>>   get prohibively expensive - imagine having 8000 copies of struct
>>>>   super_block for a file system just because we wanted some separation
>>>>   of say, s_dev.
>>>
>>> That's no different to using individual overlay mounts for the
>>> thousands of containers that are on the system. This doesn't seem to
>>> be a major problem...
>>
>> Overlay mounts are indepedent of one another and don't need coordination
>> among them.  The memory usage is relatively unimportant.  The important
>> part is having a bunch of superblocks that all correspond to the same
>> resources and coordinating them at the VFS level.  Your assumptions
>> below follow how your XFS subvolumes work, where there's a clear
>> hierarchy between the subvolumes and the master filesystem with a
>> mapping layer between them.  Btrfs subvolumes have no such hierarchy.
>> Everything is shared. 
> 
> Yup, that's the impedence mismatch between the VFS infrastructure
> and btrfs that I was talking about. What I'm trying to communicate
> is that I think the proposal is attacking the impedence mismatch
> from the wrong direction.
> 
> i.e. The proposal is to modify btrfs code to propagate stuff that
> btrfs needs to know to deal with it's internal "everything is
> shared" problems up into the VFS where it's probably not useful to
> anything other than btrfs. We already have the necessary construct
> in the VFS - I think we should be trying to use the information held
> by the generic VFS infrastructure to solve the solve the specific
> btrfs issue at hand....

The many namespaces to one I/O domain relationship isn't a
btrfs-internal problem.  It's visible to the user and it's visible
inside the kernel.  The view implementation gives the VFS a generic
mechanism to allow it to represent that.  The plan isn't to only use the
view for that but to also allow separate security contexts for things
like containers.  Those have a similar issue to the inode availability
discussed above.  We have superblocks where we need them.  We could have
a view just as a easily.  Plumbing a vfsmount is the wrong approach.

>> So while we could use a writeback hierarchy to
>> merge all of the inode lists before doing writeback on the 'master'
>> superblock, we'd gain nothing by it.  Handling anything involving
>> s_umount with a superblock per subvolume would be a nightmare.
>> Ultimately, it would be a ton of effort that amounts to working around
>> the VFS instead of with it.
> 
> I'm not suggesting that btrfs needs to use a superblock per
> subvolume. Please don't confuse my statements along the lines of
> "this doesn't seem to be a problem for others" with "you must change
> btrfs to do this". I'm just saying that the problems arising from
> using a superblock per subvolume are not as dire as is being
> implied.

It's possible to solve the btrfs problem this way but it adds a bunch of
complexity for... what benefit, exactly? As I said, it's working around
the VFS instead of working with it.  As Mark initially stated, we handle
I/O and namespace domains.  Btrfs has many namespaces and only one I/O
domain.

-Jeff

-- 
Jeff Mahoney
SUSE Labs




[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 88+ messages in thread

* Re: [RFC][PATCH 0/76] vfs: 'views' for filesystems with more than one root
  2018-06-05 20:17       ` Jeff Mahoney
@ 2018-06-06  9:49         ` Amir Goldstein
  2018-06-06 20:42           ` Mark Fasheh
  2018-06-06 21:19           ` Jeff Mahoney
  0 siblings, 2 replies; 88+ messages in thread
From: Amir Goldstein @ 2018-06-06  9:49 UTC (permalink / raw)
  To: Jeff Mahoney
  Cc: Dave Chinner, Mark Fasheh, linux-fsdevel, linux-kernel,
	Linux Btrfs, Miklos Szeredi, David Howells, Jan Kara

On Tue, Jun 5, 2018 at 11:17 PM, Jeff Mahoney <jeffm@suse.com> wrote:
> Sorry, just getting back to this.
>
> On 5/9/18 2:41 AM, Dave Chinner wrote:
>> On Tue, May 08, 2018 at 10:06:44PM -0400, Jeff Mahoney wrote:
>>> On 5/8/18 7:38 PM, Dave Chinner wrote:
>>>> On Tue, May 08, 2018 at 11:03:20AM -0700, Mark Fasheh wrote:
>>>>> Hi,
>>>>>
>>>>> The VFS's super_block covers a variety of filesystem functionality. In
>>>>> particular we have a single structure representing both I/O and
>>>>> namespace domains.
>>>>>
>>>>> There are requirements to de-couple this functionality. For example,
>>>>> filesystems with more than one root (such as btrfs subvolumes) can
>>>>> have multiple inode namespaces. This starts to confuse userspace when
>>>>> it notices multiple inodes with the same inode/device tuple on a
>>>>> filesystem.
>>>>

Speaking as someone who joined this discussion late, maybe years after
it started, it would help to get an overview of existing problems and how
fs_view aims to solve them.

I do believe that both Overlayfs and Btrfs can benefit from a layer of
abstraction
in the VFS, but I think it is best if we start with laying all the
common problems
and then see how a solution would look like.

Even the name of the abstraction (fs_view) doesn't make it clear to me what
it is we are abstracting (security context? st_dev? what else?). probably best
to try to describe the abstraction from user POV rather then give sporadic
examples of what MAY go into fs_view.

While at it, need to see if this discussion has any intersections with David
Howell's fs_context work, because if we consider adding sub volume support
to VFS, we may want to leave some reserved bits in the API for it.

[...]

> One thing is clear: If we want to solve the btrfs and overlayfs problems
> in the same way, the view approach with a simple static mapping doesn't
> work.  Sticking something between the inode and superblock doesn't get
> the job done when the belongs to a different file system.  Overlayfs
> needs a per-object remapper, which means a callback that takes a path.
> Suddenly the way we do things in the SUSE kernel doesn't seem so hacky
> anymore.
>

And what is the SUSE way?

> I'm not sure we need the same solution for btrfs and overlayfs.  It's
> not the same problem.  Every object in overlayfs as a unique mapping
> already.  If we report s_dev and i_ino from the inode, it still maps to
> a unique user-visible object.  It may not map back to the overlayfs
> name, but that's a separate issue that's more difficult to solve.  The
> btrfs issue isn't one of presenting an alternative namespace to the
> user.  Btrfs has multiple internal namespaces and no way to publish them
> to the rest of the kernel.
>

FYI, the Overlayfs file/inode mapping is about to change with many
VFS hacks queued for removal, so stay tuned.

[...]

>> My point is that if we are talking about infrastructure to remap
>> what userspace sees from different mountpoint views into a
>> filesystem, then it should be done above the filesystem layers in
>> the VFS so all filesystems behave the same way. And in this case,
>> the vfsmount maps exactly to the "fs_view" that Mark has proposed we
>> add to the superblock.....
>
> It's proposed to be above the superblock with a default view in the
> superblock.  It would sit between the inode and the superblock so we
> have access to it anywhere we already have an inode.  That's the main
> difference.  We already have the inode everywhere it's needed.  Plumbing
> a vfsmount everywhere needed means changing code that only requires an
> inode and doesn't need a vfsmount.
>
> The two biggest problem areas:
> - Writeback tracepoints print a dev/inode pair.  Do we want to plumb a
> vfsmount into __mark_inode_dirty, super_operations->write_inode,
> __writeback_single_inode, writeback_sb_inodes, etc?
> - Audit.  As it happens, most of audit has a path or file that can be
> used.  We do run into problems with fsnotify.  fsnotify_move is called
> from vfs_rename which turns into a can of worms pretty quickly.
>

Can you please elaborate on that problem.
Do you mean when watching a directory for changes, you need to
be able to tell in which fs_view the directory inode that is being watched?

>>> It makes sense for that to be above the
>>> superblock because the file system doesn't care about them.  We're
>>> interested in the inode namespace, which for every other file system can
>>> be described using an inode and a superblock pair, but btrfs has another
>>> layer in the middle: inode -> btrfs_root -> superblock.
>>
>> Which seems to me to be irrelevant if there's a vfsmount per
>> subvolume that can hold per-subvolume information.
>
> I disagree.  There are a ton of places where we only have access to an
> inode and only need access to an inode.  It also doesn't solve the
> overlayfs issue.
>

I have an interest of solving another problem.
In VFS operations where only inode is available, I would like to be able to
report fsnotify events (e.g. fsnotify_move()) only in directories under a
certain subtree root. That could be achieved either by bind mount the subtree
root and passing vfsmount into vfs_rename() or by defining an fs_view on the
subtree and mounting that fs_view.

Thanks,
Amir.

^ permalink raw reply	[flat|nested] 88+ messages in thread

* Re: [RFC][PATCH 0/76] vfs: 'views' for filesystems with more than one root
  2018-06-06  9:49         ` Amir Goldstein
@ 2018-06-06 20:42           ` Mark Fasheh
  2018-06-07  6:06             ` Amir Goldstein
  2018-06-06 21:19           ` Jeff Mahoney
  1 sibling, 1 reply; 88+ messages in thread
From: Mark Fasheh @ 2018-06-06 20:42 UTC (permalink / raw)
  To: Amir Goldstein
  Cc: Jeff Mahoney, Dave Chinner, linux-fsdevel, linux-kernel,
	Linux Btrfs, Miklos Szeredi, David Howells, Jan Kara

Hi Amir, thanks for the comments!

On Wed, Jun 06, 2018 at 12:49:48PM +0300, Amir Goldstein wrote:
> On Tue, Jun 5, 2018 at 11:17 PM, Jeff Mahoney <jeffm@suse.com> wrote:
> > Sorry, just getting back to this.
> >
> > On 5/9/18 2:41 AM, Dave Chinner wrote:
> >> On Tue, May 08, 2018 at 10:06:44PM -0400, Jeff Mahoney wrote:
> >>> On 5/8/18 7:38 PM, Dave Chinner wrote:
> >>>> On Tue, May 08, 2018 at 11:03:20AM -0700, Mark Fasheh wrote:
> >>>>> Hi,
> >>>>>
> >>>>> The VFS's super_block covers a variety of filesystem functionality. In
> >>>>> particular we have a single structure representing both I/O and
> >>>>> namespace domains.
> >>>>>
> >>>>> There are requirements to de-couple this functionality. For example,
> >>>>> filesystems with more than one root (such as btrfs subvolumes) can
> >>>>> have multiple inode namespaces. This starts to confuse userspace when
> >>>>> it notices multiple inodes with the same inode/device tuple on a
> >>>>> filesystem.
> >>>>
> 
> Speaking as someone who joined this discussion late, maybe years after
> it started, it would help to get an overview of existing problems and how
> fs_view aims to solve them.
> 
> I do believe that both Overlayfs and Btrfs can benefit from a layer of
> abstraction
> in the VFS, but I think it is best if we start with laying all the
> common problems
> and then see how a solution would look like.
> 
> Even the name of the abstraction (fs_view) doesn't make it clear to me what
> it is we are abstracting (security context? st_dev? what else?). probably best
> to try to describe the abstraction from user POV rather then give sporadic
> examples of what MAY go into fs_view.

The first problem fs_view intended to fix was the s_dev issue, where some
filesystems return a different device from stat(2) than what the rest of the
kernel exports. If you look at the e-mail record I referenced:

https://marc.info/?l=linux-btrfs&m=130074451403261&w=2

you'll see how that can confuse some userspace software when they try to
take the ino/dev pair they get from one portion of the kernel (for example,
/proc/pid/maps) then use it to resolve to an inode on the system.

As it turns out, there's other places where we might want to decouple some
superblock fields, hence why I mention security contexts. I am admittedly
less familiar with that particular problem but as I understand it,
containers on a btrfs subvolume have to go through an overlay to route
around the default security context. With fs_view we could point subvolumes
to their own security contexts.

Btw, sorry that the name is confusing. I've never been good at picking them.
That said, if you have a minute to check out the first patch or two you'll
see that the patches are basically putting a struct in between the super
block and the inode.


One thing I'd like to politely suggest is that anyone now following this
conversation to please read the at least the first patch. It's an easy read
and I feel like the conversation overall would be much more clear if
everyone understood what we're going for. I worry that I didn't do a
particularly good job explaining the actual code changes.

https://www.spinics.net/lists/linux-fsdevel/msg125492.html


Regarding a layout of the problems, I have a more complete e-mail coming
soon which should describe in detail the issues I've seen with respect to
how the kernel is exporting ino/dev pairs (outside of statx). fs_view alone
is not enough to solve that problem. I'd be happy to CC you on that one if
you'd like.


> While at it, need to see if this discussion has any intersections with David
> Howell's fs_context work, because if we consider adding sub volume support
> to VFS, we may want to leave some reserved bits in the API for it.
> 
> [...]
> 
> > One thing is clear: If we want to solve the btrfs and overlayfs problems
> > in the same way, the view approach with a simple static mapping doesn't
> > work.  Sticking something between the inode and superblock doesn't get
> > the job done when the belongs to a different file system.  Overlayfs
> > needs a per-object remapper, which means a callback that takes a path.
> > Suddenly the way we do things in the SUSE kernel doesn't seem so hacky
> > anymore.
> >
> 
> And what is the SUSE way?

At SUSE, we carry a version of this patch:

https://marc.info/?l=linux-btrfs&m=130532890824992&w=2

Essentially a callback which was rejected for various reasons.

The fs_view work was intended to replace that patch with an upstream
solution.

 
> > I'm not sure we need the same solution for btrfs and overlayfs.  It's
> > not the same problem.  Every object in overlayfs as a unique mapping
> > already.  If we report s_dev and i_ino from the inode, it still maps to
> > a unique user-visible object.  It may not map back to the overlayfs
> > name, but that's a separate issue that's more difficult to solve.  The
> > btrfs issue isn't one of presenting an alternative namespace to the
> > user.  Btrfs has multiple internal namespaces and no way to publish them
> > to the rest of the kernel.
> >
> 
> FYI, the Overlayfs file/inode mapping is about to change with many
> VFS hacks queued for removal, so stay tuned.
> 
> [...]

Actually, would you mind giving me a pointer to this work? I'd be very
interested to see what exactly might be changing.


> >> My point is that if we are talking about infrastructure to remap
> >> what userspace sees from different mountpoint views into a
> >> filesystem, then it should be done above the filesystem layers in
> >> the VFS so all filesystems behave the same way. And in this case,
> >> the vfsmount maps exactly to the "fs_view" that Mark has proposed we
> >> add to the superblock.....
> >
> > It's proposed to be above the superblock with a default view in the
> > superblock.  It would sit between the inode and the superblock so we
> > have access to it anywhere we already have an inode.  That's the main
> > difference.  We already have the inode everywhere it's needed.  Plumbing
> > a vfsmount everywhere needed means changing code that only requires an
> > inode and doesn't need a vfsmount.
> >
> > The two biggest problem areas:
> > - Writeback tracepoints print a dev/inode pair.  Do we want to plumb a
> > vfsmount into __mark_inode_dirty, super_operations->write_inode,
> > __writeback_single_inode, writeback_sb_inodes, etc?
> > - Audit.  As it happens, most of audit has a path or file that can be
> > used.  We do run into problems with fsnotify.  fsnotify_move is called
> > from vfs_rename which turns into a can of worms pretty quickly.
> >
> 
> Can you please elaborate on that problem.
> Do you mean when watching a directory for changes, you need to
> be able to tell in which fs_view the directory inode that is being watched?

Here Jeff is responding to Dave's suggestion that we use a vfsmount
instead of the fs_view. You cannot get to a vfsmount from an inode or even
dentry alone, so this implies that we'd be passing a vfsmount down a ton of
code that otherwise doesn't care about it.

fs_view has the advantage that it is accesible from the inode so those
places which ONLY have an inode can easily get to the correct device (the
code changes make this pretty clear).



> >>> It makes sense for that to be above the
> >>> superblock because the file system doesn't care about them.  We're
> >>> interested in the inode namespace, which for every other file system can
> >>> be described using an inode and a superblock pair, but btrfs has another
> >>> layer in the middle: inode -> btrfs_root -> superblock.
> >>
> >> Which seems to me to be irrelevant if there's a vfsmount per
> >> subvolume that can hold per-subvolume information.
> >
> > I disagree.  There are a ton of places where we only have access to an
> > inode and only need access to an inode.  It also doesn't solve the
> > overlayfs issue.
> >
> 
> I have an interest of solving another problem.
> In VFS operations where only inode is available, I would like to be able to
> report fsnotify events (e.g. fsnotify_move()) only in directories under a
> certain subtree root. That could be achieved either by bind mount the subtree
> root and passing vfsmount into vfs_rename() or by defining an fs_view on the
> subtree and mounting that fs_view.

I'm not sure whether fs_view works for this. Taking a quick look at
fsnotify, the state is already on the inode? If there's a globabl fsnotify
state that needs to be per subtree than yes we could move that to the
fs_view and you'd simply deref it from the inode struct.

I hope this helps,
	--Mark

^ permalink raw reply	[flat|nested] 88+ messages in thread

* Re: [RFC][PATCH 0/76] vfs: 'views' for filesystems with more than one root
  2018-06-06  9:49         ` Amir Goldstein
  2018-06-06 20:42           ` Mark Fasheh
@ 2018-06-06 21:19           ` Jeff Mahoney
  2018-06-07  6:17             ` Amir Goldstein
  1 sibling, 1 reply; 88+ messages in thread
From: Jeff Mahoney @ 2018-06-06 21:19 UTC (permalink / raw)
  To: Amir Goldstein
  Cc: Dave Chinner, Mark Fasheh, linux-fsdevel, linux-kernel,
	Linux Btrfs, Miklos Szeredi, David Howells, Jan Kara


[-- Attachment #1.1: Type: text/plain, Size: 7255 bytes --]

Hi Amir -

Mark's answered some of your questions already, so I'll skip those.

On 6/6/18 5:49 AM, Amir Goldstein wrote:
> On Tue, Jun 5, 2018 at 11:17 PM, Jeff Mahoney <jeffm@suse.com> wrote:
>> Sorry, just getting back to this.
>>
>> On 5/9/18 2:41 AM, Dave Chinner wrote:
>>> On Tue, May 08, 2018 at 10:06:44PM -0400, Jeff Mahoney wrote:
>>>> On 5/8/18 7:38 PM, Dave Chinner wrote:
>>>>> On Tue, May 08, 2018 at 11:03:20AM -0700, Mark Fasheh wrote:
>>>>>> Hi,
>>>>>>
>>>>>> The VFS's super_block covers a variety of filesystem functionality. In
>>>>>> particular we have a single structure representing both I/O and
>>>>>> namespace domains.
>>>>>>
>>>>>> There are requirements to de-couple this functionality. For example,
>>>>>> filesystems with more than one root (such as btrfs subvolumes) can
>>>>>> have multiple inode namespaces. This starts to confuse userspace when
>>>>>> it notices multiple inodes with the same inode/device tuple on a
>>>>>> filesystem.
>>>>>
> 
> Speaking as someone who joined this discussion late, maybe years after
> it started, it would help to get an overview of existing problems and how
> fs_view aims to solve them.
> 
> I do believe that both Overlayfs and Btrfs can benefit from a layer of
> abstraction
> in the VFS, but I think it is best if we start with laying all the
> common problems
> and then see how a solution would look like.
> 
> Even the name of the abstraction (fs_view) doesn't make it clear to me what
> it is we are abstracting (security context? st_dev? what else?). probably best
> to try to describe the abstraction from user POV rather then give sporadic
> examples of what MAY go into fs_view.
> 
> While at it, need to see if this discussion has any intersections with David
> Howell's fs_context work, because if we consider adding sub volume support
> to VFS, we may want to leave some reserved bits in the API for it.
> 
> [...]
> 
>> One thing is clear: If we want to solve the btrfs and overlayfs problems
>> in the same way, the view approach with a simple static mapping doesn't
>> work.  Sticking something between the inode and superblock doesn't get
>> the job done when the belongs to a different file system.  Overlayfs
>> needs a per-object remapper, which means a callback that takes a path.
>> Suddenly the way we do things in the SUSE kernel doesn't seem so hacky
>> anymore.
>>
> 
> And what is the SUSE way?
> 
>> I'm not sure we need the same solution for btrfs and overlayfs.  It's
>> not the same problem.  Every object in overlayfs as a unique mapping
>> already.  If we report s_dev and i_ino from the inode, it still maps to
>> a unique user-visible object.  It may not map back to the overlayfs
>> name, but that's a separate issue that's more difficult to solve.  The
>> btrfs issue isn't one of presenting an alternative namespace to the
>> user.  Btrfs has multiple internal namespaces and no way to publish them
>> to the rest of the kernel.
>>
> 
> FYI, the Overlayfs file/inode mapping is about to change with many
> VFS hacks queued for removal, so stay tuned.
> 
> [...]

I have to admit I'm curious how this will work.  I've heard rumor of
using overlayfs inodes and calling the underlying file system's
inode_operations.  If part of that work removes the danger of overlayfs
inode numbers colliding with xino mode, I'm definitely interested.

>>> My point is that if we are talking about infrastructure to remap
>>> what userspace sees from different mountpoint views into a
>>> filesystem, then it should be done above the filesystem layers in
>>> the VFS so all filesystems behave the same way. And in this case,
>>> the vfsmount maps exactly to the "fs_view" that Mark has proposed we
>>> add to the superblock.....
>>
>> It's proposed to be above the superblock with a default view in the
>> superblock.  It would sit between the inode and the superblock so we
>> have access to it anywhere we already have an inode.  That's the main
>> difference.  We already have the inode everywhere it's needed.  Plumbing
>> a vfsmount everywhere needed means changing code that only requires an
>> inode and doesn't need a vfsmount.
>>
>> The two biggest problem areas:
>> - Writeback tracepoints print a dev/inode pair.  Do we want to plumb a
>> vfsmount into __mark_inode_dirty, super_operations->write_inode,
>> __writeback_single_inode, writeback_sb_inodes, etc?
>> - Audit.  As it happens, most of audit has a path or file that can be
>> used.  We do run into problems with fsnotify.  fsnotify_move is called
>> from vfs_rename which turns into a can of worms pretty quickly.
>>
> 
> Can you please elaborate on that problem.
> Do you mean when watching a directory for changes, you need to
> be able to tell in which fs_view the directory inode that is being watched?

I was investigating whether Dave's suggestion of using a vfsmount was
feasible.  When following the audit call graph up, I found
fsnotify_move, called by vfs_rename.  Piping a vfsmount into the vfs_*
operations has historically been rejected by Al (see Apparmor
discussions, among others), and with good reason.  The file system
implementation shouldn't care about where it's mounted.  While piping it
into vfs_rename doesn't seem too invasive, it's called by various file
systems' ->rename callback, so then we're stuck piping vfsmounts into
inode_operations, which is what Al's been wanting to avoid for years.

>>>> It makes sense for that to be above the
>>>> superblock because the file system doesn't care about them.  We're
>>>> interested in the inode namespace, which for every other file system can
>>>> be described using an inode and a superblock pair, but btrfs has another
>>>> layer in the middle: inode -> btrfs_root -> superblock.
>>>
>>> Which seems to me to be irrelevant if there's a vfsmount per
>>> subvolume that can hold per-subvolume information.
>>
>> I disagree.  There are a ton of places where we only have access to an
>> inode and only need access to an inode.  It also doesn't solve the
>> overlayfs issue.
>>
> 
> I have an interest of solving another problem.
> In VFS operations where only inode is available, I would like to be able to
> report fsnotify events (e.g. fsnotify_move()) only in directories under a
> certain subtree root. That could be achieved either by bind mount the subtree
> root and passing vfsmount into vfs_rename() or by defining an fs_view on the
> subtree and mounting that fs_view.

I'm not sure there's a lot of overlap, but I expect that this will end
up running into the same review feedback that Al gave during the
AppArmor merge: vfsmounts have no business at the lower level and you
can get the same behavior by hooking in at a higher level.  See
security_path_* vs security_inode_* for how that was resolved.

What you're talking about isn't really what we had in mind for the
fs_view.  In our case, it sits between the inode and superblock, which
would be at too low a level for determining whether an inode is under a
certain subtree.  In any event, wouldn't you need a path instead of an
inode to do what you're proposing?

-Jeff

-- 
Jeff Mahoney
SUSE Labs


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 88+ messages in thread

* Re: [RFC][PATCH 0/76] vfs: 'views' for filesystems with more than one root
  2018-06-06 20:42           ` Mark Fasheh
@ 2018-06-07  6:06             ` Amir Goldstein
  2018-06-07 20:44               ` Mark Fasheh
  0 siblings, 1 reply; 88+ messages in thread
From: Amir Goldstein @ 2018-06-07  6:06 UTC (permalink / raw)
  To: Mark Fasheh
  Cc: Jeff Mahoney, Dave Chinner, linux-fsdevel, linux-kernel,
	Linux Btrfs, Miklos Szeredi, David Howells, Jan Kara

On Wed, Jun 6, 2018 at 11:42 PM, Mark Fasheh <mfasheh@suse.de> wrote:
> Hi Amir, thanks for the comments!
>

Hi Mark,

[...]
>
> Btw, sorry that the name is confusing. I've never been good at picking them.

Didn't say that it was confusing. It might very well be the perfect name...
if I only knew what sort of thing we are trying to name...

> That said, if you have a minute to check out the first patch or two you'll
> see that the patches are basically putting a struct in between the super
> block and the inode.
>
>
> One thing I'd like to politely suggest is that anyone now following this
> conversation to please read the at least the first patch. It's an easy read
> and I feel like the conversation overall would be much more clear if
> everyone understood what we're going for. I worry that I didn't do a
> particularly good job explaining the actual code changes.
>
> https://www.spinics.net/lists/linux-fsdevel/msg125492.html
>


I did look at the patches. They look simple and clean and they solve A problem.
All I'm saying is that we should look at the set of problems that we know of
before we design an abstraction layer.

>
> Regarding a layout of the problems, I have a more complete e-mail coming
> soon which should describe in detail the issues I've seen with respect to
> how the kernel is exporting ino/dev pairs (outside of statx). fs_view alone
> is not enough to solve that problem. I'd be happy to CC you on that one if
> you'd like.
>

Sure.

[...]

>>
>> And what is the SUSE way?
>
> At SUSE, we carry a version of this patch:
>
> https://marc.info/?l=linux-btrfs&m=130532890824992&w=2
>
> Essentially a callback which was rejected for various reasons.
>

Don't see a patch here. Wrong link?

> The fs_view work was intended to replace that patch with an upstream
> solution.
>
>

[...]

>>
>> FYI, the Overlayfs file/inode mapping is about to change with many
>> VFS hacks queued for removal, so stay tuned.
>>
>> [...]
>
> Actually, would you mind giving me a pointer to this work? I'd be very
> interested to see what exactly might be changing.
>

Mostly, less VFS code is going to be exposed to underlying inode:

https://marc.info/?l=linux-fsdevel&m=152760014530531&w=2

[...]

>> I have an interest of solving another problem.
>> In VFS operations where only inode is available, I would like to be able to
>> report fsnotify events (e.g. fsnotify_move()) only in directories under a
>> certain subtree root. That could be achieved either by bind mount the subtree
>> root and passing vfsmount into vfs_rename() or by defining an fs_view on the
>> subtree and mounting that fs_view.
>
> I'm not sure whether fs_view works for this. Taking a quick look at
> fsnotify, the state is already on the inode? If there's a globabl fsnotify
> state that needs to be per subtree than yes we could move that to the
> fs_view and you'd simply deref it from the inode struct.
>

That was my thinking. I have patches to attach an fsnotify mark
to super block. If fs_view could have a root that is different than
super block's root and if file system can guaranty that objects
cannot be moved outside of fs_view root, then fsnotify mark
could be attached to fs_view.

Thanks,
Amir.

^ permalink raw reply	[flat|nested] 88+ messages in thread

* Re: [RFC][PATCH 0/76] vfs: 'views' for filesystems with more than one root
  2018-06-06 21:19           ` Jeff Mahoney
@ 2018-06-07  6:17             ` Amir Goldstein
  0 siblings, 0 replies; 88+ messages in thread
From: Amir Goldstein @ 2018-06-07  6:17 UTC (permalink / raw)
  To: Jeff Mahoney
  Cc: Dave Chinner, Mark Fasheh, linux-fsdevel, linux-kernel,
	Linux Btrfs, Miklos Szeredi, David Howells, Jan Kara

On Thu, Jun 7, 2018 at 12:19 AM, Jeff Mahoney <jeffm@suse.com> wrote:
[...]
>>
>> FYI, the Overlayfs file/inode mapping is about to change with many
>> VFS hacks queued for removal, so stay tuned.
>>
>> [...]
>
> I have to admit I'm curious how this will work.  I've heard rumor of
> using overlayfs inodes and calling the underlying file system's
> inode_operations.  If part of that work removes the danger of overlayfs
> inode numbers colliding with xino mode, I'm definitely interested.

See https://marc.info/?l=linux-fsdevel&m=152760014530531&w=2

It doesn't remove the need to maintain a unique and persistent inode
number namespace in overlayfs. It just reduces exposure of the underlying
inode to VFS.

[...]

>>> - Audit.  As it happens, most of audit has a path or file that can be
>>> used.  We do run into problems with fsnotify.  fsnotify_move is called
>>> from vfs_rename which turns into a can of worms pretty quickly.
>>>
>>
>> Can you please elaborate on that problem.
>> Do you mean when watching a directory for changes, you need to
>> be able to tell in which fs_view the directory inode that is being watched?
>
> I was investigating whether Dave's suggestion of using a vfsmount was
> feasible.  When following the audit call graph up, I found
> fsnotify_move, called by vfs_rename.  Piping a vfsmount into the vfs_*
> operations has historically been rejected by Al (see Apparmor
> discussions, among others), and with good reason.  The file system
> implementation shouldn't care about where it's mounted.  While piping it
> into vfs_rename doesn't seem too invasive, it's called by various file
> systems' ->rename callback, so then we're stuck piping vfsmounts into
> inode_operations, which is what Al's been wanting to avoid for years.
>

Yes, I've heard about this objection, thought didn't have a reference.

[...]
>>
>> I have an interest of solving another problem.
>> In VFS operations where only inode is available, I would like to be able to
>> report fsnotify events (e.g. fsnotify_move()) only in directories under a
>> certain subtree root. That could be achieved either by bind mount the subtree
>> root and passing vfsmount into vfs_rename() or by defining an fs_view on the
>> subtree and mounting that fs_view.
>
> I'm not sure there's a lot of overlap, but I expect that this will end
> up running into the same review feedback that Al gave during the
> AppArmor merge: vfsmounts have no business at the lower level and you
> can get the same behavior by hooking in at a higher level.  See
> security_path_* vs security_inode_* for how that was resolved.
>
> What you're talking about isn't really what we had in mind for the
> fs_view.  In our case, it sits between the inode and superblock, which
> would be at too low a level for determining whether an inode is under a
> certain subtree.  In any event, wouldn't you need a path instead of an
> inode to do what you're proposing?
>

Not if the fs_view could have a root that is different than sb root
then I could attach fsnotify mark to fs_view instead of say vfsmount
and I have the information I need inside fsnotify_move().

Thanks,
Amir.

^ permalink raw reply	[flat|nested] 88+ messages in thread

* Re: [RFC][PATCH 0/76] vfs: 'views' for filesystems with more than one root
  2018-06-07  6:06             ` Amir Goldstein
@ 2018-06-07 20:44               ` Mark Fasheh
  0 siblings, 0 replies; 88+ messages in thread
From: Mark Fasheh @ 2018-06-07 20:44 UTC (permalink / raw)
  To: Amir Goldstein
  Cc: Jeff Mahoney, Dave Chinner, linux-fsdevel, linux-kernel,
	Linux Btrfs, Miklos Szeredi, David Howells, Jan Kara

On Thu, Jun 07, 2018 at 09:06:04AM +0300, Amir Goldstein wrote:
> On Wed, Jun 6, 2018 at 11:42 PM, Mark Fasheh <mfasheh@suse.de> wrote:
> > Hi Amir, thanks for the comments!
> >
> 
> Hi Mark,
> 
> [...]
> >
> > Btw, sorry that the name is confusing. I've never been good at picking them.
> 
> Didn't say that it was confusing. It might very well be the perfect name...
> if I only knew what sort of thing we are trying to name...

Fair enough :)


> > That said, if you have a minute to check out the first patch or two you'll
> > see that the patches are basically putting a struct in between the super
> > block and the inode.
> >
> >
> > One thing I'd like to politely suggest is that anyone now following this
> > conversation to please read the at least the first patch. It's an easy read
> > and I feel like the conversation overall would be much more clear if
> > everyone understood what we're going for. I worry that I didn't do a
> > particularly good job explaining the actual code changes.
> >
> > https://www.spinics.net/lists/linux-fsdevel/msg125492.html
> >
> 
> 
> I did look at the patches. They look simple and clean and they solve A problem.
> All I'm saying is that we should look at the set of problems that we know of
> before we design an abstraction layer.

Agreed, I think my more recent e-mail does a much better job of laying out
the issues we're seeing here.


> >> And what is the SUSE way?
> >
> > At SUSE, we carry a version of this patch:
> >
> > https://marc.info/?l=linux-btrfs&m=130532890824992&w=2
> >
> > Essentially a callback which was rejected for various reasons.
> >
> 
> Don't see a patch here. Wrong link?

That was the 0/2 mail in the patch series. Here are the next two, which
contain the actual patches:

https://marc.info/?l=linux-btrfs&m=130532892525016&w=2
https://marc.info/?l=linux-btrfs&m=130532899325091&w=2

Keep in mind that the patch has evolved since then though it's essentially
the same idea - use a callback where we need to get the correct device.


> > The fs_view work was intended to replace that patch with an upstream
> > solution.
> >
> >
> 
> [...]
> 
> >>
> >> FYI, the Overlayfs file/inode mapping is about to change with many
> >> VFS hacks queued for removal, so stay tuned.
> >>
> >> [...]
> >
> > Actually, would you mind giving me a pointer to this work? I'd be very
> > interested to see what exactly might be changing.
> >
> 
> Mostly, less VFS code is going to be exposed to underlying inode:
> 
> https://marc.info/?l=linux-fsdevel&m=152760014530531&w=2
> 
> [...]

Awesome, thanks for the link Amir.


> > I'm not sure whether fs_view works for this. Taking a quick look at
> > fsnotify, the state is already on the inode? If there's a globabl fsnotify
> > state that needs to be per subtree than yes we could move that to the
> > fs_view and you'd simply deref it from the inode struct.
> >
> 
> That was my thinking. I have patches to attach an fsnotify mark
> to super block. If fs_view could have a root that is different than
> super block's root and if file system can guaranty that objects
> cannot be moved outside of fs_view root, then fsnotify mark
> could be attached to fs_view.

Ahh yeah so in that case we could have the mark on the fs_view instead of
the superblock and you'd deref it from the inode to get to that inodes root.

Thanks,
	--Mark

^ permalink raw reply	[flat|nested] 88+ messages in thread

end of thread, other threads:[~2018-06-07 20:44 UTC | newest]

Thread overview: 88+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-08 18:03 [RFC][PATCH 0/76] vfs: 'views' for filesystems with more than one root Mark Fasheh
2018-05-08 18:03 ` [PATCH 01/76] vfs: Introduce struct fs_view Mark Fasheh
2018-05-08 18:03 ` [PATCH 02/76] arch: Use inode_sb() helper instead of inode->i_sb Mark Fasheh
2018-05-08 18:03 ` [PATCH 03/76] drivers: " Mark Fasheh
2018-05-08 18:03 ` [PATCH 04/76] fs: " Mark Fasheh
2018-05-08 18:03 ` [PATCH 05/76] include: " Mark Fasheh
2018-05-08 18:03 ` [PATCH 06/76] ipc: " Mark Fasheh
2018-05-08 18:03 ` [PATCH 07/76] kernel: " Mark Fasheh
2018-05-08 18:03 ` [PATCH 08/76] mm: " Mark Fasheh
2018-05-08 18:03 ` [PATCH 09/76] net: " Mark Fasheh
2018-05-08 18:03 ` [PATCH 10/76] security: " Mark Fasheh
2018-05-08 18:03 ` [PATCH 11/76] fs/9p: " Mark Fasheh
2018-05-08 18:03 ` [PATCH 12/76] fs/adfs: " Mark Fasheh
2018-05-08 18:03 ` [PATCH 13/76] fs/affs: " Mark Fasheh
2018-05-08 18:03 ` [PATCH 14/76] fs/afs: " Mark Fasheh
2018-05-08 18:03 ` [PATCH 15/76] fs/autofs4: " Mark Fasheh
2018-05-08 18:03 ` [PATCH 16/76] fs/befs: " Mark Fasheh
2018-05-08 18:03 ` [PATCH 17/76] fs/bfs: " Mark Fasheh
2018-05-08 18:03 ` [PATCH 18/76] fs/btrfs: " Mark Fasheh
2018-05-08 18:03 ` [PATCH 19/76] fs/ceph: " Mark Fasheh
2018-05-08 18:03 ` [PATCH 20/76] fs/cifs: " Mark Fasheh
2018-05-08 18:03 ` [PATCH 21/76] fs/coda: " Mark Fasheh
2018-05-08 18:03 ` [PATCH 22/76] fs/configfs: " Mark Fasheh
2018-05-08 18:03 ` [PATCH 23/76] fs/cramfs: " Mark Fasheh
2018-05-08 18:03 ` [PATCH 24/76] fs/crypto: " Mark Fasheh
2018-05-08 18:03 ` [PATCH 25/76] fs/ecryptfs: " Mark Fasheh
2018-05-08 18:03 ` [PATCH 26/76] fs/efivarfs: " Mark Fasheh
2018-05-08 18:03 ` [PATCH 27/76] fs/efs: " Mark Fasheh
2018-05-08 18:03 ` [PATCH 28/76] fs/exofs: " Mark Fasheh
2018-05-08 18:03 ` [PATCH 29/76] fs/exportfs: " Mark Fasheh
2018-05-08 18:03 ` [PATCH 30/76] fs/ext2: " Mark Fasheh
2018-05-08 18:03 ` [PATCH 31/76] fs/ext4: " Mark Fasheh
2018-05-08 18:03 ` [PATCH 32/76] fs/f2fs: " Mark Fasheh
2018-05-10 10:10   ` Chao Yu
2018-05-08 18:03 ` [PATCH 33/76] fs/fat: " Mark Fasheh
2018-05-08 18:03 ` [PATCH 34/76] fs/freevxfs: " Mark Fasheh
2018-05-08 18:03 ` [PATCH 35/76] fs/fuse: " Mark Fasheh
2018-05-08 18:03 ` [PATCH 36/76] fs/gfs2: " Mark Fasheh
2018-05-08 18:03 ` [PATCH 37/76] fs/hfs: " Mark Fasheh
2018-05-08 18:03 ` [PATCH 38/76] fs/hfsplus: " Mark Fasheh
2018-05-08 18:03 ` [PATCH 39/76] fs/hostfs: " Mark Fasheh
2018-05-08 18:04 ` [PATCH 40/76] fs/hpfs: " Mark Fasheh
2018-05-08 18:04 ` [PATCH 41/76] fs/hugetlbfs: " Mark Fasheh
2018-05-08 18:04 ` [PATCH 42/76] fs/isofs: " Mark Fasheh
2018-05-08 18:04 ` [PATCH 43/76] fs/jbd2: " Mark Fasheh
2018-05-08 18:04 ` [PATCH 44/76] fs/jffs2: " Mark Fasheh
2018-05-08 18:04 ` [PATCH 45/76] fs/jfs: " Mark Fasheh
2018-05-08 18:04 ` [PATCH 46/76] fs/kernfs: " Mark Fasheh
2018-05-08 18:04 ` [PATCH 47/76] fs/lockd: " Mark Fasheh
2018-05-08 18:04 ` [PATCH 48/76] fs/minix: " Mark Fasheh
2018-05-08 18:04 ` [PATCH 49/76] fs/nfsd: " Mark Fasheh
2018-05-08 18:04 ` [PATCH 50/76] fs/nfs: " Mark Fasheh
2018-05-08 18:04 ` [PATCH 51/76] fs/nilfs2: " Mark Fasheh
2018-05-08 18:04 ` [PATCH 52/76] fs/notify: " Mark Fasheh
2018-05-08 18:04 ` [PATCH 53/76] fs/ntfs: " Mark Fasheh
2018-05-08 18:04 ` [PATCH 54/76] fs/ocfs2: " Mark Fasheh
2018-05-08 18:04 ` [PATCH 55/76] fs/omfs: " Mark Fasheh
2018-05-08 18:04 ` [PATCH 56/76] fs/openpromfs: " Mark Fasheh
2018-05-08 18:04 ` [PATCH 57/76] fs/orangefs: " Mark Fasheh
2018-05-08 18:04 ` [PATCH 58/76] fs/overlayfs: " Mark Fasheh
2018-05-08 18:04 ` [PATCH 59/76] fs/proc: " Mark Fasheh
2018-05-08 18:04 ` [PATCH 60/76] fs/qnx4: " Mark Fasheh
2018-05-08 18:04 ` [PATCH 61/76] fs/qnx6: " Mark Fasheh
2018-05-08 18:04 ` [PATCH 62/76] fs/quota: " Mark Fasheh
2018-05-08 18:04 ` [PATCH 63/76] fs/ramfs: " Mark Fasheh
2018-05-08 18:04 ` [PATCH 64/76] fs/read: " Mark Fasheh
2018-05-08 18:04 ` [PATCH 65/76] fs/reiserfs: " Mark Fasheh
2018-05-08 18:04 ` [PATCH 66/76] fs/romfs: " Mark Fasheh
2018-05-08 18:04 ` [PATCH 67/76] fs/squashfs: " Mark Fasheh
2018-05-08 18:04 ` [PATCH 68/76] fs/sysv: " Mark Fasheh
2018-05-08 18:04 ` [PATCH 69/76] fs/ubifs: " Mark Fasheh
2018-05-08 18:04 ` [PATCH 70/76] fs/udf: " Mark Fasheh
2018-05-08 18:04 ` [PATCH 71/76] fs/ufs: " Mark Fasheh
2018-05-08 18:04 ` [PATCH 72/76] fs/xfs: " Mark Fasheh
2018-05-08 18:04 ` [PATCH 73/76] vfs: Move s_dev to to struct fs_view Mark Fasheh
2018-05-08 18:04 ` [PATCH 74/76] fs: Use fs_view device from struct inode Mark Fasheh
2018-05-08 18:04 ` [PATCH 75/76] fs: Use fs view device from struct super_block Mark Fasheh
2018-05-08 18:04 ` [PATCH 76/76] btrfs: Use fs_view in roots, point inodes to it Mark Fasheh
2018-05-08 23:38 ` [RFC][PATCH 0/76] vfs: 'views' for filesystems with more than one root Dave Chinner
2018-05-09  2:06   ` Jeff Mahoney
2018-05-09  6:41     ` Dave Chinner
2018-06-05 20:17       ` Jeff Mahoney
2018-06-06  9:49         ` Amir Goldstein
2018-06-06 20:42           ` Mark Fasheh
2018-06-07  6:06             ` Amir Goldstein
2018-06-07 20:44               ` Mark Fasheh
2018-06-06 21:19           ` Jeff Mahoney
2018-06-07  6:17             ` Amir Goldstein

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).