提交 af21ca8e 编写于 作者: B Bob Peterson 提交者: Steven Whitehouse

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: NBob Peterson <rpeterso@redhat.com>
Signed-off-by: NSteven Whitehouse <swhiteho@redhat.com>
上级 37f71577
...@@ -1401,9 +1401,14 @@ static void rg_mblk_search(struct gfs2_rgrpd *rgd, struct gfs2_inode *ip, ...@@ -1401,9 +1401,14 @@ static void rg_mblk_search(struct gfs2_rgrpd *rgd, struct gfs2_inode *ip,
u32 extlen; u32 extlen;
u32 free_blocks = rgd->rd_free_clone - rgd->rd_reserved; u32 free_blocks = rgd->rd_free_clone - rgd->rd_reserved;
int ret; int ret;
struct inode *inode = &ip->i_inode;
if (S_ISDIR(inode->i_mode))
extlen = 1;
else {
extlen = max_t(u32, atomic_read(&rs->rs_sizehint), requested); extlen = max_t(u32, atomic_read(&rs->rs_sizehint), requested);
extlen = clamp(extlen, RGRP_RSRV_MINBLKS, free_blocks); extlen = clamp(extlen, RGRP_RSRV_MINBLKS, free_blocks);
}
if ((rgd->rd_free_clone < rgd->rd_reserved) || (free_blocks < extlen)) if ((rgd->rd_free_clone < rgd->rd_reserved) || (free_blocks < extlen))
return; return;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册