Re: [f2fs-dev] [PATCH v4] f2fs: do not support mmap write for large folio

Jaegeuk Kim via Linux-f2fs-devel
2026-04-13T22:46:48Z

Let's check mmap writes onto the large folio, since we don't support writing
large folios.

Reviewed-by: Daeho Jeong <daehojeong@google.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
---

- add f2fs_err to catch any issue

fs/f2fs/file.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
index 2c4880f24b54..e917342cb828 100644
--- a/fs/f2fs/file.c
+++ b/fs/f2fs/file.c
@@ -82,8 +82,17 @@ static vm_fault_t f2fs_vm_page_mkwrite(struct vm_fault *vmf)
int err = 0;
vm_fault_t ret;

- if (unlikely(IS_IMMUTABLE(inode)))
+ /*
+ * We only support large folio on the read case.
+ * Don't make any dirty pages.
+ */
+ if (unlikely(IS_IMMUTABLE(inode)) ||
+ mapping_large_folio_support(inode->i_mapping)) {
+ f2fs_err(sbi, "Not expected: immutable: %d large_folio: %d",
+ IS_IMMUTABLE(inode),
+ mapping_large_folio_support(inode->i_mapping));
return VM_FAULT_SIGBUS;
+ }

if (is_inode_flag_set(inode, FI_COMPRESS_RELEASED)) {
err = -EIO;
--
2.54.0.rc0.605.g598a273b03-goog