Received: by 2002:ab2:7855:0:b0:1f9:5764:f03e with SMTP id m21csp819015lqp; Thu, 23 May 2024 00:19:14 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCX4NIsGVSe8/03opieifzeoMNN0h1MriNgQcaHnhVlbPxDjrRnXzyjcllGGQItXrwMwvE2abvuA99lKrFl+WkUwExO7brM4/MAMmQfSnQ== X-Google-Smtp-Source: AGHT+IEVUiCfYYB29ECtZZ0GvWchgMTUCzK6nXugOjrM9OjsRg5iuqCIrPlnmKlGOZkS3u60d3nU X-Received: by 2002:a17:902:d54b:b0:1f3:2d65:5698 with SMTP id d9443c01a7336-1f32d655911mr35035045ad.22.1716448754577; Thu, 23 May 2024 00:19:14 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716448754; cv=pass; d=google.com; s=arc-20160816; b=kESKxi75OLnEnkcb+1ZoZSzFJG5O7s0lI+3DMqSKvQ1QQqXoTPQ6sPMLNIggZUoH66 wUQrA9urOKM4uzH2BGO2qZqhSy/psQBpMzKosqFCzXUE2h7nrNBiY37aG8rgBg26Mjw+ h2swIH4O5MImGSo5S++9DktxOVQ/FTjwR8t0a+D1PM0+e2QPNx57NKEcJToVPmzybt/s dQ0mFfXCJbSQotFAr8xyCAv2ANutZGdUPJ8myMowv4PeRM6T8U7G/4JZP+J6emcjn06J 5froOXc9ReDBCdBvv4VDLI+S8apHjGsL4aojfXfMMCVtQePKH4Ae1+s07iQljvc1v1lH wCEQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:dlp-filter:cms-type:in-reply-to:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:subject:cc:to :from:date:dkim-signature:dkim-filter:message-id; bh=jWCOeb8x4NIqcfn/S47RDrttegWDeSIWveRZexI/Bx0=; fh=aut9++QLo/p/gCv2hUApAOytztunAajPCRW4G6b5vaY=; b=g5mVkwsHYISwY+SBwmfjhnT2s/CZ5MlGGOik5flTYRtI9kZBp3LlIZK6GTP/vUY2Ht 0d6cUcveQvfgYHQZsrckWall6isocqKWUFOWM89EY6rgwmzQlrlNLVmbqXsKQje37JPp R0khUGKuDBboHeWY47vivvsvjwg4Jf42/qCWsBFw8zhnzLoNdMeZ45pnB/B37aDxBUpL EP3wDO6ehjk1l70IzeFoQt6mGfuPvruXTiZ77RUThK3pe/NDOBDvyEwY/2e06tjfddoA cx05Oim3T6ap7E1xpCbzOrrmAJTPqgzuwlQHpeVWWDOpRTL5Iv/s25S7pud41GLQpqTX RQLg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=T7eEsAMB; arc=pass (i=1 spf=pass spfdomain=samsung.com dkim=pass dkdomain=samsung.com dmarc=pass fromdomain=samsung.com); spf=pass (google.com: domain of linux-kernel+bounces-187081-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-187081-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id d9443c01a7336-1f2fd61a408si72357985ad.306.2024.05.23.00.19.14 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 May 2024 00:19:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-187081-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=T7eEsAMB; arc=pass (i=1 spf=pass spfdomain=samsung.com dkim=pass dkdomain=samsung.com dmarc=pass fromdomain=samsung.com); spf=pass (google.com: domain of linux-kernel+bounces-187081-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-187081-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Message-ID: <664eedf2.170a0220.b9be1.c290SMTPIN_ADDED_BROKEN@mx.google.com> X-Google-Original-Message-ID: <20240523065514.7745whk3pwem57cy@nj.shetty@samsung.com> Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id D386F28101A for ; Thu, 23 May 2024 07:19:13 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id EBCED13CA9A; Thu, 23 May 2024 07:19:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=samsung.com header.i=@samsung.com header.b="T7eEsAMB" Received: from mailout2.samsung.com (mailout2.samsung.com [203.254.224.25]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3009613B5AD for ; Thu, 23 May 2024 07:18:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=203.254.224.25 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716448740; cv=none; b=rqGPXiX4WeFplg5KknT88VBk9ID9ktISkzY299CNUpmlmIDuPbujSRvVqNWSD/1zg4I+9d1F71fVd0y8Pus+nzOPhEIZ4cx7N9ee8nlpcFGti7GVLlLCu9Q6izxQMDmQoT5a7gWfNouCSWRu76h8Cw0cqENSWPHDz2EDgKO981o= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716448740; c=relaxed/simple; bh=jWCOeb8x4NIqcfn/S47RDrttegWDeSIWveRZexI/Bx0=; h=Date:From:To:Cc:Subject:Message-ID:MIME-Version:In-Reply-To: Content-Type:References; b=dTT/5rp0iIZNOinPspSEx0RLgpgxHcmdfZuaK9mQAnSDg2JugUNk58GuVoTUltzuI3A66av7FNoYHIIiNsWb4H/WcGp8HFPxyNo7eaAhEMliaMsPTCWh9BiV0OaaGeIVfcA+Ev+2mLpKWqkjF2bPCe1TJUMd7wL5BOgu6DnW9hM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=samsung.com; spf=pass smtp.mailfrom=samsung.com; dkim=pass (1024-bit key) header.d=samsung.com header.i=@samsung.com header.b=T7eEsAMB; arc=none smtp.client-ip=203.254.224.25 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=samsung.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=samsung.com Received: from epcas5p4.samsung.com (unknown [182.195.41.42]) by mailout2.samsung.com (KnoxPortal) with ESMTP id 20240523071850epoutp0234f7ec4b135a3561b565a0edb73375ff~SDQa4kcVM2720427204epoutp02u for ; Thu, 23 May 2024 07:18:50 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.samsung.com 20240523071850epoutp0234f7ec4b135a3561b565a0edb73375ff~SDQa4kcVM2720427204epoutp02u DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1716448730; bh=jWCOeb8x4NIqcfn/S47RDrttegWDeSIWveRZexI/Bx0=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=T7eEsAMBqajIntqs+tUrOXdE5z1Z8/yuEDyIRMsNOsKZ9gYuWcOk7RQ3Fox1R5MLF bDdhUktVkH9xmaB7bbLSptz5rSGE5IznCRDsq0fZuB/4vvdDJ9b/7eQVD3Do2sHZDE dj32iJotp0R1/wTpwPsSEWaQcnRrx0JF8rZPfJjk= Received: from epsnrtp3.localdomain (unknown [182.195.42.164]) by epcas5p4.samsung.com (KnoxPortal) with ESMTP id 20240523071849epcas5p4e36fe28b6920bb4eb2fe8abd5274ef92~SDQaH4f1l1433114331epcas5p4L; Thu, 23 May 2024 07:18:49 +0000 (GMT) Received: from epsmges5p3new.samsung.com (unknown [182.195.38.174]) by epsnrtp3.localdomain (Postfix) with ESMTP id 4VlKKN3MGfz4x9Q8; Thu, 23 May 2024 07:18:48 +0000 (GMT) Received: from epcas5p1.samsung.com ( [182.195.41.39]) by epsmges5p3new.samsung.com (Symantec Messaging Gateway) with SMTP id 6F.46.09665.8DDEE466; Thu, 23 May 2024 16:18:48 +0900 (KST) Received: from epsmtrp2.samsung.com (unknown [182.195.40.14]) by epcas5p3.samsung.com (KnoxPortal) with ESMTPA id 20240523070224epcas5p3e695021dfef14e09478bef71d4bb64ff~SDCE7vT5o0314003140epcas5p3U; Thu, 23 May 2024 07:02:24 +0000 (GMT) Received: from epsmgms1p1new.samsung.com (unknown [182.195.42.41]) by epsmtrp2.samsung.com (KnoxPortal) with ESMTP id 20240523070224epsmtrp22e3d76a6e7aa74b89d002a30de5600bb~SDCE5d1aF0741007410epsmtrp2_; Thu, 23 May 2024 07:02:24 +0000 (GMT) X-AuditID: b6c32a4b-829fa700000025c1-f7-664eedd8e7bf Received: from epsmtip2.samsung.com ( [182.195.34.31]) by epsmgms1p1new.samsung.com (Symantec Messaging Gateway) with SMTP id 08.F4.08924.00AEE466; Thu, 23 May 2024 16:02:24 +0900 (KST) Received: from nj.shetty?samsung.com (unknown [107.99.41.245]) by epsmtip2.samsung.com (KnoxPortal) with ESMTPA id 20240523070220epsmtip27aba71b0cc2f5f6b9888de9ca58d5e0e~SDCA-AENl3101731017epsmtip2E; Thu, 23 May 2024 07:02:20 +0000 (GMT) Date: Thu, 23 May 2024 06:55:14 +0000 From: Nitesh Shetty To: Bart Van Assche Cc: Jens Axboe , Jonathan Corbet , Alasdair Kergon , Mike Snitzer , Mikulas Patocka , Keith Busch , Christoph Hellwig , Sagi Grimberg , Chaitanya Kulkarni , Alexander Viro , Christian Brauner , Jan Kara , martin.petersen@oracle.com, david@fromorbit.com, hare@suse.de, damien.lemoal@opensource.wdc.com, anuj20.g@samsung.com, joshi.k@samsung.com, nitheshshetty@gmail.com, gost.dev@samsung.com, Vincent Fu , linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, dm-devel@lists.linux.dev, linux-nvme@lists.infradead.org, linux-fsdevel@vger.kernel.org Subject: Re: [PATCH v20 12/12] null_blk: add support for copy offload Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 In-Reply-To: <631c55b9-8b0a-4ac0-81bd-acf82c4a7602@acm.org> X-Brightmail-Tracker: H4sIAAAAAAAAA02TfUxTVxjGc+69vb1V0SuiOxbdoHNRYUA7W3Zg4owK3ATdWOZY4sxYR69A KG3txxxsThRBwQjC5pQCCq0ZFhAEqmIV53Cg8hG2ISKKVrHddFWpMjWGCWu9dfG/3/vx5Dnn ffNSuP9xvpBKV+lZrUquFJFTiOPnFi8Mu3L/gw3iAyWzUWNXJ4627XmOo7rrxSRynXsE0I/u ZzhynN0B0HhvH46snTcAqjJVEmjo7EkMnTaVYshS14Gh8n25GOqYvE+i0vbLADkHjBhquxqK qvMPEeh020UC9dsqSHTwJycf1ZyfwFDJzgEMtTq2AtTgGiXQhauB6PaunQD1PT/PWz6P6b+U wHSZIHPSeJ3P9N1oIpj+XgPTXFtAMi2HtjB3WsoAc2ooh2TMRd/zmN25D0jmZJ6dxzx0XiWY 0TMDJFNkrQVMT9Wv/MRZ6zKWprFyBasNYlUpakW6KjVGlPBx8spkWaRYEiaJQu+KglTyTDZG tGp1YlhcutIzIVHQV3KlwZNKlOt0oohlS7Vqg54NSlPr9DEiVqNQaqSacJ08U2dQpYarWH20 RCx+R+Zp/CIjrdl9i9C4pn/tfGLn54DhaYVAQEFaCguqy4lCMIXyp08BaG/vxrjgEYCmX/7h ebv86ScAWpv0LxWmUjPgmto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wW616/Z7E4cUva4nF3B6PF+b/HWR1kPC5f8fY4tUjCY+esu+we5+9tZPG4fLbU Y9OqTjaPzUvqPV5snsnosftmA5vH4r7JrB69ze/YPHa23mf1+Pj0FovH+31X2Tz6tqxi9Diz 4Ah7gHAUl01Kak5mWWqRvl0CV8ab/zYFf7grHvV0MDcwdnF1MXJySAiYSCyatJgRxBYS2M0o cfZ5EURcUmLZ3yPMELawxMp/z9m7GLmAaj4ySuxb28fWxcjBwSKgKvGyRRvEZBPQljj9nwOk XERAQ+Lbg+UsIOXMAmfYJM6t/Qc2X1jAVaL/6HJ2EJtXwFni+to2VoiZZ5kkrj3cApUQlDg5 8wkLiM0sYCYxb/NDZpAFzALSEsv/cUCE5SWat84Gu41TwFri6ffNTBMYBWch6Z6FpHsWQvcs JN0LGFlWMUqmFhTnpucWGxYY5qWW6xUn5haX5qXrJefnbmIEJxMtzR2M21d90DvEyMTBeIhR goNZSYQ3eqVvmhBvSmJlVWpRfnxRaU5q8SFGaQ4WJXFe8Re9KUIC6YklqdmpqQWpRTBZJg5O qQYmRaUzR2Yd3qp+u8xqc7q0yJ9SUZ2Dxqdtbl0qzrDnnKXMULDxRmmxba33rmbTiYGLo6oe Hr0reTbp2oVHGRvjr6QoX9TedyrZ6mmncup8uXmlJfnWPpFbar+8mvmns2qKLoNP75Tvoic+ X/iz+dyfwM9HeJ0EHm5bm6C7+JTVr9nsXLc7L87PvD39IDvPYvV32XWN+x3UvroXOPBxx3mn xLr7Rug0SzBY3/jUH2DgzVP5b2VApPimTz/v7Di2aL0BE8/Slqymog6tbwvfuN5nXN+66cej lpWxrV139mxZOoXvy7wlL1flCh87/D/Ii9Eh/pNWRadvsf+NIrWQhynbHzJOSVG0fXT6hzLj phxrJZbijERDLeai4kQA8kXBwJUDAAA= X-CMS-MailID: 20240523070224epcas5p3e695021dfef14e09478bef71d4bb64ff X-Msg-Generator: CA Content-Type: multipart/mixed; boundary="----0ARpVfROdpzmGW4Ln12FwIta42jNjH8le_L8dBWq-uMGoSqN=_1f5f7_" X-Sendblock-Type: REQ_APPROVE CMS-TYPE: 105P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20240520103039epcas5p4373f7234162a32222ac225b976ae30ce References: <20240520102033.9361-1-nj.shetty@samsung.com> <20240520102033.9361-13-nj.shetty@samsung.com> <2433bc0d-3867-475d-b472-0f6725f9a296@acm.org> <20240521144629.reyeiktaj72p4lzd@green245> <631c55b9-8b0a-4ac0-81bd-acf82c4a7602@acm.org> ------0ARpVfROdpzmGW4Ln12FwIta42jNjH8le_L8dBWq-uMGoSqN=_1f5f7_ Content-Type: text/plain; charset="utf-8"; format="flowed" Content-Transfer-Encoding: 8bit Content-Disposition: inline On 22/05/24 10:52AM, Bart Van Assche wrote: >On 5/21/24 07:46, Nitesh Shetty wrote: >>On 20/05/24 04:42PM, Bart Van Assche wrote: >>>On 5/20/24 03:20, Nitesh Shetty wrote: >>>>+    __rq_for_each_bio(bio, req) { >>>>+        if (seg == blk_rq_nr_phys_segments(req)) { >>>>+            sector_in = bio->bi_iter.bi_sector; >>>>+            if (rem != bio->bi_iter.bi_size) >>>>+                return status; >>>>+        } else { >>>>+            sector_out = bio->bi_iter.bi_sector; >>>>+            rem = bio->bi_iter.bi_size; >>>>+        } >>>>+        seg++; >>>>+    } >>> >>>_rq_for_each_bio() iterates over the bios in a request. Does a copy >>>offload request always have two bios - one copy destination bio and >>>one copy source bio? If so, is 'seg' a bio counter? Why is that bio >>>counter compared with the number of physical segments in the request? >>> >>Yes, your observation is right. We are treating first bio as dst and >>second as src. If not for that comparision, we might need to store the >>index in a temporary variable and parse based on index value. > >I'm still wondering why 'seg' is compared with blk_rq_nr_phys_segments(req). > In this case blk_rq_nr_phys_segments is used as counter value(==2), which tells its a src IO. But using a macro instead of this comparison will avoid this confusion. We will change this in next version to make it explicit. Thank you, Nitesh Shetty ------0ARpVfROdpzmGW4Ln12FwIta42jNjH8le_L8dBWq-uMGoSqN=_1f5f7_ Content-Type: text/plain; charset="utf-8" ------0ARpVfROdpzmGW4Ln12FwIta42jNjH8le_L8dBWq-uMGoSqN=_1f5f7_--