diff --git a/[refs] b/[refs] index ed5084c1f5c8..b0dcd4366705 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: c743d96b6d2ff55a94df7b5ac7c74987bb9c343b +refs/heads/master: 431a4820bfcdf7ff530e745230bafb06c9bf2d6d diff --git a/trunk/fs/splice.c b/trunk/fs/splice.c index 722449f7d5d6..421b3b821152 100644 --- a/trunk/fs/splice.c +++ b/trunk/fs/splice.c @@ -290,13 +290,17 @@ __generic_file_splice_read(struct file *in, loff_t *ppos, * Lookup the (hopefully) full range of pages we need. */ spd.nr_pages = find_get_pages_contig(mapping, index, nr_pages, pages); + index += spd.nr_pages; /* * If find_get_pages_contig() returned fewer pages than we needed, - * allocate the rest and fill in the holes. + * readahead/allocate the rest and fill in the holes. */ + if (spd.nr_pages < nr_pages) + page_cache_readahead_ondemand(mapping, &in->f_ra, in, + NULL, index, nr_pages - spd.nr_pages); + error = 0; - index += spd.nr_pages; while (spd.nr_pages < nr_pages) { /* * Page could be there, find_get_pages_contig() breaks on @@ -304,9 +308,6 @@ __generic_file_splice_read(struct file *in, loff_t *ppos, */ page = find_get_page(mapping, index); if (!page) { - page_cache_readahead_ondemand(mapping, &in->f_ra, in, - NULL, index, nr_pages - spd.nr_pages); - /* * page didn't exist, allocate one. */