diff mbox series

[f2fs-dev,019/153] f2fs: Use a folio in f2fs_ra_meta_pages_cond()

Message ID 20250331201256.1057782-20-willy@infradead.org (mailing list archive)
State New
Headers show
Series f2fs folio conversions for 6.16 | expand

Commit Message

Matthew Wilcox (Oracle) March 31, 2025, 8:10 p.m. UTC
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) <willy@infradead.org>
---
 fs/f2fs/checkpoint.c | 8 ++++----
 fs/f2fs/f2fs.h       | 2 +-
 2 files changed, 5 insertions(+), 5 deletions(-)
diff mbox series

Patch

diff --git a/fs/f2fs/checkpoint.c b/fs/f2fs/checkpoint.c
index 1a5fbecd9356..30e68de82f73 100644
--- a/fs/f2fs/checkpoint.c
+++ b/fs/f2fs/checkpoint.c
@@ -325,16 +325,16 @@  int f2fs_ra_meta_pages(struct f2fs_sb_info *sbi, block_t start, int nrpages,
 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, 0);
 
 	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 3d2be01f9363..f05185ed1c75 100644
--- a/fs/f2fs/f2fs.h
+++ b/fs/f2fs/f2fs.h
@@ -2871,7 +2871,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) {