linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] f2fs: include non-compressed blocks in compr_written_block
@ 2021-10-06 17:49 Daeho Jeong
  2021-10-09  4:44 ` [f2fs-dev] " Chao Yu
  0 siblings, 1 reply; 9+ messages in thread
From: Daeho Jeong @ 2021-10-06 17:49 UTC (permalink / raw)
  To: linux-kernel, linux-f2fs-devel, kernel-team; +Cc: Daeho Jeong

From: Daeho Jeong <daehojeong@google.com>

Need to include non-compressed blocks in compr_written_block to
estimate average compression ratio more accurately.

Signed-off-by: Daeho Jeong <daehojeong@google.com>
---
 fs/f2fs/compress.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/fs/f2fs/compress.c b/fs/f2fs/compress.c
index c1bf9ad4c220..9b663eaf4805 100644
--- a/fs/f2fs/compress.c
+++ b/fs/f2fs/compress.c
@@ -1530,6 +1530,7 @@ int f2fs_write_multi_pages(struct compress_ctx *cc,
 	if (cluster_may_compress(cc)) {
 		err = f2fs_compress_pages(cc);
 		if (err == -EAGAIN) {
+			add_compr_block_stat(cc->inode, cc->cluster_size);
 			goto write;
 		} else if (err) {
 			f2fs_put_rpages_wbc(cc, wbc, true, 1);
-- 
2.33.0.882.g93a45727a2-goog


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

* Re: [f2fs-dev] [PATCH] f2fs: include non-compressed blocks in compr_written_block
  2021-10-06 17:49 [PATCH] f2fs: include non-compressed blocks in compr_written_block Daeho Jeong
@ 2021-10-09  4:44 ` Chao Yu
  2021-10-11 16:02   ` Daeho Jeong
  0 siblings, 1 reply; 9+ messages in thread
From: Chao Yu @ 2021-10-09  4:44 UTC (permalink / raw)
  To: Daeho Jeong, linux-kernel, linux-f2fs-devel, kernel-team; +Cc: Daeho Jeong

On 2021/10/7 1:49, Daeho Jeong wrote:
> From: Daeho Jeong <daehojeong@google.com>
> 
> Need to include non-compressed blocks in compr_written_block to
> estimate average compression ratio more accurately.
> 
> Signed-off-by: Daeho Jeong <daehojeong@google.com>
> ---
>   fs/f2fs/compress.c | 1 +
>   1 file changed, 1 insertion(+)
> 
> diff --git a/fs/f2fs/compress.c b/fs/f2fs/compress.c
> index c1bf9ad4c220..9b663eaf4805 100644
> --- a/fs/f2fs/compress.c
> +++ b/fs/f2fs/compress.c
> @@ -1530,6 +1530,7 @@ int f2fs_write_multi_pages(struct compress_ctx *cc,
>   	if (cluster_may_compress(cc)) {
>   		err = f2fs_compress_pages(cc);
>   		if (err == -EAGAIN) {
> +			add_compr_block_stat(cc->inode, cc->cluster_size);

Shouldn't we relocate this after 'write' label?

One more concern, it looks we've changed what compr_block stat indicated,
literally, the block we account should be compressed..., how about accounting
it by introducing .presist_blocks, used_blocks or occupied_blocks.... thoughts?

Thanks,

>   			goto write;
>   		} else if (err) {
>   			f2fs_put_rpages_wbc(cc, wbc, true, 1);
> 

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

* Re: [f2fs-dev] [PATCH] f2fs: include non-compressed blocks in compr_written_block
  2021-10-09  4:44 ` [f2fs-dev] " Chao Yu
@ 2021-10-11 16:02   ` Daeho Jeong
  2021-10-13 14:17     ` Chao Yu
  0 siblings, 1 reply; 9+ messages in thread
From: Daeho Jeong @ 2021-10-11 16:02 UTC (permalink / raw)
  To: Chao Yu; +Cc: linux-kernel, linux-f2fs-devel, kernel-team, Daeho Jeong

> > diff --git a/fs/f2fs/compress.c b/fs/f2fs/compress.c
> > index c1bf9ad4c220..9b663eaf4805 100644
> > --- a/fs/f2fs/compress.c
> > +++ b/fs/f2fs/compress.c
> > @@ -1530,6 +1530,7 @@ int f2fs_write_multi_pages(struct compress_ctx *cc,
> >       if (cluster_may_compress(cc)) {
> >               err = f2fs_compress_pages(cc);
> >               if (err == -EAGAIN) {
> > +                     add_compr_block_stat(cc->inode, cc->cluster_size);
>
> Shouldn't we relocate this after 'write' label?
>
> One more concern, it looks we've changed what compr_block stat indicated,
> literally, the block we account should be compressed..., how about accounting
> it by introducing .presist_blocks, used_blocks or occupied_blocks.... thoughts?
>

What I wanted to add here is just one case in which compression was
tried, but couldn't save any block, so gave up.
If we put this below the "write" label, we will count blocks, even if
the file is turned off for compression in "user-controlled
compression" mode.
Like the commit comment says, I want to estimate the overall compression rate.
But, if we include every other compression disabled condition, it
won't work like that.

Thanks,

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

* Re: [f2fs-dev] [PATCH] f2fs: include non-compressed blocks in compr_written_block
  2021-10-11 16:02   ` Daeho Jeong
@ 2021-10-13 14:17     ` Chao Yu
  2021-10-13 17:52       ` Daeho Jeong
  0 siblings, 1 reply; 9+ messages in thread
From: Chao Yu @ 2021-10-13 14:17 UTC (permalink / raw)
  To: Daeho Jeong; +Cc: linux-kernel, linux-f2fs-devel, kernel-team, Daeho Jeong

On 2021/10/12 0:02, Daeho Jeong wrote:
>>> diff --git a/fs/f2fs/compress.c b/fs/f2fs/compress.c
>>> index c1bf9ad4c220..9b663eaf4805 100644
>>> --- a/fs/f2fs/compress.c
>>> +++ b/fs/f2fs/compress.c
>>> @@ -1530,6 +1530,7 @@ int f2fs_write_multi_pages(struct compress_ctx *cc,
>>>        if (cluster_may_compress(cc)) {
>>>                err = f2fs_compress_pages(cc);
>>>                if (err == -EAGAIN) {
>>> +                     add_compr_block_stat(cc->inode, cc->cluster_size);
>>
>> Shouldn't we relocate this after 'write' label?
>>
>> One more concern, it looks we've changed what compr_block stat indicated,
>> literally, the block we account should be compressed..., how about accounting
>> it by introducing .presist_blocks, used_blocks or occupied_blocks.... thoughts?
>>
> 
> What I wanted to add here is just one case in which compression was
> tried, but couldn't save any block, so gave up.
> If we put this below the "write" label, we will count blocks, even if
> the file is turned off for compression in "user-controlled
> compression" mode.
> Like the commit comment says, I want to estimate the overall compression rate.
> But, if we include every other compression disabled condition, it
> won't work like that.

Got it, thanks for the explanation.

Any thoughts about renaming compr_block? since some blocks accounted in
.compr_block weren't compressed blocks.

Thanks,

> 
> Thanks,
> 

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

* Re: [f2fs-dev] [PATCH] f2fs: include non-compressed blocks in compr_written_block
  2021-10-13 14:17     ` Chao Yu
@ 2021-10-13 17:52       ` Daeho Jeong
  2021-10-21 11:57         ` Chao Yu
  0 siblings, 1 reply; 9+ messages in thread
From: Daeho Jeong @ 2021-10-13 17:52 UTC (permalink / raw)
  To: Chao Yu; +Cc: linux-kernel, linux-f2fs-devel, kernel-team, Daeho Jeong

Sorry, many parts of userspace already rely on these names.
I wrote that compr_written_blocks shows the block count written after
compression since mount.
So, the count of blocks written as original data after compression
because of no gain would not be an exception.

Thanks,


On Wed, Oct 13, 2021 at 7:17 AM Chao Yu <chao@kernel.org> wrote:
>
> On 2021/10/12 0:02, Daeho Jeong wrote:
> >>> diff --git a/fs/f2fs/compress.c b/fs/f2fs/compress.c
> >>> index c1bf9ad4c220..9b663eaf4805 100644
> >>> --- a/fs/f2fs/compress.c
> >>> +++ b/fs/f2fs/compress.c
> >>> @@ -1530,6 +1530,7 @@ int f2fs_write_multi_pages(struct compress_ctx *cc,
> >>>        if (cluster_may_compress(cc)) {
> >>>                err = f2fs_compress_pages(cc);
> >>>                if (err == -EAGAIN) {
> >>> +                     add_compr_block_stat(cc->inode, cc->cluster_size);
> >>
> >> Shouldn't we relocate this after 'write' label?
> >>
> >> One more concern, it looks we've changed what compr_block stat indicated,
> >> literally, the block we account should be compressed..., how about accounting
> >> it by introducing .presist_blocks, used_blocks or occupied_blocks.... thoughts?
> >>
> >
> > What I wanted to add here is just one case in which compression was
> > tried, but couldn't save any block, so gave up.
> > If we put this below the "write" label, we will count blocks, even if
> > the file is turned off for compression in "user-controlled
> > compression" mode.
> > Like the commit comment says, I want to estimate the overall compression rate.
> > But, if we include every other compression disabled condition, it
> > won't work like that.
>
> Got it, thanks for the explanation.
>
> Any thoughts about renaming compr_block? since some blocks accounted in
> .compr_block weren't compressed blocks.
>
> Thanks,
>
> >
> > Thanks,
> >

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

* Re: [f2fs-dev] [PATCH] f2fs: include non-compressed blocks in compr_written_block
  2021-10-13 17:52       ` Daeho Jeong
@ 2021-10-21 11:57         ` Chao Yu
  2021-10-21 15:51           ` Daeho Jeong
  0 siblings, 1 reply; 9+ messages in thread
From: Chao Yu @ 2021-10-21 11:57 UTC (permalink / raw)
  To: Daeho Jeong; +Cc: linux-kernel, linux-f2fs-devel, kernel-team, Daeho Jeong

On 2021/10/14 1:52, Daeho Jeong wrote:
> Sorry, many parts of userspace already rely on these names.
> I wrote that compr_written_blocks shows the block count written after
> compression since mount.
> So, the count of blocks written as original data after compression
> because of no gain would not be an exception.

Okay, shouldn't we Cc stable mailing list for this patch? otherwise
userspace tool may get different stat number with the same compressed
file in different kernel?

Thanks,

> 
> Thanks,
> 
> 
> On Wed, Oct 13, 2021 at 7:17 AM Chao Yu <chao@kernel.org> wrote:
>>
>> On 2021/10/12 0:02, Daeho Jeong wrote:
>>>>> diff --git a/fs/f2fs/compress.c b/fs/f2fs/compress.c
>>>>> index c1bf9ad4c220..9b663eaf4805 100644
>>>>> --- a/fs/f2fs/compress.c
>>>>> +++ b/fs/f2fs/compress.c
>>>>> @@ -1530,6 +1530,7 @@ int f2fs_write_multi_pages(struct compress_ctx *cc,
>>>>>         if (cluster_may_compress(cc)) {
>>>>>                 err = f2fs_compress_pages(cc);
>>>>>                 if (err == -EAGAIN) {
>>>>> +                     add_compr_block_stat(cc->inode, cc->cluster_size);
>>>>
>>>> Shouldn't we relocate this after 'write' label?
>>>>
>>>> One more concern, it looks we've changed what compr_block stat indicated,
>>>> literally, the block we account should be compressed..., how about accounting
>>>> it by introducing .presist_blocks, used_blocks or occupied_blocks.... thoughts?
>>>>
>>>
>>> What I wanted to add here is just one case in which compression was
>>> tried, but couldn't save any block, so gave up.
>>> If we put this below the "write" label, we will count blocks, even if
>>> the file is turned off for compression in "user-controlled
>>> compression" mode.
>>> Like the commit comment says, I want to estimate the overall compression rate.
>>> But, if we include every other compression disabled condition, it
>>> won't work like that.
>>
>> Got it, thanks for the explanation.
>>
>> Any thoughts about renaming compr_block? since some blocks accounted in
>> .compr_block weren't compressed blocks.
>>
>> Thanks,
>>
>>>
>>> Thanks,
>>>

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

* Re: [f2fs-dev] [PATCH] f2fs: include non-compressed blocks in compr_written_block
  2021-10-21 11:57         ` Chao Yu
@ 2021-10-21 15:51           ` Daeho Jeong
  2021-10-21 21:18             ` Jaegeuk Kim
  0 siblings, 1 reply; 9+ messages in thread
From: Daeho Jeong @ 2021-10-21 15:51 UTC (permalink / raw)
  To: Chao Yu; +Cc: linux-kernel, linux-f2fs-devel, kernel-team, Daeho Jeong

> Okay, shouldn't we Cc stable mailing list for this patch? otherwise
> userspace tool may get different stat number with the same compressed
> file in different kernel?
>

Oh, could you let me know what the address of the "stable" mailing list is?

Thanks,

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

* Re: [f2fs-dev] [PATCH] f2fs: include non-compressed blocks in compr_written_block
  2021-10-21 15:51           ` Daeho Jeong
@ 2021-10-21 21:18             ` Jaegeuk Kim
  2021-10-22 14:16               ` Chao Yu
  0 siblings, 1 reply; 9+ messages in thread
From: Jaegeuk Kim @ 2021-10-21 21:18 UTC (permalink / raw)
  To: Daeho Jeong
  Cc: Chao Yu, Daeho Jeong, kernel-team, linux-kernel, linux-f2fs-devel

On 10/21, Daeho Jeong wrote:
> > Okay, shouldn't we Cc stable mailing list for this patch? otherwise
> > userspace tool may get different stat number with the same compressed
> > file in different kernel?
> >
> 
> Oh, could you let me know what the address of the "stable" mailing list is?

Added Fixes and -stable. :)

> 
> Thanks,
> 
> 
> _______________________________________________
> 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] 9+ messages in thread

* Re: [f2fs-dev] [PATCH] f2fs: include non-compressed blocks in compr_written_block
  2021-10-21 21:18             ` Jaegeuk Kim
@ 2021-10-22 14:16               ` Chao Yu
  0 siblings, 0 replies; 9+ messages in thread
From: Chao Yu @ 2021-10-22 14:16 UTC (permalink / raw)
  To: Jaegeuk Kim, Daeho Jeong
  Cc: Daeho Jeong, kernel-team, linux-kernel, linux-f2fs-devel

On 2021/10/22 5:18, Jaegeuk Kim wrote:
> On 10/21, Daeho Jeong wrote:
>>> Okay, shouldn't we Cc stable mailing list for this patch? otherwise
>>> userspace tool may get different stat number with the same compressed
>>> file in different kernel?
>>>
>>
>> Oh, could you let me know what the address of the "stable" mailing list is?
> 
> Added Fixes and -stable. :)

Reviewed-by: Chao Yu <chao@kernel.org>

Thanks,

> 
>>
>> Thanks,
>>
>>
>> _______________________________________________
>> 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] 9+ messages in thread

end of thread, other threads:[~2021-10-22 14:16 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-06 17:49 [PATCH] f2fs: include non-compressed blocks in compr_written_block Daeho Jeong
2021-10-09  4:44 ` [f2fs-dev] " Chao Yu
2021-10-11 16:02   ` Daeho Jeong
2021-10-13 14:17     ` Chao Yu
2021-10-13 17:52       ` Daeho Jeong
2021-10-21 11:57         ` Chao Yu
2021-10-21 15:51           ` Daeho Jeong
2021-10-21 21:18             ` Jaegeuk Kim
2021-10-22 14:16               ` Chao Yu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).