diff options
author | Steven Whitehouse <swhiteho@redhat.com> | 2011-09-01 08:31:59 -0400 |
---|---|---|
committer | Steven Whitehouse <swhiteho@redhat.com> | 2011-10-21 07:39:34 -0400 |
commit | 54335b1fca27b84baa75b1f45985d98262003837 (patch) | |
tree | c6b21aff1759d86be56208e9981117e4383c3f47 /fs/gfs2/file.c | |
parent | 8339ee543ece6e2dcc1bbd97d5350163c198cf00 (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/file.c')
-rw-r--r-- | fs/gfs2/file.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/fs/gfs2/file.c b/fs/gfs2/file.c index d717b72500a4..3467f3662149 100644 --- a/fs/gfs2/file.c +++ b/fs/gfs2/file.c | |||
@@ -397,7 +397,7 @@ static int gfs2_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf) | |||
397 | rblocks += data_blocks ? data_blocks : 1; | 397 | rblocks += data_blocks ? data_blocks : 1; |
398 | if (ind_blocks || data_blocks) { | 398 | if (ind_blocks || data_blocks) { |
399 | rblocks += RES_STATFS + RES_QUOTA; | 399 | rblocks += RES_STATFS + RES_QUOTA; |
400 | rblocks += gfs2_rg_blocks(al); | 400 | rblocks += gfs2_rg_blocks(ip); |
401 | } | 401 | } |
402 | ret = gfs2_trans_begin(sdp, rblocks, 0); | 402 | ret = gfs2_trans_begin(sdp, rblocks, 0); |
403 | if (ret) | 403 | if (ret) |
@@ -823,7 +823,7 @@ static void calc_max_reserv(struct gfs2_inode *ip, loff_t max, loff_t *len, | |||
823 | unsigned int *data_blocks, unsigned int *ind_blocks) | 823 | unsigned int *data_blocks, unsigned int *ind_blocks) |
824 | { | 824 | { |
825 | const struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode); | 825 | const struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode); |
826 | unsigned int max_blocks = ip->i_alloc->al_rgd->rd_free_clone; | 826 | unsigned int max_blocks = ip->i_rgd->rd_free_clone; |
827 | unsigned int tmp, max_data = max_blocks - 3 * (sdp->sd_max_height - 1); | 827 | unsigned int tmp, max_data = max_blocks - 3 * (sdp->sd_max_height - 1); |
828 | 828 | ||
829 | for (tmp = max_data; tmp > sdp->sd_diptrs;) { | 829 | for (tmp = max_data; tmp > sdp->sd_diptrs;) { |
@@ -912,7 +912,7 @@ retry: | |||
912 | al->al_requested = data_blocks + ind_blocks; | 912 | al->al_requested = data_blocks + ind_blocks; |
913 | 913 | ||
914 | rblocks = RES_DINODE + ind_blocks + RES_STATFS + RES_QUOTA + | 914 | rblocks = RES_DINODE + ind_blocks + RES_STATFS + RES_QUOTA + |
915 | RES_RG_HDR + gfs2_rg_blocks(al); | 915 | RES_RG_HDR + gfs2_rg_blocks(ip); |
916 | if (gfs2_is_jdata(ip)) | 916 | if (gfs2_is_jdata(ip)) |
917 | rblocks += data_blocks ? data_blocks : 1; | 917 | rblocks += data_blocks ? data_blocks : 1; |
918 | 918 | ||