Received: by 2002:a05:6358:701b:b0:131:369:b2a3 with SMTP id 27csp3726727rwo; Mon, 24 Jul 2023 16:02:45 -0700 (PDT) X-Google-Smtp-Source: APBJJlGxrxmYQJKnf4ib25vv4nbbJZje/JOgj0V9KlOToahvA+orXoxjr8Jedb43/w2cHDd0ATct X-Received: by 2002:a17:906:1cf:b0:957:1df0:9cbf with SMTP id 15-20020a17090601cf00b009571df09cbfmr11380001ejj.19.1690239764953; Mon, 24 Jul 2023 16:02:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690239764; cv=none; d=google.com; s=arc-20160816; b=atzy0spIViiUGjJXxtqYE1w4TYNC+crgo29Uq5ASi8JvioEgP92GHtk56fP/haOBab KBxj9UF+Sv10p0CmMWs19N7fUUnMPaUmf0cy0isU4lw9X+D8nDD9aNDyJouZ/gWe38T1 Ga8hbUUt9QnaxiV/dnKcNuNMlXZvjjugdjDdsrPBnRAlQqsElmUTR3qgppTK/zh/B+Of 8ISbElnzqQ2ZF+OUGisfA7lUU1+u3AiaX85lfkVTnj+usw4ndqUd2JzuBfUawhtnPZ3e slfQKel6/1r42V08j0Y2xDR4ZZszQ0CCfJjeLoHuU46fkb4TtZ91MOcqTa1aYOj59xCZ /gTQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=YiVLpoqRBSUKN+9FWsFBB1zWbxDt+GF5JFvfD+9xwvQ=; fh=bVm7hz54tHxX+6t0rYN/omhojhMNB3HvXuIqxjDN3Kg=; b=QbNEQ4bIswDNEx5RUuJR5j3GmtgxhTkerrTAttuZXWiZV5mKQ8CMviq0Do33d3T/No 2JKQJ3JFMY5hZee01OLSe0tLBkIWqqqaSw394704FID431Dp2hp3IxFAmODUuv1suNTl 4f2mHcFAnVGKsSkRoFZephETTbHhKcPUwaEqRgN4w10f18eQPxO3vVRP/rBwKu6rk5gd OzcMnJ0mkQ2BE0DA1K7TGxcgROMHbTidcIhuob+dsXEj6yT4QS9mmSEimieRJSjIk3dy zwVROASKRC0YM2sn5jYIkLGeFh767UDQF/9r+wjPFm3wy8dF8eOV+yr09kMXkAYGTLbI jAiw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@fromorbit-com.20221208.gappssmtp.com header.s=20221208 header.b=IsnQRu4g; 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=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=fromorbit.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s19-20020a170906961300b0099331b3e6f6si6154278ejx.661.2023.07.24.16.02.19; Mon, 24 Jul 2023 16:02:44 -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=@fromorbit-com.20221208.gappssmtp.com header.s=20221208 header.b=IsnQRu4g; 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=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=fromorbit.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230370AbjGXWIc (ORCPT + 99 others); Mon, 24 Jul 2023 18:08:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45918 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230203AbjGXWIa (ORCPT ); Mon, 24 Jul 2023 18:08:30 -0400 Received: from mail-pl1-x630.google.com (mail-pl1-x630.google.com [IPv6:2607:f8b0:4864:20::630]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A306819A0 for ; Mon, 24 Jul 2023 15:08:28 -0700 (PDT) Received: by mail-pl1-x630.google.com with SMTP id d9443c01a7336-1bb8e45185bso9690345ad.1 for ; Mon, 24 Jul 2023 15:08:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fromorbit-com.20221208.gappssmtp.com; s=20221208; t=1690236508; x=1690841308; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=YiVLpoqRBSUKN+9FWsFBB1zWbxDt+GF5JFvfD+9xwvQ=; b=IsnQRu4gLa6XZH4i8mAcdMuH1PvZahVQhG7uaMFWzE5NQYY7cYwBovrK2ePjpSBFg6 AWEENSUJUVg6nzQug4aLpnOuOkrvfMhLacHxR4qXAHXAxqa5dFINgbN5Ttg/1f82p3H5 FyK86rylKoC3btv2Zxs0nyvwCT68Fg3fXrQEFP8z2PY/53JvNhUv5mM7ZSnJDBk9sAXf JwstgMaugLMuQ0LY2yjKwz7l+o4ItdLPddsBJbalVTkkUc4/Z7gWdcd23R1rWeFZBriN jo8AciZUR0I3rqJoXf5UMmfog7GJGSAyy8AIspX4a3ikNsX1aHCrLIPksEpIS7jWG0tK HuNA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690236508; x=1690841308; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=YiVLpoqRBSUKN+9FWsFBB1zWbxDt+GF5JFvfD+9xwvQ=; b=iSJLTjW9oKT45Q10cIz0QAxgkEmYuqzOhA13AOvHOEtX8QZMrGI9aYXzqdyivyyo84 97o3tHAkZcAjML4W4DvsZZLsVjA9wEXRD/v4V/4WkPg0IKiiHL0ZVtRGURNlbcPAvxUd ri1Rx21gziX0dCdMbcwAS1cyPZPYygZEnybh7PK0IDaPeeDkZ3MQ9y3cCSINJZJIb/9l J/ddc/sef1nGN/uWWSecvgrf4dcf/kv+SWJNPscAuiN/nuFuheUJshxOuzg8JmiD0Ru5 iCp9IGsWj9cryMw1SEJUpQExf+xzRANRSGOA+GTLuQheYoPAihPl/HrwRjguWeKg9APO SXRw== X-Gm-Message-State: ABy/qLZjhgVTjx2nHjIOQRSK+m+IWcutfBgJrKYrdv1TnudU6DEl+5mP Y7Vk1OL0e6UT5X/BX3/wVqDfVw== X-Received: by 2002:a17:902:a58b:b0:1bb:bb70:c23e with SMTP id az11-20020a170902a58b00b001bbbb70c23emr241901plb.18.1690236507746; Mon, 24 Jul 2023 15:08:27 -0700 (PDT) Received: from dread.disaster.area (pa49-186-119-116.pa.vic.optusnet.com.au. [49.186.119.116]) by smtp.gmail.com with ESMTPSA id jw22-20020a170903279600b001b9da42cd7dsm9427325plb.279.2023.07.24.15.08.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Jul 2023 15:08:27 -0700 (PDT) Received: from dave by dread.disaster.area with local (Exim 4.96) (envelope-from ) id 1qO3j6-00A72u-2Y; Tue, 25 Jul 2023 08:08:24 +1000 Date: Tue, 25 Jul 2023 08:08:24 +1000 From: Dave Chinner To: Christoph Hellwig Cc: Nitesh Shetty , Alexander Viro , Christian Brauner , gost.dev@samsung.com, Anuj Gupta , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] fs/read_write: Enable copy_file_range for block device. Message-ID: References: <20230724060336.8939-1-nj.shetty@samsung.com> <20230724163838.GB26430@lst.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230724163838.GB26430@lst.de> X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,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: X-Mailing-List: linux-kernel@vger.kernel.org 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. -- Dave Chinner david@fromorbit.com