From patchwork Tue Dec 15 17:29:12 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stanislav Kinsburskiy X-Patchwork-Id: 7856101 Return-Path: X-Original-To: patchwork-linux-fsdevel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id EC1CC9F349 for ; Tue, 15 Dec 2015 17:29:45 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B8E4C2020F for ; Tue, 15 Dec 2015 17:29:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B4D9B201EC for ; Tue, 15 Dec 2015 17:29:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965382AbbLOR3U (ORCPT ); Tue, 15 Dec 2015 12:29:20 -0500 Received: from swsoft-msk-nat.sw.ru ([195.214.232.10]:31754 "EHLO sandbox" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S965496AbbLOR3R (ORCPT ); Tue, 15 Dec 2015 12:29:17 -0500 Received: from localhost.localdomain (localhost [127.0.0.1]) by sandbox (8.14.8/8.14.8) with ESMTP id tBFHTC3v016458; Tue, 15 Dec 2015 21:29:12 +0400 Subject: [PATCH RFC 3/3] splice: add support of splicing to packetized pipe From: Stanislav Kinsburskiy To: linux-fsdevel@vger.kernel.org, viro@zeniv.linux.org.uk, linux-kernel@vger.kernel.org Cc: criu@openvz.org, skinsbursky@virtuozzo.com Date: Tue, 15 Dec 2015 21:29:12 +0400 Message-ID: <20151215172912.16355.90422.stgit@localhost.localdomain> In-Reply-To: <20151215172356.16355.29361.stgit@localhost.localdomain> References: <20151215172356.16355.29361.stgit@localhost.localdomain> User-Agent: StGit/0.17-dirty MIME-Version: 1.0 Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- fs/splice.c | 8 ++++++++ 1 file changed, 8 insertions(+) -- To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html 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);