Re: [PATCH v10 24/25] fuse: Convert from readpages to readahead

From: Miklos Szeredi
Date: Wed Mar 25 2020 - 10:43:16 EST


On Wed, Mar 25, 2020 at 1:02 PM Matthew Wilcox <willy@xxxxxxxxxxxxx> wrote:
>
> On Wed, Mar 25, 2020 at 10:42:56AM +0100, Miklos Szeredi wrote:
> > > + while ((page = readahead_page(rac))) {
> > > + if (fuse_readpages_fill(&data, page) != 0)
> >
> > Shouldn't this unlock + put page on error?
>
> We're certainly inconsistent between the two error exits from
> fuse_readpages_fill(). But I think we can simplify the whole thing
> ... how does this look to you?

Nice, overall.

>
> - while ((page = readahead_page(rac))) {
> - if (fuse_readpages_fill(&data, page) != 0)
> + nr_pages = min(readahead_count(rac), fc->max_pages);

Missing fc->max_read clamp.

> + ia = fuse_io_alloc(NULL, nr_pages);
> + if (!ia)
> return;
> + ap = &ia->ap;
> + __readahead_batch(rac, ap->pages, nr_pages);

nr_pages = __readahead_batch(...)?

This will give consecutive pages, right?

Thanks,
Miklos