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 68/76] fs/sysv: Use inode_sb() helper instead of inode->i_sb
Date: Tue, 8 May 2018 11:04:28 -0700 [thread overview]
Message-ID: <20180508180436.716-69-mfasheh@suse.de> (raw)
In-Reply-To: <20180508180436.716-1-mfasheh@suse.de>
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
next prev parent reply other threads:[~2018-05-08 18:10 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 ` [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 ` Mark Fasheh [this message]
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-69-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®