summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYongpeng Yang <yangyongpeng@xiaomi.com>2025-12-27 10:34:31 +0300
committerJaegeuk Kim <jaegeuk@kernel.org>2026-01-01 06:30:25 +0300
commit9609dd704725a40cd63d915f2ab6c44248a44598 (patch)
tree464f35ad3d62b70bde9e6ec0e7baa6b237558409
parentdb1a8a7813f74968f79bd510fd5f0ae866bf8efd (diff)
downloadlinux-9609dd704725a40cd63d915f2ab6c44248a44598.tar.xz
f2fs: remove non-uptodate folio from the page cache in move_data_block
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. Signed-off-by: Yunlei He <heyunlei@xiaomi.com> Signed-off-by: Yongpeng Yang <yangyongpeng@xiaomi.com> Reviewed-by: Chao Yu <chao@kernel.org> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
-rw-r--r--fs/f2fs/gc.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c
index 58b291d19f06..d889f7d9a70f 100644
--- a/fs/f2fs/gc.c
+++ b/fs/f2fs/gc.c
@@ -1453,7 +1453,11 @@ up_out:
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;
}