]> err.no Git - linux-2.6/commitdiff
[GFS2] Remove gfs2_inode_attr_in
authorSteven Whitehouse <swhiteho@redhat.com>
Wed, 8 Nov 2006 20:45:46 +0000 (15:45 -0500)
committerSteven Whitehouse <swhiteho@redhat.com>
Thu, 30 Nov 2006 15:34:52 +0000 (10:34 -0500)
This function wasn't really doing the right thing. There was no need
to update the inode size at this point and the updating of the
i_blocks field has now been moved to the places where di_blocks is
updated. A result of this patch and some those preceeding it is that
unlocking a glock is now a much more efficient process, since there
is no longer any requirement to copy data from the gfs2 inode into
the vfs inode at this point.

Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
fs/gfs2/bmap.c
fs/gfs2/dir.c
fs/gfs2/eattr.c
fs/gfs2/glops.c
fs/gfs2/inode.c
fs/gfs2/inode.h

index 692d4a3da1bcffe968a5d388d0b9e27da1c6ccf4..06e3447ea1326e901f4f96e4c08bfa6b06d8eca2 100644 (file)
@@ -163,6 +163,7 @@ int gfs2_unstuff_dinode(struct gfs2_inode *ip, struct page *page)
        if (ip->i_di.di_size) {
                *(__be64 *)(di + 1) = cpu_to_be64(block);
                ip->i_di.di_blocks++;
+               gfs2_set_inode_blocks(&ip->i_inode);
                di->di_blocks = cpu_to_be64(ip->i_di.di_blocks);
        }
 
@@ -272,6 +273,7 @@ static int build_height(struct inode *inode, unsigned height)
        *(__be64 *)(di + 1) = cpu_to_be64(bn);
        ip->i_di.di_height += new_height;
        ip->i_di.di_blocks += new_height;
+       gfs2_set_inode_blocks(&ip->i_inode);
        di->di_height = cpu_to_be16(ip->i_di.di_height);
        di->di_blocks = cpu_to_be64(ip->i_di.di_blocks);
        brelse(dibh);
@@ -415,6 +417,7 @@ static int lookup_block(struct gfs2_inode *ip, struct buffer_head *bh,
 
        *ptr = cpu_to_be64(*block);
        ip->i_di.di_blocks++;
+       gfs2_set_inode_blocks(&ip->i_inode);
 
        *new = 1;
        return 0;
@@ -770,6 +773,7 @@ static int do_strip(struct gfs2_inode *ip, struct buffer_head *dibh,
                if (!ip->i_di.di_blocks)
                        gfs2_consist_inode(ip);
                ip->i_di.di_blocks--;
+               gfs2_set_inode_blocks(&ip->i_inode);
        }
        if (bstart) {
                if (metadata)
index c82d7cb4a6547eebdf4f115093dba98ed377f4e1..a2923fb91bba0306cf961f3f8450ce527a18f67f 100644 (file)
@@ -901,6 +901,7 @@ static int dir_make_exhash(struct inode *inode)
 
        dip->i_di.di_size = sdp->sd_sb.sb_bsize / 2;
        dip->i_di.di_blocks++;
+       gfs2_set_inode_blocks(&dip->i_inode);
        dip->i_di.di_flags |= GFS2_DIF_EXHASH;
 
        for (x = sdp->sd_hash_ptrs, y = -1; x; x >>= 1, y++) ;
@@ -1038,6 +1039,7 @@ static int dir_split_leaf(struct inode *inode, const struct qstr *name)
        error = gfs2_meta_inode_buffer(dip, &dibh);
        if (!gfs2_assert_withdraw(GFS2_SB(&dip->i_inode), !error)) {
                dip->i_di.di_blocks++;
+               gfs2_set_inode_blocks(&dip->i_inode);
                gfs2_dinode_out(dip, dibh->b_data);
                brelse(dibh);
        }
@@ -1516,6 +1518,7 @@ static int dir_new_leaf(struct inode *inode, const struct qstr *name)
                return error;
        gfs2_trans_add_bh(ip->i_gl, bh, 1);
        ip->i_di.di_blocks++;
+       gfs2_set_inode_blocks(&ip->i_inode);
        gfs2_dinode_out(ip, bh->b_data);
        brelse(bh);
        return 0;
@@ -1860,6 +1863,7 @@ static int leaf_dealloc(struct gfs2_inode *dip, u32 index, u32 len,
                if (!dip->i_di.di_blocks)
                        gfs2_consist_inode(dip);
                dip->i_di.di_blocks--;
+               gfs2_set_inode_blocks(&dip->i_inode);
        }
 
        error = gfs2_dir_write_data(dip, ht, index * sizeof(u64), size);
index 7dde84775ba73098f2217f6dd8c18f634abaa21b..ebebbdcd7057cf2b2dd1b700eb1ac18aadab5a92 100644 (file)
@@ -281,6 +281,7 @@ static int ea_dealloc_unstuffed(struct gfs2_inode *ip, struct buffer_head *bh,
                if (!ip->i_di.di_blocks)
                        gfs2_consist_inode(ip);
                ip->i_di.di_blocks--;
+               gfs2_set_inode_blocks(&ip->i_inode);
        }
        if (bstart)
                gfs2_free_meta(ip, bstart, blen);
@@ -598,6 +599,7 @@ static int ea_alloc_blk(struct gfs2_inode *ip, struct buffer_head **bhp)
        ea->ea_num_ptrs = 0;
 
        ip->i_di.di_blocks++;
+       gfs2_set_inode_blocks(&ip->i_inode);
 
        return 0;
 }
@@ -649,6 +651,7 @@ static int ea_write(struct gfs2_inode *ip, struct gfs2_ea_header *ea,
                        gfs2_metatype_set(bh, GFS2_METATYPE_ED, GFS2_FORMAT_ED);
 
                        ip->i_di.di_blocks++;
+                       gfs2_set_inode_blocks(&ip->i_inode);
 
                        copy = data_len > sdp->sd_jbsize ? sdp->sd_jbsize :
                                                           data_len;
@@ -977,6 +980,7 @@ static int ea_set_block(struct gfs2_inode *ip, struct gfs2_ea_request *er,
                ip->i_di.di_eattr = blk;
                ip->i_di.di_flags |= GFS2_DIF_EA_INDIRECT;
                ip->i_di.di_blocks++;
+               gfs2_set_inode_blocks(&ip->i_inode);
 
                eablk++;
        }
@@ -1387,6 +1391,7 @@ static int ea_dealloc_indirect(struct gfs2_inode *ip)
                if (!ip->i_di.di_blocks)
                        gfs2_consist_inode(ip);
                ip->i_di.di_blocks--;
+               gfs2_set_inode_blocks(&ip->i_inode);
        }
        if (bstart)
                gfs2_free_meta(ip, bstart, blen);
@@ -1441,6 +1446,7 @@ static int ea_dealloc_block(struct gfs2_inode *ip)
        if (!ip->i_di.di_blocks)
                gfs2_consist_inode(ip);
        ip->i_di.di_blocks--;
+       gfs2_set_inode_blocks(&ip->i_inode);
 
        error = gfs2_meta_inode_buffer(ip, &dibh);
        if (!error) {
index 9c2033714b08132c20a7223913e276b8b01ab067..b92de0af0bf30f66b66869a7c49c684d6a3c6c7e 100644 (file)
@@ -356,7 +356,6 @@ static int inode_go_lock(struct gfs2_holder *gh)
                error = gfs2_inode_refresh(ip);
                if (error)
                        return error;
-               gfs2_inode_attr_in(ip);
        }
 
        if ((ip->i_di.di_flags & GFS2_DIF_TRUNC_IN_PROG) &&
@@ -380,11 +379,8 @@ static void inode_go_unlock(struct gfs2_holder *gh)
        struct gfs2_glock *gl = gh->gh_gl;
        struct gfs2_inode *ip = gl->gl_object;
 
-       if (ip == NULL)
-               return;
-       if (test_bit(GLF_DIRTY, &gl->gl_flags))
-               gfs2_inode_attr_in(ip);
-       gfs2_meta_cache_flush(ip);
+       if (ip)
+               gfs2_meta_cache_flush(ip);
 }
 
 /**
index 19b2736cd52f70e38e643c6651193dbe4c48ebc2..ea9ca239c8784ebc4610261e30d1c967fc83cc3c 100644 (file)
 #include "trans.h"
 #include "util.h"
 
-/**
- * gfs2_inode_attr_in - Copy attributes from the dinode into the VFS inode
- * @ip: The GFS2 inode (with embedded disk inode data)
- * @inode:  The Linux VFS inode
- *
- */
-
-void gfs2_inode_attr_in(struct gfs2_inode *ip)
-{
-       struct inode *inode = &ip->i_inode;
-       struct gfs2_dinode_host *di = &ip->i_di;
-
-       i_size_write(inode, di->di_size);
-       inode->i_blocks = di->di_blocks <<
-               (GFS2_SB(inode)->sd_sb.sb_bsize_shift - GFS2_BASIC_BLOCK_SHIFT);
-}
-
 static int iget_test(struct inode *inode, void *opaque)
 {
        struct gfs2_inode *ip = GFS2_I(inode);
        struct gfs2_inum_host *inum = opaque;
 
-       if (ip && ip->i_num.no_addr == inum->no_addr)
+       if (ip->i_num.no_addr == inum->no_addr)
                return 1;
 
        return 0;
@@ -187,7 +170,9 @@ static int gfs2_dinode_in(struct gfs2_inode *ip, const void *buf)
         */
        ip->i_inode.i_nlink = be32_to_cpu(str->di_nlink);
        di->di_size = be64_to_cpu(str->di_size);
+       i_size_write(&ip->i_inode, di->di_size);
        di->di_blocks = be64_to_cpu(str->di_blocks);
+       gfs2_set_inode_blocks(&ip->i_inode);
        ip->i_inode.i_atime.tv_sec = be64_to_cpu(str->di_atime);
        ip->i_inode.i_atime.tv_nsec = 0;
        ip->i_inode.i_mtime.tv_sec = be64_to_cpu(str->di_mtime);
index 54d584eddf2962f2b6443fd4d62aa17e0cddf039..46917edfdd6c15f5d412d5332376b6ab437cb647 100644 (file)
@@ -25,6 +25,13 @@ static inline int gfs2_is_dir(struct gfs2_inode *ip)
        return S_ISDIR(ip->i_inode.i_mode);
 }
 
+static inline void gfs2_set_inode_blocks(struct inode *inode)
+{
+       struct gfs2_inode *ip = GFS2_I(inode);
+       inode->i_blocks = ip->i_di.di_blocks <<
+               (GFS2_SB(inode)->sd_sb.sb_bsize_shift - GFS2_BASIC_BLOCK_SHIFT);
+}
+
 void gfs2_inode_attr_in(struct gfs2_inode *ip);
 struct inode *gfs2_inode_lookup(struct super_block *sb, struct gfs2_inum_host *inum, unsigned type);
 struct inode *gfs2_ilookup(struct super_block *sb, struct gfs2_inum_host *inum);