Commit a08a166f authored by Fengguang Wu's avatar Fengguang Wu Committed by Linus Torvalds
Browse files

readahead: convert splice invocations



Convert splice reads to use on-demand readahead.
Signed-off-by: default avatarFengguang 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: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 3ea89ee8
...@@ -286,12 +286,6 @@ __generic_file_splice_read(struct file *in, loff_t *ppos, ...@@ -286,12 +286,6 @@ __generic_file_splice_read(struct file *in, loff_t *ppos,
if (nr_pages > PIPE_BUFFERS) if (nr_pages > PIPE_BUFFERS)
nr_pages = PIPE_BUFFERS; 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. * Lookup the (hopefully) full range of pages we need.
*/ */
...@@ -310,11 +304,8 @@ __generic_file_splice_read(struct file *in, loff_t *ppos, ...@@ -310,11 +304,8 @@ __generic_file_splice_read(struct file *in, loff_t *ppos,
*/ */
page = find_get_page(mapping, index); page = find_get_page(mapping, index);
if (!page) { if (!page) {
/* page_cache_readahead_ondemand(mapping, &in->f_ra, in,
* Make sure the read-ahead engine is notified NULL, index, nr_pages - spd.nr_pages);
* about this failure.
*/
handle_ra_miss(mapping, &in->f_ra, index);
/* /*
* page didn't exist, allocate one. * page didn't exist, allocate one.
...@@ -361,6 +352,10 @@ __generic_file_splice_read(struct file *in, loff_t *ppos, ...@@ -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); this_len = min_t(unsigned long, len, PAGE_CACHE_SIZE - loff);
page = pages[page_nr]; 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 * If the page isn't uptodate, we may need to start io on it
*/ */
...@@ -453,6 +448,7 @@ __generic_file_splice_read(struct file *in, loff_t *ppos, ...@@ -453,6 +448,7 @@ __generic_file_splice_read(struct file *in, loff_t *ppos,
*/ */
while (page_nr < nr_pages) while (page_nr < nr_pages)
page_cache_release(pages[page_nr++]); page_cache_release(pages[page_nr++]);
in->f_ra.prev_index = index;
if (spd.nr_pages) if (spd.nr_pages)
return splice_to_pipe(pipe, &spd); return splice_to_pipe(pipe, &spd);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment