[PATCH 2/2] f2fs: avoid writepage lock when many threads call fsync

From: Jaegeuk Kim
Date: Fri Mar 11 2016 - 19:15:00 EST


If many threads try to write small number of data and fsync, we should avoid
writepages lock contention.

Signed-off-by: Jaegeuk Kim <jaegeuk@xxxxxxxxxx>
---
fs/f2fs/data.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
index e5c762b..fb75699 100644
--- a/fs/f2fs/data.c
+++ b/fs/f2fs/data.c
@@ -1400,7 +1400,8 @@ static int f2fs_write_data_pages(struct address_space *mapping,

diff = nr_pages_to_write(sbi, DATA, wbc);

- if (!S_ISDIR(inode->i_mode) && wbc->sync_mode == WB_SYNC_ALL) {
+ if (!S_ISDIR(inode->i_mode) && wbc->sync_mode == WB_SYNC_ALL &&
+ !is_inode_flag_set(F2FS_I(inode), FI_NEED_IPU)) {
mutex_lock(&sbi->writepages);
locked = true;
}
--
2.6.3