GFS2: Clean up inode deallocation
The major part of this patch is just moving a function from inode.c to super.c so that it is next to its single caller and can thus be marked static.
However there are also a couple of other changes too. The first is to remove the setting of the GLF_DIRTY and GLF_LFLUSH flags, since those will have already been set earlier in the process.
The second is to invalidate all the metadata pages associated with the inode. There is no point in continuing to cache them, since even if the local node were to recreate the inode, it would repopulate the pages without any disk I/O. This helps free up memory early which is important for workloads with lots of unlink activity when under memory pressure.
Signed-off-by Steven Whitehouse <[email protected]>
fs/gfs2/inode.c +0 -59
@@ -341,65 +341,6 @@ int gfs2_inode_refresh(struct gfs2_inode *ip)return error; } -int gfs2_dinode_dealloc (struct gfs2_inode *ip) -{ -struct gfs2_sbd *sdp =GFS2_SB (&ip->i_inode); -struct gfs2_alloc *al; -struct gfs2_rgrpd *rgd; -int error; - -if (gfs2_get_inode_blocks (&ip->i_inode) !=1 ) { -if (gfs2_consist_inode (ip)) -gfs2_dinode_print (ip); -return -EIO ; - } - - al =gfs2_alloc_get (ip); -if (!al) -return -ENOMEM ; - - error =gfs2_quota_hold (ip,NO_QUOTA_CHANGE ,NO_QUOTA_CHANGE ); -if (error) - goto out; - - error =gfs2_rindex_hold (sdp, &al->al_ri_gh); -if (error) - goto out_qs; - - rgd =gfs2_blk2rgrpd (sdp, ip->i_no_addr); -if (!rgd) { -gfs2_consist_inode (ip); - error = -EIO ; - goto out_rindex_relse; - } - - error =gfs2_glock_nq_init (rgd->rd_gl,LM_ST_EXCLUSIVE ,0 , - &al->al_rgd_gh); -if (error) - goto out_rindex_relse; - - error =gfs2_trans_begin (sdp,RES_RG_BIT +RES_STATFS +RES_QUOTA ,1 ); -if (error) - goto out_rg_gunlock; - -set_bit (GLF_DIRTY , &ip->i_gl->gl_flags); -set_bit (GLF_LFLUSH , &ip->i_gl->gl_flags); - -gfs2_free_di (rgd, ip); - -gfs2_trans_end (sdp); - -out_rg_gunlock: -gfs2_glock_dq_uninit (&al->al_rgd_gh); -out_rindex_relse: -gfs2_glock_dq_uninit (&al->al_ri_gh); -out_qs: -gfs2_quota_unhold (ip); -out: -gfs2_alloc_put (ip); -return error; -} -/** * gfs2_change_nlink - Change nlink count on inode * @ip: The GFS2 inode
fs/gfs2/inode.h +0 -1
@@ -106,7 +106,6 @@ extern struct inode *gfs2_ilookup(struct super_block *sb, u64 no_addr);extern int gfs2_inode_refresh (struct gfs2_inode *ip); -extern int gfs2_dinode_dealloc (struct gfs2_inode *inode);extern int gfs2_change_nlink (struct gfs2_inode *ip,int diff);extern struct inode *gfs2_lookupi (struct inode *dir,const struct qstr *name,int is_root);
fs/gfs2/super.c +57 -0
69 lines not on this page · raw message