Commit 0b749ce3802428007a37870eb51ba3c0bdf90857

Authored by Jens Axboe
1 parent 49d0b21be2

[PATCH] splice: be smarter about calling do_page_cache_readahead()

We don't want to call into the read-ahead logic unless we are at the
start of a page, _or_ we have multiple pages to read.

Signed-off-by: Jens Axboe <axboe@suse.de>

Showing 1 changed file with 5 additions and 2 deletions Side-by-side Diff

... ... @@ -250,9 +250,12 @@
250 250 nr_pages = PIPE_BUFFERS;
251 251  
252 252 /*
253   - * initiate read-ahead on this page range
  253 + * initiate read-ahead on this page range. however, don't call into
  254 + * read-ahead if this is a non-zero offset (we are likely doing small
  255 + * chunk splice and the page is already there) for a single page.
254 256 */
255   - do_page_cache_readahead(mapping, in, index, nr_pages);
  257 + if (!offset || nr_pages > 1)
  258 + do_page_cache_readahead(mapping, in, index, nr_pages);
256 259  
257 260 /*
258 261 * now fill in the holes