summaryrefslogtreecommitdiffstats
path: root/fs/ext3/file.c
diff options
context:
space:
mode:
authorMingming Cao <cmm@us.ibm.com>2005-06-28 20:45:16 -0700
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-06-28 21:20:35 -0700
commit21fe3471c3aaa5c489c5d3a4d705291eb7511248 (patch)
treed1074604279a899f617d6653b42a31e01226f824 /fs/ext3/file.c
parentfb3cc4320e1fd87143683b540e459a2e20fdc9bb (diff)
downloadlinux-stable-21fe3471c3aaa5c489c5d3a4d705291eb7511248.tar.gz
linux-stable-21fe3471c3aaa5c489c5d3a4d705291eb7511248.tar.bz2
linux-stable-21fe3471c3aaa5c489c5d3a4d705291eb7511248.zip
[PATCH] ext3: reduce allocate-with-reservation lock latencies
Currently in ext3 block reservation code, the global filesystem reservation tree lock (rsv_block) is hold during the process of searching for a space to make a new reservation window, including while scaning the block bitmap to verify if the avalible window has a free block. Holding the lock during bitmap scan is unnecessary and could possibly cause scalability issue and latency issues. This patch tries to address this by dropping the lock before scan the bitmap. Before that we need to reserve the open window in case someone else is targetting at the same window. Question was should we reserve the whole free reservable space or just the window size we need. Reserve the whole free reservable space will possibly force other threads which intended to do block allocation nearby move to another block group(cause bad layout). In this patch, we just reserve the desired size before drop the lock and scan the block bitmap. This patch fixed a ext3 reservation latency issue seen on a cvs check out test. Patch is tested with many fsx, tiobench, dbench and untar a kernel test. Signed-Off-By: Mingming Cao <cmm@us.ibm.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'fs/ext3/file.c')
-rw-r--r--fs/ext3/file.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/fs/ext3/file.c b/fs/ext3/file.c
index 5ad8cf0292df..98e78345ead9 100644
--- a/fs/ext3/file.c
+++ b/fs/ext3/file.c
@@ -36,7 +36,11 @@ static int ext3_release_file (struct inode * inode, struct file * filp)
/* if we are the last writer on the inode, drop the block reservation */
if ((filp->f_mode & FMODE_WRITE) &&
(atomic_read(&inode->i_writecount) == 1))
+ {
+ down(&EXT3_I(inode)->truncate_sem);
ext3_discard_reservation(inode);
+ up(&EXT3_I(inode)->truncate_sem);
+ }
if (is_dx(inode) && filp->private_data)
ext3_htree_free_dir_info(filp->private_data);