Message ID | 20231222061313.12260-6-nj.shetty@samsung.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-9446-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:2483:b0:fb:cd0c:d3e with SMTP id q3csp900156dyi; Thu, 21 Dec 2023 23:34:28 -0800 (PST) X-Google-Smtp-Source: AGHT+IFFBngXxsxh71Wk8IyoCrDkfyklaee86NNeFnrBxG3zZCUzyuoySRgp0pIOlYTqxNQTXt82 X-Received: by 2002:a17:906:50a:b0:a02:bc2d:e026 with SMTP id j10-20020a170906050a00b00a02bc2de026mr455099eja.46.1703230468108; Thu, 21 Dec 2023 23:34:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703230468; cv=none; d=google.com; s=arc-20160816; b=1KU+wQpOkFhZe6xzrtnj7Dks2P9c5/lJ/XAGey5GnXFW/tB1kO7SHQkTztXnQZJ1su mqduKFjdBPrOlItEPAnQhifff6dQA2F/VxEqW4/gxX14n/9Wel/9SAGkOiIdYLM6dsq7 Y2ODBLzWB2Ysen/dwxvmR/AKFc/nD5RTzOkoTQuVAVgWnEixJYxkI01DGel9xTyXB60X FrMfE/RLvY8Pf3QFTYyWWNm0qc8CX0UVKPeKd2Oy2EXPqd46YEfCpmoZr0xw5LfESyxk TbIpAFQ2efZbUlkLpgG5gtb3QaTVkZqNQz35xuVBXOBCPcX2QNSM67AWD3RzHlEjvHsd yQxQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:dlp-filter:cms-type:content-transfer-encoding :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature :dkim-filter; bh=WyEZwCEcMZEgd+uPDvb2WQHlAKDzDTA2b4v6jEJOw5k=; fh=Ah9URUT0YMcW0AdypunxP2ZkdaXV7jPEsLx7S1j82es=; b=yGhlot2mnAo0q5N2cFawZGYeAPw+xTTel9WDYztDbYRsbPLrAcKYgs17ubtn3/Hf8h IM1biGyCW80Qtxc76V7aL2hzG+0k7xTa6R328Cb/E35eukj2fnGtAMJhaOXZqN3c5SGy 8a5Cxj9cvet2aDtjNQIldxSyGbW02BuiYwk6Qy0ayhybFW55L1ro7KF5Rgog3WxGDzzJ vM4AbNhgj9PH8mQ+92sq3ZiFCLXsny/kUVSqi9CFQmHGKHD8FPwNMlulJPSjufLxn7PT tWOy1AcouwDa9yk8HCJ3kXnIzZaLeVKjvUcM2VLSrE+e3aDv4e4NLG95NREqlcZZ9Po3 chdQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=aFFNXEWc; spf=pass (google.com: domain of linux-kernel+bounces-9446-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-9446-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id l22-20020a170907915600b00a269fa420c0si1461701ejs.555.2023.12.21.23.34.27 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Dec 2023 23:34:28 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-9446-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=aFFNXEWc; spf=pass (google.com: domain of linux-kernel+bounces-9446-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-9446-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 8EB521F26012 for <ouuuleilei@gmail.com>; Fri, 22 Dec 2023 07:34:27 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C9E03219FA; Fri, 22 Dec 2023 07:32:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=samsung.com header.i=@samsung.com header.b="aFFNXEWc" X-Original-To: linux-kernel@vger.kernel.org Received: from mailout3.samsung.com (mailout3.samsung.com [203.254.224.33]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 849871EB4B for <linux-kernel@vger.kernel.org>; Fri, 22 Dec 2023 07:32:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=samsung.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=samsung.com Received: from epcas5p3.samsung.com (unknown [182.195.41.41]) by mailout3.samsung.com (KnoxPortal) with ESMTP id 20231222073216epoutp033d321ab0524045635d3d1a678ddcae9d~jFvds3hAD2965229652epoutp039 for <linux-kernel@vger.kernel.org>; Fri, 22 Dec 2023 07:32:16 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout3.samsung.com 20231222073216epoutp033d321ab0524045635d3d1a678ddcae9d~jFvds3hAD2965229652epoutp039 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1703230336; bh=WyEZwCEcMZEgd+uPDvb2WQHlAKDzDTA2b4v6jEJOw5k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aFFNXEWcDSD08Jt4soITZ4CqvtFquJiYPLx0JiGHGyIuKL+tH5o9yZKacBbvZ7Xhv PrUqQ07BqhP1aOUJ7RAM0MbQO44oIDoqpipf5559/APFr+SAQWTyYAsfmfsIKF1JcH heaUv64PVHtIzO+3iUTb9CURktKTFXKaXl5vVvvg= Received: from epsnrtp4.localdomain (unknown [182.195.42.165]) by epcas5p3.samsung.com (KnoxPortal) with ESMTP id 20231222073215epcas5p3d382a2a311619cd6cbaeddbeb22c4db8~jFvdKbJmw0585105851epcas5p31; Fri, 22 Dec 2023 07:32:15 +0000 (GMT) Received: from epsmgec5p1new.samsung.com (unknown [182.195.38.177]) by epsnrtp4.localdomain (Postfix) with ESMTP id 4SxJsT44Cmz4x9Q1; Fri, 22 Dec 2023 07:32:13 +0000 (GMT) Received: from epcas5p4.samsung.com ( [182.195.41.42]) by epsmgec5p1new.samsung.com (Symantec Messaging Gateway) with SMTP id 9A.54.08567.D7B35856; Fri, 22 Dec 2023 16:32:13 +0900 (KST) Received: from epsmtrp2.samsung.com (unknown [182.195.40.14]) by epcas5p1.samsung.com (KnoxPortal) with ESMTPA id 20231222062136epcas5p18f39a4dea2e66c56c652f29c0dc85a15~jExxKy2F72292622926epcas5p1C; Fri, 22 Dec 2023 06:21:36 +0000 (GMT) Received: from epsmgmc1p1new.samsung.com (unknown [182.195.42.40]) by epsmtrp2.samsung.com (KnoxPortal) with ESMTP id 20231222062136epsmtrp2e00b9a0c775dac9476ac12096c995dc0~jExxJ2QAp1637116371epsmtrp2K; Fri, 22 Dec 2023 06:21:36 +0000 (GMT) X-AuditID: b6c32a44-3abff70000002177-7e-65853b7d75e0 Received: from epsmtip2.samsung.com ( [182.195.34.31]) by epsmgmc1p1new.samsung.com (Symantec Messaging Gateway) with SMTP id 20.3D.07368.0FA25856; Fri, 22 Dec 2023 15:21:36 +0900 (KST) Received: from green245.sa.corp.samsungelectronics.net (unknown [107.99.41.245]) by epsmtip2.samsung.com (KnoxPortal) with ESMTPA id 20231222062132epsmtip2ec4c90b353e75c0a4e1c894584ccc4c5~jExtyQ-Ok0362303623epsmtip2U; Fri, 22 Dec 2023 06:21:32 +0000 (GMT) From: Nitesh Shetty <nj.shetty@samsung.com> To: Jens Axboe <axboe@kernel.dk>, Jonathan Corbet <corbet@lwn.net>, Alasdair Kergon <agk@redhat.com>, Mike Snitzer <snitzer@kernel.org>, Mikulas Patocka <mpatocka@redhat.com>, dm-devel@lists.linux.dev, Keith Busch <kbusch@kernel.org>, Christoph Hellwig <hch@lst.de>, Sagi Grimberg <sagi@grimberg.me>, Chaitanya Kulkarni <kch@nvidia.com>, Alexander Viro <viro@zeniv.linux.org.uk>, Christian Brauner <brauner@kernel.org> Cc: martin.petersen@oracle.com, linux-scsi@vger.kernel.org, nitheshshetty@gmail.com, anuj1072538@gmail.com, gost.dev@samsung.com, mcgrof@kernel.org, Anuj Gupta <anuj20.g@samsung.com>, Hannes Reinecke <hare@suse.de>, Nitesh Shetty <nj.shetty@samsung.com>, linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, linux-nvme@lists.infradead.org, linux-fsdevel@vger.kernel.org Subject: [PATCH v19 05/12] fs/read_write: Enable copy_file_range for block device. Date: Fri, 22 Dec 2023 11:42:59 +0530 Message-Id: <20231222061313.12260-6-nj.shetty@samsung.com> X-Mailer: git-send-email 2.35.1.500.gb896f729e2 In-Reply-To: <20231222061313.12260-1-nj.shetty@samsung.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Brightmail-Tracker: H4sIAAAAAAAAA01Te1BUZRTvu3f3smALFyT7XIZiNmkQXGCL3T5UhFG0O8VMBGiN0wzcYa/A ALvbPjJsQhCQR8oCYhNL8hKpBUaUl8tjzUDeKRnyLEpHIHINB8ggGZdYLpT//c7vnN/vfOd8 c3i4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nTL2Rlu2/GhmHzlQABX+ok+Bjrf9lw9gp5sGJOpykEE7V6vGhodZ77euKZnu07 yvfWaNWDPM98vclB+anH+2jtHENR0izLcb6/94P+k9NaPb+5JQ7YymupSV7O33nG8n2OK/wH Ugd9worClySZ9mddXZvbEMJxk9bbR9xs2t2zNQ75Nsos+YsMhvQ1ubl+Rh/UH7B53QkUyW0M njl5dsOB6OlK/VVZ56pfBu0HybYY3DIvujrlGmZfyx2J7T3j6ZVY6f2uY4V5o+uCQfWj7VKJ 7t6EpurSgkqZUpmBRwXPf45ltZ7eQp7TiAjFYbG7C84pxL8BvynQ1GYDAAA= X-CMS-MailID: 20231222062136epcas5p18f39a4dea2e66c56c652f29c0dc85a15 X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" X-Sendblock-Type: REQ_APPROVE CMS-TYPE: 105P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20231222062136epcas5p18f39a4dea2e66c56c652f29c0dc85a15 References: <20231222061313.12260-1-nj.shetty@samsung.com> <CGME20231222062136epcas5p18f39a4dea2e66c56c652f29c0dc85a15@epcas5p1.samsung.com> X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1785966591212928808 X-GMAIL-MSGID: 1785966591212928808 |
Series |
Implement copy offload support
|
|
Commit Message
Nitesh Shetty
Dec. 22, 2023, 6:12 a.m. UTC
From: Anuj Gupta <anuj20.g@samsung.com> This is a prep patch. Allow copy_file_range to work for block devices. Relaxing generic_copy_file_checks allows us to reuse the existing infra, instead of adding a new user interface for block copy offload. Change generic_copy_file_checks to use ->f_mapping->host for both inode_in and inode_out. Allow block device in generic_file_rw_checks. Reviewed-by: Hannes Reinecke <hare@suse.de> Signed-off-by: Anuj Gupta <anuj20.g@samsung.com> Signed-off-by: Nitesh Shetty <nj.shetty@samsung.com> --- fs/read_write.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/fs/read_write.c b/fs/read_write.c index 4771701c896b..f0f52bf48f57 100644 --- a/fs/read_write.c +++ b/fs/read_write.c @@ -1405,8 +1405,8 @@ static int generic_copy_file_checks(struct file *file_in, loff_t pos_in, struct file *file_out, loff_t pos_out, size_t *req_count, unsigned int flags) { - struct inode *inode_in = file_inode(file_in); - struct inode *inode_out = file_inode(file_out); + struct inode *inode_in = file_in->f_mapping->host; + struct inode *inode_out = file_out->f_mapping->host; uint64_t count = *req_count; loff_t size_in; int ret; @@ -1708,7 +1708,9 @@ int generic_file_rw_checks(struct file *file_in, struct file *file_out) /* Don't copy dirs, pipes, sockets... */ if (S_ISDIR(inode_in->i_mode) || S_ISDIR(inode_out->i_mode)) return -EISDIR; - if (!S_ISREG(inode_in->i_mode) || !S_ISREG(inode_out->i_mode)) + if (!S_ISREG(inode_in->i_mode) && !S_ISBLK(inode_in->i_mode)) + return -EINVAL; + if ((inode_in->i_mode & S_IFMT) != (inode_out->i_mode & S_IFMT)) return -EINVAL; if (!(file_in->f_mode & FMODE_READ) ||