On 02/18, Matthew Wilcox (Oracle) wrote:
> Convert f2fs_put_page() to f2fs_folio_put() and add a wrapper.
> Replaces three calls to compound_head() with one.
>
> Signed-off-by: Matthew Wilcox (Oracle) <[email protected]>
> ---
> fs/f2fs/f2fs.h | 15 ++++++++++-----
> 1 file changed, 10 insertions(+), 5 deletions(-)
>
> diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
> index b05653f196dd..5e01a08afbd7 100644
> --- a/fs/f2fs/f2fs.h
> +++ b/fs/f2fs/f2fs.h
> @@ -2806,16 +2806,21 @@ static inline struct page *f2fs_pagecache_get_page(
> return pagecache_get_page(mapping, index, fgp_flags, gfp_mask);
> }
>
> -static inline void f2fs_put_page(struct page *page, int unlock)
> +static inline void f2fs_folio_put(struct folio *folio, bool unlock)
> {
> - if (!page)
> + if (!folio)
> return;
>
> if (unlock) {
> - f2fs_bug_on(F2FS_P_SB(page), !PageLocked(page));
> - unlock_page(page);
> + f2fs_bug_on(F2FS_F_SB(folio), !folio_test_locked(folio));
> + folio_unlock(folio);
> }
> - put_page(page);
> + folio_put(folio);
> +}
> +
> +static inline void f2fs_put_page(struct page *page, int unlock)
> +{
I got a kernel panic, since there are still several places to pass a null
page pointer, which feeds to page_folio() which doesn't expect the null.
Applying this can avoid the panic.
if (!page)
return;
> + f2fs_folio_put(page_folio(page), unlock);
> }
>
> static inline void f2fs_put_dnode(struct dnode_of_data *dn)
> --
> 2.47.2
>
_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel