All of lore.kernel.org
 help / color / mirror / Atom feed
* [f2fs-dev] [PATCH] f2fs: compress: remove unneeded read when rewrite whole cluster
@ 2021-06-10  3:28 Fengnan Chang via Linux-f2fs-devel
  2021-06-21  6:49 ` Fengnan Chang
  0 siblings, 1 reply; 3+ messages in thread
From: Fengnan Chang via Linux-f2fs-devel @ 2021-06-10  3:28 UTC (permalink / raw)
  To: jaegeuk, chao, linux-f2fs-devel; +Cc: Fengnan Chang

For now, when overwrite compressed file, we need read old data to page
cache first and update pages.
But when we need overwrite whole cluster, we don't need old data
anymore.
So, remove read data process in this case, I have made
some simple changes to test, tests have shown that this can lead to
significant performance improvements, the speed of sequential write
up to 2x.

This modificy just check wheather the whole page was dirty, because
when writeback cache f2fs_prepare_compress_overwrite will be called again.
when update whole cluster, cc in prepare_compress_overwrite will be
empty, so will not read old data.
when only update one page in cluster,  cc in prepae_compress_overwrite
will not be empty, so will read old data.

Signed-off-by: Fengnan Chang <changfengnan@vivo.com>
Signed-off-by: Chao Yu <yuchao0@huawei.com>
---
 fs/f2fs/data.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
index d4795eda12fa..9376c62e0ecc 100644
--- a/fs/f2fs/data.c
+++ b/fs/f2fs/data.c
@@ -3307,6 +3307,9 @@ static int f2fs_write_begin(struct file *file, struct address_space *mapping,

 		*fsdata = NULL;

+		if (len == PAGE_SIZE)
+			goto repeat;
+
 		ret = f2fs_prepare_compress_overwrite(inode, pagep,
 							index, fsdata);
 		if (ret < 0) {
-- 
2.29.0



_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [f2fs-dev] [PATCH] f2fs: compress: remove unneeded read when rewrite whole cluster
  2021-06-10  3:28 [f2fs-dev] [PATCH] f2fs: compress: remove unneeded read when rewrite whole cluster Fengnan Chang via Linux-f2fs-devel
@ 2021-06-21  6:49 ` Fengnan Chang
  2021-06-21 23:45   ` Chao Yu
  0 siblings, 1 reply; 3+ messages in thread
From: Fengnan Chang @ 2021-06-21  6:49 UTC (permalink / raw)
  To: jaegeuk, chao, linux-f2fs-devel

Hi chao & jaegeuk:
   Any comments about this?

Thanks.

On 2021/6/10 11:28, Fengnan Chang wrote:
> For now, when overwrite compressed file, we need read old data to page
> cache first and update pages.
> But when we need overwrite whole cluster, we don't need old data
> anymore.
> So, remove read data process in this case, I have made
> some simple changes to test, tests have shown that this can lead to
> significant performance improvements, the speed of sequential write
> up to 2x.
> 
> This modificy just check wheather the whole page was dirty, because
> when writeback cache f2fs_prepare_compress_overwrite will be called again.
> when update whole cluster, cc in prepare_compress_overwrite will be
> empty, so will not read old data.
> when only update one page in cluster,  cc in prepae_compress_overwrite
> will not be empty, so will read old data.
> 
> Signed-off-by: Fengnan Chang <changfengnan@vivo.com>
> Signed-off-by: Chao Yu <yuchao0@huawei.com>
> ---
>   fs/f2fs/data.c | 3 +++
>   1 file changed, 3 insertions(+)
> 
> diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
> index d4795eda12fa..9376c62e0ecc 100644
> --- a/fs/f2fs/data.c
> +++ b/fs/f2fs/data.c
> @@ -3307,6 +3307,9 @@ static int f2fs_write_begin(struct file *file, struct address_space *mapping,
> 
>   		*fsdata = NULL;
> 
> +		if (len == PAGE_SIZE)
> +			goto repeat;
> +
>   		ret = f2fs_prepare_compress_overwrite(inode, pagep,
>   							index, fsdata);
>   		if (ret < 0) {
> 


_______________________________________________
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

* Re: [f2fs-dev] [PATCH] f2fs: compress: remove unneeded read when rewrite whole cluster
  2021-06-21  6:49 ` Fengnan Chang
@ 2021-06-21 23:45   ` Chao Yu
  0 siblings, 0 replies; 3+ messages in thread
From: Chao Yu @ 2021-06-21 23:45 UTC (permalink / raw)
  To: Fengnan Chang; +Cc: jaegeuk, linux-f2fs-devel

On 2021/6/21 14:49, Fengnan Chang wrote:
> Hi chao & jaegeuk:
>    Any comments about this?
> 
> Thanks.
> 
> On 2021/6/10 11:28, Fengnan Chang wrote:
>> For now, when overwrite compressed file, we need read old data to page
>> cache first and update pages.
>> But when we need overwrite whole cluster, we don't need old data
>> anymore.

Commit message needs to be updated as:

when we overwrite the whole page in cluster, we don't need read original
data before write, because after write_end(), writepages() can help to
load left data in that cluster.

Acked-by: Chao Yu <yuchao0@huawei.com>

Thanks,

>> So, remove read data process in this case, I have made
>> some simple changes to test, tests have shown that this can lead to
>> significant performance improvements, the speed of sequential write
>> up to 2x.
>>
>> This modificy just check wheather the whole page was dirty, because
>> when writeback cache f2fs_prepare_compress_overwrite will be called again.
>> when update whole cluster, cc in prepare_compress_overwrite will be
>> empty, so will not read old data.
>> when only update one page in cluster,  cc in prepae_compress_overwrite
>> will not be empty, so will read old data.
>>
>> Signed-off-by: Fengnan Chang <changfengnan@vivo.com>
>> Signed-off-by: Chao Yu <yuchao0@huawei.com>
>> ---
>>   fs/f2fs/data.c | 3 +++
>>   1 file changed, 3 insertions(+)
>>
>> diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
>> index d4795eda12fa..9376c62e0ecc 100644
>> --- a/fs/f2fs/data.c
>> +++ b/fs/f2fs/data.c
>> @@ -3307,6 +3307,9 @@ static int f2fs_write_begin(struct file *file, struct address_space *mapping,
>>
>>           *fsdata = NULL;
>>
>> +        if (len == PAGE_SIZE)
>> +            goto repeat;
>> +
>>           ret = f2fs_prepare_compress_overwrite(inode, pagep,
>>                               index, fsdata);
>>           if (ret < 0) {
>>


_______________________________________________
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:[~2021-06-21 23:46 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-10  3:28 [f2fs-dev] [PATCH] f2fs: compress: remove unneeded read when rewrite whole cluster Fengnan Chang via Linux-f2fs-devel
2021-06-21  6:49 ` Fengnan Chang
2021-06-21 23:45   ` Chao Yu

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.