[PATCH v3 07/17] f2fs: remove mappedtodisk flag usage in mmap write path

From: Nanzhe Zhao

Date: Fri Oct 09 2026 - 12:24:03 EST


PG_mappedtodisk was inherited from the nobh/buffer-head era. However,
f2fs has no buffer heads and the flag is no longer meaningful. The only
user of the flag is the "no holes" shortcut in f2fs_vm_page_mkwrite(),
which makes mmap write faults skip:

- zeroing the post-EOF part of the faulted folio,
- marking the folio dirty (mm dirties shared file mappings after
->page_mkwrite() returns, so this one was not noticeable),
- APP_MAPPED_IO iostat and REQ_TIME updates.

Remove this shortcut in f2fs_vm_page_mkwrite() and stop setting it in
f2fs_read_single_page().

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

diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
index d45fbe0db161..59f065eed712 100644
--- a/fs/f2fs/data.c
+++ b/fs/f2fs/data.c
@@ -2572,7 +2572,6 @@ static int f2fs_read_single_page(struct inode *inode, struct fsverity_info *vi,
got_it:
if ((map->m_flags & F2FS_MAP_MAPPED)) {
block_nr = map->m_pblk + block_in_file - map->m_lblk;
- folio_set_mappedtodisk(folio);

if (!f2fs_is_valid_blkaddr(F2FS_I_SB(inode), block_nr,
DATA_GENERIC_ENHANCE_READ)) {
diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
index aade9a04d8f3..e7471949faf2 100644
--- a/fs/f2fs/file.c
+++ b/fs/f2fs/file.c
@@ -218,12 +218,6 @@ static vm_fault_t f2fs_vm_page_mkwrite(struct vm_fault *vmf)
/* wait for GCed page writeback via generic cache */
f2fs_wait_on_block_writeback(inode, dn.data_blkaddr);

- /*
- * check to see if the page is mapped already (no holes)
- */
- if (folio_test_mappedtodisk(folio))
- goto out_sem;
-
/* page is wholly or partially inside EOF */
if (((loff_t)(folio->index + 1) << PAGE_SHIFT) >
i_size_read(inode)) {
--
2.43.0