summaryrefslogtreecommitdiff
path: root/fs/splice.c
diff options
context:
space:
mode:
authorFengguang Wu <wfg@mail.ustc.edu.cn>2007-07-19 01:48:03 -0700
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-07-19 10:04:44 -0700
commita08a166fe77d9f9ad88ed6d06b97e73453661f89 (patch)
treeea7e8aa2936e12ee4f81c7f0c6b8b130021ebe56 /fs/splice.c
parent3ea89ee86a82e9fbde37018d9b9e92a552e5fd13 (diff)
downloadlinux-3.10-a08a166fe77d9f9ad88ed6d06b97e73453661f89.tar.gz
linux-3.10-a08a166fe77d9f9ad88ed6d06b97e73453661f89.tar.bz2
linux-3.10-a08a166fe77d9f9ad88ed6d06b97e73453661f89.zip
readahead: convert splice invocations
Convert splice reads to use on-demand readahead. Signed-off-by: Fengguang Wu <wfg@mail.ustc.edu.cn> Cc: Steven Pratt <slpratt@austin.ibm.com> Cc: Ram Pai <linuxram@us.ibm.com> Cc: Jens Axboe <axboe@suse.de> Cc: Rusty Russell <rusty@rustcorp.com.au> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/splice.c')
-rw-r--r--fs/splice.c18
1 files changed, 7 insertions, 11 deletions
diff --git a/fs/splice.c b/fs/splice.c
index 53fc2082a46..722449f7d5d 100644
--- a/fs/splice.c
+++ b/fs/splice.c
@@ -287,12 +287,6 @@ __generic_file_splice_read(struct file *in, loff_t *ppos,
nr_pages = PIPE_BUFFERS;
/*
- * Don't try to 2nd guess the read-ahead logic, call into
- * page_cache_readahead() like the page cache reads would do.
- */
- page_cache_readahead(mapping, &in->f_ra, in, index, nr_pages);
-
- /*
* Lookup the (hopefully) full range of pages we need.
*/
spd.nr_pages = find_get_pages_contig(mapping, index, nr_pages, pages);
@@ -310,11 +304,8 @@ __generic_file_splice_read(struct file *in, loff_t *ppos,
*/
page = find_get_page(mapping, index);
if (!page) {
- /*
- * Make sure the read-ahead engine is notified
- * about this failure.
- */
- handle_ra_miss(mapping, &in->f_ra, index);
+ page_cache_readahead_ondemand(mapping, &in->f_ra, in,
+ NULL, index, nr_pages - spd.nr_pages);
/*
* page didn't exist, allocate one.
@@ -361,6 +352,10 @@ __generic_file_splice_read(struct file *in, loff_t *ppos,
this_len = min_t(unsigned long, len, PAGE_CACHE_SIZE - loff);
page = pages[page_nr];
+ if (PageReadahead(page))
+ page_cache_readahead_ondemand(mapping, &in->f_ra, in,
+ page, index, nr_pages - page_nr);
+
/*
* If the page isn't uptodate, we may need to start io on it
*/
@@ -453,6 +448,7 @@ fill_it:
*/
while (page_nr < nr_pages)
page_cache_release(pages[page_nr++]);
+ in->f_ra.prev_index = index;
if (spd.nr_pages)
return splice_to_pipe(pipe, &spd);