Re: [PATCH 11/12] fuse: Convert from readpages to readahead

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Jan 24, 2020 at 05:35:52PM -0800, Matthew Wilcox wrote:
> From: "Matthew Wilcox (Oracle)" <willy@xxxxxxxxxxxxx>
> 
> 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@xxxxxxxxxxxxx>
.....
> @@ -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@xxxxxxxxxxxxx




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux