On Mon, Nov 14, 2022 at 04:02:20PM +0000, David Howells wrote:
> +++ b/mm/filemap.c
> @@ -3941,6 +3941,10 @@ bool filemap_release_folio(struct folio *folio, gfp_t 
> gfp)
>       struct address_space * const mapping = folio->mapping;
>  
>       BUG_ON(!folio_test_locked(folio));
> +     if ((!mapping || !mapping_release_always(mapping))
> +         && !folio_test_private(folio) &&
> +         !folio_test_private_2(folio))
> +             return true;

Why do you need to test 'mapping' here?  Also this is the most
inconsistent style ...

        if ((!mapping || !mapping_release_always(mapping)) &&
            !folio_test_private(folio) && !folio_test_private_2(folio))

works fine, but if you insist on splitting over three lines, then:

        if ((!mapping || !mapping_release_always(mapping)) &&
            !folio_test_private(folio) && 
            !folio_test_private_2(folio))

> @@ -276,7 +275,7 @@ static long mapping_evict_folio(struct address_space 
> *mapping,
>       if (folio_ref_count(folio) >
>                       folio_nr_pages(folio) + folio_has_private(folio) + 1)

I think this line is incorrect, right?  You don't increment the folio
refcount just because the folio has private2 set, do you?

>               return 0;
> -     if (folio_has_private(folio) && !filemap_release_folio(folio, 0))
> +     if (!filemap_release_folio(folio, 0))
>               return 0;
>  
>       return remove_mapping(mapping, folio);

Can we get rid of folio_has_private() / page_has_private() now?

--
Linux-cachefs mailing list
Linux-cachefs@redhat.com
https://listman.redhat.com/mailman/listinfo/linux-cachefs

Reply via email to