On 4/1/25 04:10, Matthew Wilcox (Oracle) wrote:
> 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) <[email protected]>
> ---
> fs/f2fs/checkpoint.c | 8 ++++----
> fs/f2fs/f2fs.h | 2 +-
> 2 files changed, 5 insertions(+), 5 deletions(-)
>
> 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 (IS_ERR(folio))
folio = NULL;
if (!folio || !folio_test_uptodate(folio))
readahead = true;
f2fs_folio_put(folio, false);
Thanks,
>
> 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) {
_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel