Received: by 2002:ab2:7853:0:b0:1fa:5c73:8e2d with SMTP id m19csp3989lqp; Thu, 30 May 2024 10:12:49 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXWyj/sv8sohxIX7RzJC8D04Dtbr8akjiVgbnC+GMHvRfN8jAxXiMIHb7HhpxLO7vyqJb/OqktzLbK2RzrRaAqANEq/yUkPtMkDSirV1Q== X-Google-Smtp-Source: AGHT+IGDfnCFdf7IIV77j0bMmPla8FDUYQXIToP6VwnbnrLurOdaz9dHeqrc+AFLaKA9wby6u+SE X-Received: by 2002:ac2:48b3:0:b0:52b:78c8:efd with SMTP id 2adb3069b0e04-52b7d4892a9mr1789719e87.60.1717089169424; Thu, 30 May 2024 10:12:49 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717089169; cv=pass; d=google.com; s=arc-20160816; b=OnmSYc3vdmhtttYlZqthEvyFmalzKTtKCdWKw39K9k3chuD8/fihfv5jriBCuK+Yvw D1OTe3/HEfnK30ruDWTIxwUp5LGl24Yj1xGTSuNfMPuaBQgvgwv/uC4o0DRUaRxYf3n/ qzMxvzN3upOUq2Ig/2NLyvTKpd6NC0Zm1blFowlBTB7GhDQANgMECB4CH4Gd1HSFPQDw rId49EXUKdqEeMeY3i8XGZwLijIM0hFTncm+xf4FUiyj7HjoA18HI1jWOt2R/RC+u0AA q1wr36X4U222LMVFKvJeusgaG8Z2I1ulb8TQjBc77KQwoQipqP5u26OIJblS25+QK2vZ WnBw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=Ul8tShPV3DUMrLj4E7kNdLyBZmST2o57Jd5aN0FDWYg=; fh=kuoMew3g3SeiY1fBNdvEKhWRQAGW6sItW/xl9/tfeX8=; b=txXC6fruSZCsZHIN2t/Pd1YS1q03LxTMCeqS6iMPKFX3otpCKnoZX9WSi8dvWsjJRF c89mB/YXzecf4HGwRhDD3MQBSYDYNPU0G/9LLDJk19ZVv1LMde7w/1IlF2YWq17VpA9v I4VbLbX/jKSFzFrklVuR9UraaKj953WIoRBDRLDtazIiu9ue6+IzxYYZkfYEMjdaTBgY nvTibcCWeZHwVYNyDTkB5gaZDBlFOBXpJ4OnymsJjvlyNMWAZyHpXpzKeiZQgnVtPutM MgBRmPYGHe3c/4860GF0tbj+cKsJZfPWDWjmLRB07z0H3mvPKRO5wMMjQ6KRZFA+TR6N QPFg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@acm.org header.s=mr01 header.b=pDdrsLN3; arc=pass (i=1 spf=pass spfdomain=acm.org dkim=pass dkdomain=acm.org dmarc=pass fromdomain=acm.org); spf=pass (google.com: domain of linux-kernel+bounces-195716-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-195716-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=acm.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id a640c23a62f3a-a626c800e41si776107266b.110.2024.05.30.10.12.49 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 May 2024 10:12:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-195716-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@acm.org header.s=mr01 header.b=pDdrsLN3; arc=pass (i=1 spf=pass spfdomain=acm.org dkim=pass dkdomain=acm.org dmarc=pass fromdomain=acm.org); spf=pass (google.com: domain of linux-kernel+bounces-195716-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-195716-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=acm.org 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 am.mirrors.kernel.org (Postfix) with ESMTPS id D79CC1F21793 for ; Thu, 30 May 2024 17:12:47 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 725654EB31; Thu, 30 May 2024 17:11:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=acm.org header.i=@acm.org header.b="pDdrsLN3" Received: from 008.lax.mailroute.net (008.lax.mailroute.net [199.89.1.11]) (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 2DC3A45BE4; Thu, 30 May 2024 17:11:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=199.89.1.11 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717089091; cv=none; b=gUdfIh8OT6X+brsgPk2x0c3TdubG9/HbDpT8UpSDJvhh+ofIIw8GTFpnVPkBP8yoyu5kY392HVG9uiLaAlyIup/OWUDnXuu9/FUrNHIGsTqn8yKjadnllQnGn02CGYP16Df0CI3MzGuYtoPCZEMX1yoB3oku19byljw6zlYq0HU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717089091; c=relaxed/simple; bh=go0cYzcDqydRtutKma5FUwv79zZ3P7zOWhGl/8O+3OI=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=CkVKFvLxaJsigiQ7RfCmp0CXKIatuPkMJ3ptN6HMGuXul6xUF3h6XZFT1jHUaR6QgZO1oJBnnDcvNGr2MwLexL2u2SSiL3EE1Wb4fjSoNtOt9UZ93vUqwPEym7NshI0Mupmx6sh1vEQm7l5bnukrFtMHSfyCSP2xsoPooxj65Dw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=acm.org; spf=pass smtp.mailfrom=acm.org; dkim=pass (2048-bit key) header.d=acm.org header.i=@acm.org header.b=pDdrsLN3; arc=none smtp.client-ip=199.89.1.11 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=acm.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=acm.org Received: from localhost (localhost [127.0.0.1]) by 008.lax.mailroute.net (Postfix) with ESMTP id 4Vqt812W1wz6Cnk9F; Thu, 30 May 2024 17:11:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=acm.org; h= content-transfer-encoding:content-type:content-type:in-reply-to :from:from:content-language:references:subject:subject :user-agent:mime-version:date:date:message-id:received:received; s=mr01; t=1717089079; x=1719681080; bh=Ul8tShPV3DUMrLj4E7kNdLyB ZmST2o57Jd5aN0FDWYg=; b=pDdrsLN3JZPbFaUtLRbj37cnYuTv29wYsaoWbWPX 0jAfS4sWOekodOat3cJMbqn2RuFn9uq1dvv60rD84RsGZNOhy608uxLLU+fhbyly eKTbCc9wykATpOsmXQs1/utBwypcCkWl3KNU2MCRI5q96GhEKAOJtbitLN7/YNmG 3Mn9taXV/EfZN1zWvkxJYjfq7QJgcsxlE8NwOH4KI1q7OAQMt6CrARV53oLIJ5CE jigej7/3tFmHOi5xt9zZPOhIruRk26PiBfPzT3bdqB0Juw5GHorv14poLk5Hg7m/ 4sx7azLGVHPrQJdDegiabUIRkEKLqqQMji0NKTMLKSNjWA== X-Virus-Scanned: by MailRoute Received: from 008.lax.mailroute.net ([127.0.0.1]) by localhost (008.lax [127.0.0.1]) (mroute_mailscanner, port 10029) with LMTP id T0Ifl3ssZIoq; Thu, 30 May 2024 17:11:19 +0000 (UTC) Received: from [100.96.154.26] (unknown [104.132.0.90]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: bvanassche@acm.org) by 008.lax.mailroute.net (Postfix) with ESMTPSA id 4Vqt7l6w1zz6Cnk97; Thu, 30 May 2024 17:11:15 +0000 (UTC) Message-ID: Date: Thu, 30 May 2024 10:11:15 -0700 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v20 02/12] Add infrastructure for copy offload in block and request layer. To: Nitesh Shetty Cc: Damien Le Moal , 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, 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 References: <20240520102033.9361-1-nj.shetty@samsung.com> <20240520102033.9361-3-nj.shetty@samsung.com> <20240529061736.rubnzwkkavgsgmie@nj.shetty@samsung.com> <9f1ec1c1-e1b8-48ac-b7ff-8efb806a1bc8@kernel.org> <665850bd.050a0220.a5e6b.5b72SMTPIN_ADDED_BROKEN@mx.google.com> Content-Language: en-US From: Bart Van Assche In-Reply-To: <665850bd.050a0220.a5e6b.5b72SMTPIN_ADDED_BROKEN@mx.google.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable On 5/30/24 00:16, Nitesh Shetty wrote: > +static inline bool blk_copy_offload_attempt_combine(struct request_que= ue *q, > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 = struct bio *bio) > +{ > +=C2=A0=C2=A0=C2=A0 struct blk_plug *plug =3D current->plug; > +=C2=A0=C2=A0=C2=A0 struct request *rq; > + > +=C2=A0=C2=A0=C2=A0 if (!plug || rq_list_empty(plug->mq_list)) > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 return false; > + > +=C2=A0=C2=A0=C2=A0 rq_list_for_each(&plug->mq_list, rq) { > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 if (rq->q =3D=3D q) { > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 if = (!blk_copy_offload_combine(rq, bio)) > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0 return true; > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 bre= ak; > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 } > + > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 /* > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 * Only keep iterating= plug list for combines if we have multiple > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 * queues > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 */ > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 if (!plug->multiple_queues) > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 bre= ak; > +=C2=A0=C2=A0=C2=A0 } > +=C2=A0=C2=A0=C2=A0 return false; > +} This new approach has the following two disadvantages: * Without plug, REQ_OP_COPY_SRC and REQ_OP_COPY_DST are not combined. The= se two operation types are the only operation types for which not using a plu= g causes an I/O failure. * A loop is required to combine the REQ_OP_COPY_SRC and REQ_OP_COPY_DST o= perations. Please switch to the approach Hannes suggested, namely bio chaining. Chai= ning REQ_OP_COPY_SRC and REQ_OP_COPY_DST bios before these are submitted elimi= nates the two disadvantages mentioned above. Thanks, Bart.