summaryrefslogtreecommitdiff
path: root/fs/splice.c
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2016-12-10 13:20:53 -0500
committerAl Viro <viro@zeniv.linux.org.uk>2016-12-26 23:53:52 -0500
commit13c0f52beb6310b9c08804c0929901f70abd211a (patch)
tree2ecd8ac788982c1e72764c9069de73978a71c18c /fs/splice.c
parent3d6ea290f337cc64cf44290482e36306fc8aaa31 (diff)
make nr_pages calculation in default_file_splice_read() a bit less ugly
It's an artifact of lousy calling conventions of iov_iter_get_pages_alloc(). Hopefully, we'll get something saner come next cycle; for now that'll do. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/splice.c')
-rw-r--r--fs/splice.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/fs/splice.c b/fs/splice.c
index 1af65632c371..712bc902e414 100644
--- a/fs/splice.c
+++ b/fs/splice.c
@@ -385,7 +385,7 @@ static ssize_t default_file_splice_read(struct file *in, loff_t *ppos,
struct iov_iter to;
struct page **pages;
unsigned int nr_pages;
- size_t offset, dummy, copied = 0;
+ size_t offset, base, copied = 0;
ssize_t res;
int i;
@@ -400,12 +400,11 @@ static ssize_t default_file_splice_read(struct file *in, loff_t *ppos,
iov_iter_pipe(&to, ITER_PIPE | READ, pipe, len + offset);
- res = iov_iter_get_pages_alloc(&to, &pages, len + offset, &dummy);
+ res = iov_iter_get_pages_alloc(&to, &pages, len + offset, &base);
if (res <= 0)
return -ENOMEM;
- BUG_ON(dummy);
- nr_pages = DIV_ROUND_UP(res, PAGE_SIZE);
+ nr_pages = DIV_ROUND_UP(res + base, PAGE_SIZE);
vec = __vec;
if (nr_pages > PIPE_DEF_BUFFERS) {