f2fs: move dir data flush to write checkpoint process
authorYunlei He <heyunlei@huawei.com>
Tue, 6 Nov 2018 02:25:29 +0000 (10:25 +0800)
committerJaegeuk Kim <jaegeuk@kernel.org>
Wed, 2 Jan 2019 23:44:47 +0000 (15:44 -0800)
This patch move dir data flush to write checkpoint process, by
doing this, it may reduce some time for dir fsync.

pre:
-f2fs_do_sync_file enter
-file_write_and_wait_range  <- flush & wait
-write_checkpoint
-do_checkpoint     <- wait all
-f2fs_do_sync_file exit

now:
-f2fs_do_sync_file enter
-write_checkpoint
-block_operations   <- flush dir & no wait
-do_checkpoint     <- wait all
-f2fs_do_sync_file exit

Signed-off-by: Yunlei He <heyunlei@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
fs/f2fs/file.c

index 7834de01becc0b8f873b4335280f8a8a1c5f60aa..5a2ca734b6d80a3b77a867111ad1b5e17055064d 100644 (file)
@@ -216,6 +216,9 @@ static int f2fs_do_sync_file(struct file *file, loff_t start, loff_t end,
 
        trace_f2fs_sync_file_enter(inode);
 
+       if (S_ISDIR(inode->i_mode))
+               goto go_write;
+
        /* if fdatasync is triggered, let's do in-place-update */
        if (datasync || get_dirty_pages(inode) <= SM_I(sbi)->min_fsync_blocks)
                set_inode_flag(inode, FI_NEED_IPU);