[PATCH 14/14] f2fs: make compressed files compatible with large folio

From: Nanzhe Zhao

Date: Wed Aug 26 2026 - 09:13:10 EST


The compression flag is the hint indicates that the inode can be
compressed, when the inode is using large folio, we expected it keeps
using the large folio read/write paths and its data stays uncompressed
on disk until the inode is evicted and re-read

Let f2fs_write_begin() skip the compression overwrite preparation for
such inodes and remove the compressed-file gate in
f2fs_read_data_large_folio() so the data is simply read/written as
regular blocks.

Signed-off-by: Nanzhe Zhao <zhaonanzhe@xxxxxxxxxx>
---
fs/f2fs/data.c | 9 ++-------
1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
index 2e20833c6417..befcdc3742f6 100644
--- a/fs/f2fs/data.c
+++ b/fs/f2fs/data.c
@@ -2955,12 +2955,6 @@ static int f2fs_read_data_large_folio(struct inode *inode,
int ret = 0;
bool folio_in_bio = false;

- if (f2fs_compressed_file(inode)) {
- if (folio)
- folio_unlock(folio);
- return -EOPNOTSUPP;
- }
-
map.m_seg_type = NO_CHECK_TYPE;

if (rac)
@@ -4935,7 +4929,8 @@ static int f2fs_write_begin(const struct kiocb *iocb,
}

#ifdef CONFIG_F2FS_FS_COMPRESSION
- if (f2fs_compressed_file(inode)) {
+ if (f2fs_compressed_file(inode) &&
+ !mapping_large_folio_support(inode->i_mapping)) {
int ret;
struct page *page;

--
2.43.0