]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
[PATCH] splice: be smarter about calling do_page_cache_readahead()
authorJens Axboe <axboe@suse.de>
Mon, 10 Apr 2006 07:05:04 +0000 (09:05 +0200)
committerJens Axboe <axboe@suse.de>
Mon, 10 Apr 2006 07:05:04 +0000 (09:05 +0200)
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>
fs/splice.c

index 50c43a1e0923435bda007a5556930c483a95328c..9bfd6af0cf452a4a558ea4b88c9044777d924502 100644 (file)
@@ -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