]> git.itanic.dy.fi Git - linux-stable/commitdiff
nilfs2: get rid of NILFS_I_NILFS
authorRyusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
Thu, 5 May 2011 03:56:51 +0000 (12:56 +0900)
committerRyusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
Tue, 10 May 2011 13:21:56 +0000 (22:21 +0900)
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 <konishi.ryusuke@lab.ntt.co.jp>
fs/nilfs2/bmap.c
fs/nilfs2/btnode.c
fs/nilfs2/gcinode.c
fs/nilfs2/inode.c
fs/nilfs2/mdt.h
fs/nilfs2/sufile.c
fs/nilfs2/sufile.h

index 4723f04e9b12a0e904f945997b5e1aa73cfc757b..aadbd0b5e3e8fbe516261e5ae069296b8ed940f8 100644 (file)
@@ -34,7 +34,9 @@
 
 struct inode *nilfs_bmap_get_dat(const struct nilfs_bmap *bmap)
 {
-       return NILFS_I_NILFS(bmap->b_inode)->ns_dat;
+       struct the_nilfs *nilfs = bmap->b_inode->i_sb->s_fs_info;
+
+       return nilfs->ns_dat;
 }
 
 static int nilfs_bmap_convert_error(struct nilfs_bmap *bmap,
index 609cd223eea85abf39232688e2ccbd9dad94ee68..4817560424236ec6c5456a573e0d131834daacc9 100644 (file)
@@ -62,7 +62,7 @@ nilfs_btnode_create_block(struct address_space *btnc, __u64 blocknr)
                BUG();
        }
        memset(bh->b_data, 0, 1 << inode->i_blkbits);
-       bh->b_bdev = NILFS_I_NILFS(inode)->ns_bdev;
+       bh->b_bdev = inode->i_sb->s_bdev;
        bh->b_blocknr = blocknr;
        set_buffer_mapped(bh);
        set_buffer_uptodate(bh);
@@ -94,10 +94,11 @@ int nilfs_btnode_submit_block(struct address_space *btnc, __u64 blocknr,
        if (pblocknr == 0) {
                pblocknr = blocknr;
                if (inode->i_ino != NILFS_DAT_INO) {
-                       struct inode *dat = NILFS_I_NILFS(inode)->ns_dat;
+                       struct the_nilfs *nilfs = inode->i_sb->s_fs_info;
 
                        /* blocknr is a virtual block number */
-                       err = nilfs_dat_translate(dat, blocknr, &pblocknr);
+                       err = nilfs_dat_translate(nilfs->ns_dat, blocknr,
+                                                 &pblocknr);
                        if (unlikely(err)) {
                                brelse(bh);
                                goto out_locked;
@@ -120,7 +121,7 @@ int nilfs_btnode_submit_block(struct address_space *btnc, __u64 blocknr,
                goto found;
        }
        set_buffer_mapped(bh);
-       bh->b_bdev = NILFS_I_NILFS(inode)->ns_bdev;
+       bh->b_bdev = inode->i_sb->s_bdev;
        bh->b_blocknr = pblocknr; /* set block address for read */
        bh->b_end_io = end_buffer_read_sync;
        get_bh(bh);
index 6f0d60a0fd6a21e1bd4966baa6824703611f1f58..6e79ac0f49a16babc5ec455f054f2fbbdcd40e79 100644 (file)
@@ -84,9 +84,9 @@ int nilfs_gccache_submit_read_data(struct inode *inode, sector_t blkoff,
                goto out;
 
        if (pbn == 0) {
-               struct inode *dat_inode = NILFS_I_NILFS(inode)->ns_dat;
-                                         /* use original dat, not gc dat. */
-               err = nilfs_dat_translate(dat_inode, vbn, &pbn);
+               struct the_nilfs *nilfs = inode->i_sb->s_fs_info;
+
+               err = nilfs_dat_translate(nilfs->ns_dat, vbn, &pbn);
                if (unlikely(err)) { /* -EIO, -ENOMEM, -ENOENT */
                        brelse(bh);
                        goto failed;
@@ -100,7 +100,7 @@ int nilfs_gccache_submit_read_data(struct inode *inode, sector_t blkoff,
        }
 
        if (!buffer_mapped(bh)) {
-               bh->b_bdev = NILFS_I_NILFS(inode)->ns_bdev;
+               bh->b_bdev = inode->i_sb->s_bdev;
                set_buffer_mapped(bh);
        }
        bh->b_blocknr = pbn;
index 699170e0f308436a16ae6c75d78b9b0709d4be12..34ded2c24807b4e8d642a61b39a81be4aecdad92 100644 (file)
@@ -74,14 +74,14 @@ 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;
        __u64 blknum = 0;
        int err = 0, ret;
-       struct inode *dat = NILFS_I_NILFS(inode)->ns_dat;
        unsigned maxblocks = bh_result->b_size >> inode->i_blkbits;
 
-       down_read(&NILFS_MDT(dat)->mi_sem);
+       down_read(&NILFS_MDT(nilfs->ns_dat)->mi_sem);
        ret = nilfs_bmap_lookup_contig(ii->i_bmap, blkoff, &blknum, maxblocks);
-       up_read(&NILFS_MDT(dat)->mi_sem);
+       up_read(&NILFS_MDT(nilfs->ns_dat)->mi_sem);
        if (ret >= 0) { /* found */
                map_bh(bh_result, inode->i_sb, blknum);
                if (ret > 0)
@@ -940,7 +940,7 @@ void nilfs_dirty_inode(struct inode *inode)
 int nilfs_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo,
                 __u64 start, __u64 len)
 {
-       struct the_nilfs *nilfs = NILFS_I_NILFS(inode);
+       struct the_nilfs *nilfs = inode->i_sb->s_fs_info;
        __u64 logical = 0, phys = 0, size = 0;
        __u32 flags = 0;
        loff_t isize;
index ed68563ec708bd135c7abe0145a960de771424fb..baea03663a3d969e5c27f9ced8d4ea005edc7a73 100644 (file)
@@ -64,11 +64,6 @@ static inline struct nilfs_mdt_info *NILFS_MDT(const struct inode *inode)
        return inode->i_private;
 }
 
-static inline struct the_nilfs *NILFS_I_NILFS(struct inode *inode)
-{
-       return inode->i_sb->s_fs_info;
-}
-
 /* Default GFP flags using highmem */
 #define NILFS_MDT_GFP      (__GFP_WAIT | __GFP_IO | __GFP_HIGHMEM)
 
@@ -108,7 +103,7 @@ static inline void nilfs_mdt_clear_dirty(struct inode *inode)
 
 static inline __u64 nilfs_mdt_cno(struct inode *inode)
 {
-       return NILFS_I_NILFS(inode)->ns_cno;
+       return ((struct the_nilfs *)inode->i_sb->s_fs_info)->ns_cno;
 }
 
 #define nilfs_mdt_bgl_lock(inode, bg) \
index 37b9631cc0164c5c8be6a990082832bb97ad6af8..ce679cfc6dda54ee8e40323f142202edf6e6f403 100644 (file)
@@ -562,7 +562,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 = NILFS_I_NILFS(sufile);
+       struct the_nilfs *nilfs = sufile->i_sb->s_fs_info;
        void *kaddr;
        int ret;
 
@@ -812,7 +812,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 = NILFS_I_NILFS(sufile);
+       struct the_nilfs *nilfs = sufile->i_sb->s_fs_info;
        void *kaddr;
        unsigned long nsegs, segusages_per_block;
        ssize_t n;
index 1eac4c6ea384ce4ec0ec09de27ad9638a5a15371..e84bc5b51fc11df1090084ba0d0eb25c342fb2ad 100644 (file)
@@ -31,7 +31,7 @@
 
 static inline unsigned long nilfs_sufile_get_nsegments(struct inode *sufile)
 {
-       return NILFS_I_NILFS(sufile)->ns_nsegments;
+       return ((struct the_nilfs *)sufile->i_sb->s_fs_info)->ns_nsegments;
 }
 
 unsigned long nilfs_sufile_get_ncleansegs(struct inode *sufile);