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 33145EB64DC for ; Thu, 20 Jul 2023 08:00:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230376AbjGTIAc (ORCPT ); Thu, 20 Jul 2023 04:00:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43748 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229814AbjGTIAb (ORCPT ); Thu, 20 Jul 2023 04:00:31 -0400 Received: from verein.lst.de (verein.lst.de [213.95.11.211]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CAA352684; Thu, 20 Jul 2023 01:00:29 -0700 (PDT) Received: by verein.lst.de (Postfix, from userid 2407) id 98BAB6732D; Thu, 20 Jul 2023 10:00:26 +0200 (CEST) Date: Thu, 20 Jul 2023 10:00:26 +0200 From: Christoph Hellwig To: Nitesh Shetty 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, dlemoal@kernel.org, nitheshshetty@gmail.com, gost.dev@samsung.com, Kanchan Joshi , Javier =?iso-8859-1?Q?Gonz=E1lez?= , 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 5/9] nvme: add copy offload support Message-ID: <20230720080026.GB6246@lst.de> References: <20230627183629.26571-1-nj.shetty@samsung.com> <20230627183629.26571-6-nj.shetty@samsung.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230627183629.26571-6-nj.shetty@samsung.com> User-Agent: Mutt/1.5.17 (2007-11-01) Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org > + if (blk_rq_nr_phys_segments(req) != 2) > + return BLK_STS_IOERR; The magic number of segments adding up source and dest really need constants and helpers to make the code understandable. > + /* +1 shift as dst+src length is added in request merging, we send copy > + * for half the length. > + */ > + n_lba = blk_rq_bytes(req) >> (ns->lba_shift + 1); I do not understand the logic and comment here. > + if (WARN_ON(!n_lba)) WARN_ON_ONCE > + return BLK_STS_NOTSUPP; and BLK_STS_NOTSUPP seems like the wrong error here, this is an invalid argument.