aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ext3
diff options
context:
space:
mode:
authorJan Kara <jack@suse.cz>2014-03-04 05:52:16 -0500
committerJan Kara <jack@suse.cz>2014-03-12 17:48:02 -0400
commit2299432e1950c9ac0aa649d4617374ea24b6f131 (patch)
tree8a376b4a81039ab5d0cd739aed46b0272f1f792c /fs/ext3
parentcbcf27a9927e32931389980ee770f206377eb21b (diff)
ext3: Speedup WB_SYNC_ALL pass
When doing filesystem wide sync, there's no need to force transaction commit separately for each inode because ext3_sync_fs() takes care of forcing commit at the end. Most of the time this slowness doesn't manifest because previous WB_SYNC_NONE writeback doesn't leave much to write but when there are processes aggressively creating new files and several filesystems to sync, the sync slowness can be noticeable. In the following test script sync(1) takes around 6 minutes when there are two ext3 filesystems mounted on a standard SATA drive. After this patch sync is about twice as fast in the default data=ordered mode. For data=writeback mode we have even bigger speedup. function run_writers { for (( i = 0; i < 10; i++ )); do mkdir $1/dir$i for (( j = 0; j < 40000; j++ )); do dd if=/dev/zero of=$1/dir$i/$j bs=4k count=4 &>/dev/null done & done } for dir in "$@"; do run_writers $dir done sleep 40 time sync Signed-off-by: Jan Kara <jack@suse.cz>
Diffstat (limited to 'fs/ext3')
-rw-r--r--fs/ext3/inode.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/fs/ext3/inode.c b/fs/ext3/inode.c
index 4ecf88fb69a8..ddf5c21cffbc 100644
--- a/fs/ext3/inode.c
+++ b/fs/ext3/inode.c
@@ -3210,7 +3210,12 @@ int ext3_write_inode(struct inode *inode, struct writeback_control *wbc)
3210 return -EIO; 3210 return -EIO;
3211 } 3211 }
3212 3212
3213 if (wbc->sync_mode != WB_SYNC_ALL) 3213 /*
3214 * No need to force transaction in WB_SYNC_NONE mode. Also
3215 * ext3_sync_fs() will force the commit after everything is
3216 * written.
3217 */
3218 if (wbc->sync_mode != WB_SYNC_ALL || wbc->for_sync)
3214 return 0; 3219 return 0;
3215 3220
3216 return ext3_force_commit(inode->i_sb); 3221 return ext3_force_commit(inode->i_sb);