diff options
author | Jin Xu <jinuxstyle@gmail.com> | 2013-08-15 19:17:01 +0800 |
---|---|---|
committer | Andreas Blaesius <skate4life@gmx.de> | 2016-06-05 21:20:36 +0200 |
commit | 25856a6db4b41e930f9202df86d5c4a1961c9fc0 (patch) | |
tree | c1a0e4335f9aa4fea83df2a6b409c93339827b31 /fs/f2fs | |
parent | 22d9eadfcae107a927ab73658427656f0a16a557 (diff) | |
download | kernel_samsung_espresso10-25856a6db4b41e930f9202df86d5c4a1961c9fc0.zip kernel_samsung_espresso10-25856a6db4b41e930f9202df86d5c4a1961c9fc0.tar.gz kernel_samsung_espresso10-25856a6db4b41e930f9202df86d5c4a1961c9fc0.tar.bz2 |
f2fs: avoid writing inode redundantly when creating a file
In f2fs_write_inode, updating inode after f2fs_balance_fs is not
a optimized way in the case that f2fs_gc is performed ahead. The
inode page will be unnecessarily written out twice, one of which
is in f2fs_gc->...->sync_node_pages and the other is in
update_inode_page.
Let's update the inode page in prior to f2fs_balance_fs to avoid
this.
To reproduce it,
$ touch file (before this step, should make the device need f2fs_gc)
$ sync (or wait the bdi to write dirty inode)
Signed-off-by: Jin Xu <jinuxstyle@gmail.com>
Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
Diffstat (limited to 'fs/f2fs')
-rw-r--r-- | fs/f2fs/inode.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/fs/f2fs/inode.c b/fs/f2fs/inode.c index 46a7b52..7f44b8a 100644 --- a/fs/f2fs/inode.c +++ b/fs/f2fs/inode.c @@ -221,9 +221,6 @@ int f2fs_write_inode(struct inode *inode, struct writeback_control *wbc) if (!is_inode_flag_set(F2FS_I(inode), FI_DIRTY_INODE)) return 0; - if (wbc) - f2fs_balance_fs(sbi); - /* * We need to lock here to prevent from producing dirty node pages * during the urgent cleaning time when runing out of free sections. @@ -231,6 +228,10 @@ int f2fs_write_inode(struct inode *inode, struct writeback_control *wbc) ilock = mutex_lock_op(sbi); ret = update_inode_page(inode); mutex_unlock_op(sbi, ilock); + + if (wbc) + f2fs_balance_fs(sbi); + return ret; } |