Re: [f2fs-dev] [PATCH v5 RESEND] f2fs: compress: add compress_inode to cache compressed blocks

From: Chao Yu
Date: Mon Dec 07 2020 - 20:00:11 EST


On 2020/12/8 2:13, Eric Biggers wrote:
On Mon, Dec 07, 2020 at 05:52:20PM +0800, Chao Yu wrote:
diff --git a/Documentation/filesystems/f2fs.rst b/Documentation/filesystems/f2fs.rst
index dae15c96e659..fd413d319e93 100644
--- a/Documentation/filesystems/f2fs.rst
+++ b/Documentation/filesystems/f2fs.rst
@@ -268,6 +268,9 @@ compress_mode=%s Control file compression mode. This supports "fs" and "user"
choosing the target file and the timing. The user can do manual
compression/decompression on the compression enabled files using
ioctls.
+compress_cache Support to use address space of inner inode to cache
+ compressed block, in order to improve cache hit ratio of
+ random read.

What is an "inner inode"? Mount options should be understandable without
understanding filesystem implementation details.

I'd like to use "a filesystem managed inode" instead, if there is no further
comment.


+const struct address_space_operations f2fs_compress_aops = {
+ .releasepage = f2fs_release_page,
+ .invalidatepage = f2fs_invalidate_page,
+};
+
+struct address_space *COMPRESS_MAPPING(struct f2fs_sb_info *sbi)
+{
+ return sbi->compress_inode->i_mapping;
+}
+
+void invalidate_compress_page(struct f2fs_sb_info *sbi, block_t blkaddr)
+{
+ if (!sbi->compress_inode)
+ return;
+ invalidate_mapping_pages(COMPRESS_MAPPING(sbi), blkaddr, blkaddr);
+}

Global functions should have the "f2fs_" prefix.

Yup,

Thanks,


- Eric
.