From: Matthew Wilcox (Oracle) Date: Mon, 31 Mar 2025 20:10:39 +0000 (+0100) Subject: f2fs: Use a folio in f2fs_ra_meta_pages_cond() X-Git-Tag: v6.16-rc1~115^2~164 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2525a784737b2fb7c23fe3d2efa21658100419e4;p=thirdparty%2Fkernel%2Flinux.git f2fs: Use a folio in f2fs_ra_meta_pages_cond() Remove a call to find_get_page(). Saves two hidden calls to compound_head(). Change f2fs_folio_put() to check for IS_ERR_OR_NULL to handle the case where we got an error pointer back from filemap_get_folio(). Signed-off-by: Matthew Wilcox (Oracle) Reviewed-by: Chao Yu Signed-off-by: Jaegeuk Kim --- diff --git a/fs/f2fs/checkpoint.c b/fs/f2fs/checkpoint.c index ad3fef66ee54c..3fa66bfba100c 100644 --- a/fs/f2fs/checkpoint.c +++ b/fs/f2fs/checkpoint.c @@ -325,16 +325,16 @@ out: void f2fs_ra_meta_pages_cond(struct f2fs_sb_info *sbi, pgoff_t index, unsigned int ra_blocks) { - struct page *page; + struct folio *folio; bool readahead = false; if (ra_blocks == RECOVERY_MIN_RA_BLOCKS) return; - page = find_get_page(META_MAPPING(sbi), index); - if (!page || !PageUptodate(page)) + folio = filemap_get_folio(META_MAPPING(sbi), index); + if (IS_ERR(folio) || !folio_test_uptodate(folio)) readahead = true; - f2fs_put_page(page, 0); + f2fs_folio_put(folio, false); if (readahead) f2fs_ra_meta_pages(sbi, index, ra_blocks, META_POR, true); diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h index 3e9cb3206bbad..9915f31ee2d15 100644 --- a/fs/f2fs/f2fs.h +++ b/fs/f2fs/f2fs.h @@ -2885,7 +2885,7 @@ static inline struct page *f2fs_pagecache_get_page( static inline void f2fs_folio_put(struct folio *folio, bool unlock) { - if (!folio) + if (IS_ERR_OR_NULL(folio)) return; if (unlock) {