From bfd096cd5be8bd78a3fcdc419a5ac3351d3042d4 Mon Sep 17 00:00:00 2001 From: Fengguang Wu Date: Thu, 19 Jul 2007 01:48:03 -0700 Subject: [PATCH] --- yaml --- r: 61571 b: refs/heads/master c: a08a166fe77d9f9ad88ed6d06b97e73453661f89 h: refs/heads/master i: 61569: 1ddb7b7d6f3a6c20e9361b190de1b4dc61a89636 61567: 56fcb65c7941bdd6824bb090d4a7731af102771d v: v3 --- [refs] | 2 +- trunk/fs/splice.c | 18 +++++++----------- 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/[refs] b/[refs] index 5bb0c0fd7b2d..77dacd770ec9 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 3ea89ee86a82e9fbde37018d9b9e92a552e5fd13 +refs/heads/master: a08a166fe77d9f9ad88ed6d06b97e73453661f89 diff --git a/trunk/fs/splice.c b/trunk/fs/splice.c index 53fc2082a468..722449f7d5d6 100644 --- a/trunk/fs/splice.c +++ b/trunk/fs/splice.c @@ -286,12 +286,6 @@ __generic_file_splice_read(struct file *in, loff_t *ppos, if (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. */ @@ -310,11 +304,8 @@ __generic_file_splice_read(struct file *in, loff_t *ppos, */ page = find_get_page(mapping, index); if (!page) { - /* - * Make sure the read-ahead engine is notified - * about this failure. - */ - handle_ra_miss(mapping, &in->f_ra, index); + page_cache_readahead_ondemand(mapping, &in->f_ra, in, + NULL, index, nr_pages - spd.nr_pages); /* * page didn't exist, allocate one. @@ -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); 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 */ @@ -453,6 +448,7 @@ __generic_file_splice_read(struct file *in, loff_t *ppos, */ while (page_nr < nr_pages) page_cache_release(pages[page_nr++]); + in->f_ra.prev_index = index; if (spd.nr_pages) return splice_to_pipe(pipe, &spd);