Skip to contentSkip to conversation

f2fs: include non-compressed blocks in compr_written_block

PATCH In review Daeho Jeong 3 participants 9 messages Oct 6, 2021 – Oct 22, 2021 F2FS file system

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 f2fs: include non-compressed blocks in compr_written_block

From: Daeho Jeong <[email protected]>

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

---
 fs/f2fs/compress.c | 1 +
 1 file changed, 1 insertion(+)
fs/f2fs/compress.c +1 -0
index c1bf9ad4c220..9b663eaf4805 100644
@@ -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);
Signature · 8 lines
2.33.0.882.g93a45727a2-goog



_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
maintainer
#1 lore raw
Quoted 15 lines · Daeho Jeong

From: Daeho Jeong <[email protected]>

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

---
  fs/f2fs/compress.c | 1 +
  1 file changed, 1 insertion(+)
fs/f2fs/compress.c +0 -0
index c1bf9ad4c220..9b663eaf4805 100644

fs/f2fs/compress.c int f2fs_write_multi_pages(struct compress_ctx *cc, · line 1533

Quoted 4 lines
fs/f2fs/compress.c +1 -0
@@ -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,

Quoted 4 lines
fs/f2fs/compress.c +0 -0
  			goto write;
  		} else if (err) {
  			f2fs_put_rpages_wbc(cc, wbc, true, 1);
#2 lore raw
Quoted 12 lines

fs/f2fs/compress.c int f2fs_write_multi_pages(struct compress_ctx *cc, · line 1533

Quoted 9 lines
fs/f2fs/compress.c +1 -0
index c1bf9ad4c220..9b663eaf4805 100644
@@ -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?

Quoted 4 lines

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,

maintainer
#3 lore raw
Quoted 17 lines · Daeho Jeong
Quoted 12 lines

fs/f2fs/compress.c int f2fs_write_multi_pages(struct compress_ctx *cc, · line 1533

Quoted 9 lines
fs/f2fs/compress.c +1 -0
index c1bf9ad4c220..9b663eaf4805 100644
@@ -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?

Quoted 4 lines

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?

Quoted 8 lines

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,

Quoted 3 lines

Thanks,

#4 lore raw

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,

Quoted 38 lines · Chao Yu
Quoted 17 lines · Daeho Jeong
Quoted 12 lines

fs/f2fs/compress.c int f2fs_write_multi_pages(struct compress_ctx *cc, · line 1533

Quoted 9 lines
fs/f2fs/compress.c +1 -0
index c1bf9ad4c220..9b663eaf4805 100644
@@ -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?

Quoted 4 lines

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?

Quoted 8 lines

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,

Quoted 3 lines

Thanks,

maintainer
#5 lore raw
Quoted 5 lines · 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.

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,

Quoted 43 lines

Thanks,

Quoted 38 lines · Chao Yu
Quoted 17 lines · Daeho Jeong
Quoted 12 lines

fs/f2fs/compress.c int f2fs_write_multi_pages(struct compress_ctx *cc, · line 1533

Quoted 9 lines
fs/f2fs/compress.c +1 -0
index c1bf9ad4c220..9b663eaf4805 100644
@@ -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?

Quoted 4 lines

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?

Quoted 8 lines

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,

Quoted 3 lines

Thanks,

#6 lore raw
Quoted 4 lines

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,

maintainer
#7 lore raw
Quoted 6 lines · Daeho Jeong
Quoted 4 lines

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. :)

Quoted 8 lines

Thanks,

_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

maintainer Reviewed-by
#8 lore raw
Quoted 9 lines · Jaegeuk Kim
Quoted 6 lines · Daeho Jeong
Quoted 4 lines

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,

Quoted 9 lines
Quoted 9 lines

Thanks,

_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel