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]>
---
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(-)

diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c
index 6afd57fa5387..8e742f74ab4a 100644
--- a/fs/f2fs/gc.c
+++ b/fs/f2fs/gc.c
@@ -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;
 }
 
-- 
2.43.0



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

Reply via email to