1 From 5641cdf29b90a83166aab8bc4f97b39df59d9359 Mon Sep 17 00:00:00 2001
2 From: Yunlei He <heyunlei@huawei.com>
3 Date: Tue, 6 Nov 2018 10:25:29 +0800
4 Subject: f2fs: move dir data flush to write checkpoint process
6 [ Upstream commit b61ac5b720146c619c7cdf17eff2551b934399e5 ]
8 This patch move dir data flush to write checkpoint process, by
9 doing this, it may reduce some time for dir fsync.
12 -f2fs_do_sync_file enter
13 -file_write_and_wait_range <- flush & wait
15 -do_checkpoint <- wait all
16 -f2fs_do_sync_file exit
19 -f2fs_do_sync_file enter
21 -block_operations <- flush dir & no wait
22 -do_checkpoint <- wait all
23 -f2fs_do_sync_file exit
25 Signed-off-by: Yunlei He <heyunlei@huawei.com>
26 Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
27 Signed-off-by: Sasha Levin <sashal@kernel.org>
29 fs/f2fs/file.c | 3 +++
30 1 file changed, 3 insertions(+)
32 diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
33 index 7d3189f1941c..5f549bc4e097 100644
36 @@ -205,6 +205,9 @@ static int f2fs_do_sync_file(struct file *file, loff_t start, loff_t end,
38 trace_f2fs_sync_file_enter(inode);
40 + if (S_ISDIR(inode->i_mode))
43 /* if fdatasync is triggered, let's do in-place-update */
44 if (datasync || get_dirty_pages(inode) <= SM_I(sbi)->min_fsync_blocks)
45 set_inode_flag(inode, FI_NEED_IPU);