diff options
| author | Jens Axboe <axboe@suse.de> | 2006-04-20 07:05:48 -0400 |
|---|---|---|
| committer | Jens Axboe <axboe@suse.de> | 2006-04-20 07:05:48 -0400 |
| commit | 82aa5d6183667aa2a5f3c61e390934b0273d2ad7 (patch) | |
| tree | 81fa617b8a970173cc7114acf1acc0e676caa1c5 | |
| parent | a0aa7f68afeeb92f6274b395177c20e617c8ed2d (diff) | |
[PATCH] splice: fix smaller sized splice reads
Signed-off-by: Jens Axboe <axboe@suse.de>
| -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 22fac87e90b3..0559e7577a04 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 | ||
