diff options
author | Jens Axboe <axboe@suse.de> | 2006-04-20 13:05:48 +0200 |
---|---|---|
committer | Jens Axboe <axboe@suse.de> | 2006-04-20 13:05:48 +0200 |
commit | 82aa5d6183667aa2a5f3c61e390934b0273d2ad7 (patch) | |
tree | 81fa617b8a970173cc7114acf1acc0e676caa1c5 /fs/splice.c | |
parent | [PATCH] Don't inherit ->splice_pipe across forks (diff) | |
download | linux-82aa5d6183667aa2a5f3c61e390934b0273d2ad7.tar.xz linux-82aa5d6183667aa2a5f3c61e390934b0273d2ad7.zip |
[PATCH] splice: fix smaller sized splice reads
Signed-off-by: Jens Axboe <axboe@suse.de>
Diffstat (limited to '')
-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, error = 0; bytes = 0; for (i = 0; i < nr_pages; i++, index++) { + unsigned int this_len; + + if (!len) + break; + + /* + * this_len is the max we'll use from this page + */ + this_len = min(len, PAGE_CACHE_SIZE - loff); find_page: /* * lookup the page for this index @@ -366,11 +375,13 @@ readpage: * force quit after adding this page */ nr_pages = i; + this_len = min(this_len, loff); } } fill_it: pages[i] = page; - bytes += PAGE_CACHE_SIZE - loff; + bytes += this_len; + len -= this_len; loff = 0; } |