aboutsummaryrefslogtreecommitdiffstats
path: root/fs/gfs2
diff options
context:
space:
mode:
authorBob Peterson <rpeterso@redhat.com>2013-05-14 13:04:29 -0400
committerSteven Whitehouse <swhiteho@redhat.com>2013-05-24 08:47:32 -0400
commitaf21ca8ed50f01c5278c5ded6dad6f05e8a5d2e4 (patch)
treeb946cf57b899c5c056da802ad95393028140e12e /fs/gfs2
parent37f715774e2dd9ae521334dbbc3af63becd47adb (diff)
GFS2: Use single-block reservations for directories
This patch changes the multi-block allocation code, such that directory inodes only get a single block reserved in the bitmap. That way, the bitmaps are more tightly packed together, and there are fewer spans of free blocks for in-use block reservations. This means it takes less time to find a free span of blocks in the bitmap, which speeds things up. This increases the performance of some workloads by almost 2X. In Nate's mockup.py script (which does (1) create dir, (2) create dir in dir, (3) create file in that dir) the test executes in 23 steps rather than 43 steps, a 47% performance improvement. Signed-off-by: Bob Peterson <rpeterso@redhat.com> Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
Diffstat (limited to 'fs/gfs2')
-rw-r--r--fs/gfs2/rgrp.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/fs/gfs2/rgrp.c b/fs/gfs2/rgrp.c
index 0c5a575b513e..5232525934ae 100644
--- a/fs/gfs2/rgrp.c
+++ b/fs/gfs2/rgrp.c
@@ -1401,9 +1401,14 @@ static void rg_mblk_search(struct gfs2_rgrpd *rgd, struct gfs2_inode *ip,
1401 u32 extlen; 1401 u32 extlen;
1402 u32 free_blocks = rgd->rd_free_clone - rgd->rd_reserved; 1402 u32 free_blocks = rgd->rd_free_clone - rgd->rd_reserved;
1403 int ret; 1403 int ret;
1404 struct inode *inode = &ip->i_inode;
1404 1405
1405 extlen = max_t(u32, atomic_read(&rs->rs_sizehint), requested); 1406 if (S_ISDIR(inode->i_mode))
1406 extlen = clamp(extlen, RGRP_RSRV_MINBLKS, free_blocks); 1407 extlen = 1;
1408 else {
1409 extlen = max_t(u32, atomic_read(&rs->rs_sizehint), requested);
1410 extlen = clamp(extlen, RGRP_RSRV_MINBLKS, free_blocks);
1411 }
1407 if ((rgd->rd_free_clone < rgd->rd_reserved) || (free_blocks < extlen)) 1412 if ((rgd->rd_free_clone < rgd->rd_reserved) || (free_blocks < extlen))
1408 return; 1413 return;
1409 1414