summaryrefslogtreecommitdiff
path: root/fs/gfs2/trans.h
diff options
context:
space:
mode:
authorSteven Whitehouse <swhiteho@redhat.com>2011-09-01 16:31:59 +0400
committerSteven Whitehouse <swhiteho@redhat.com>2011-10-21 15:39:34 +0400
commit54335b1fca27b84baa75b1f45985d98262003837 (patch)
treec6b21aff1759d86be56208e9981117e4383c3f47 /fs/gfs2/trans.h
parent8339ee543ece6e2dcc1bbd97d5350163c198cf00 (diff)
downloadlinux-54335b1fca27b84baa75b1f45985d98262003837.tar.xz
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/trans.h')
-rw-r--r--fs/gfs2/trans.h8
1 files changed, 5 insertions, 3 deletions
diff --git a/fs/gfs2/trans.h b/fs/gfs2/trans.h
index 980c5c05398a..f8f101ef600c 100644
--- a/fs/gfs2/trans.h
+++ b/fs/gfs2/trans.h
@@ -28,10 +28,12 @@ struct gfs2_glock;
/* reserve either the number of blocks to be allocated plus the rg header
* block, or all of the blocks in the rg, whichever is smaller */
-static inline unsigned int gfs2_rg_blocks(const struct gfs2_alloc *al)
+static inline unsigned int gfs2_rg_blocks(const struct gfs2_inode *ip)
{
- return (al->al_requested < al->al_rgd->rd_length)?
- al->al_requested + 1 : al->al_rgd->rd_length;
+ const struct gfs2_alloc *al = ip->i_alloc;
+ if (al->al_requested < ip->i_rgd->rd_length)
+ return al->al_requested + 1;
+ return ip->i_rgd->rd_length;
}
extern int gfs2_trans_begin(struct gfs2_sbd *sdp, unsigned int blocks,