Skip to content

Commit 0ef28f9

Browse files
committed
nilfs2: get rid of NILFS_I_NILFS
This replaces all references of NILFS_I_NILFS(inode)->ns_bdev with inode->i_sb->s_bdev and unfolds remaining uses of NILFS_I_NILFS inline function. Before 2.6.37, referring to a nilfs object from inodes needed a conditional judgement, and NILFS_I_NILFS was helpful to simplify it. But now we can simply do it by going through a super block instance like inode->i_sb->s_fs_info. Signed-off-by: Ryusuke Konishi <[email protected]>
1 parent 0cc1283 commit 0ef28f9

File tree

7 files changed

+20
-22
lines changed

7 files changed

+20
-22
lines changed

fs/nilfs2/bmap.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,9 @@
3434

3535
struct inode *nilfs_bmap_get_dat(const struct nilfs_bmap *bmap)
3636
{
37-
return NILFS_I_NILFS(bmap->b_inode)->ns_dat;
37+
struct the_nilfs *nilfs = bmap->b_inode->i_sb->s_fs_info;
38+
39+
return nilfs->ns_dat;
3840
}
3941

4042
static int nilfs_bmap_convert_error(struct nilfs_bmap *bmap,

fs/nilfs2/btnode.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ nilfs_btnode_create_block(struct address_space *btnc, __u64 blocknr)
6262
BUG();
6363
}
6464
memset(bh->b_data, 0, 1 << inode->i_blkbits);
65-
bh->b_bdev = NILFS_I_NILFS(inode)->ns_bdev;
65+
bh->b_bdev = inode->i_sb->s_bdev;
6666
bh->b_blocknr = blocknr;
6767
set_buffer_mapped(bh);
6868
set_buffer_uptodate(bh);
@@ -94,10 +94,11 @@ int nilfs_btnode_submit_block(struct address_space *btnc, __u64 blocknr,
9494
if (pblocknr == 0) {
9595
pblocknr = blocknr;
9696
if (inode->i_ino != NILFS_DAT_INO) {
97-
struct inode *dat = NILFS_I_NILFS(inode)->ns_dat;
97+
struct the_nilfs *nilfs = inode->i_sb->s_fs_info;
9898

9999
/* blocknr is a virtual block number */
100-
err = nilfs_dat_translate(dat, blocknr, &pblocknr);
100+
err = nilfs_dat_translate(nilfs->ns_dat, blocknr,
101+
&pblocknr);
101102
if (unlikely(err)) {
102103
brelse(bh);
103104
goto out_locked;
@@ -120,7 +121,7 @@ int nilfs_btnode_submit_block(struct address_space *btnc, __u64 blocknr,
120121
goto found;
121122
}
122123
set_buffer_mapped(bh);
123-
bh->b_bdev = NILFS_I_NILFS(inode)->ns_bdev;
124+
bh->b_bdev = inode->i_sb->s_bdev;
124125
bh->b_blocknr = pblocknr; /* set block address for read */
125126
bh->b_end_io = end_buffer_read_sync;
126127
get_bh(bh);

fs/nilfs2/gcinode.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,9 @@ int nilfs_gccache_submit_read_data(struct inode *inode, sector_t blkoff,
8484
goto out;
8585

8686
if (pbn == 0) {
87-
struct inode *dat_inode = NILFS_I_NILFS(inode)->ns_dat;
88-
/* use original dat, not gc dat. */
89-
err = nilfs_dat_translate(dat_inode, vbn, &pbn);
87+
struct the_nilfs *nilfs = inode->i_sb->s_fs_info;
88+
89+
err = nilfs_dat_translate(nilfs->ns_dat, vbn, &pbn);
9090
if (unlikely(err)) { /* -EIO, -ENOMEM, -ENOENT */
9191
brelse(bh);
9292
goto failed;
@@ -100,7 +100,7 @@ int nilfs_gccache_submit_read_data(struct inode *inode, sector_t blkoff,
100100
}
101101

102102
if (!buffer_mapped(bh)) {
103-
bh->b_bdev = NILFS_I_NILFS(inode)->ns_bdev;
103+
bh->b_bdev = inode->i_sb->s_bdev;
104104
set_buffer_mapped(bh);
105105
}
106106
bh->b_blocknr = pbn;

fs/nilfs2/inode.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,14 +74,14 @@ int nilfs_get_block(struct inode *inode, sector_t blkoff,
7474
struct buffer_head *bh_result, int create)
7575
{
7676
struct nilfs_inode_info *ii = NILFS_I(inode);
77+
struct the_nilfs *nilfs = inode->i_sb->s_fs_info;
7778
__u64 blknum = 0;
7879
int err = 0, ret;
79-
struct inode *dat = NILFS_I_NILFS(inode)->ns_dat;
8080
unsigned maxblocks = bh_result->b_size >> inode->i_blkbits;
8181

82-
down_read(&NILFS_MDT(dat)->mi_sem);
82+
down_read(&NILFS_MDT(nilfs->ns_dat)->mi_sem);
8383
ret = nilfs_bmap_lookup_contig(ii->i_bmap, blkoff, &blknum, maxblocks);
84-
up_read(&NILFS_MDT(dat)->mi_sem);
84+
up_read(&NILFS_MDT(nilfs->ns_dat)->mi_sem);
8585
if (ret >= 0) { /* found */
8686
map_bh(bh_result, inode->i_sb, blknum);
8787
if (ret > 0)
@@ -940,7 +940,7 @@ void nilfs_dirty_inode(struct inode *inode)
940940
int nilfs_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo,
941941
__u64 start, __u64 len)
942942
{
943-
struct the_nilfs *nilfs = NILFS_I_NILFS(inode);
943+
struct the_nilfs *nilfs = inode->i_sb->s_fs_info;
944944
__u64 logical = 0, phys = 0, size = 0;
945945
__u32 flags = 0;
946946
loff_t isize;

fs/nilfs2/mdt.h

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -64,11 +64,6 @@ static inline struct nilfs_mdt_info *NILFS_MDT(const struct inode *inode)
6464
return inode->i_private;
6565
}
6666

67-
static inline struct the_nilfs *NILFS_I_NILFS(struct inode *inode)
68-
{
69-
return inode->i_sb->s_fs_info;
70-
}
71-
7267
/* Default GFP flags using highmem */
7368
#define NILFS_MDT_GFP (__GFP_WAIT | __GFP_IO | __GFP_HIGHMEM)
7469

@@ -108,7 +103,7 @@ static inline void nilfs_mdt_clear_dirty(struct inode *inode)
108103

109104
static inline __u64 nilfs_mdt_cno(struct inode *inode)
110105
{
111-
return NILFS_I_NILFS(inode)->ns_cno;
106+
return ((struct the_nilfs *)inode->i_sb->s_fs_info)->ns_cno;
112107
}
113108

114109
#define nilfs_mdt_bgl_lock(inode, bg) \

fs/nilfs2/sufile.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -562,7 +562,7 @@ int nilfs_sufile_get_stat(struct inode *sufile, struct nilfs_sustat *sustat)
562562
{
563563
struct buffer_head *header_bh;
564564
struct nilfs_sufile_header *header;
565-
struct the_nilfs *nilfs = NILFS_I_NILFS(sufile);
565+
struct the_nilfs *nilfs = sufile->i_sb->s_fs_info;
566566
void *kaddr;
567567
int ret;
568568

@@ -812,7 +812,7 @@ ssize_t nilfs_sufile_get_suinfo(struct inode *sufile, __u64 segnum, void *buf,
812812
struct nilfs_segment_usage *su;
813813
struct nilfs_suinfo *si = buf;
814814
size_t susz = NILFS_MDT(sufile)->mi_entry_size;
815-
struct the_nilfs *nilfs = NILFS_I_NILFS(sufile);
815+
struct the_nilfs *nilfs = sufile->i_sb->s_fs_info;
816816
void *kaddr;
817817
unsigned long nsegs, segusages_per_block;
818818
ssize_t n;

fs/nilfs2/sufile.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131

3232
static inline unsigned long nilfs_sufile_get_nsegments(struct inode *sufile)
3333
{
34-
return NILFS_I_NILFS(sufile)->ns_nsegments;
34+
return ((struct the_nilfs *)sufile->i_sb->s_fs_info)->ns_nsegments;
3535
}
3636

3737
unsigned long nilfs_sufile_get_ncleansegs(struct inode *sufile);

0 commit comments

Comments
 (0)