Skip to content

Commit

Permalink
[PATCH] splice: be smarter about calling do_page_cache_readahead()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Jens Axboe committed Apr 10, 2006
1 parent 49d0b21 commit 0b749ce
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions fs/splice.c
Original file line number Diff line number Diff line change
Expand Up @@ -250,9 +250,12 @@ static int __generic_file_splice_read(struct file *in, struct inode *pipe,
nr_pages = PIPE_BUFFERS;

/*
* initiate read-ahead on this page range
* initiate read-ahead on this page range. however, don't call into
* read-ahead if this is a non-zero offset (we are likely doing small
* chunk splice and the page is already there) for a single page.
*/
do_page_cache_readahead(mapping, in, index, nr_pages);
if (!offset || nr_pages > 1)
do_page_cache_readahead(mapping, in, index, nr_pages);

/*
* now fill in the holes
Expand Down

0 comments on commit 0b749ce

Please sign in to comment.