Message ID | 20230811105300.15889-6-nj.shetty@samsung.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b824:0:b0:3f2:4152:657d with SMTP id z4csp1118770vqi; Fri, 11 Aug 2023 07:04:55 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFBrxOuxn24ZDv7iIh9hE2LbqOOXBN0zZgKwmm+9aAhvZT8RXoZ+BI7iopwWRm7SGXQ7wfZ X-Received: by 2002:a05:6a20:4c2:b0:141:d54e:a90a with SMTP id 2-20020a056a2004c200b00141d54ea90amr1649865pzd.56.1691762695464; Fri, 11 Aug 2023 07:04:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691762695; cv=none; d=google.com; s=arc-20160816; b=Da617VVYE9bGWMECv5d2bym4nuaBF0k/DLPJN4zK1lv6xXqlGH4QtR2JZlkw2uFx86 QLrTvLAvdYNohrldipa2QK2BxoWlNAmEdtVHTRYGG/xxVaK30vrcNPhabo/F6O+b0qmm qSAEmup4yAkiR2LCrGTF+dHnnTkb31tPb4E4wwdvUlH3Th+J6qNjTC5ACdp8Si6vlklL aSUs05Mmy5eAtH3+MYV0KLldQSNL6V8NiU+gsX8FUVmrMJMlNdXwuQlSKj9HKAUs+lL9 76APSajtRfsoJRuhXvcD95+8b1V4Zhmgg0qCLYjw4FsSJ4KwxzCLVO+zk6aYQUdKC9kG uLqQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:dlp-filter:cms-type :content-transfer-encoding:mime-version:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:dkim-filter; bh=MgYJBFtmH7216xSYBP2FX2+G/oY64phd7tAep8xj414=; fh=KPnJ2bV8QBHEZYZXgEBXTcZktFMQIXprWdeVUEsjHvE=; b=UBcRPh2cSSDl8eghPN7Xrw4Y0nELW/jWG7ckcYaNhUurhlASEGUY6ajepa3jn3iyol f0u7P64MZicBw4ABaW6MBT9h8nIuDb97PR8SGgo2Bm+llnQPZMZ881MdCabqytqFNJSD 6WMQBscVj3p3qVbYJM4y0NgviuU14DyC7+xL/o4rcAJ5sPx7fCRPns2DaD72iT784Rle /jY1jT8US67HnEwq4dyGun18RtWT4/drcC3w6+zJ9tO2DhfidVudXtoT4B7DaltezenC voNaaecTSGa6McyDTwfJ1ZwF2lrgKRNs7VfwwHkM29IiIRpCXyBLjWrGuWj1j8LE3GPl fWQg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=kLjEiHBI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t7-20020a056a0021c700b0068719ad3172si3554364pfj.76.2023.08.11.07.04.38; Fri, 11 Aug 2023 07:04:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=kLjEiHBI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236374AbjHKLUh (ORCPT <rfc822;shaohuahua6@gmail.com> + 99 others); Fri, 11 Aug 2023 07:20:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39626 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236334AbjHKLUc (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Fri, 11 Aug 2023 07:20:32 -0400 Received: from mailout3.samsung.com (mailout3.samsung.com [203.254.224.33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CDBC919AC for <linux-kernel@vger.kernel.org>; Fri, 11 Aug 2023 04:20:17 -0700 (PDT) Received: from epcas5p4.samsung.com (unknown [182.195.41.42]) by mailout3.samsung.com (KnoxPortal) with ESMTP id 20230811112015epoutp03962184bf6abdeafe843ec83728837215~6UDj0KPo90704607046epoutp039 for <linux-kernel@vger.kernel.org>; Fri, 11 Aug 2023 11:20:15 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout3.samsung.com 20230811112015epoutp03962184bf6abdeafe843ec83728837215~6UDj0KPo90704607046epoutp039 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1691752815; bh=MgYJBFtmH7216xSYBP2FX2+G/oY64phd7tAep8xj414=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kLjEiHBIl/69e5H9eT/n/VMQysj4wTSLh+9EuFpQLaHrivhd28bZAMGtFtyMmxheb StXL7vam6UtqyMYnY21IBHve5rm9e5QN20KSI1SQkosX4Kacg0hox16/Vh2JlM2ldd A3bLqvyKL0gmVqEnx/+LuOQMjrY0NtJLamU0wor8= Received: from epsnrtp4.localdomain (unknown [182.195.42.165]) by epcas5p3.samsung.com (KnoxPortal) with ESMTP id 20230811112014epcas5p3958f8d1967ab15897bb3be62821571ed~6UDjP4Mct0795807958epcas5p39; Fri, 11 Aug 2023 11:20:14 +0000 (GMT) Received: from epsmges5p2new.samsung.com (unknown [182.195.38.175]) by epsnrtp4.localdomain (Postfix) with ESMTP id 4RMhCw0bX0z4x9Pw; Fri, 11 Aug 2023 11:20:12 +0000 (GMT) Received: from epcas5p1.samsung.com ( [182.195.41.39]) by epsmges5p2new.samsung.com (Symantec Messaging Gateway) with SMTP id D1.F9.44250.B6916D46; Fri, 11 Aug 2023 20:20:11 +0900 (KST) Received: from epsmtrp2.samsung.com (unknown [182.195.40.14]) by epcas5p4.samsung.com (KnoxPortal) with ESMTPA id 20230811105723epcas5p468fa65dc9c5bea39d40359ce55bcd9aa~6Tvmbnr272396023960epcas5p4J; Fri, 11 Aug 2023 10:57:23 +0000 (GMT) Received: from epsmgms1p2new.samsung.com (unknown [182.195.42.42]) by epsmtrp2.samsung.com (KnoxPortal) with ESMTP id 20230811105723epsmtrp2adcad1d7712db43b279f48d44b4483be~6TvmaM7uj2537325373epsmtrp20; Fri, 11 Aug 2023 10:57:23 +0000 (GMT) X-AuditID: b6c32a4a-c4fff7000000acda-84-64d6196bc3b0 Received: from epsmtip2.samsung.com ( [182.195.34.31]) by epsmgms1p2new.samsung.com (Symantec Messaging Gateway) with SMTP id EA.01.30535.31416D46; Fri, 11 Aug 2023 19:57:23 +0900 (KST) Received: from green245.sa.corp.samsungelectronics.net (unknown [107.99.41.245]) by epsmtip2.samsung.com (KnoxPortal) with ESMTPA id 20230811105720epsmtip243422a725f23ed8a3fb938caebd214bf~6TvivIhqg1483514835epsmtip2E; Fri, 11 Aug 2023 10:57:19 +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>, dm-devel@redhat.com, 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, mcgrof@kernel.org, dlemoal@kernel.org, gost.dev@samsung.com, Anuj Gupta <anuj20.g@samsung.com>, 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 v14 05/11] fs/read_write: Enable copy_file_range for block device. Date: Fri, 11 Aug 2023 16:22:48 +0530 Message-Id: <20230811105300.15889-6-nj.shetty@samsung.com> X-Mailer: git-send-email 2.35.1.500.gb896f729e2 In-Reply-To: <20230811105300.15889-1-nj.shetty@samsung.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Brightmail-Tracker: H4sIAAAAAAAAA01TfVRTZRzuvXe7G+g4l2nxbp5kZx5LIGBDGJePoR3N7ik6hxOco9Yf48bu AWTcjX1I4x8ppALlQ4OCmQEJ8VVAC3CAExpHJ0sE9AiCqUDslJKQH5GiQIyb5X/P73l/z/P7 eM+PjwoXMDE/nTHSeobSSDFvTmd/wKvBGtGoWrYiIFpd51Hi49IllGi+UYIRs/33ATHT9ykg Jnt3EPa5E1xivK8LIRqbzyHEcccoINxXLQhhnwgiaj6p5RBn7AMc4kr3VxhR9a2bR9Q7lxHi WqkbEJ1PqlCiZXaeQ1yY2EQMLTm5O18ih27+wCGvDJpIa1MBRv5Ye4jsGc/FyFPFn3PJorw5 jLznnuCQ82evYmRxexMgH1g3k9aZu0jC+vcyYtNoSk3rJTSTolWnM6lK6duJql2qCIVMHiyP IiKlEobKpJXS3fEJwXvSNavjSiUHKY1plUqgDAZpaFysXmsy0pI0rcGolNI6tUYXrgsxUJkG E5MawtDGaLlMFhaxmpickVbX+JCr+0nw4e+/DPNyQcO6QsDnQzwcjtVlFQJvvhDvAfBmxTDG BvcBLKu4x2ODBQCLT36PFgKvNcWxpV7Eg4W4HcC20jg2KR+B80dGuB5bDA+CP6/wPfxGPBeF bT2ngCdAcQcCr9UM8zzqDXgSnL1exvVgDr4Vni52rPECPBo6VjoA218oLLnl66G98Bg4b72M sSm+cKByhuPBKO4P8zpOoB5/iJd4QVvNNMJqd8P6ljS26Q3wjrOdx2IxfDBnx1icDRvLGjBW exhAy5gFsA87YL6rBPX4oHgAbO0OZemXYbmrBWHr+sCiJzMIywug7etneAv8rrX6X38RHP37 I4xth4TNpxPYXRUD+NT2JbcUS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CEidnPgEbwywgL9G8dTbzBEaBWUhSs5CkFjAyrWKUTC0o zk3PLTYsMMpLLdcrTswtLs1L10vOz93ECI5ULa0djHtWfdA7xMjEwXiIUYKDWUmE1zb4UooQ b0piZVVqUX58UWlOavEhRmkOFiVx3m+ve1OEBNITS1KzU1MLUotgskwcnFINTEdnaUsJMFsq s/dnczyyquZh15h8Mdbp6KR+ri+FrHcna6tP6rtz5Ued3zFfqYjIA7/mxyZvUpyVwJeqpHrX 02HXxNlXKvfwKtU/Ps8rYNQ8v3GP/wqRSyqmpyzf910qT5z+J+SyxcX+yUuPbIr8uVS8zsbQ 66XDjM2Nr47UvBWaYvEmZ/K5s+v/xTxdefH88ezKQ41t/UwfWiu2Tdv+qXxiPU/3bZNN3U8E 7Lav3PPwYdHdzDdspnWNR2WzFC9V3PoStvnI+uM6xpMrXNXmyD8ynTx/55E5vHXvUrXnfeB+ Ga4wWbZv6Y4+hc96EfViz1fdda844loWefFckdu1f7p5528ENvgJHE++6pvapaPEUpyRaKjF XFScCAB+WHkdQwMAAA== X-CMS-MailID: 20230811105723epcas5p468fa65dc9c5bea39d40359ce55bcd9aa 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: 20230811105723epcas5p468fa65dc9c5bea39d40359ce55bcd9aa References: <20230811105300.15889-1-nj.shetty@samsung.com> <CGME20230811105723epcas5p468fa65dc9c5bea39d40359ce55bcd9aa@epcas5p4.samsung.com> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL, SPF_HELO_PASS,SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1773941760263468183 X-GMAIL-MSGID: 1773941760263468183 |
Series |
Implement copy offload support
|
|
Commit Message
Nitesh Shetty
Aug. 11, 2023, 10:52 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. 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 b07de77ef126..eaeb481477f4 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) ||