Re: [PATCH 03/33] mm: Implement readahead_control pageset expansion
From: Christoph Hellwig
Date: Tue Feb 16 2021 - 05:35:00 EST
On Mon, Feb 15, 2021 at 03:44:52PM +0000, David Howells wrote:
> Provide a function, readahead_expand(), that expands the set of pages
> specified by a readahead_control object to encompass a revised area with a
> proposed size and length.
>
> The proposed area must include all of the old area and may be expanded yet
> more by this function so that the edges align on (transparent huge) page
> boundaries as allocated.
>
> The expansion will be cut short if a page already exists in either of the
> areas being expanded into. Note that any expansion made in such a case is
> not rolled back.
>
> This will be used by fscache so that reads can be expanded to cache granule
> boundaries, thereby allowing whole granules to be stored in the cache, but
> there are other potential users also.
So looking at linux-next this seems to have a user, but that user is
dead wood given that nothing implements ->expand_readahead.
Looking at the code structure I think netfs_readahead and
netfs_rreq_expand is a complete mess and needs to be turned upside
down, that is instead of calling back from netfs_readahead to the
calling file system, split it into a few helpers called by the
caller.
But even after this can't we just expose the cache granule boundary
to the VM so that the read-ahead request gets setup correctly from
the very beginning?