aboutsummaryrefslogtreecommitdiffstats
path: root/fs/splice.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/splice.c')
-rw-r--r--fs/splice.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/fs/splice.c b/fs/splice.c
index 421b3b821152..6ddd0329f866 100644
--- a/fs/splice.c
+++ b/fs/splice.c
@@ -265,7 +265,7 @@ __generic_file_splice_read(struct file *in, loff_t *ppos,
265 unsigned int flags) 265 unsigned int flags)
266{ 266{
267 struct address_space *mapping = in->f_mapping; 267 struct address_space *mapping = in->f_mapping;
268 unsigned int loff, nr_pages; 268 unsigned int loff, nr_pages, req_pages;
269 struct page *pages[PIPE_BUFFERS]; 269 struct page *pages[PIPE_BUFFERS];
270 struct partial_page partial[PIPE_BUFFERS]; 270 struct partial_page partial[PIPE_BUFFERS];
271 struct page *page; 271 struct page *page;
@@ -281,10 +281,8 @@ __generic_file_splice_read(struct file *in, loff_t *ppos,
281 281
282 index = *ppos >> PAGE_CACHE_SHIFT; 282 index = *ppos >> PAGE_CACHE_SHIFT;
283 loff = *ppos & ~PAGE_CACHE_MASK; 283 loff = *ppos & ~PAGE_CACHE_MASK;
284 nr_pages = (len + loff + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT; 284 req_pages = (len + loff + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT;
285 285 nr_pages = min(req_pages, (unsigned)PIPE_BUFFERS);
286 if (nr_pages > PIPE_BUFFERS)
287 nr_pages = PIPE_BUFFERS;
288 286
289 /* 287 /*
290 * Lookup the (hopefully) full range of pages we need. 288 * Lookup the (hopefully) full range of pages we need.
@@ -298,7 +296,7 @@ __generic_file_splice_read(struct file *in, loff_t *ppos,
298 */ 296 */
299 if (spd.nr_pages < nr_pages) 297 if (spd.nr_pages < nr_pages)
300 page_cache_readahead_ondemand(mapping, &in->f_ra, in, 298 page_cache_readahead_ondemand(mapping, &in->f_ra, in,
301 NULL, index, nr_pages - spd.nr_pages); 299 NULL, index, req_pages - spd.nr_pages);
302 300
303 error = 0; 301 error = 0;
304 while (spd.nr_pages < nr_pages) { 302 while (spd.nr_pages < nr_pages) {
@@ -355,7 +353,7 @@ __generic_file_splice_read(struct file *in, loff_t *ppos,
355 353
356 if (PageReadahead(page)) 354 if (PageReadahead(page))
357 page_cache_readahead_ondemand(mapping, &in->f_ra, in, 355 page_cache_readahead_ondemand(mapping, &in->f_ra, in,
358 page, index, nr_pages - page_nr); 356 page, index, req_pages - page_nr);
359 357
360 /* 358 /*
361 * If the page isn't uptodate, we may need to start io on it 359 * If the page isn't uptodate, we may need to start io on it