lkml.org 
[lkml]   [2020]   [Jan]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: [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@infradead.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@infradead.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@fromorbit.com

\
 
 \ /
  Last update: 2020-01-29 02:09    [W:0.158 / U:0.108 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site