From patchwork Sat Oct 24 23:17:14 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peng Tao X-Patchwork-Id: 7480481 Return-Path: X-Original-To: patchwork-linux-nfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id ED71CBF90C for ; Sat, 24 Oct 2015 15:29:46 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 2C1B1206EF for ; Sat, 24 Oct 2015 15:29:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 45FA52070B for ; Sat, 24 Oct 2015 15:29:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752766AbbJXP3l (ORCPT ); Sat, 24 Oct 2015 11:29:41 -0400 Received: from mail-pa0-f49.google.com ([209.85.220.49]:34030 "EHLO mail-pa0-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752715AbbJXP3g (ORCPT ); Sat, 24 Oct 2015 11:29:36 -0400 Received: by padhk11 with SMTP id hk11so144713338pad.1 for ; Sat, 24 Oct 2015 08:29:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=primarydata_com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=A3jAWg72IqyYV+Ug7x5t24OQfLZEejV4tsPhHNtDDf0=; b=ks3pxxCN5oCujAvpwi4LgsUYRAVPXRVHVMsgEVKdtMvzSprAN8/171kRXQfhwZxku7 z0jXLOWvY1aMJI/mA22sHH1/2ZvpdcgyB0iNBzFN+ww4X7OFD73KbvBmjVoCvjPnodaW xmrGk0Cn+wFJhJAHMMwwjGJJGOELgOqSFCPXkvti4/IDgK+JvsaJKvXTDuQ1+BpNW5FK HlO0h5g6J+OjlgJkv2yv74p+nwRPLNDkawNYGq915p0VNWNmL9Hsc2BgdGG9vdBv73vD fNnOGgCF4GSIDPHVT/eCHR/jUOLBacaPdddVZSWQbY8zq6IiooPrgQlgkyZCikcLZiWL 1h7A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=A3jAWg72IqyYV+Ug7x5t24OQfLZEejV4tsPhHNtDDf0=; b=SwQcNwJ3M12Z8eTkEuz4/J35Y0qasPGjYaldsowxXlf74ZRgslv7qZPxhmOd8C0ksM PGeFsOu+ZKV0jcRhyhhT2CwvemlFMQxOBpTrDm7GCmux0EXSzDa7acPIzdVxvahBngxN /zszCJNsCTgDE0tTPrNukwBBwL9EBbA40EXO/jt/Tib34HJ3g4YDIjvejvIvmQFdoE2x EkfqkTUaz4c3eVDhTZMY1OG2w1A3UGOHv/Ld2/9L9uC5qGQBqXdDORlPTlL98c+PXQNT bBaRHYgVhwImompHi7phMpAha8KiGzMcQ46BXunoaE+FpDpyEEOOE+oPWEs1bNamIV2z 0SYA== X-Gm-Message-State: ALoCoQkUyYBFCsy7nJOmMbxlwECPityl7XsmFBBuz+sZgOZUVh81vOUjDW2gBqmwXvZs3RPJNzrN X-Received: by 10.68.196.97 with SMTP id il1mr11872645pbc.131.1445700575308; Sat, 24 Oct 2015 08:29:35 -0700 (PDT) Received: from lear.localdomain (ec2-54-65-164-9.ap-northeast-1.compute.amazonaws.com. [54.65.164.9]) by smtp.gmail.com with ESMTPSA id nj1sm24764918pbc.2.2015.10.24.08.29.28 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 24 Oct 2015 08:29:34 -0700 (PDT) From: Peng Tao To: linux-fsdevel@vger.kernel.org Cc: Trond Myklebust , Anna Schumaker , Christoph Hellwig , Zach Brown , Darren Hart , Jeff Layton , bfields@fieldses.org, "Darrick J. Wong" , viro@zeniv.linux.org.uk, linux-nfs@vger.kernel.org, linux-btrfs@vger.kernel.org, linux-cifs@vger.kernel.org, Steve French , Peng Tao Subject: [PATCH 7/9] nfs42: remove private clone ioctl handler Date: Sun, 25 Oct 2015 07:17:14 +0800 Message-Id: <1445728636-10109-8-git-send-email-tao.peng@primarydata.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1445728636-10109-1-git-send-email-tao.peng@primarydata.com> References: <1445728636-10109-1-git-send-email-tao.peng@primarydata.com> Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Spam-Status: No, score=-4.8 required=5.0 tests=BAYES_00, DATE_IN_FUTURE_06_12, DKIM_SIGNED, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, 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 BTRFS_IOC_CLONE/BTRFS_IOC_CLONE_RANGE is now handled by generic layer and goes through the .copy_file_range method. Signed-off-by: Peng Tao --- fs/nfs/nfs4file.c | 96 ------------------------------------------------------- 1 file changed, 96 deletions(-) diff --git a/fs/nfs/nfs4file.c b/fs/nfs/nfs4file.c index f1924d8..181b67b 100644 --- a/fs/nfs/nfs4file.c +++ b/fs/nfs/nfs4file.c @@ -240,99 +240,8 @@ out_unlock: out: return ret < 0 ? ret : len; } - -static noinline long -nfs42_ioctl_clone(struct file *dst_file, unsigned long srcfd, - u64 src_off, u64 dst_off, u64 count) -{ - struct inode *dst_inode = file_inode(dst_file); - struct fd src_file; - struct inode *src_inode; - int ret; - - /* dst file must be opened for writing */ - if (!(dst_file->f_mode & FMODE_WRITE)) - return -EINVAL; - - ret = mnt_want_write_file(dst_file); - if (ret) - return ret; - - src_file = fdget(srcfd); - if (!src_file.file) { - ret = -EBADF; - goto out_drop_write; - } - - src_inode = file_inode(src_file.file); - - /* src and dst must be different files */ - ret = -EINVAL; - if (src_inode == dst_inode) - goto out_fput; - - /* src file must be opened for reading */ - if (!(src_file.file->f_mode & FMODE_READ)) - goto out_fput; - - /* src and dst must be regular files */ - ret = -EISDIR; - if (!S_ISREG(src_inode->i_mode) || !S_ISREG(dst_inode->i_mode)) - goto out_fput; - - ret = -EXDEV; - if (src_file.file->f_path.mnt != dst_file->f_path.mnt || - src_inode->i_sb != dst_inode->i_sb) - goto out_fput; - - ret = nfs42_copy_file_range(src_file.file, src_off, dst_file, - dst_off, count, 0); - if (ret > 0) - ret = 0; - -out_fput: - fdput(src_file); -out_drop_write: - mnt_drop_write_file(dst_file); - return ret; -} - -static long nfs42_ioctl_clone_range(struct file *dst_file, void __user *argp) -{ - struct nfs_ioctl_clone_range_args args; - - if (copy_from_user(&args, argp, sizeof(args))) - return -EFAULT; - - return nfs42_ioctl_clone(dst_file, args.src_fd, args.src_off, args.dst_off, args.count); -} -#else -static long nfs42_ioctl_clone(struct file *dst_file, unsigned long srcfd, - u64 src_off, u64 dst_off, u64 count) -{ - return -ENOTTY; -} - -static long nfs42_ioctl_clone_range(struct file *dst_file, void __user *argp) -{ - return -ENOTTY; -} #endif /* CONFIG_NFS_V4_2 */ -long nfs4_ioctl(struct file *file, unsigned int cmd, unsigned long arg) -{ - void __user *argp = (void __user *)arg; - - switch (cmd) { - case NFS_IOC_CLONE: - return nfs42_ioctl_clone(file, arg, 0, 0, 0); - case NFS_IOC_CLONE_RANGE: - return nfs42_ioctl_clone_range(file, argp); - } - - return -ENOTTY; -} - const struct file_operations nfs4_file_operations = { #ifdef CONFIG_NFS_V4_2 .llseek = nfs4_file_llseek, @@ -356,9 +265,4 @@ const struct file_operations nfs4_file_operations = { #endif /* CONFIG_NFS_V4_2 */ .check_flags = nfs_check_flags, .setlease = simple_nosetlease, -#ifdef CONFIG_COMPAT - .unlocked_ioctl = nfs4_ioctl, -#else - .compat_ioctl = nfs4_ioctl, -#endif /* CONFIG_COMPAT */ };