From: Mark Fasheh <mfasheh@suse.de>
To: linux-fsdevel@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, linux-btrfs@vger.kernel.org,
Mark Fasheh <mfasheh@suse.de>
Subject: [PATCH 55/76] fs/omfs: Use inode_sb() helper instead of inode->i_sb
Date: Tue, 8 May 2018 11:04:15 -0700 [thread overview]
Message-ID: <20180508180436.716-56-mfasheh@suse.de> (raw)
In-Reply-To: <20180508180436.716-1-mfasheh@suse.de>
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
next prev parent reply other threads:[~2018-05-08 18:23 UTC|newest]
Thread overview: 88+ messages / expand[flat|nested] mbox.gz Atom feed top
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 ` Mark Fasheh [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180508180436.716-56-mfasheh@suse.de \
--to=mfasheh@suse.de \
--cc=linux-btrfs@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®