From: Stanislav Kinsburskiy <skinsbursky@virtuozzo.com>
To: linux-fsdevel@vger.kernel.org, viro@zeniv.linux.org.uk,
linux-kernel@vger.kernel.org
Cc: criu@openvz.org, skinsbursky@virtuozzo.com
Subject: [PATCH RFC 3/3] splice: add support of splicing to packetized pipe
Date: Tue, 15 Dec 2015 21:29:12 +0400 [thread overview]
Message-ID: <20151215172912.16355.90422.stgit@localhost.localdomain> (raw)
In-Reply-To: <20151215172356.16355.29361.stgit@localhost.localdomain>
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);
prev parent reply other threads:[~2015-12-15 17:29 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-12-15 17:28 [PATCH RFC 0/3] Fix splice for packetized pipes Stanislav Kinsburskiy
2015-12-15 17:29 ` [PATCH RFC 1/3] pipe: make is_packetized() non-static and declare in pipe_fs_i.h Stanislav Kinsburskiy
2015-12-15 17:29 ` [PATCH RFC 2/3] splice: new SPLICE_F_PACKET flag introduced Stanislav Kinsburskiy
2015-12-15 17:29 ` Stanislav Kinsburskiy [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20151215172912.16355.90422.stgit@localhost.localdomain \
--to=skinsbursky@virtuozzo.com \
--cc=criu@openvz.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=viro@zeniv.linux.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).