Received: by 2002:a05:6358:701b:b0:131:369:b2a3 with SMTP id 27csp2728836rwo; Sun, 23 Jul 2023 23:35:23 -0700 (PDT) X-Google-Smtp-Source: APBJJlFyZUbxqhob7zVv2ev0v5kE6p6JTeLcZkzryM+SNYdmUmLu6B4D+DWWTiPjmWTG4R4ZCWQB X-Received: by 2002:a17:907:778b:b0:99b:4a2b:2ea3 with SMTP id ky11-20020a170907778b00b0099b4a2b2ea3mr8498011ejc.17.1690180523432; Sun, 23 Jul 2023 23:35:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690180523; cv=none; d=google.com; s=arc-20160816; b=YHGxKKa8LYmjpF8xwxLpZPplKpX1HaBfGulz/UwucRJhknqn7xmn+ztJ8RrtmkUR0Q MfMazJPWwgE5kM8SCqCqPlLImyfPI3mF2f7OaPNEtqDtAZMS+Sg4vJbNL4dGbt5rKfEP voTvD78mcYOKSYPY39bHv830kV6nHztM1fPyaAuBrFmkhFR/R6N63cfaTcwgt+QKeW6M 2itjA4pCi+DRh4GaT1x2f3bgpkBQ1C7TkRishlj3Bk2P3VOUdoVubJYrB0qV/a3OqObw v3JrQ+zG9LYgyg38zW8piy0SVGEkW71krYarTwt9cXlT7Ft8YXFVBRNA/AyryAogBoIb 2Dhg== 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:user-agent :in-reply-to:mime-version:message-id:subject:cc:to:from:date :dkim-signature:dkim-filter; bh=wTF0Ru9o1qX1XpvkpWa3mKHhkbLaktTkpAUnB1hI0DQ=; fh=rFsiD4FpGrmTEGgPEc3zf5dgbmRUfkht+d5hhEy6/bU=; b=aQvO60b3C38szi989ty8e5JyX9uCSg2Kk++1aZXXeUIB+jLpywEEus3XkUnd9roDn0 38ac3ms0qeyz5Bu8cy52DKabrhIlg6BNDw6bSC6ImYyTBcPIcrwYHq3dQn6/3iBUbXo+ e3N07ALQegaKyaxDsk+BjALuBWd9G02ia94m9uahkKpv5QrpO0iAd8foTW9+958UZGQ+ 210dW1ToYvQzIhoXaT25Rjx8k9vLh3BP4yPoDrlMPSaasY91/Iu45upMsre+K5y/gGAf BgLDcnRfzhtMUgML3+bFQFj1beyWmzbWyEziZr5Tm99UwcSLJdIWEGPEL9J1RojyNikr Mm6w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=pGzoCpXs; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f20-20020a170906c09400b00991df467babsi6121817ejz.221.2023.07.23.23.34.59; Sun, 23 Jul 2023 23:35:23 -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=pGzoCpXs; 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 S229492AbjGXGLT (ORCPT + 99 others); Mon, 24 Jul 2023 02:11:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50330 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229550AbjGXGLR (ORCPT ); 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 6AD6E1AE for ; Sun, 23 Jul 2023 23:11:14 -0700 (PDT) Received: from epcas5p2.samsung.com (unknown [182.195.41.40]) by mailout2.samsung.com (KnoxPortal) with ESMTP id 20230724061111epoutp02e828b8b4cd0c7a8c97cb8e3fb3cfeae6~0uOkIgFKp0241202412epoutp02W for ; Mon, 24 Jul 2023 06:11:11 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.samsung.com 20230724061111epoutp02e828b8b4cd0c7a8c97cb8e3fb3cfeae6~0uOkIgFKp0241202412epoutp02W DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1690179071; bh=wTF0Ru9o1qX1XpvkpWa3mKHhkbLaktTkpAUnB1hI0DQ=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=pGzoCpXs1UOQ+l3asEdG8DArz1Syln55BBDbmu2SPssX7NAmvlsjNwHBxzcuhQQWj CxG6DVMTl+TTlscFhStH+wFX3j38d+bpojDrzobtlpjsDLbIb/Vgr44md4/fUoSJSS ySiQqvXB5ZQdS6B1yohx1LRduHCNBtouAz//wb9Q= Received: from epsnrtp4.localdomain (unknown [182.195.42.165]) by epcas5p2.samsung.com (KnoxPortal) with ESMTP id 20230724061110epcas5p2503ac4c4ac74bf7d8c202484a6932147~0uOjZHrS53020830208epcas5p2e; Mon, 24 Jul 2023 06:11:10 +0000 (GMT) Received: from epsmges5p3new.samsung.com (unknown [182.195.38.174]) by epsnrtp4.localdomain (Postfix) with ESMTP id 4R8VCc0BLhz4x9QK; Mon, 24 Jul 2023 06:11:08 +0000 (GMT) Received: from epcas5p3.samsung.com ( [182.195.41.41]) by epsmges5p3new.samsung.com (Symantec Messaging Gateway) with SMTP id 8A.B5.06099.BF51EB46; Mon, 24 Jul 2023 15:11:07 +0900 (KST) Received: from epsmtrp1.samsung.com (unknown [182.195.40.13]) by epcas5p4.samsung.com (KnoxPortal) with ESMTPA id 20230724054922epcas5p4cdcf4bdb7ddc57eac4d687b40d9633b9~0t7hBWhw70396703967epcas5p4_; Mon, 24 Jul 2023 05:49:22 +0000 (GMT) Received: from epsmgms1p1new.samsung.com (unknown [182.195.42.41]) by epsmtrp1.samsung.com (KnoxPortal) with ESMTP id 20230724054922epsmtrp1589ea7b455f628dab9e4898d7d32032a~0t7g8VLIR2266822668epsmtrp1C; Mon, 24 Jul 2023 05:49:22 +0000 (GMT) X-AuditID: b6c32a4b-d308d700000017d3-66-64be15fb2893 Received: from epsmtip2.samsung.com ( [182.195.34.31]) by epsmgms1p1new.samsung.com (Symantec Messaging Gateway) with SMTP id 1A.24.34491.1E01EB46; Mon, 24 Jul 2023 14:49:21 +0900 (KST) Received: from green245 (unknown [107.99.41.245]) by epsmtip2.samsung.com (KnoxPortal) with ESMTPA id 20230724054918epsmtip2e23bc6255b974fdc88465d963a53ae7e~0t7da5FbA1810118101epsmtip2U; Mon, 24 Jul 2023 05:49:18 +0000 (GMT) Date: Mon, 24 Jul 2023 11:16:06 +0530 From: Nitesh Shetty To: Christoph Hellwig Cc: Jens Axboe , Jonathan Corbet , Alasdair Kergon , Mike Snitzer , dm-devel@redhat.com, Keith Busch , Sagi Grimberg , Chaitanya Kulkarni , Alexander Viro , Christian Brauner , martin.petersen@oracle.com, linux-scsi@vger.kernel.org, willy@infradead.org, hare@suse.de, djwong@kernel.org, bvanassche@acm.org, ming.lei@redhat.com, dlemoal@kernel.org, nitheshshetty@gmail.com, gost.dev@samsung.com, Anuj Gupta , 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: Re: [PATCH v13 4/9] fs, block: copy_file_range for def_blk_ops for direct block device Message-ID: <20230724054606.y6ibtn4mwupmziii@green245> MIME-Version: 1.0 In-Reply-To: <20230720075710.GC5042@lst.de> User-Agent: NeoMutt/20171215 X-Brightmail-Tracker: H4sIAAAAAAAAA02Te0zTVxTHvb9f+2vBFX8gZBdwSso2Awzk7UVAmRr9GRaHcZGMZWGV/tIy oO36QDfH5DFwg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K84i96U4QE0hNLUrNTUwtSi2CyTBycUg1M83ICDkiefP1R w3f+1xd/hGd6HXtQsEm0IlftwdFXJTXxMbynCjoevkpv/Z+yL/fX+Xy3zNBcBsG0c9rfTgTn tu9bPWtlULFBbthBSx5H/wPP57FE/GbcvHZ18AOpW1xznmXzXas74aSqV6tVd9Hw7+2bFVKS x52Nb87efqBxB+PD6wd9ZJ4uvH7JYEFD/P/UmfP+rHSVi9/za064KZ+SZTqra0rvtpPN7csD bv5R2mD9Z9qswDDm3mmJh9XrW9pEufOmPZ2xu5Ct5ayEgUXN8/SOZOb0eXx692fz6so0Xb87 d1np/yNawmaGBxY1PVBt+le0OjWMbVex1n0R3Q8zvR/fusHw8tZT8yx7ic1CSizFGYmGWsxF xYkASAGQ3YMDAAA= X-CMS-MailID: 20230724054922epcas5p4cdcf4bdb7ddc57eac4d687b40d9633b9 X-Msg-Generator: CA Content-Type: multipart/mixed; boundary="----PcSJ1RlEyPKfjXIiTsweH-7MCPtMf9v3nlMrb72LWO-fIHxy=_dd00a_" X-Sendblock-Type: REQ_APPROVE CMS-TYPE: 105P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20230627184029epcas5p49a29676fa6dff5f24ddfa5c64e525a51 References: <20230627183629.26571-1-nj.shetty@samsung.com> <20230627183629.26571-5-nj.shetty@samsung.com> <20230720075710.GC5042@lst.de> 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: X-Mailing-List: linux-kernel@vger.kernel.org ------PcSJ1RlEyPKfjXIiTsweH-7MCPtMf9v3nlMrb72LWO-fIHxy=_dd00a_ Content-Type: text/plain; charset="utf-8"; format="flowed" Content-Disposition: inline On 23/07/20 09:57AM, Christoph Hellwig wrote: >> +/* Copy source offset from source block device to destination block >> + * device. Returns the length of bytes copied. >> + */ >> +ssize_t blkdev_copy_offload_failfast( >> + struct block_device *bdev_in, loff_t pos_in, >> + struct block_device *bdev_out, loff_t pos_out, >> + size_t len, gfp_t gfp_mask) > >This is an odd and very misnamed interface. > >Either we have a klkdev_copy() interface that automatically falls back >to a fallback (maybe with an opt-out), or we have separate >blkdev_copy_offload/blkdev_copy_emulated interface and let the caller >decide. But none of that really is "failfast". > >Also this needs to go into the helpers patch and not a patch that is >supposed to just wire copying up for block device node. > Acked. >> index b07de77ef126..d27148a2543f 100644 >> --- a/fs/read_write.c >> +++ b/fs/read_write.c >> @@ -1447,7 +1447,8 @@ static int generic_copy_file_checks(struct file *file_in, loff_t pos_in, >> return -EOVERFLOW; >> >> /* Shorten the copy to EOF */ >> - size_in = i_size_read(inode_in); >> + size_in = i_size_read(file_in->f_mapping->host); > >generic_copy_file_checks needs to be fixed to use ->mapping->host both >or inode_in and inode_out at the top of the file instead of this >band aid. And that needs to be a separate patch with a Fixes tag. > Addressed below. >> @@ -1708,7 +1709,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_ISREG(inode_out->i_mode)) && >> + (!S_ISBLK(inode_in->i_mode) || !S_ISBLK(inode_out->i_mode))) > >This is using weird indentation, and might also not be doing >exactly what we want. I think the better thing to do here is to: > > 1) check for the accetable types only on the in inode > 2) have a check that the mode matches for the in and out inodes > >And please do this as a separate prep patch instead of hiding it here. > Agreed. We will send a separate patch, that enables copy_file_range on block devices. Thank you, Nitesh Shetty ------PcSJ1RlEyPKfjXIiTsweH-7MCPtMf9v3nlMrb72LWO-fIHxy=_dd00a_ Content-Type: text/plain; charset="utf-8" ------PcSJ1RlEyPKfjXIiTsweH-7MCPtMf9v3nlMrb72LWO-fIHxy=_dd00a_--