mirror of
https://github.com/torvalds/linux.git
synced 2026-06-01 19:13:47 +02:00
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) <willy@infradead.org> Reviewed-by: Chao Yu <chao@kernel.org> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
This commit is contained in:
parent
95e3117621
commit
2525a78473
|
|
@ -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, false);
|
||||
|
||||
if (readahead)
|
||||
f2fs_ra_meta_pages(sbi, index, ra_blocks, META_POR, true);
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user