f2fs: remove non-uptodate folio from the page cache in move_data_block
PATCH v2 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.
Signed-off-by Yunlei He <[email protected]>
Signed-off-by Yongpeng Yang <[email protected]>
--- fs/f2fs/gc.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
fs/f2fs/gc.c +7 -1
@@ -1453,7 +1453,13 @@ 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_trylock(folio) may fail, so the flag must be cleared. */ +folio_clear_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