From 6a38449b7418b8418ccdcc617cbf3d3dc4b62a3c Mon Sep 17 00:00:00 2001 From: Fengguang Wu Date: Thu, 19 Jul 2007 01:48:05 -0700 Subject: [PATCH] --- yaml --- r: 61574 b: refs/heads/master c: 431a4820bfcdf7ff530e745230bafb06c9bf2d6d h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/fs/splice.c | 11 ++++++----- 2 files changed, 7 insertions(+), 6 deletions(-) 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. */