From patchwork Thu Dec 4 17:50:50 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pieter Smith X-Patchwork-Id: 5439631 Return-Path: X-Original-To: patchwork-linux-nfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 673AA9F30B for ; Thu, 4 Dec 2014 17:54:57 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 953B62035C for ; Thu, 4 Dec 2014 17:54:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C471B2021F for ; Thu, 4 Dec 2014 17:54:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932849AbaLDRyf (ORCPT ); Thu, 4 Dec 2014 12:54:35 -0500 Received: from mail-wi0-f182.google.com ([209.85.212.182]:53231 "EHLO mail-wi0-f182.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932991AbaLDRwD (ORCPT ); Thu, 4 Dec 2014 12:52:03 -0500 Received: by mail-wi0-f182.google.com with SMTP id h11so28774509wiw.3 for ; Thu, 04 Dec 2014 09:52:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=O/X86gIkp3MZP9Yr/BCyWLEyhYqoPfTAojJZmY8H2AU=; b=NWYSy0VcXqTLklPhEBOW4tIds2pQuRifipcB/imwnkFQLWXubmPEUeP9St2Az1+S89 ez0RwgBVF+DHz0HJHZLUsexnkFWrXE2YU0TdpNGfwQQL0VtWE4YnwzCovbNG7xM9JeP3 iavEqGKNRZY0bagZM0VVfSUvUEIJOQEsHtnPkPWsibw3XxB8dTUB3/whHAq6A83OvI7V y3AKG34tqaoVekXG/8XtbWxMkFPsYq66rGkmw0OLKuh4WoKVoxOiCMizUrSr+7+Ect0l BSjNnhCkm4gDYFZyQ9Rxq3gTejN8rZDCYYJlqz1QzSIaD5DD1q4XxKv306yVk8ViJ2NI m2zA== X-Received: by 10.180.83.228 with SMTP id t4mr15999656wiy.28.1417715521200; Thu, 04 Dec 2014 09:52:01 -0800 (PST) Received: from localhost.localdomain (ip4da2e5c1.direct-adsl.nl. [77.162.229.193]) by mx.google.com with ESMTPSA id et4sm6578978wjd.15.2014.12.04.09.51.58 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 04 Dec 2014 09:52:00 -0800 (PST) From: Pieter Smith To: linux-kernel@vger.kernel.org Cc: Josh Triplett , Pieter Smith , Alexander Duyck , Alexander Viro , Alexei Starovoitov , Andrew Morton , Bertrand Jacquin , Catalina Mocanu , Daniel Borkmann , "David S. Miller" , Eric Dumazet , "Eric W. Biederman" , Fabian Frederick , fuse-devel@lists.sourceforge.net (open list:FUSE: FILESYSTEM...), Geert Uytterhoeven , Hugh Dickins , Iulia Manda , Jan Beulich , "J. Bruce Fields" , Jeff Layton , linux-api@vger.kernel.org (open list:ABI/API), linux-fsdevel@vger.kernel.org, linux-nfs@vger.kernel.org (open list:KERNEL NFSD, SUNR...), "Luis R. Rodriguez" , Matt Turner , Mel Gorman , "Michael S. Tsirkin" , Miklos Szeredi , netdev@vger.kernel.org (open list:NETWORKING [GENERAL]), Oleg Nesterov , Paul Durrant , "Paul E. McKenney" , Peter Foley , Thomas Graf , Tom Herbert , Trond Myklebust , Willem de Bruijn , Xiao Guangrong , =?UTF-8?q?=E8=94=A1=E6=AD=A3=E9=BE=99?= Subject: [PATCH v6 2/7] fs: moved kernel_write to fs/read_write Date: Thu, 4 Dec 2014 18:50:50 +0100 Message-Id: <1417715473-24110-3-git-send-email-pieter@boesman.nl> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1417715473-24110-1-git-send-email-pieter@boesman.nl> References: <1417715473-24110-1-git-send-email-pieter@boesman.nl> Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID,T_RP_MATCHES_RCVD,UNPARSEABLE_RELAY autolearn=unavailable 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 kernel_write shares infrastructure with the read_write translation unit but not with the splice translation unit. Grouping kernel_write with the read_write translation unit is more logical. It also paves the way to compiling out the splice group of syscalls for embedded systems that do not need them. Signed-off-by: Pieter Smith --- fs/read_write.c | 16 ++++++++++++++++ fs/splice.c | 16 ---------------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/fs/read_write.c b/fs/read_write.c index d9451ba..f4c8d8b 100644 --- a/fs/read_write.c +++ b/fs/read_write.c @@ -1191,3 +1191,19 @@ COMPAT_SYSCALL_DEFINE5(pwritev, compat_ulong_t, fd, } #endif +ssize_t kernel_write(struct file *file, const char *buf, size_t count, + loff_t pos) +{ + mm_segment_t old_fs; + ssize_t res; + + old_fs = get_fs(); + set_fs(get_ds()); + /* The cast to a user pointer is valid due to the set_fs() */ + res = vfs_write(file, (__force const char __user *)buf, count, &pos); + set_fs(old_fs); + + return res; +} +EXPORT_SYMBOL(kernel_write); + diff --git a/fs/splice.c b/fs/splice.c index c1a2861..44b201b 100644 --- a/fs/splice.c +++ b/fs/splice.c @@ -583,22 +583,6 @@ static ssize_t kernel_readv(struct file *file, const struct iovec *vec, return res; } -ssize_t kernel_write(struct file *file, const char *buf, size_t count, - loff_t pos) -{ - mm_segment_t old_fs; - ssize_t res; - - old_fs = get_fs(); - set_fs(get_ds()); - /* The cast to a user pointer is valid due to the set_fs() */ - res = vfs_write(file, (__force const char __user *)buf, count, &pos); - set_fs(old_fs); - - return res; -} -EXPORT_SYMBOL(kernel_write); - ssize_t default_file_splice_read(struct file *in, loff_t *ppos, struct pipe_inode_info *pipe, size_t len, unsigned int flags)