Re: [PATCH v11 32/33] fs/netfs: Add folio fscache functions

From: David Howells
Date: Wed Jun 16 2021 - 05:16:13 EST


Matthew Wilcox (Oracle) <willy@xxxxxxxxxxxxx> wrote:

> /**
> - * set_page_fscache - Set PG_fscache on a page and take a ref
> - * @page: The page.
> + * folio_start_fscache - Start an fscache operation on a folio.
> + * @folio: The folio.
> *
> - * Set the PG_fscache (PG_private_2) flag on a page and take the reference
> - * needed for the VM to handle its lifetime correctly. This sets the flag and
> - * takes the reference unconditionally, so care must be taken not to set the
> - * flag again if it's already set.
> + * Call this function before an fscache operation starts on a folio.
> + * Starting a second fscache operation before the first one finishes is
> + * not allowed.

That's not correct. It's only used for operations that write from the page to
disk. Operations that read into the page are covered by the page lock.

> + * folio_end_fscache - End an fscache operation on a folio.
> ...
> + * Call this function after an fscache operation has finished. This will
> + * wake any sleepers waiting on this folio.

Ditto.

> + * folio_wait_fscache - Wait for an fscache operation on this folio to end.
> + * @folio: The folio.
> *
> + * If an fscache operation is in progress on this folio, wait for it to
> + * finish. Another fscache operation may start after this one finishes,
> + * unless the caller holds the folio lock.

Ditto.

Apart from that, it looks okay.

David