diff options
author | Linus Torvalds <torvalds@g5.osdl.org> | 2006-04-20 11:17:04 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-04-20 11:17:04 -0400 |
commit | 402a26f0c040077ed6f941eefac5a6971f0d5f40 (patch) | |
tree | f74e5d732404e9716b3c753007bac0f5d1e92869 /fs | |
parent | bf7cf6ee1bd00679bbe93b6ae73f80032759b8df (diff) | |
parent | 4f73247f0e53be1bd4aa519476e6261a8e4a64ab (diff) |
Merge branch 'for-linus' of git://brick.kernel.dk/data/git/linux-2.6-block
* 'for-linus' of git://brick.kernel.dk/data/git/linux-2.6-block:
[PATCH] block/elevator.c: remove unused exports
[PATCH] splice: fix smaller sized splice reads
[PATCH] Don't inherit ->splice_pipe across forks
[patch] cleanup: use blk_queue_stopped
[PATCH] Document online io scheduler switching
Diffstat (limited to 'fs')
-rw-r--r-- | fs/splice.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/fs/splice.c b/fs/splice.c index 22fac87e90..0559e7577a 100644 --- a/fs/splice.c +++ b/fs/splice.c | |||
@@ -275,6 +275,15 @@ __generic_file_splice_read(struct file *in, loff_t *ppos, | |||
275 | error = 0; | 275 | error = 0; |
276 | bytes = 0; | 276 | bytes = 0; |
277 | for (i = 0; i < nr_pages; i++, index++) { | 277 | for (i = 0; i < nr_pages; i++, index++) { |
278 | unsigned int this_len; | ||
279 | |||
280 | if (!len) | ||
281 | break; | ||
282 | |||
283 | /* | ||
284 | * this_len is the max we'll use from this page | ||
285 | */ | ||
286 | this_len = min(len, PAGE_CACHE_SIZE - loff); | ||
278 | find_page: | 287 | find_page: |
279 | /* | 288 | /* |
280 | * lookup the page for this index | 289 | * lookup the page for this index |
@@ -366,11 +375,13 @@ readpage: | |||
366 | * force quit after adding this page | 375 | * force quit after adding this page |
367 | */ | 376 | */ |
368 | nr_pages = i; | 377 | nr_pages = i; |
378 | this_len = min(this_len, loff); | ||
369 | } | 379 | } |
370 | } | 380 | } |
371 | fill_it: | 381 | fill_it: |
372 | pages[i] = page; | 382 | pages[i] = page; |
373 | bytes += PAGE_CACHE_SIZE - loff; | 383 | bytes += this_len; |
384 | len -= this_len; | ||
374 | loff = 0; | 385 | loff = 0; |
375 | } | 386 | } |
376 | 387 | ||