aboutsummaryrefslogtreecommitdiffstats
path: root/fs/gfs2/inode.c
diff options
context:
space:
mode:
authorSteven Whitehouse <swhiteho@redhat.com>2011-09-01 08:31:59 -0400
committerSteven Whitehouse <swhiteho@redhat.com>2011-10-21 07:39:34 -0400
commit54335b1fca27b84baa75b1f45985d98262003837 (patch)
treec6b21aff1759d86be56208e9981117e4383c3f47 /fs/gfs2/inode.c
parent8339ee543ece6e2dcc1bbd97d5350163c198cf00 (diff)
GFS2: Cache the most recently used resource group in the inode
This means that after the initial allocation for any inode, the last used resource group is cached in the inode for future use. This drastically reduces the number of lookups of resource groups in the common case, and this the contention on that data structure. The allocation algorithm is the same as previously, except that we always check to see if the goal block is within the cached rgrp first before going to the rbtree to look one up. Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
Diffstat (limited to 'fs/gfs2/inode.c')
-rw-r--r--fs/gfs2/inode.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/fs/gfs2/inode.c b/fs/gfs2/inode.c
index 29703dd97dc9..55b3bbaf2f25 100644
--- a/fs/gfs2/inode.c
+++ b/fs/gfs2/inode.c
@@ -583,7 +583,7 @@ static int link_dinode(struct gfs2_inode *dip, const struct qstr *name,
583 goto fail_quota_locks; 583 goto fail_quota_locks;
584 584
585 error = gfs2_trans_begin(sdp, sdp->sd_max_dirres + 585 error = gfs2_trans_begin(sdp, sdp->sd_max_dirres +
586 al->al_rgd->rd_length + 586 dip->i_rgd->rd_length +
587 2 * RES_DINODE + 587 2 * RES_DINODE +
588 RES_STATFS + RES_QUOTA, 0); 588 RES_STATFS + RES_QUOTA, 0);
589 if (error) 589 if (error)
@@ -613,8 +613,7 @@ fail_end_trans:
613 gfs2_trans_end(sdp); 613 gfs2_trans_end(sdp);
614 614
615fail_ipreserv: 615fail_ipreserv:
616 if (dip->i_alloc->al_rgd) 616 gfs2_inplace_release(dip);
617 gfs2_inplace_release(dip);
618 617
619fail_quota_locks: 618fail_quota_locks:
620 gfs2_quota_unlock(dip); 619 gfs2_quota_unlock(dip);
@@ -731,8 +730,7 @@ static int gfs2_create_inode(struct inode *dir, struct dentry *dentry,
731 brelse(bh); 730 brelse(bh);
732 731
733 gfs2_trans_end(sdp); 732 gfs2_trans_end(sdp);
734 if (dip->i_alloc->al_rgd) 733 gfs2_inplace_release(dip);
735 gfs2_inplace_release(dip);
736 gfs2_quota_unlock(dip); 734 gfs2_quota_unlock(dip);
737 gfs2_alloc_put(dip); 735 gfs2_alloc_put(dip);
738 mark_inode_dirty(inode); 736 mark_inode_dirty(inode);
@@ -896,7 +894,7 @@ static int gfs2_link(struct dentry *old_dentry, struct inode *dir,
896 goto out_gunlock_q; 894 goto out_gunlock_q;
897 895
898 error = gfs2_trans_begin(sdp, sdp->sd_max_dirres + 896 error = gfs2_trans_begin(sdp, sdp->sd_max_dirres +
899 gfs2_rg_blocks(al) + 897 gfs2_rg_blocks(dip) +
900 2 * RES_DINODE + RES_STATFS + 898 2 * RES_DINODE + RES_STATFS +
901 RES_QUOTA, 0); 899 RES_QUOTA, 0);
902 if (error) 900 if (error)
@@ -1371,7 +1369,7 @@ static int gfs2_rename(struct inode *odir, struct dentry *odentry,
1371 goto out_gunlock_q; 1369 goto out_gunlock_q;
1372 1370
1373 error = gfs2_trans_begin(sdp, sdp->sd_max_dirres + 1371 error = gfs2_trans_begin(sdp, sdp->sd_max_dirres +
1374 gfs2_rg_blocks(al) + 1372 gfs2_rg_blocks(ndip) +
1375 4 * RES_DINODE + 4 * RES_LEAF + 1373 4 * RES_DINODE + 4 * RES_LEAF +
1376 RES_STATFS + RES_QUOTA + 4, 0); 1374 RES_STATFS + RES_QUOTA + 4, 0);
1377 if (error) 1375 if (error)