From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 78FC5EB64DD for ; Mon, 24 Jul 2023 22:08:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230358AbjGXWId (ORCPT ); Mon, 24 Jul 2023 18:08:33 -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-Google-Smtp-Source: APBJJlFL7IL5vlAW4dKgeOmKmmNUCeLrE4HqWcCSK+s5M0r3YESnNOQX7pVoll5fhQI/4j0tYoOEGA== 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> 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