Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1292375

[PATCH RFC 3/3] splice: add support of splicing to packetized pipe

From Stanislav Kinsburskiy <skinsbursky@virtuozzo.com>
Newsgroups linux.kernel
Subject [PATCH RFC 3/3] splice: add support of splicing to packetized pipe
Date 2015-12-15 18:30 +0100
Message-ID <qG1Ae-7eq-13@gated-at.bofh.it> (permalink)
References <qG1Ae-7eq-15@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


This patch uses SPLICE_F_PACKET as a flag, representing packetized pipe.
In splice_to_pipe() this flag is converted into PIPE_BUF_FLAG_PACKET on pipe
buffer.

Signed-off-by: Stanislav Kinsburskiy <skinsbursky@virtuozzo.com>
---
 fs/splice.c |    8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/fs/splice.c b/fs/splice.c
index 4cf700d..d698fb2 100644
--- a/fs/splice.c
+++ b/fs/splice.c
@@ -210,6 +210,8 @@ ssize_t splice_to_pipe(struct pipe_inode_info *pipe,
 			buf->ops = spd->ops;
 			if (spd->flags & SPLICE_F_GIFT)
 				buf->flags |= PIPE_BUF_FLAG_GIFT;
+			if (spd->flags & SPLICE_F_PACKET)
+				buf->flags |= PIPE_BUF_FLAG_PACKET;
 
 			pipe->nrbufs++;
 			page_nr++;
@@ -1420,6 +1422,9 @@ static long do_splice(struct file *in, loff_t __user *off_in,
 			offset = in->f_pos;
 		}
 
+		if (is_packetized(out))
+			flags |= SPLICE_F_PACKET;
+
 		ret = do_splice_to(in, &offset, opipe, len, flags);
 
 		if (!off_in)
@@ -1609,6 +1614,9 @@ static long vmsplice_to_pipe(struct file *file, const struct iovec __user *iov,
 	if (splice_grow_spd(pipe, &spd))
 		return -ENOMEM;
 
+	if (is_packetized(file))
+		spd.flags |= SPLICE_F_PACKET;
+
 	spd.nr_pages = get_iovec_page_array(iov, nr_segs, spd.pages,
 					    spd.partial, false,
 					    spd.nr_pages_max);

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | Next | Find similar | Unroll thread


Thread

[PATCH RFC 3/3] splice: add support of splicing to packetized pipe Stanislav Kinsburskiy <skinsbursky@virtuozzo.com> - 2015-12-15 18:30 +0100

csiph-web