Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp20397460rwd; Thu, 29 Jun 2023 01:31:19 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7iT90rgHqcaneapZsBUvLiTYfFRpABSqU7BCsVKzGsrMgvu7Jh47oKNv9lwuRXldzbBCoF X-Received: by 2002:a17:90a:17ca:b0:262:ec74:bb33 with SMTP id q68-20020a17090a17ca00b00262ec74bb33mr8561333pja.46.1688027479376; Thu, 29 Jun 2023 01:31:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688027479; cv=none; d=google.com; s=arc-20160816; b=a7r9gbS55lE28TahzRWkF6JQ+5jHbz/x7sYssY4Lh7nDVhqnzgsCPBUZWcDkNPgS4n 5Ujgxo5Kf25ISBQkDx8zIRkullfXlxOqAHFfDnmY923Z0WB4CSjKSSETIK29Bo5MoXAX d/JKghrHRht5MyXCAPl1n3Au9APixEEPLsWgGcR+PBvX59W5CffDEzFwwCUAsUcCqlKg CuZ/ljOraIDs2WoFGV7feJTas44jrPDa2wWjhn/Q4IYaTmTGDeO6df8uIZZHVeXGFBh5 z0dDynFcgt6ZQbH0ABLcxDB1ykvZNympr3iIbhjbbEcwIA7OOGIvnALlLALPW6h4ZMeZ fB3Q== 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=IyD2z568ZZGB9FehtcOv1GRa9s+/z/rHUL2vV68hwRk=; fh=URER+EPEsA8zfVkm3y3O64jmBpjQQ0x/NPujXlvKP8k=; b=Be7YPPsOxfGg3jsxlXAUaJW+5wxIzs8UehFKuvymslx9SZhTJG/dvzHjXgBn9AVZW4 eS3kYwFu2brA0X5gzwBBDYIwDdVbKBxgS6jdhA+YxobYvN+vY9ZuUF4UJtR9O/p/lJyE gX+tAxSqg4sPJ839/0nT2AG9DFv0X4Pww9MIW9jczYGDIit+gtNjZMCifePqcLyLgp6J QGAGwPPqI2X3pFtzuEefC+DfhZQqXHDkTp6k2fnvsPv1RzXS8NxqtRNS9yxbDHvW6YZN dcWOHz1iwHo6mle+/5AxalG1tPwrQinAfsqnsoIRxp2JEJU1/mDC+U0TcJza9N7AU2ag M4Og== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=Cz8Mh9kr; 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 d2-20020a17090a02c200b00259aa59bf3esi11860307pjd.176.2023.06.29.01.31.05; Thu, 29 Jun 2023 01:31:19 -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=Cz8Mh9kr; 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 S232477AbjF2Htg (ORCPT + 99 others); Thu, 29 Jun 2023 03:49:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59660 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232284AbjF2Hrj (ORCPT ); Thu, 29 Jun 2023 03:47:39 -0400 Received: from mailout2.samsung.com (mailout2.samsung.com [203.254.224.25]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 514A02D51 for ; Thu, 29 Jun 2023 00:47:37 -0700 (PDT) Received: from epcas5p2.samsung.com (unknown [182.195.41.40]) by mailout2.samsung.com (KnoxPortal) with ESMTP id 20230629074735epoutp02b48b917f5e1c870bf79299a9daecbabe~tEamxkpAe1806618066epoutp02E for ; Thu, 29 Jun 2023 07:47:35 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.samsung.com 20230629074735epoutp02b48b917f5e1c870bf79299a9daecbabe~tEamxkpAe1806618066epoutp02E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1688024855; bh=IyD2z568ZZGB9FehtcOv1GRa9s+/z/rHUL2vV68hwRk=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=Cz8Mh9kraMlg6KpMGNL3q95uT5xR3iADcB5oRFaJgoVkQOF2j3WI4HssNYoJIVs46 k8EwtnrFKV0BPbdRa3BYawYzlSHrIiZNo8kYINTXSht9zdFLDVs5TOS28ChFrxVGYF 78IHgfgxuUeAFDbgfJMQw10x4UqUjzZIVtNJSV5s= Received: from epsnrtp3.localdomain (unknown [182.195.42.164]) by epcas5p4.samsung.com (KnoxPortal) with ESMTP id 20230629074734epcas5p4cc802435e65817703a6bfa7a237a6433~tEalXK4Ib2970729707epcas5p4t; Thu, 29 Jun 2023 07:47:34 +0000 (GMT) Received: from epsmges5p3new.samsung.com (unknown [182.195.38.182]) by epsnrtp3.localdomain (Postfix) with ESMTP id 4Qs9XN4QGHz4x9Q2; Thu, 29 Jun 2023 07:47:32 +0000 (GMT) Received: from epcas5p2.samsung.com ( [182.195.41.40]) by epsmges5p3new.samsung.com (Symantec Messaging Gateway) with SMTP id C8.77.06099.4173D946; Thu, 29 Jun 2023 16:47:32 +0900 (KST) Received: from epsmtrp1.samsung.com (unknown [182.195.40.13]) by epcas5p4.samsung.com (KnoxPortal) with ESMTPA id 20230628164314epcas5p43d203daae701b950a2649bb97c0c8ef5~s4E-sqhrT1878918789epcas5p4N; Wed, 28 Jun 2023 16:43:14 +0000 (GMT) Received: from epsmgms1p2new.samsung.com (unknown [182.195.42.42]) by epsmtrp1.samsung.com (KnoxPortal) with ESMTP id 20230628164314epsmtrp1b4b1b459c8517507dab6d889ddb70aa8~s4E-rV6Yc2914729147epsmtrp1o; Wed, 28 Jun 2023 16:43:14 +0000 (GMT) X-AuditID: b6c32a4b-cafff700000017d3-69-649d37142ebc Received: from epsmtip1.samsung.com ( [182.195.34.30]) by epsmgms1p2new.samsung.com (Symantec Messaging Gateway) with SMTP id F2.92.30535.2236C946; Thu, 29 Jun 2023 01:43:14 +0900 (KST) Received: from green245 (unknown [107.99.41.245]) by epsmtip1.samsung.com (KnoxPortal) with ESMTPA id 20230628164304epsmtip18665c8edaf0a91b72f882ceb4459921d~s4E2b1J9z2949329493epsmtip1U; Wed, 28 Jun 2023 16:43:04 +0000 (GMT) Date: Wed, 28 Jun 2023 22:09:58 +0530 From: Nitesh Shetty To: Damien Le Moal Cc: Jens Axboe , Jonathan Corbet , Alasdair Kergon , Mike Snitzer , dm-devel@redhat.com, Keith Busch , Christoph Hellwig , 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, 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: <20230628163958.tgwtlszadsa7zoub@green245> MIME-Version: 1.0 In-Reply-To: <365d5129-b65e-919a-3ceb-cc2ccf6b7a5a@kernel.org> User-Agent: NeoMutt/20171215 X-Brightmail-Tracker: H4sIAAAAAAAAA02TaUxUVxTHe9978+ZhO/pESC9ggU5DVQzL1GG4IJtRyWsgLS1tPxgbfDAv QIGZySxV2xr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ggPbEkNTs1tSC1CCbLxMEp1cB02LL7ZoB8 v+7nV4u2nG2ewBEYfyx2Jdtl5iP5Wh0vT7VJxrYp2Hlydf/8KXdb4GfWSrW9AVPrZ0vNe9NR 9/N9h90r+5UXJ9WteBH2jMtit/q1Zn7d0ICALWJJycFTVm2Oe3TO2cX29qLJhuvfaz6t9HMP T41syhMsMv048XaozAWFY+oxW7JnLp3j6SvguzdZgGVWnPw8py2Kpw0SfvXvf53+cvvahx8l PaSNjucX7jXIt/vInsozy0067Hpa5S7Nu8vzPOZZvC68cHq256f1QjU7L2rqnLb6xtZ1vWdt 8s+03TtePZ/5q7/W9dPTPT/0YmyufreeJtJ1ZWPQmSedv/8cPp1fd5LrVsW/NIYdSizFGYmG WsxFxYkAxFAvgIIDAAA= X-CMS-MailID: 20230628164314epcas5p43d203daae701b950a2649bb97c0c8ef5 X-Msg-Generator: CA Content-Type: multipart/mixed; boundary="----CHyoCALg6LzvWsSTaVDWulLjyDTSZVBAz8-9IIrQs0inuafE=_9622e_" 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> <365d5129-b65e-919a-3ceb-cc2ccf6b7a5a@kernel.org> 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 ------CHyoCALg6LzvWsSTaVDWulLjyDTSZVBAz8-9IIrQs0inuafE=_9622e_ Content-Type: text/plain; charset="utf-8"; format="flowed" Content-Disposition: inline On 23/06/28 03:51PM, Damien Le Moal wrote: >On 6/28/23 03:36, Nitesh Shetty wrote: >> For direct block device opened with O_DIRECT, use copy_file_range to >> issue device copy offload, and fallback to generic_copy_file_range incase >> device copy offload capability is absent. > >...if the device does not support copy offload or the device files are not open >with O_DIRECT. > >No ? > Yes your right. We will fallback to generic_copy_file_range in either of these cases. >> Modify checks to allow bdevs to use copy_file_range. >> >> Suggested-by: Ming Lei >> Signed-off-by: Anuj Gupta >> Signed-off-by: Nitesh Shetty >> --- >> block/blk-lib.c | 26 ++++++++++++++++++++++++++ >> block/fops.c | 20 ++++++++++++++++++++ >> fs/read_write.c | 7 +++++-- >> include/linux/blkdev.h | 4 ++++ >> 4 files changed, 55 insertions(+), 2 deletions(-) >> >> diff --git a/block/blk-lib.c b/block/blk-lib.c >> index 09e0d5d51d03..7d8e09a99254 100644 >> --- a/block/blk-lib.c >> +++ b/block/blk-lib.c >> @@ -473,6 +473,32 @@ ssize_t blkdev_copy_offload( >> } >> EXPORT_SYMBOL_GPL(blkdev_copy_offload); >> >> +/* Copy source offset from source block device to destination block >> + * device. Returns the length of bytes copied. >> + */ > >Multi-line comment style: start with a "/*" line please. > acked >> +ssize_t blkdev_copy_offload_failfast( > >What is the "failfast" in the name for ? We dont want failed copy offload IOs to fallback to block layer copy emulation. We wanted a API to return error, if offload fails. > >> + 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) >> +{ >> + struct request_queue *in_q = bdev_get_queue(bdev_in); >> + struct request_queue *out_q = bdev_get_queue(bdev_out); >> + ssize_t ret = 0; > >You do not need this initialization. > we need this initialization, because __blkdev_copy_offload return number of bytes copied or error value. So we can not return 0, incase of success/partial completion. blkdev_copy_offload_failfast is expected to return number of bytes copied. >> + >> + if (blkdev_copy_sanity_check(bdev_in, pos_in, bdev_out, pos_out, len)) >> + return 0; >> + >> + if (blk_queue_copy(in_q) && blk_queue_copy(out_q)) { > >Given that I think we do not allow copies between different devices, in_q and >out_q should always be the same, no ? acked, will update this. > >> + ret = __blkdev_copy_offload(bdev_in, pos_in, bdev_out, pos_out, >> + len, NULL, NULL, gfp_mask); > >Same here. Why pass 2 bdevs if we only allow copies within the same device ? > acked, will update function arguments to take single bdev. >> + if (ret < 0) >> + return 0; >> + } >> + >> + return ret; > >return 0; > Nack, explained above. Thank you, Nitesh Shetty ------CHyoCALg6LzvWsSTaVDWulLjyDTSZVBAz8-9IIrQs0inuafE=_9622e_ Content-Type: text/plain; charset="utf-8" ------CHyoCALg6LzvWsSTaVDWulLjyDTSZVBAz8-9IIrQs0inuafE=_9622e_--