* [PATCH] f2fs: move dir data flush to write checkpoint process
@ 2018-11-06 2:25 Yunlei He
2018-11-06 9:19 ` Chao Yu
0 siblings, 1 reply; 3+ messages in thread
From: Yunlei He @ 2018-11-06 2:25 UTC (permalink / raw)
To: jaegeuk, yuchao0, chao; +Cc: miaoxie, linux-f2fs-devel
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>
---
fs/f2fs/file.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
index 88b1246..9eaf07f 100644
--- a/fs/f2fs/file.c
+++ b/fs/f2fs/file.c
@@ -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);
--
1.9.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] f2fs: move dir data flush to write checkpoint process
2018-11-06 2:25 [PATCH] f2fs: move dir data flush to write checkpoint process Yunlei He
@ 2018-11-06 9:19 ` Chao Yu
2018-11-06 11:19 ` heyunlei
0 siblings, 1 reply; 3+ messages in thread
From: Chao Yu @ 2018-11-06 9:19 UTC (permalink / raw)
To: Yunlei He, jaegeuk, chao; +Cc: miaoxie, linux-f2fs-devel
On 2018/11/6 10:25, Yunlei He wrote:
> 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>
> ---
> fs/f2fs/file.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
> index 88b1246..9eaf07f 100644
> --- a/fs/f2fs/file.c
> +++ b/fs/f2fs/file.c
> @@ -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,
> +
> /* 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);
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] f2fs: move dir data flush to write checkpoint process
2018-11-06 9:19 ` Chao Yu
@ 2018-11-06 11:19 ` heyunlei
0 siblings, 0 replies; 3+ messages in thread
From: heyunlei @ 2018-11-06 11:19 UTC (permalink / raw)
To: Yuchao (T), jaegeuk, chao; +Cc: miaoxie (A), linux-f2fs-devel
>-----Original Message-----
>From: Yuchao (T)
>Sent: Tuesday, November 06, 2018 5:20 PM
>To: heyunlei; jaegeuk@kernel.org; chao@kernel.org
>Cc: linux-f2fs-devel@lists.sourceforge.net; miaoxie (A)
>Subject: Re: [f2fs-dev][PATCH] f2fs: move dir data flush to write checkpoint process
>
>
>
>On 2018/11/6 10:25, Yunlei He wrote:
>> 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>
>> ---
>> fs/f2fs/file.c | 3 +++
>> 1 file changed, 3 insertions(+)
>>
>> diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
>> index 88b1246..9eaf07f 100644
>> --- a/fs/f2fs/file.c
>> +++ b/fs/f2fs/file.c
>> @@ -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?
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.
>
>Thanks,
>
>> +
>> /* 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
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-11-06 11:19 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-06 2:25 [PATCH] f2fs: move dir data flush to write checkpoint process Yunlei He
2018-11-06 9:19 ` Chao Yu
2018-11-06 11:19 ` heyunlei
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.