From: Jens Axboe Date: Mon, 10 Apr 2006 07:05:04 +0000 (+0200) Subject: [PATCH] splice: be smarter about calling do_page_cache_readahead() X-Git-Tag: upstream/snapshot3+hdmi~40889^2~14 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=0b749ce3802428007a37870eb51ba3c0bdf90857;p=platform%2Fadaptation%2Frenesas_rcar%2Frenesas_kernel.git [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 --- diff --git a/fs/splice.c b/fs/splice.c index 50c43a1..9bfd6af 100644 --- a/fs/splice.c +++ b/fs/splice.c @@ -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