aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/splice.c18
1 files changed, 7 insertions, 11 deletions
diff --git a/fs/splice.c b/fs/splice.c
index 53fc2082a468..722449f7d5d6 100644
--- a/fs/splice.c
+++ b/fs/splice.c
@@ -287,12 +287,6 @@ __generic_file_splice_read(struct file *in, loff_t *ppos,
287 nr_pages = PIPE_BUFFERS; 287 nr_pages = PIPE_BUFFERS;
288 288
289 /* 289 /*
290 * Don't try to 2nd guess the read-ahead logic, call into
291 * page_cache_readahead() like the page cache reads would do.
292 */
293 page_cache_readahead(mapping, &in->f_ra, in, index, nr_pages);
294
295 /*
296 * Lookup the (hopefully) full range of pages we need. 290 * Lookup the (hopefully) full range of pages we need.
297 */ 291 */
298 spd.nr_pages = find_get_pages_contig(mapping, index, nr_pages, pages); 292 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,
310 */ 304 */
311 page = find_get_page(mapping, index); 305 page = find_get_page(mapping, index);
312 if (!page) { 306 if (!page) {
313 /* 307 page_cache_readahead_ondemand(mapping, &in->f_ra, in,
314 * Make sure the read-ahead engine is notified 308 NULL, index, nr_pages - spd.nr_pages);
315 * about this failure.
316 */
317 handle_ra_miss(mapping, &in->f_ra, index);
318 309
319 /* 310 /*
320 * page didn't exist, allocate one. 311 * page didn't exist, allocate one.
@@ -361,6 +352,10 @@ __generic_file_splice_read(struct file *in, loff_t *ppos,
361 this_len = min_t(unsigned long, len, PAGE_CACHE_SIZE - loff); 352 this_len = min_t(unsigned long, len, PAGE_CACHE_SIZE - loff);
362 page = pages[page_nr]; 353 page = pages[page_nr];
363 354
355 if (PageReadahead(page))
356 page_cache_readahead_ondemand(mapping, &in->f_ra, in,
357 page, index, nr_pages - page_nr);
358
364 /* 359 /*
365 * If the page isn't uptodate, we may need to start io on it 360 * If the page isn't uptodate, we may need to start io on it
366 */ 361 */
@@ -453,6 +448,7 @@ fill_it:
453 */ 448 */
454 while (page_nr < nr_pages) 449 while (page_nr < nr_pages)
455 page_cache_release(pages[page_nr++]); 450 page_cache_release(pages[page_nr++]);
451 in->f_ra.prev_index = index;
456 452
457 if (spd.nr_pages) 453 if (spd.nr_pages)
458 return splice_to_pipe(pipe, &spd); 454 return splice_to_pipe(pipe, &spd);