Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp3645740pxb; Mon, 9 Nov 2020 17:27:42 -0800 (PST) X-Google-Smtp-Source: ABdhPJz6AkhuJWks7JYLDUNKeyO857n8G3kAdtHdPdDiHtBw0UnAGsIFzKKJvE8uhJYsRNNaQbzQ X-Received: by 2002:a17:906:3daa:: with SMTP id y10mr17561361ejh.23.1604971662453; Mon, 09 Nov 2020 17:27:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604971662; cv=none; d=google.com; s=arc-20160816; b=aoS5/9nfUqGwy0tUk+XyZ6DfW4qMyBUb7q0vL0KLCwRxrQyFicvNo0MTyATQ3ZyAvt LCWSgWGRCrVF46PdGZZnUlDnd4TOE4/MJEHE8Ik6Q7RdwpO5gThKr09b8tgaLvIIhIAx BaOS+RFn/Pbd9HxSueWdHExI8Wd/0Y2lwSJeTCjTYCAsdNmXeMkPU63dl3RBgjSTnsi7 ou6434sWWczF20VQsb2UjKtAc8oKqVqi+cUfU+xo8fS8zMnEwSDtgdX2+r/Api1oTRn1 +NvkkRYPBX8dm5Q7eRRWkIS9SgpXL+ApLK6rLeT6Lh7pufI7tm23GuJTRxzUU6iiWhCV RzGw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=7WDHMWNMdnfvdyJ61BguDg+nXCfZYDgKrvAvUQyK6q0=; b=OQ9FJV1wCn5vrO1edNeU9FaIHsisAtDDxMArz/yFQ1QCgRzO79XrRC5UiL6RXM9Y/Y UnkkwMaJQWZYGJMA8vqaqq/pmfF6zoqY5mUowsSns6r0gmrzNCJ9ht/BAwvmxUrYc1FH ktidVbDtXrPHtcLI2QFKwQZr8hMPj7UsqReWDimwgguXxV9rVs4Ti4+tHrZYMuJxUPO7 sHI/4eYtZ+nV3MJxKK5NYWEFPoNVxCxREYWH5/JkcBooFgz7vTfY5sG99Eg2W+8rNgjF 3VpEKh6Z8KYF/jwhq170eNqolj0wZH9YIP2n5vXA/qA9vFs4ENF8vbYZtaLwW5Ru90QJ gLIg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id cq11si8168365edb.332.2020.11.09.17.27.19; Mon, 09 Nov 2020 17:27:42 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731195AbgKJBZv (ORCPT + 99 others); Mon, 9 Nov 2020 20:25:51 -0500 Received: from szxga06-in.huawei.com ([45.249.212.32]:7474 "EHLO szxga06-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730603AbgKJBZu (ORCPT ); Mon, 9 Nov 2020 20:25:50 -0500 Received: from DGGEMS411-HUB.china.huawei.com (unknown [172.30.72.59]) by szxga06-in.huawei.com (SkyGuard) with ESMTP id 4CVVYN2sYkzhhH9; Tue, 10 Nov 2020 09:25:44 +0800 (CST) Received: from szvp000203569.huawei.com (10.120.216.130) by DGGEMS411-HUB.china.huawei.com (10.3.19.211) with Microsoft SMTP Server id 14.3.487.0; Tue, 10 Nov 2020 09:25:38 +0800 From: Chao Yu To: CC: , , , Chao Yu Subject: [PATCH v5 1/2] f2fs: avoid unneeded data copy in f2fs_ioc_move_range() Date: Tue, 10 Nov 2020 09:24:36 +0800 Message-ID: <20201110012437.26482-1-yuchao0@huawei.com> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.120.216.130] X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Fields in struct f2fs_move_range won't change in f2fs_ioc_move_range(), let's avoid copying this structure's data to userspace. Signed-off-by: Chao Yu --- v5: - no change. fs/f2fs/file.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c index 52417a2e3f4f..22ae8ae0072f 100644 --- a/fs/f2fs/file.c +++ b/fs/f2fs/file.c @@ -2898,12 +2898,6 @@ static int f2fs_ioc_move_range(struct file *filp, unsigned long arg) range.pos_out, range.len); mnt_drop_write_file(filp); - if (err) - goto err_out; - - if (copy_to_user((struct f2fs_move_range __user *)arg, - &range, sizeof(range))) - err = -EFAULT; err_out: fdput(dst); return err; -- 2.26.2