f2fs: move dir data flush to write checkpoint process
PATCH 1/1 f2fs: move dir data flush to write checkpoint process
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
--- fs/f2fs/file.c | 3 +++ 1 file changed, 3 insertions(+)
fs/f2fs/file.c +3 -0
@@ -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 );
Signature · 1 line
1.9.1
Quoted 27 lines · Yunlei He
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 exitnow:
-f2fs_do_sync_file enter
-write_checkpoint
-block_operations <- flush dir & no wait
-do_checkpoint <- wait all
-f2fs_do_sync_file exitSigned-off-by Yunlei He <[email protected]>--- fs/f2fs/file.c | 3 +++ 1 file changed, 3 insertions(+)fs/f2fs/file.c +0
-0
fs/f2fs/file.c static int f2fs_do_sync_file(struct file *file, loff_t start, loff_t end, · line 220
Quoted 5 lines
fs/f2fs/file.c +2
-0@@ -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;
Not sure, will we skip calling f2fs_write_inode due to this check? so we will miss some metadata update cached in inode cache?
Thanks,
Quoted 5 lines
fs/f2fs/file.c +1
-0+/* 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 );
Quoted 40 lines
-----Original Message-----
From: Yuchao (T)
Sent: Tuesday, November 06, 2018 5:20 PM
To: heyunlei; [email protected]; [email protected]
Cc: [email protected]; miaoxie (A)
Subject: Re: [f2fs-dev][PATCH] f2fs: move dir data flush to write checkpoint processQuoted 28 lines · Yunlei He
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 exitnow:
-f2fs_do_sync_file enter
-write_checkpoint
-block_operations <- flush dir & no wait
-do_checkpoint <- wait all
-f2fs_do_sync_file exitSigned-off-by Yunlei He <[email protected]>--- fs/f2fs/file.c | 3 +++ 1 file changed, 3 insertions(+)fs/f2fs/file.c +0
-0@@ -216,6 +216,9 @@ static int f2fs_do_sync_file(struct file *file, loff_t start, loff_t end,
Quoted 7 lines
fs/f2fs/file.c static int f2fs_do_sync_file(struct file *file, loff_t start, loff_t end, · line 220
Quoted 4 lines
fs/f2fs/file.c +2
-0trace_f2fs_sync_file_enter (inode); +if (S_ISDIR (inode->i_mode)) + goto go_write;Not sure, will we skip calling
f2fs_write_inodedue to this check? so we will miss some metadata update cached in inode cache?
Here,new checkpoint will update all dirty inodes metadata from inode cache to inode page? Or maybe we just skip file_write_and_wait_range action for I found it will always write a checkpoint even the dir is clean.
And then, I test the original code:
Mkdir A
Sync A
While true
Fsync A
Everytime fsync the clean directory A,f2fs will write a new checkpoint also.
Thanks.
Quoted 8 lines
Thanks,
Quoted 5 lines
fs/f2fs/file.c +1
-0+/* 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 );
_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel