Received: by 2002:a05:7412:8d23:b0:f7:29d7:fb05 with SMTP id bj35csp342448rdb; Sat, 16 Dec 2023 10:17:23 -0800 (PST) X-Google-Smtp-Source: AGHT+IG04A73AgLOTgnuJEsHBDFLVhFAFjjdlK9PNH5gYF1RLrM7vY7UaCw+rKb9kZ7m9mY7KsMH X-Received: by 2002:a05:6830:1e58:b0:6d8:c133:7827 with SMTP id e24-20020a0568301e5800b006d8c1337827mr14515379otj.18.1702750643485; Sat, 16 Dec 2023 10:17:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702750643; cv=none; d=google.com; s=arc-20160816; b=XZi324zrqsunFXRjsi5WvAjSGRSw79N9GUSI5Etf1rP0hVe/fCJta6tYM5XMAUYTDT Q5esB8rS6IQ9HjmY+T2dV94mZraalo6ILgkaN/LYP9BirN7iim0cER3zDWRHJuKF2DYv J7NTmPllPCuxoQihvkVPp2fDFeHbIS5aZeXL2F9lcQia+Qu8Yd04crB2YON1rFqqY47q Ch2jbot3t3B0Quelm2rfhB1tL70y7LcVsQ02DKrfQUTpPiL7uho9Q7M9UZ4kq6F50vOJ hpzhXMLygsvQFvULuFjl9OUQ5FP+I3AOiVpHACFuciP+L/D6RdyBR1F7Yba08J7SGeKK xf3w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=VvRVmZz0fw4sy81ISwg0UmUCzFZE4mCNoPdzHScTDrI=; fh=OZkGasthJibGztgSF/C0/rA8Mse/WF1zwJJxT2z6Vb8=; b=s7C4795DdOBzAc+jIQU5M8E92RJ3JgvnVNJUI7/nFFlUpcwEkxlsE49Z8whpW+SNIC GKG/vDwWS72wMw0FVjjNb38Tl8wvnkyTt/vEBR6Ji07x+3xlo56et90zK6RXexoP+krN W7+K6a7bJXY0RHVKndOb1300Y+sU3Vq6d5BLxm+aOhwHXp+ty7aWnp7WimL4uPfpVaD8 fO/IOG3EADNZH1gfDRbLDG6C7ljpoGtiUcjCJhtviwUPsUYz+O+5KLebGKkQLac+e8nh tLk6CGaF47PGbQ6LAOE7EsfMBfIdlkCIWcu839popNQruHIfYNz1o0F49JFSWNS+jR2l AwsQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=i9jmdFDq; spf=pass (google.com: domain of linux-kernel+bounces-2322-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-2322-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id l5-20020a056a00140500b006cdf584699fsi15173220pfu.336.2023.12.16.10.17.23 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 16 Dec 2023 10:17:23 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-2322-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=i9jmdFDq; spf=pass (google.com: domain of linux-kernel+bounces-2322-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-2322-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.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 18122284F1B for ; Sat, 16 Dec 2023 18:17:23 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DC3FE31A85; Sat, 16 Dec 2023 18:17:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="i9jmdFDq" X-Original-To: linux-kernel@vger.kernel.org Received: from mail-yb1-f181.google.com (mail-yb1-f181.google.com [209.85.219.181]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D094E3172E; Sat, 16 Dec 2023 18:17:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-yb1-f181.google.com with SMTP id 3f1490d57ef6-db99bad7745so1435840276.0; Sat, 16 Dec 2023 10:17:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1702750627; x=1703355427; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=VvRVmZz0fw4sy81ISwg0UmUCzFZE4mCNoPdzHScTDrI=; b=i9jmdFDq3mTzHWblmX+MWiK35gxF0zci04EM4L8xa0yrvNP4n36bb7oC9vQ6EVYtD/ m32x9SvC/IbYgPChVnogpk8NURIwV7pP5pY64VpfC50sii0w5ol5Q4rKoBHmHVJ+uBmS VJa8rg3di5KMchkhfrsJ1+O65TJgt899jT7bgn92j5QSEST3CYRDlG3uhBqiOT9esv8F IoQRFvtMYKf+HQQOu/08H1sHjzfB+lMIVrEvj+THEvMwlIWkx37yFhhrcsOcX+OxZt3z OkmddB26/t5PvN8hIDmlMtozDIftEyn8ch09SioLduoPrhfDJhIX4j7f3emBc3Mb1oAr 73OA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702750627; x=1703355427; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=VvRVmZz0fw4sy81ISwg0UmUCzFZE4mCNoPdzHScTDrI=; b=tQ8m3/KXSgyZ96WxmFlTOHPKuJipYNkZ4VbmQlvQXlKMjRmshH8K70pRgThkm4ChkJ w/d2QsSdqMqz/DnXhXvCzC8aAkrkn478vDuAzvYlqz1QxGd8aIpI8hfebU+rMnWEF2q7 d/ICGw+1/4/IqGo9fbjJphEP9U2CCfWt5epA3tit3/+ubb+cb+K8mYFWlRtUGEOaq1st HRzKA5MqM7U6tTpkw4aog16xgTSl4jthhdyuQOkOk6EJ01eODEMCwH7fvKArVJU72V/2 sLdCAKb2G0moakYObLHMFmRiepF+JMEiIXnfWwSNAEocMGhMGTQy/pY/693rMOOKONqE Sugw== X-Gm-Message-State: AOJu0YwIS81zT16VfbSm8rJvs2v4c2jw3IjJHRZH29HI6S5cTP7YVlYw px147zSP69NAWf2RyFpdGRTQTmfFvBYCRH14+qw= X-Received: by 2002:a25:5f03:0:b0:dbc:1b67:e358 with SMTP id t3-20020a255f03000000b00dbc1b67e358mr8995770ybb.95.1702750626697; Sat, 16 Dec 2023 10:17:06 -0800 (PST) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20231206100253.13100-1-joshi.k@samsung.com> <20231206100253.13100-3-joshi.k@samsung.com> In-Reply-To: From: Nitesh Shetty Date: Sat, 16 Dec 2023 23:46:55 +0530 Message-ID: Subject: Re: [PATCH v18 02/12] Add infrastructure for copy offload in block and request layer. To: Keith Busch Cc: Kanchan Joshi , Jens Axboe , Jonathan Corbet , Alasdair Kergon , Mike Snitzer , Mikulas Patocka , dm-devel@lists.linux.dev, Christoph Hellwig , Sagi Grimberg , Chaitanya Kulkarni , Alexander Viro , Christian Brauner , martin.petersen@oracle.com, linux-scsi@vger.kernel.org, anuj1072538@gmail.com, gost.dev@samsung.com, mcgrof@kernel.org, Nitesh Shetty , 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 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable >>On Thu, Dec 14, 2023 at 6:41=E2=80=AFAM Keith Busch w= rote: >>> >>> On Wed, Dec 06, 2023 at 03:32:34PM +0530, Kanchan Joshi wrote: >>> > static inline bool bio_has_data(struct bio *bio) >>> > { >>> > - if (bio && >>> > - bio->bi_iter.bi_size && >>> > - bio_op(bio) !=3D REQ_OP_DISCARD && >>> > - bio_op(bio) !=3D REQ_OP_SECURE_ERASE && >>> > - bio_op(bio) !=3D REQ_OP_WRITE_ZEROES) >>> > + if (bio && (bio_op(bio) =3D=3D REQ_OP_READ || bio_op(bio) =3D= =3D REQ_OP_WRITE)) >>> > return true; >>> >>> There are other ops besides READ and WRITE that have data, but this is >>> might be fine by the fact that other ops with data currently don't call >>> this function. >>> >>> > diff --git a/include/linux/blk_types.h b/include/linux/blk_types.h >>> > index 7c2316c91cbd..bd821eaa7a02 100644 >>> > --- a/include/linux/blk_types.h >>> > +++ b/include/linux/blk_types.h >>> > @@ -393,6 +393,10 @@ enum req_op { >>> > /* reset all the zone present on the device */ >>> > REQ_OP_ZONE_RESET_ALL =3D (__force blk_opf_t)17, >>> > >>> > + /* copy offload dst and src operation */ >>> > + REQ_OP_COPY_SRC =3D (__force blk_opf_t)19, >>> >>> Should this be an even numbered OP? The odd ones are for data >>> WRITEs. Our request opcode needs to be write based(even) so that while forming nvme= -tcp packets we send this as part of the nvme capsule. But now I think this design can be simplified as you suggested, if we align COPY_SRC to even and COPY_DST to odd. This requires us to change the design= by sending dst bio first hence forming a write based request, followed by src bio's. Will send a follow up series next week fixing this. Thank you, Nitesh Shetty