Message ID | 20230724060336.8939-1-nj.shetty@samsung.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9010:0:b0:3e4:2afc:c1 with SMTP id l16csp1603561vqg; Sun, 23 Jul 2023 23:23:46 -0700 (PDT) X-Google-Smtp-Source: APBJJlHaenINIGgzC1xZqMBBHxvu1auqNe+JgmYGZY9TcC3qsL/z7NQG4CK2S5blWWtCjO32FxFv X-Received: by 2002:a17:906:77c5:b0:994:34a2:8727 with SMTP id m5-20020a17090677c500b0099434a28727mr9877510ejn.41.1690179826146; Sun, 23 Jul 2023 23:23:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690179826; cv=none; d=google.com; s=arc-20160816; b=K8ePNiFn9UD/YU5EqA+4utMG1qB2Fe7q6p3Wyq1XXCqL57bDzeRSBofuOyyIQEWS8p Akcge85LkJ0mP+KZVzgIwZLm3XUjBlw5+CpdTNF061+Cr//mI2QxsX4Oz0P0H53zws++ nu2Rm4hkRYf81wCpmdlfARRQLb5xO6NImEei5Gz/p83kTZbdAbcVlpOlLGlX3bAxQxjr ZLRz6G+8vP76A4zE7ylSH1kfYnKaTblf+a6bGrQyLZPbHdCIeXXi92ANFlXsm2htUTUe hnEahbGDBQ/LLRHbAtZ8mjmoDeCEuFoscL0CM2YGr4li6iavqidlWm/zhjnyggTA7u1c SQHA== 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:message-id:date:subject:cc :to:from:dkim-signature:dkim-filter; bh=IK3dxHmN4H0mrKlZYjtF8HydO/F3EynIGSvvTtPQyYo=; fh=5gc+B5mJV1kkKrxs/FjuCyt1417yucuaWRx4UdbEyyo=; b=bBt/OVPXWJJI+Os3teVAfUWpoyU8T+6DgU1JwQS00m0rWlQL/TQqxE5pRmHCxSl31L 4PeRmgakyN65xVqKQ2pJkrSYQOboGnH8C7J0RxkyDM+Ebg4eqB2csJlWkbrM9UcnAdWV VxZQUfd48iAWQA93TZrSOGZ+NYS8a60H25TgcvMS/6zb/0VJvnwImpFHHuVCaj5qt67x CZynhv298J6QHOH38ns6brM0DFz2lTCrCqMFU+kP3eLYFLGglelK+Bvwv7IgCBoW1Ubu vLwUsib3NzEsbnvvL4+OXiLpM5n+Gkoq88DUaPnt1B2q1ehiUrCNPUG3DRKQZ0UKW2pm q/FQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=gaU9lxo5; 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 w20-20020a170906185400b009926928d482si5570265eje.447.2023.07.23.23.23.20; Sun, 23 Jul 2023 23:23:46 -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=gaU9lxo5; 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 S230213AbjGXGLX (ORCPT <rfc822;kautuk.consul.80@gmail.com> + 99 others); Mon, 24 Jul 2023 02:11:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50342 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229711AbjGXGLR (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 24 Jul 2023 02:11:17 -0400 Received: from mailout2.samsung.com (mailout2.samsung.com [203.254.224.25]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 41C5F18E for <linux-kernel@vger.kernel.org>; Sun, 23 Jul 2023 23:11:16 -0700 (PDT) Received: from epcas5p2.samsung.com (unknown [182.195.41.40]) by mailout2.samsung.com (KnoxPortal) with ESMTP id 20230724061114epoutp02fc70c4300338a32c1eaf01a9fb984f32~0uOnehTit0241602416epoutp02b for <linux-kernel@vger.kernel.org>; Mon, 24 Jul 2023 06:11:14 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.samsung.com 20230724061114epoutp02fc70c4300338a32c1eaf01a9fb984f32~0uOnehTit0241602416epoutp02b DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1690179074; bh=IK3dxHmN4H0mrKlZYjtF8HydO/F3EynIGSvvTtPQyYo=; h=From:To:Cc:Subject:Date:References:From; b=gaU9lxo5L2d62LSVOkqafz2Tm3GaNW/u8Wz7NQBvvei2c10rcQbGxIf674pqoAJ/q KGZ8jnGONHlWU26Sy0kN7KNU9gT4NcUb2WwTEu/53YoQLyetVfbNKJiut6cQKaJU48 DMa8lTG8uicmNRXp5h3KfRBB0CuhkEUXX8p4xwd0= Received: from epsnrtp2.localdomain (unknown [182.195.42.163]) by epcas5p2.samsung.com (KnoxPortal) with ESMTP id 20230724061114epcas5p2ede7af22d682b0b0ca9a2d78aad5e658~0uOnG8x--0258702587epcas5p2D; Mon, 24 Jul 2023 06:11:14 +0000 (GMT) Received: from epsmges5p2new.samsung.com (unknown [182.195.38.178]) by epsnrtp2.localdomain (Postfix) with ESMTP id 4R8VCh1rD9z4x9Py; Mon, 24 Jul 2023 06:11:12 +0000 (GMT) Received: from epcas5p1.samsung.com ( [182.195.41.39]) by epsmges5p2new.samsung.com (Symantec Messaging Gateway) with SMTP id 64.49.44250.0061EB46; Mon, 24 Jul 2023 15:11:12 +0900 (KST) Received: from epsmtrp1.samsung.com (unknown [182.195.40.13]) by epcas5p2.samsung.com (KnoxPortal) with ESMTPA id 20230724060655epcas5p24f21ce77480885c746b9b86d27585492~0uK2VvzRT2148421484epcas5p25; Mon, 24 Jul 2023 06:06:55 +0000 (GMT) Received: from epsmgms1p1new.samsung.com (unknown [182.195.42.41]) by epsmtrp1.samsung.com (KnoxPortal) with ESMTP id 20230724060655epsmtrp12375dce4a7600f368a4d6c2ea1201731~0uK2VCzLu0052600526epsmtrp1P; Mon, 24 Jul 2023 06:06:55 +0000 (GMT) X-AuditID: b6c32a4a-c4fff7000000acda-5e-64be1600b2e0 Received: from epsmtip2.samsung.com ( [182.195.34.31]) by epsmgms1p1new.samsung.com (Symantec Messaging Gateway) with SMTP id 6C.95.34491.FF41EB46; Mon, 24 Jul 2023 15:06:55 +0900 (KST) Received: from green245.sa.corp.samsungelectronics.net (unknown [107.99.41.245]) by epsmtip2.samsung.com (KnoxPortal) with ESMTPA id 20230724060654epsmtip2702415b5f52b1f1a85a44b20693599a6~0uK1JO11Z2599125991epsmtip2X; Mon, 24 Jul 2023 06:06:54 +0000 (GMT) From: Nitesh Shetty <nj.shetty@samsung.com> To: Alexander Viro <viro@zeniv.linux.org.uk>, Christian Brauner <brauner@kernel.org> Cc: hch@lst.de, gost.dev@samsung.com, Anuj Gupta <anuj20.g@samsung.com>, Nitesh Shetty <nj.shetty@samsung.com>, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] fs/read_write: Enable copy_file_range for block device. Date: Mon, 24 Jul 2023 11:33:36 +0530 Message-Id: <20230724060336.8939-1-nj.shetty@samsung.com> X-Mailer: git-send-email 2.35.1.500.gb896f729e2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFmpnk+LIzCtJLcpLzFFi42LZdlhTXZdBbF+Kwe7ZHBZNE/4yW7w+/InR 4uaBnUwWK1cfZbLYs/cki8XlXXPYLLb9ns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d27585492 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: 20230724060655epcas5p24f21ce77480885c746b9b86d27585492 References: <CGME20230724060655epcas5p24f21ce77480885c746b9b86d27585492@epcas5p2.samsung.com> X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham 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: 1772282001367960827 X-GMAIL-MSGID: 1772282001367960827 |
Series |
fs/read_write: Enable copy_file_range for block device.
|
|
Commit Message
Nitesh Shetty
July 24, 2023, 6:03 a.m. UTC
From: Anuj Gupta <anuj20.g@samsung.com> 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(-)
Comments
On Mon, Jul 24, 2023 at 11:33:36AM +0530, Nitesh Shetty wrote: > From: Anuj Gupta <anuj20.g@samsung.com> > > 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. Why? copy_file_range() is for copying a range of a regular file to another regular file - why do we want to support block devices for somethign that is clearly intended for copying data files? Also, the copy_file_range man page states: ERRORS ..... EINVAL Either fd_in or fd_out is not a regular file. ..... If we are changing the behavioru of copy_file_range (why?), then man page updates need to be done as well, documenting the change, which kernel versions only support regular files, etc. Cheers, Dave.
> > 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. > > Why? copy_file_range() is for copying a range of a regular file to > another regular file - why do we want to support block devices for > somethign that is clearly intended for copying data files? Nitesh has a series to add block layer copy offload, and uses that to implement copy_file_range on block device nodes, which seems like a sensible use case for copy_file_range on block device nodes, and that series was hiding a change like this deep down in a "block" title patch, so I asked for it to be split out. It still really should be in that series, as there's very little point in changing this check without an actual implementation making use of it.
> { > - 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; This doesn't directly have anything to do with block devices, as regular files can also have a f_mapping that's different. None of the file systems actually supporting copy offload right now do, but changing the dereference here is a correctness thing totally independent of block device support.
On Mon, Jul 24, 2023 at 06:38:38PM +0200, Christoph Hellwig wrote: > > > 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. > > > > Why? copy_file_range() is for copying a range of a regular file to > > another regular file - why do we want to support block devices for > > somethign that is clearly intended for copying data files? > > Nitesh has a series to add block layer copy offload, Yes, I know. > and uses that to > implement copy_file_range on block device nodes, Yes, I know. > which seems like a > sensible use case for copy_file_range on block device nodes, Except for the fact it's documented and implemented as for copying data ranges of *regular files*. Block devices are not regular files... There is nothing in this patchset that explains why this syscall feature creep is desired, why it is the best solution, what benefits it provides, how this new feature is discoverable, etc. It also does not mention that user facing documentation needs to change, etc > and that > series was hiding a change like this deep down in a "block" title > patch, I know. > so I asked for it to be split out. It still really should > be in that series, as there's very little point in changing this > check without an actual implementation making use of it. And that's because it's the wrong way to be implementing block device copy offloads. That patchset originally added ioctls to issue block copy offloads to block devices from userspace - that's the way block device specific functionality is generally added and I have no problems with that. However, when I originally suggested that the generic copy_file_range() fallback path that filesystems use (i.e. generic_copy_file_range()) should try to use the block copy offload path before falling back to using splice to copy the data through host memory, things went off the rails. That has turned into "copy_file_range() should support block devices directly" and the ioctl interfaces were removed. The block copy offload patchset still doesn't have a generic path for filesystems to use this block copy offload. This is *not* what I originally suggested, and provides none of the benefit to users that would come from what I originally suggested. Block device copy offload is largely useless to users if file data copies within a filesystem don't make use of it - very few applications ever copy data directly to/from block devices directly... So from a system level point of view, expanding copy_file_range() to do direct block device data copies doesn't make any sense. Expanding the existing copy_file_range() generic fallback to attempt block copy offload (i.e. hardware accel) makes much more sense, and will make copy_file_range() much more useful to users on filesystem like ext4 that don't have reflink support... So, yeah, this patch, regardless of how it is presented, needs to a whole lot more justification that "we want to do this" in the commit message... -Dave.
Hi Dave, On 23/07/25 08:08AM, Dave Chinner wrote: >On Mon, Jul 24, 2023 at 06:38:38PM +0200, Christoph Hellwig wrote: >> > > 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. >> > >> > Why? copy_file_range() is for copying a range of a regular file to >> > another regular file - why do we want to support block devices for >> > somethign that is clearly intended for copying data files? >> >> Nitesh has a series to add block layer copy offload, > >Yes, I know. > >> and uses that to >> implement copy_file_range on block device nodes, > >Yes, I know. > >> which seems like a >> sensible use case for copy_file_range on block device nodes, > >Except for the fact it's documented and implemented as for copying >data ranges of *regular files*. Block devices are not regular >files... > >There is nothing in this patchset that explains why this syscall >feature creep is desired, why it is the best solution, what benefits >it provides, how this new feature is discoverable, etc. It also does >not mention that user facing documentation needs to change, etc > Agreed. I missed adding context in description. >> and that >> series was hiding a change like this deep down in a "block" title >> patch, > >I know. > >> so I asked for it to be split out. It still really should >> be in that series, as there's very little point in changing this >> check without an actual implementation making use of it. > >And that's because it's the wrong way to be implementing block >device copy offloads. > >That patchset originally added ioctls to issue block copy offloads >to block devices from userspace - that's the way block device >specific functionality is generally added and I have no problems >with that. > We moved to copy_file_range, so that we can reuse the existing infra instead of adding another ioctl[1]. >However, when I originally suggested that the generic >copy_file_range() fallback path that filesystems use (i.e. >generic_copy_file_range()) should try to use the block copy offload >path before falling back to using splice to copy the data through >host memory, things went off the rails. > >That has turned into "copy_file_range() should support block devices >directly" and the ioctl interfaces were removed. The block copy >offload patchset still doesn't have a generic path for filesystems >to use this block copy offload. This is *not* what I originally >suggested, and provides none of the benefit to users that would come >from what I originally suggested. Block device copy offload is >largely useless to users if file data copies within a filesystem >don't make use of it - very few applications ever copy data directly >to/from block devices directly... > >So from a system level point of view, expanding copy_file_range() to >do direct block device data copies doesn't make any sense. Expanding >the existing copy_file_range() generic fallback to attempt block >copy offload (i.e. hardware accel) makes much more sense, and will >make copy_file_range() much more useful to users on filesystem like >ext4 that don't have reflink support... > Agreed. But adding all the cases is making the series heavier and harder to iterate. So we trimmed some of the patches and feature. Hopefully we can get to filesystems, if the current series gets in. >So, yeah, this patch, regardless of how it is presented, needs to a >whole lot more justification that "we want to do this" in the commit >message... > Agreed, the commit description was not conveying the things we wanted to do. It makes sense to send block related relaxation as part of copy offload series instead of doing it here. However, the change to get inode pointer using mapping_host is still independent and can go as a separate fix patch. Thank you, Nitesh Shetty [1] https://lore.kernel.org/all/Y3607N6lDRK6WU7%2F@T590/
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) ||