Skip to contentSkip to conversation

f2fs: remove non-uptodate folio from the page cache in move_data_block

PATCH Applied Yongpeng Yang 2 participants 3 messages Dec 27, 2025 – Jan 7 F2FS file system

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 f2fs: remove non-uptodate folio from the page cache in move_data_block

From: Yongpeng Yang <[email protected]>

During data movement, move_data_block acquires file folio without triggering a file read. Such folio are typically not uptodate, they need to be removed from the page cache after gc complete. This patch marks folio with the PG_dropbehind flag and uses folio_end_dropbehind to remove folio from the page cache.

---
v3:
- Drop folio_clear_dropbehind, because __filemap_get_folio_mpol will clear PG_dropbehind flag when fgp_flags /wo FGP_DONTCACHE flag. v2:
- Remove folio from the page cache via PG_dropbehind flag and folio_end_dropbehind instead of invalidate_mapping_pages.

---
 fs/f2fs/gc.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
fs/f2fs/gc.c +5 -1
index 6afd57fa5387..8e742f74ab4a 100644
@@ -1453,7 +1453,11 @@ static int move_data_block(struct inode *inode, block_t bidx,
 put_out:
 	f2fs_put_dnode(&dn);
 out:
-	f2fs_folio_put(folio, true);
+	if (!folio_test_uptodate(folio))
+		__folio_set_dropbehind(folio);
+	folio_unlock(folio);
+	folio_end_dropbehind(folio);
+	folio_put(folio);
 	return err;
 }
 
Signature · 8 lines
2.43.0



_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
Reviewed-by Chao Yu on v3 1/1
#1 lore raw
Quoted 10 lines · Yongpeng Yang

From: Yongpeng Yang <[email protected]>

During data movement, move_data_block acquires file folio without triggering a file read. Such folio are typically not uptodate, they need to be removed from the page cache after gc complete. This patch marks folio with the PG_dropbehind flag and uses folio_end_dropbehind to remove folio from the page cache.

Thanks,

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

#2 lore raw
In reply to Yongpeng Yang

Hello:

This patch was applied to jaegeuk/f2fs.git (dev)
by Jaegeuk Kim <[email protected]>:

Quoted 9 lines · On Sat, 27 Dec 2025 15:34:31 +0800 you wrote:

From: Yongpeng Yang <[email protected]>

During data movement, move_data_block acquires file folio without triggering a file read. Such folio are typically not uptodate, they need to be removed from the page cache after gc complete. This patch marks folio with the PG_dropbehind flag and uses folio_end_dropbehind to remove folio from the page cache.

[...]

Here is the summary with links:
- [f2fs-dev,v3,1/1] f2fs: remove non-uptodate folio from the page cache in move_data_block

    https://git.kernel.org/jaegeuk/f2fs/c/9609dd704725

You are awesome, thank you!

Signature · 10 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html




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