Re: [PATCH 05/20] shmem: export shmem_get_folio

Christoph Hellwig
2024-02-19T06:25:54Z

On Fri, Feb 16, 2024 at 01:53:09PM +0000, Matthew Wilcox wrote:
> I know I gave an R-b on this earlier, but Hugh made me look again, and
> this comment clearly does not reflect what the function does.
> Presumably it returns an errno and sets foliop if it returns 0?

Almost. With SGP_READ it can set *foliop to NULL and still return 0.

> Also, should this function be called shmem_lock_folio() to mirror
> filemap_lock_folio()?

shmem_get_folio can also allocate (and sometimes zero) a new folio.
Except for the different calling conventions that closest filemap
equivalent is __filemap_get_folio. For now I'd like to avoid the
bikeshedding on the name and just get the work done.