]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
f2fs: remove non-uptodate folio from the page cache in move_data_block
authorYongpeng Yang <yangyongpeng@xiaomi.com>
Sat, 27 Dec 2025 07:34:31 +0000 (15:34 +0800)
committerJaegeuk Kim <jaegeuk@kernel.org>
Thu, 1 Jan 2026 03:30:25 +0000 (03:30 +0000)
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>
fs/f2fs/gc.c

index 58b291d19f068201cb3daca3e7e811a331d2c8dc..d889f7d9a70f1c7c7f5fc5f704dd9ad206fdd429 100644 (file)
@@ -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;
 }