diff options
Diffstat (limited to 'fs/splice.c')
-rw-r--r-- | fs/splice.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/fs/splice.c b/fs/splice.c index 722449f7d5d6..421b3b821152 100644 --- a/fs/splice.c +++ b/fs/splice.c | |||
@@ -290,13 +290,17 @@ __generic_file_splice_read(struct file *in, loff_t *ppos, | |||
290 | * Lookup the (hopefully) full range of pages we need. | 290 | * Lookup the (hopefully) full range of pages we need. |
291 | */ | 291 | */ |
292 | 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); |
293 | index += spd.nr_pages; | ||
293 | 294 | ||
294 | /* | 295 | /* |
295 | * If find_get_pages_contig() returned fewer pages than we needed, | 296 | * If find_get_pages_contig() returned fewer pages than we needed, |
296 | * allocate the rest and fill in the holes. | 297 | * readahead/allocate the rest and fill in the holes. |
297 | */ | 298 | */ |
299 | if (spd.nr_pages < nr_pages) | ||
300 | page_cache_readahead_ondemand(mapping, &in->f_ra, in, | ||
301 | NULL, index, nr_pages - spd.nr_pages); | ||
302 | |||
298 | error = 0; | 303 | error = 0; |
299 | index += spd.nr_pages; | ||
300 | while (spd.nr_pages < nr_pages) { | 304 | while (spd.nr_pages < nr_pages) { |
301 | /* | 305 | /* |
302 | * Page could be there, find_get_pages_contig() breaks on | 306 | * Page could be there, find_get_pages_contig() breaks on |
@@ -304,9 +308,6 @@ __generic_file_splice_read(struct file *in, loff_t *ppos, | |||
304 | */ | 308 | */ |
305 | page = find_get_page(mapping, index); | 309 | page = find_get_page(mapping, index); |
306 | if (!page) { | 310 | if (!page) { |
307 | page_cache_readahead_ondemand(mapping, &in->f_ra, in, | ||
308 | NULL, index, nr_pages - spd.nr_pages); | ||
309 | |||
310 | /* | 311 | /* |
311 | * page didn't exist, allocate one. | 312 | * page didn't exist, allocate one. |
312 | */ | 313 | */ |