diff options
Diffstat (limited to 'fs/splice.c')
-rw-r--r-- | fs/splice.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/fs/splice.c b/fs/splice.c index 1ec0493266b3..406ef2b792c2 100644 --- a/fs/splice.c +++ b/fs/splice.c | |||
@@ -25,11 +25,12 @@ | |||
25 | #include <linux/mm_inline.h> | 25 | #include <linux/mm_inline.h> |
26 | #include <linux/swap.h> | 26 | #include <linux/swap.h> |
27 | #include <linux/writeback.h> | 27 | #include <linux/writeback.h> |
28 | #include <linux/module.h> | 28 | #include <linux/export.h> |
29 | #include <linux/syscalls.h> | 29 | #include <linux/syscalls.h> |
30 | #include <linux/uio.h> | 30 | #include <linux/uio.h> |
31 | #include <linux/security.h> | 31 | #include <linux/security.h> |
32 | #include <linux/gfp.h> | 32 | #include <linux/gfp.h> |
33 | #include <linux/socket.h> | ||
33 | 34 | ||
34 | /* | 35 | /* |
35 | * Attempt to steal a page from a pipe buffer. This should perhaps go into | 36 | * Attempt to steal a page from a pipe buffer. This should perhaps go into |
@@ -690,7 +691,9 @@ static int pipe_to_sendpage(struct pipe_inode_info *pipe, | |||
690 | if (!likely(file->f_op && file->f_op->sendpage)) | 691 | if (!likely(file->f_op && file->f_op->sendpage)) |
691 | return -EINVAL; | 692 | return -EINVAL; |
692 | 693 | ||
693 | more = (sd->flags & SPLICE_F_MORE) || sd->len < sd->total_len; | 694 | more = (sd->flags & SPLICE_F_MORE) ? MSG_MORE : 0; |
695 | if (sd->len < sd->total_len) | ||
696 | more |= MSG_SENDPAGE_NOTLAST; | ||
694 | return file->f_op->sendpage(file, buf->page, buf->offset, | 697 | return file->f_op->sendpage(file, buf->page, buf->offset, |
695 | sd->len, &pos, more); | 698 | sd->len, &pos, more); |
696 | } | 699 | } |
@@ -737,15 +740,12 @@ int pipe_to_file(struct pipe_inode_info *pipe, struct pipe_buffer *buf, | |||
737 | goto out; | 740 | goto out; |
738 | 741 | ||
739 | if (buf->page != page) { | 742 | if (buf->page != page) { |
740 | /* | ||
741 | * Careful, ->map() uses KM_USER0! | ||
742 | */ | ||
743 | char *src = buf->ops->map(pipe, buf, 1); | 743 | char *src = buf->ops->map(pipe, buf, 1); |
744 | char *dst = kmap_atomic(page, KM_USER1); | 744 | char *dst = kmap_atomic(page); |
745 | 745 | ||
746 | memcpy(dst + offset, src + buf->offset, this_len); | 746 | memcpy(dst + offset, src + buf->offset, this_len); |
747 | flush_dcache_page(page); | 747 | flush_dcache_page(page); |
748 | kunmap_atomic(dst, KM_USER1); | 748 | kunmap_atomic(dst); |
749 | buf->ops->unmap(pipe, buf, src); | 749 | buf->ops->unmap(pipe, buf, src); |
750 | } | 750 | } |
751 | ret = pagecache_write_end(file, mapping, sd->pos, this_len, this_len, | 751 | ret = pagecache_write_end(file, mapping, sd->pos, this_len, this_len, |
@@ -1388,7 +1388,7 @@ static long do_splice(struct file *in, loff_t __user *off_in, | |||
1388 | */ | 1388 | */ |
1389 | static int get_iovec_page_array(const struct iovec __user *iov, | 1389 | static int get_iovec_page_array(const struct iovec __user *iov, |
1390 | unsigned int nr_vecs, struct page **pages, | 1390 | unsigned int nr_vecs, struct page **pages, |
1391 | struct partial_page *partial, int aligned, | 1391 | struct partial_page *partial, bool aligned, |
1392 | unsigned int pipe_buffers) | 1392 | unsigned int pipe_buffers) |
1393 | { | 1393 | { |
1394 | int buffers = 0, error = 0; | 1394 | int buffers = 0, error = 0; |
@@ -1626,7 +1626,7 @@ static long vmsplice_to_pipe(struct file *file, const struct iovec __user *iov, | |||
1626 | return -ENOMEM; | 1626 | return -ENOMEM; |
1627 | 1627 | ||
1628 | spd.nr_pages = get_iovec_page_array(iov, nr_segs, spd.pages, | 1628 | spd.nr_pages = get_iovec_page_array(iov, nr_segs, spd.pages, |
1629 | spd.partial, flags & SPLICE_F_GIFT, | 1629 | spd.partial, false, |
1630 | pipe->buffers); | 1630 | pipe->buffers); |
1631 | if (spd.nr_pages <= 0) | 1631 | if (spd.nr_pages <= 0) |
1632 | ret = spd.nr_pages; | 1632 | ret = spd.nr_pages; |