[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200129010829.GK18610@dread.disaster.area>
Date: Wed, 29 Jan 2020 12:08:29 +1100
From: Dave Chinner <david@...morbit.com>
To: Matthew Wilcox <willy@...radead.org>
Cc: linux-fsdevel@...r.kernel.org, linux-mm@...ck.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH 11/12] fuse: Convert from readpages to readahead
On Fri, Jan 24, 2020 at 05:35:52PM -0800, Matthew Wilcox wrote:
> From: "Matthew Wilcox (Oracle)" <willy@...radead.org>
>
> Use the new readahead operation in fuse. Switching away from the
> read_cache_pages() helper gets rid of an implicit call to put_page(),
> so we can get rid of the get_page() call in fuse_readpages_fill().
> We can also get rid of the call to fuse_wait_on_page_writeback() as
> this page is newly allocated and so cannot be under writeback.
>
> Signed-off-by: Matthew Wilcox (Oracle) <willy@...radead.org>
.....
> @@ -968,19 +962,24 @@ static int fuse_readpages(struct file *file, struct address_space *mapping,
> data.max_pages = min_t(unsigned int, nr_pages, fc->max_pages);
> ;
> data.ia = fuse_io_alloc(NULL, data.max_pages);
> - err = -ENOMEM;
> if (!data.ia)
> goto out;
>
> - err = read_cache_pages(mapping, pages, fuse_readpages_fill, &data);
> - if (!err) {
> - if (data.ia->ap.num_pages)
> - fuse_send_readpages(data.ia, file);
> - else
> - fuse_io_free(data.ia);
> + while (nr_pages--) {
> + struct page *page = readahead_page(mapping, start++);
> + int err = fuse_readpages_fill(&data, page);
> +
> + if (!err)
> + continue;
> + nr_pages++;
> + goto out;
> }
That's some pretty convoluted logic. Perhaps:
for (; nr_pages > 0 ; nr_pages--) {
struct page *page = readahead_page(mapping, start++);
if (fuse_readpages_fill(&data, page))
goto out;
}
-Dave.
--
Dave Chinner
david@...morbit.com
Powered by blists - more mailing lists