From patchwork Fri Mar 28 18:04:07 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Caleb Sander Mateos X-Patchwork-Id: 14032347 Received: from mail-pj1-f98.google.com (mail-pj1-f98.google.com [209.85.216.98]) (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 E1D291DE2C4 for ; Fri, 28 Mar 2025 18:05:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.98 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743185119; cv=none; b=JqbITlOI0Vx+KRS+3yLvBILpP/4skYH9WJkmpGDQFg873eiBny8GNJzpSFfVef79IJR4oSzcMMjFcT0G4BMSZYpIgQkqq4Z+Jk1rsFeQDrZKqZauIywr0hs6cdxyGxtC9VLUgazRk2m2j68pzznk4LBaNLdfUsY99eFm69plrOQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743185119; c=relaxed/simple; bh=rX6aI6CfqNKgjOLNzaJ1NxOuUJze/mq2YTseKrDo0O8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=fIDM+9qE2YisHt/2Q1brxMnrNOk9K21EOh2LR+H+9c4qXbzbLc7wTPuo3dBcnluT2CJcLHMWWaHuOjgptQNp5YNSEzs/7Nen2C1X4WKOGHbevkhU1wIO0Ku2IhJUl1RUMLBHNo9eg6WC1E0NcoW9J+KrQ+dDWie0c85pCBvVKto= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=purestorage.com; spf=fail smtp.mailfrom=purestorage.com; dkim=pass (2048-bit key) header.d=purestorage.com header.i=@purestorage.com header.b=JoGN+PXI; arc=none smtp.client-ip=209.85.216.98 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=purestorage.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=purestorage.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=purestorage.com header.i=@purestorage.com header.b="JoGN+PXI" Received: by mail-pj1-f98.google.com with SMTP id 98e67ed59e1d1-301001bc6a8so566103a91.1 for ; Fri, 28 Mar 2025 11:05:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=purestorage.com; s=google2022; t=1743185116; x=1743789916; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=JtpDew/eD8ba5wvcK2WBBEkoLN0/liTxOdyF+pn4Qyc=; b=JoGN+PXIi+t9V231MaIEtiilm6o9EGEaPlGVxIC2Qa4JROskcIndXGEUROycPjlqSU W3o9utUIQi8zC3/AHCN3adSJ9z+oODR9wWLqpBYsoSJaqPLZckCwS91MlJrI/kA24C6O nPmM0wqGSTFjX20YSiarCN8euJlsG7e4qgQPWw27SB2F/JnJpF7d3lrba2uPbm4FpA4a 9j97rt6yRUCWYSuHG58uxd1D9MrMOFUa4V7AAq+dvLK0jbEXKa5BNn+cQd4B862XOrpB DbbBHXu3LuQ8seVttiFG7TYupnRiwO+Z8jk2WM3x7k+0wfT56bfGM6LqAAY7S9rREFYX l24Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1743185116; x=1743789916; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=JtpDew/eD8ba5wvcK2WBBEkoLN0/liTxOdyF+pn4Qyc=; b=vLNVaMhrWJ1+4XEML79120sio4bd67BSGdXMg6myQ6STRXgZXfo0Y5ATKdzO1Bpn0k mQFFOOlPXpXF5RvOIlC59Vt+4vEowTPXENO0dGlq40JqnLAmAUi417yfrkhMBUv8lnPN +bPc1Y3CblDKiUU23uLJdyf6ONt4HMiYbLGEd7jD6hYiAYVRlscoS8cwp22Q8XlwzDXn 7aiDV6BAYfBP+MOp02vrQn5pUnYAbgki66iGvnX4VpUJbkgr5vahyA2SfSz+NYaR0SKj obOEmP93KgyBus8W0fWs8F4szhI8o4F01b0vP0wpJcvpdP8/Clt3TWuNngtR9X+53Mas dVyQ== X-Gm-Message-State: AOJu0YzaZjwJ6LX6Ufa40LWJHXFWcX2XoM13yjz1OCNvIT7NSyleX7Yz +JscxQDfuUrfw+r0p7NQnstx3g03CuTlH65McTn9B3N0lbjdelLXHRhk6dApH5VsuRqW3lf+F8P OmJKN4SelTrW301RxpLsELN3ZRlGIKXBQRsPc96q7sFgC1sDD X-Gm-Gg: ASbGnctTpg/vxBuPJYCXQl/f2ylo+Ty/duANMavjpS1i8sYaGA2Cxq3RWi4GyIZfNrR LQ8OleDJyuKtZMN/NByDQIQMqRDNkkAtVvmFy5SaaUeukyFfPP/0y6DImXNy8FHseUs/8izjPPy Ac17mhPsHw9pLQ0z1jTVPk2gJGIONkU7zzZ5jS7q7Uy8px3+giGi386l0X+D1JycKXmUC5cYmn6 1YZ24psAI10HkK+YQhl56E6dq/V1WlfPdFxIBGdkPmWC2yE16AdZjyroXIhucT501GnJAVgJd+B 77ypsc+uvPLuGH3QcgmsCrMOHjPfC2+B7w== X-Google-Smtp-Source: AGHT+IESDjVpHJqj9O/gJwm20/6fgVGc5WGyQTfH3ybkt3onnBkmBYQ3O5YYLMDEqF4wpu1Fan9NngLOzE57 X-Received: by 2002:a17:90b:388b:b0:2ff:6ac2:c5ae with SMTP id 98e67ed59e1d1-30531f7bef6mr146827a91.1.1743185115754; Fri, 28 Mar 2025 11:05:15 -0700 (PDT) Received: from c7-smtp-2023.dev.purestorage.com ([2620:125:9017:12:36:3:5:0]) by smtp-relay.gmail.com with ESMTPS id 98e67ed59e1d1-305175cae25sm308791a91.14.2025.03.28.11.05.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 28 Mar 2025 11:05:15 -0700 (PDT) X-Relaying-Domain: purestorage.com Received: from dev-csander.dev.purestorage.com (dev-csander.dev.purestorage.com [10.7.70.37]) by c7-smtp-2023.dev.purestorage.com (Postfix) with ESMTP id 2FBB7340721; Fri, 28 Mar 2025 12:05:15 -0600 (MDT) Received: by dev-csander.dev.purestorage.com (Postfix, from userid 1557716354) id 26A48E40ADA; Fri, 28 Mar 2025 12:04:45 -0600 (MDT) From: Caleb Sander Mateos To: Ming Lei , Jens Axboe Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, Caleb Sander Mateos Subject: [PATCH 1/5] ublk: remove unused cmd argument to ublk_dispatch_req() Date: Fri, 28 Mar 2025 12:04:07 -0600 Message-ID: <20250328180411.2696494-2-csander@purestorage.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20250328180411.2696494-1-csander@purestorage.com> References: <20250328180411.2696494-1-csander@purestorage.com> Precedence: bulk X-Mailing-List: linux-block@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 ublk_dispatch_req() never uses its struct io_uring_cmd *cmd argument. Drop it so callers don't have to pass a value. Signed-off-by: Caleb Sander Mateos --- drivers/block/ublk_drv.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/drivers/block/ublk_drv.c b/drivers/block/ublk_drv.c index 355a59c78539..39efe443e235 100644 --- a/drivers/block/ublk_drv.c +++ b/drivers/block/ublk_drv.c @@ -1183,11 +1183,10 @@ static inline void __ublk_abort_rq(struct ublk_queue *ubq, else blk_mq_end_request(rq, BLK_STS_IOERR); } static void ublk_dispatch_req(struct ublk_queue *ubq, - struct io_uring_cmd *cmd, struct request *req, unsigned int issue_flags) { int tag = req->tag; struct ublk_io *io = &ubq->ios[tag]; @@ -1271,11 +1270,11 @@ static void ublk_cmd_tw_cb(struct io_uring_cmd *cmd, struct ublk_queue *ubq = pdu->ubq; int tag = pdu->tag; struct request *req = blk_mq_tag_to_rq( ubq->dev->tag_set.tags[ubq->q_id], tag); - ublk_dispatch_req(ubq, cmd, req, issue_flags); + ublk_dispatch_req(ubq, req, issue_flags); } static void ublk_queue_cmd(struct ublk_queue *ubq, struct request *rq) { struct ublk_io *io = &ubq->ios[rq->tag]; @@ -1290,15 +1289,13 @@ static void ublk_cmd_list_tw_cb(struct io_uring_cmd *cmd, struct request *rq = pdu->req_list; struct ublk_queue *ubq = rq->mq_hctx->driver_data; struct request *next; while (rq) { - struct ublk_io *io = &ubq->ios[rq->tag]; - next = rq->rq_next; rq->rq_next = NULL; - ublk_dispatch_req(ubq, io->cmd, rq, issue_flags); + ublk_dispatch_req(ubq, rq, issue_flags); rq = next; } } static void ublk_queue_cmd_list(struct ublk_queue *ubq, struct rq_list *l) From patchwork Fri Mar 28 18:04:08 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Caleb Sander Mateos X-Patchwork-Id: 14032342 Received: from mail-qv1-f97.google.com (mail-qv1-f97.google.com [209.85.219.97]) (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 5BEF349625 for ; Fri, 28 Mar 2025 18:04:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.97 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743185090; cv=none; b=hCPqt7663dfiD5WVae0If4xegiMRgQ3q7LGphHhFvAaQ5jsgAbQ6g+tBU0x0WzKPy4IgnGlmn8U9O1+G7CEh7F45LnnTezRkGZHQQYv+euE0XUdfkLtGTYBdpUnu24V0LcjcsMuk1vKexKMorn9wwOfaQb/V6jy6byHSDeHjzMU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743185090; c=relaxed/simple; bh=gcB0C5YqFqmhQQqyd62UolXkBK1cwcSf4o9DizoUDeM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=owQ6xB30R4m/1K7VXu1oM2NnyPFIG9OoBxoSI2bpnfMR2r5FWvOhHRTri7EFJYRwwQuXmn3eMWC9qj5nBeTe0XmPszLuuduYUmhoyO6SNfAy9l8FUuflqHSJrhNpjNjrD6266tGQlfoV/HVeHUT9+2HuseH9dcCYYQTYQiCUsVA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=purestorage.com; spf=fail smtp.mailfrom=purestorage.com; dkim=pass (2048-bit key) header.d=purestorage.com header.i=@purestorage.com header.b=bpkw35Jp; arc=none smtp.client-ip=209.85.219.97 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=purestorage.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=purestorage.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=purestorage.com header.i=@purestorage.com header.b="bpkw35Jp" Received: by mail-qv1-f97.google.com with SMTP id 6a1803df08f44-6e4231ae149so3039916d6.2 for ; Fri, 28 Mar 2025 11:04:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=purestorage.com; s=google2022; t=1743185087; x=1743789887; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=w+QsHISAznmPuIeI6H2v/o6YzereVbQ7k5Q0Zm28d6I=; b=bpkw35JpI2ah3kX5nEIKvoQ9O9FIOQ76lvHlNCp5k1HWNyhUpI9g1dNQaIo2tMNoNd x6yuSmkYOaMKLaDdNYcrYgIygSyWr27fiwW8F9L/LI6lNU+LRpL8JPqMSU0AhdIivsO1 Ot6Blz7lis5T6FvClgksstfNCON3pmzrRZhOCWTnA3DmutbAee0avs915fBuQhaevwxE eQQgpvP2HxR7Oljz0NaQhI1oEaoQ8O9CdjpPta8JFjQhUypI/Fh+UR5Ua5vVXnmcn+4r 1uaWRR4mHhTwvD7XGCwhNWWL4eixRuaLOiIgzWEMyaHcvli1fp9R6bdnNqdPuI96f0SS KuKw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1743185087; x=1743789887; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=w+QsHISAznmPuIeI6H2v/o6YzereVbQ7k5Q0Zm28d6I=; b=ruIL6tczuKBoBnzWn7tHuxVYjgIVqgOXd58X3Xl1FnCo4w13b8nQhVL1W5LiMpfkmp MWR8h3bF4pHc7+JBLKbvB4xXLgRDrxcb7WVNGHgTwrgl7wxzjwuxcmkjky4U8YTIccmb +kB83KNNBhp7eSPnVDzMbWy4KvUj5+HAuvH0P5ynbb3INJAVGvSqEZwHrBUxbxkOgQI+ mRyTNuljBGmj2AxNMXXNaL5b/29ZAr2rQ9ZPQ5+2t4GChmOuXwknv/Esa/Lxswg4et8w 6XkjG6IBTWX9GX+nmnOGIE9etlmHJiau6aBSywk4Rot9Y+PDA06rqaJ+TLh7UitmIfmQ 5t5g== X-Gm-Message-State: AOJu0Yxopcrz9hmpjn9squOf3FRk5uKTNSg3J5Lagl5KmT3/LmIKpnVv U9eUxyCa0LYJD6uskAtDg0gbde8komajFc6mR2Tk1ZxDbUxv/DjmeYrBgqz/1cMkhJFSy1rJ6uW IzL9f02rwZ01shMG+xQNm8bBaY//Cu1NJflw9RC7HwYK7mDbJ X-Gm-Gg: ASbGnctk0v8y/qxvyFhkRPqYWNZ5f058uDPURWrrAFa36Q8ENKMabDZrWUGGZpXZRi2 Nl2O8NXrmj0rmRBbQs7YgRcRUkoiefuPOZz88WqSujPRW208dWrMRw7tlCl3hbgTT/dUDJaMj2c 7OccAjiYnDBhMhc+jojrqxyA3GYMg9X/60gvVRGY1MG7w0hipv93EJ66JO/hzpU+6RIul7fqh4q UbWllePmm/ehHCJEmoPfjBfkCj50VDX4mNmlBKFDnJE0bsIsVbJpYofQxSsVnWAZe9jeDu1TPPl XdPFrio3UWH/UJjGWtvOmzRIYzr2MTeemg== X-Google-Smtp-Source: AGHT+IGOaSWLBAClwcBn1yitLGGVmefsbpho4O3wbV/JCh+TajmhlWtEu3LwJSrjmgGjceg3yAOfQ85VCQdK X-Received: by 2002:a05:620a:17a6:b0:7c0:bd67:7dd9 with SMTP id af79cd13be357-7c5eeafa472mr383002585a.11.1743185087021; Fri, 28 Mar 2025 11:04:47 -0700 (PDT) Received: from c7-smtp-2023.dev.purestorage.com ([2620:125:9017:12:36:3:5:0]) by smtp-relay.gmail.com with ESMTPS id af79cd13be357-7c5f777eac7sm17958185a.3.2025.03.28.11.04.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 28 Mar 2025 11:04:47 -0700 (PDT) X-Relaying-Domain: purestorage.com Received: from dev-csander.dev.purestorage.com (dev-csander.dev.purestorage.com [10.7.70.37]) by c7-smtp-2023.dev.purestorage.com (Postfix) with ESMTP id D13233403C5; Fri, 28 Mar 2025 12:04:45 -0600 (MDT) Received: by dev-csander.dev.purestorage.com (Postfix, from userid 1557716354) id CB90DE412FD; Fri, 28 Mar 2025 12:04:45 -0600 (MDT) From: Caleb Sander Mateos To: Ming Lei , Jens Axboe Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, Caleb Sander Mateos Subject: [PATCH 2/5] ublk: skip 1 NULL check in ublk_cmd_list_tw_cb() loop Date: Fri, 28 Mar 2025 12:04:08 -0600 Message-ID: <20250328180411.2696494-3-csander@purestorage.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20250328180411.2696494-1-csander@purestorage.com> References: <20250328180411.2696494-1-csander@purestorage.com> Precedence: bulk X-Mailing-List: linux-block@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 ublk_cmd_list_tw_cb() is always performed on a non-empty request list. So don't check whether rq is NULL on the first iteration of the loop, just on subsequent iterations. Signed-off-by: Caleb Sander Mateos --- drivers/block/ublk_drv.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/block/ublk_drv.c b/drivers/block/ublk_drv.c index 39efe443e235..8b9780c0feab 100644 --- a/drivers/block/ublk_drv.c +++ b/drivers/block/ublk_drv.c @@ -1288,16 +1288,16 @@ static void ublk_cmd_list_tw_cb(struct io_uring_cmd *cmd, struct ublk_uring_cmd_pdu *pdu = ublk_get_uring_cmd_pdu(cmd); struct request *rq = pdu->req_list; struct ublk_queue *ubq = rq->mq_hctx->driver_data; struct request *next; - while (rq) { + do { next = rq->rq_next; rq->rq_next = NULL; ublk_dispatch_req(ubq, rq, issue_flags); rq = next; - } + } while (rq); } static void ublk_queue_cmd_list(struct ublk_queue *ubq, struct rq_list *l) { struct request *rq = rq_list_peek(l); From patchwork Fri Mar 28 18:04:09 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Caleb Sander Mateos X-Patchwork-Id: 14032344 Received: from mail-pj1-f97.google.com (mail-pj1-f97.google.com [209.85.216.97]) (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 8E3F8192B89 for ; Fri, 28 Mar 2025 18:04:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.97 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743185091; cv=none; b=P0H38qCML93HcTWpzGmd88kcVW3AWhewMVf2pckzoYUXpySPkL6yq8v8ORI5DSrxfgZT49EVbSHvuVtea5pZ9ZA4DmLk2eK9eWSuR8zqt5uQWWHJ9pkqsZwlrEO++Y44ScIsjZaSWFl/4VX605DvuBWSoGmapaZ7LudcBvCZguY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743185091; c=relaxed/simple; bh=PwwHN7IqP88DTTQV80OKz7nlEHX4zcF7Qrd9VdcrqNM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ABph0H0jDq+Rtl/xWoFtZ7lKqhCmuor+/PjQs2y/BcEZs3kvHGBEJFUzLzsgcLvd3/H6NXlWEYXzTR1CzpsfCTeJ0H6zVO+zn2Vm5OIVCX2WFwk3Is6fSweM6Fg3PxKy+QpXy9+HinqEdkyMBplZQpjXdoJRW8QgpfYcNMOhyWI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=purestorage.com; spf=fail smtp.mailfrom=purestorage.com; dkim=pass (2048-bit key) header.d=purestorage.com header.i=@purestorage.com header.b=Eu2aDNh5; arc=none smtp.client-ip=209.85.216.97 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=purestorage.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=purestorage.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=purestorage.com header.i=@purestorage.com header.b="Eu2aDNh5" Received: by mail-pj1-f97.google.com with SMTP id 98e67ed59e1d1-2ff7255b8c6so537215a91.0 for ; Fri, 28 Mar 2025 11:04:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=purestorage.com; s=google2022; t=1743185088; x=1743789888; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Kj4J8k1qL5TaHC2pS/xYDJ3AApG411gLa2b3V6a909Y=; b=Eu2aDNh5CFS5p/3TxC9hitGPafDzMxzBbIrdVvAogeKDtld3aNqihATxzT88ZYOw0E lG2pIUiQh2/3aDfi6XZp7odpAk9J/5FR5NvHmEM1Ja+58n2OTYkbj7L6WM19nQ/nT9S2 wG9dV8n+Uzr1N9lVUx41KxPKol6+L7G7+uDDOERZPshdGAHqu0y9kCtrlcXLPLXJLTSp ODSyzx/ZuITRfp3iYw2kp9595j5CrIgzUgg0QNsDa3U2vDT8RVGz5b4ucGIx6yZpCkF6 NC48tgQcQBgiPqZqpdueETSgfdploRpxf7hYfEhaWOikx1sWmdEHwsGTOQhd3SOHOv3W /UYA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1743185088; x=1743789888; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Kj4J8k1qL5TaHC2pS/xYDJ3AApG411gLa2b3V6a909Y=; b=bPmaEIvqLXaIJ5RQbhrl5XCr3hv6DGWPGKYXDDrJt3aCD1LwYwlMS9JB5IDGMNgAyt lW72o9vCiZCKClp3xwluO2WTcXo8NlXefZbCMBImO/oLyDO8pF8XufEVMLQhEfObqqKz KfZ5homMmGJ+DyXviO6JtQiSiufGpwVBfAHwxpBLq/rAU1+dp2YcF2Wbur2VfjDl9B6Y lJwCIZzpAlvdCFXsqN8NU65f7U2jfTizz1zhLUPEGXqdKraQRnLnQTV8db6VjQlhTHUa CTCfukINQB/j8gm/96gztqdPrJ92e+s7IdRYg/t7qIzIU+svC6LXF1KOeuNnR4P6qPsx Nfeg== X-Gm-Message-State: AOJu0YytMNAtbdonwUruIgj5km+14Kb+P2fneU85tL3G1+fN8TXeNLPP LlVnwEmIzwF78xbHaEp/sTMDqvJ5ABHr40Vw6QSNLIpaioHNs1iFcrre3WQM34gUO1S8vi9h1Pm dq9sALkHiXiHwXqgRwFGsAtgq0PThwXK5jDXMPhkIJd0L5f4W X-Gm-Gg: ASbGnctn584blRv2sO/ZWFgdLTMc36uXM/GBtfM1lRnc/CX5dFR2nVcN4I8oft5ZsXJ DgPzsn/6HhL2C4XJi21BjLxehQp4saHztaNOn1RRekPP6HRhxvHaLm9Hg0/NGLKK7zSQlV9BKYw +D/JmCd/oIaJTRE6gSfjDcoeoXie5ovCMO0c5Tkg7XxMmo1hIhRDXtg82QvlZ0BRuY28eqvI/Q/ p2K5LqNtl3yIm34v1PAy5zAUOCTTpA4HHu/4zTlLYoR7AAglhHzd51Ur0nuh/x1dJj2lnQJKq7V kQR0ij1nqNJEdY0xZmuB0SW1T7d66UkY5g== X-Google-Smtp-Source: AGHT+IGLq/NREs7Ar+m0I0zw96xZqeWn0sWBJj45iV6NXy9CwoEMc4w3wdUIdjPWM7sfWF+XBmbDZ/3WkwbG X-Received: by 2002:a17:90b:4c0e:b0:2ff:7b15:8138 with SMTP id 98e67ed59e1d1-30532165358mr89413a91.7.1743185087574; Fri, 28 Mar 2025 11:04:47 -0700 (PDT) Received: from c7-smtp-2023.dev.purestorage.com ([2620:125:9017:12:36:3:5:0]) by smtp-relay.gmail.com with ESMTPS id 98e67ed59e1d1-30516d57bd8sm301896a91.6.2025.03.28.11.04.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 28 Mar 2025 11:04:47 -0700 (PDT) X-Relaying-Domain: purestorage.com Received: from dev-csander.dev.purestorage.com (dev-csander.dev.purestorage.com [10.7.70.37]) by c7-smtp-2023.dev.purestorage.com (Postfix) with ESMTP id D725C340721; Fri, 28 Mar 2025 12:04:46 -0600 (MDT) Received: by dev-csander.dev.purestorage.com (Postfix, from userid 1557716354) id D34F9E412FD; Fri, 28 Mar 2025 12:04:46 -0600 (MDT) From: Caleb Sander Mateos To: Ming Lei , Jens Axboe Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, Caleb Sander Mateos Subject: [PATCH 3/5] ublk: get ubq from pdu in ublk_cmd_list_tw_cb() Date: Fri, 28 Mar 2025 12:04:09 -0600 Message-ID: <20250328180411.2696494-4-csander@purestorage.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20250328180411.2696494-1-csander@purestorage.com> References: <20250328180411.2696494-1-csander@purestorage.com> Precedence: bulk X-Mailing-List: linux-block@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Save a few pointer dereferences by obtaining struct ublk_queue *ubq from the ublk_uring_cmd_pdu instead of the request's mq_hctx. Signed-off-by: Caleb Sander Mateos --- drivers/block/ublk_drv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/block/ublk_drv.c b/drivers/block/ublk_drv.c index 8b9780c0feab..9276d1fcc100 100644 --- a/drivers/block/ublk_drv.c +++ b/drivers/block/ublk_drv.c @@ -1285,11 +1285,11 @@ static void ublk_queue_cmd(struct ublk_queue *ubq, struct request *rq) static void ublk_cmd_list_tw_cb(struct io_uring_cmd *cmd, unsigned int issue_flags) { struct ublk_uring_cmd_pdu *pdu = ublk_get_uring_cmd_pdu(cmd); struct request *rq = pdu->req_list; - struct ublk_queue *ubq = rq->mq_hctx->driver_data; + struct ublk_queue *ubq = pdu->ubq; struct request *next; do { next = rq->rq_next; rq->rq_next = NULL; From patchwork Fri Mar 28 18:04:10 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Caleb Sander Mateos X-Patchwork-Id: 14032343 Received: from mail-pl1-f226.google.com (mail-pl1-f226.google.com [209.85.214.226]) (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 067F31D54D6 for ; Fri, 28 Mar 2025 18:04:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.226 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743185090; cv=none; b=MU4QU9Mm0HelwJmh5OZdQUFvu7KuOn9wLmmLbHM6pY5TkQCO2VkLKj4cVTHq6LYORXMjZbkUl/slNQcU/vFtHexVgDBf9pJOjXIn5DiwDupb+WdYwfSJHy6uUYe+tnWXBCsC3gSwLClarq/3umwxA0qux0+2xq8zK/vFnPld2Jg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743185090; c=relaxed/simple; bh=fJWyd0Z+++VvMpzFxRzmAD3YIiTyE0lwLheqAemdONI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=d7AwiWD7CwXneJIfDUagoZsQT534LYbjIBf8AKZ97IVjXEX34wSuIcwMmJpF+BVWU5sm6Nh0Y+0WIJrD6ZyLAvHjr16DL+jb6sTnEw8OlK0hhuuNzH3+OhWtzel8eZ9ClJ+S+qDy+DShiniqy8v6Q/Y8rB9m7hzrrRWZNyBrKfQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=purestorage.com; spf=fail smtp.mailfrom=purestorage.com; dkim=pass (2048-bit key) header.d=purestorage.com header.i=@purestorage.com header.b=I64Fmm0X; arc=none smtp.client-ip=209.85.214.226 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=purestorage.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=purestorage.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=purestorage.com header.i=@purestorage.com header.b="I64Fmm0X" Received: by mail-pl1-f226.google.com with SMTP id d9443c01a7336-227c7e4d5feso6717685ad.2 for ; Fri, 28 Mar 2025 11:04:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=purestorage.com; s=google2022; t=1743185088; x=1743789888; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=w1Idek15brks28Nv8cZ778Xz6huRCcZJmLXYMYLMNtA=; b=I64Fmm0XjVPGf6PnWGxopZ4ymB6IOIUd+cUYwiIp2UfRY0YSWBXzEcaTDlPHZURMt/ 6KR8NO9g4qkqp6VCpe/V9J4xayHHk8hiem6jD4szqiQZMD+Gcr9dm0vysJO2rTWrjFwD nuNGqRvYdxIIqbQJuxa2ZTvCIZT4bOVWC6cFk5IqC2nMAUCTunWya+Om8j9nqYsJ2dAa e7cQ0JmtPsffVFvK81pZ8yGAfw3oFIjssfzapfHvM2YwmVzHnrx5d6VVq8CWx0km9fu3 n5vl9D4K+tISG71KrsC3HQZbVCDx7xBQpDjdk2bXKaP2jVwG+5fsOxZ/XopQ9f4Gs8kV tb1w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1743185088; x=1743789888; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=w1Idek15brks28Nv8cZ778Xz6huRCcZJmLXYMYLMNtA=; b=HSomsLTjrPSAT8ykQqcI+TfY/eMuCbAsi00L3f2jhVIV8HO1rMqwJUxdh5Aol40mnJ XzYrDYSLU8/Mqx1xpyFj7TBTx6+8ZMyY4MY9quOPZHqKpXzJEOJJZ2CV1MFT4AFVBYfQ 0OgIhT7zFQVOBGl/tEj38coUmAtyz//PCEdEDOpn25IQgJkOXDd4YKoKC2riINLwwUkZ qdMUK+lRmOpP8YR94TwB4dqd1eToD0ceMUOrbCj4B/jE/9c9rE2mcWkNVrLGHNyfGhdH auUUy2EV9SlbmM2t0R00Vx5iX8Pk75ckednJ0tnwb29zxT3e5vr1O2nX+IjqfUurCpC7 rjPg== X-Gm-Message-State: AOJu0YwAaY5iF8m+ACfJ9bu/EGChdtINnegMqvM+bQ5btWtmCLlwLSid Qx5y5FGTexMzdph6+CGuzFcvK/L6bkv38V6YtFEekXY1rOQSGF7Q8H01z2KW/ZkLCF6txBWHOOY QzrWuNTmJvhuCbTi5d/1SaQJKRYqjdu8W X-Gm-Gg: ASbGncv1cyOG0JlCNLOhWHSz1WLptZTHQhxCo2i5TTDW62gVDdT+QAPLhdDiVD9GBVO /zeOrSbQ7Bf1kutxnISS2G0OtMvyctbh9YtoVQxMLP82+laWsXYL0SN8IsYvVx4xUlM24XQpcnX pmtNKTvZaLaP3ijT0yX9V2tBBAubM74g77Z2ZtjVMrV49huMAeuWXvGuoZjROw/a8bVMaUNJx7X +XUbN1VqykWLMMJbmdLj1X3p/rnXBfQB/pufPlCkq2k7osJFz9ZE80P53cOLL0ITrVVAlzJMJmy GoDro5prWSbrrt9dA0prPdE4HXN6CCuMJwgj10qkjNfYPaAn X-Google-Smtp-Source: AGHT+IFvPkRdPB0wYsU59eOlUQEOpUKJ5TxHSxxI6tIebCQXRXwkP/6DyJ5cr05mVyMMf7EOnbwS893QtR5c X-Received: by 2002:a17:903:985:b0:223:28a8:610b with SMTP id d9443c01a7336-2292fa08a32mr569845ad.14.1743185087910; Fri, 28 Mar 2025 11:04:47 -0700 (PDT) Received: from c7-smtp-2023.dev.purestorage.com ([208.88.159.128]) by smtp-relay.gmail.com with ESMTPS id d9443c01a7336-2291eec6156sm2811675ad.26.2025.03.28.11.04.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 28 Mar 2025 11:04:47 -0700 (PDT) X-Relaying-Domain: purestorage.com Received: from dev-csander.dev.purestorage.com (dev-csander.dev.purestorage.com [10.7.70.37]) by c7-smtp-2023.dev.purestorage.com (Postfix) with ESMTP id 522373403C5; Fri, 28 Mar 2025 12:04:47 -0600 (MDT) Received: by dev-csander.dev.purestorage.com (Postfix, from userid 1557716354) id 50DCBE412FD; Fri, 28 Mar 2025 12:04:47 -0600 (MDT) From: Caleb Sander Mateos To: Ming Lei , Jens Axboe Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, Caleb Sander Mateos Subject: [PATCH 4/5] ublk: avoid redundant io->cmd in ublk_queue_cmd_list() Date: Fri, 28 Mar 2025 12:04:10 -0600 Message-ID: <20250328180411.2696494-5-csander@purestorage.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20250328180411.2696494-1-csander@purestorage.com> References: <20250328180411.2696494-1-csander@purestorage.com> Precedence: bulk X-Mailing-List: linux-block@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 ublk_queue_cmd_list() loads io->cmd twice. The intervening stores prevent the compiler from combining the loads. Since struct ublk_io *io is only used to compute io->cmd, replace the variable with io->cmd. Signed-off-by: Caleb Sander Mateos --- drivers/block/ublk_drv.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/block/ublk_drv.c b/drivers/block/ublk_drv.c index 9276d1fcc100..23250471562a 100644 --- a/drivers/block/ublk_drv.c +++ b/drivers/block/ublk_drv.c @@ -1299,16 +1299,16 @@ static void ublk_cmd_list_tw_cb(struct io_uring_cmd *cmd, } static void ublk_queue_cmd_list(struct ublk_queue *ubq, struct rq_list *l) { struct request *rq = rq_list_peek(l); - struct ublk_io *io = &ubq->ios[rq->tag]; - struct ublk_uring_cmd_pdu *pdu = ublk_get_uring_cmd_pdu(io->cmd); + struct io_uring_cmd *cmd = ubq->ios[rq->tag].cmd; + struct ublk_uring_cmd_pdu *pdu = ublk_get_uring_cmd_pdu(cmd); pdu->req_list = rq; rq_list_init(l); - io_uring_cmd_complete_in_task(io->cmd, ublk_cmd_list_tw_cb); + io_uring_cmd_complete_in_task(cmd, ublk_cmd_list_tw_cb); } static enum blk_eh_timer_return ublk_timeout(struct request *rq) { struct ublk_queue *ubq = rq->mq_hctx->driver_data; From patchwork Fri Mar 28 18:04:11 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Caleb Sander Mateos X-Patchwork-Id: 14032345 Received: from mail-yb1-f228.google.com (mail-yb1-f228.google.com [209.85.219.228]) (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 2123C1DC992 for ; Fri, 28 Mar 2025 18:04:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.228 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743185091; cv=none; b=Rk7goA9VheKa2eX0JCalvxWye2ehpbgSeVDRaFQeXu30/Qxuzs5kPiNjPzFVXQfYOwLc0n7TSwgNiReu60P1MbBTIZ5DhQ4VBRhtOV8jUoavaEvCEKZWf3GGNzsenS98NSfGCMKKIXyowiFuon3BX2fRb8kqAEvcUoLY80TmiO8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743185091; c=relaxed/simple; bh=XQMgakDIJjvP2FenQcES4/nXwydyPWmlJoZ3T4wy04c=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=aBRnJmJUYiryPOeIAG8BRpzIo8kKSfIVjmMYeDfCagPMSjx7dPMBATWKs5ykY5wflX8jdlHLRYeX1AHL5XgDUKtNXJmtsynkToX1TGm2xVfhBG59MUP/PawtDFqwClHYnq3fbMqyg+zrNzReK8s6IbouhyK5BpoAuk7YdhXBjX4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=purestorage.com; spf=fail smtp.mailfrom=purestorage.com; dkim=pass (2048-bit key) header.d=purestorage.com header.i=@purestorage.com header.b=WblRSibU; arc=none smtp.client-ip=209.85.219.228 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=purestorage.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=purestorage.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=purestorage.com header.i=@purestorage.com header.b="WblRSibU" Received: by mail-yb1-f228.google.com with SMTP id 3f1490d57ef6-e6372042cc2so331040276.0 for ; Fri, 28 Mar 2025 11:04:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=purestorage.com; s=google2022; t=1743185089; x=1743789889; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=ToMds7a1iukk8k+ynJkA30yqjBpeuxVgmALggVXwSPI=; b=WblRSibUVk9qBh14N6JVAG2nBVgmFkk4yHYlbMVAKsxWqoQj7ivQ+tGZX8daQOwE12 IgEP/wEyqMar33IhGJP9TgaUzjDuiy229P8xtGXvOteGquSTW3vFDKOUcymk+99R9/cb JxweMLcGrM+AG7Kp1y3IUC6e/xVmHfZD8aSvP+ssnjGlJjna6QMuNn2bOJRqm+KwIjcC sNM6vzNwO8qaFD9NCri5SUs17eyJG1QsCrzCLa5wWczW1Kx+mzYB+8QejFdYqqrDwZ11 GSAYVBgIjT06xKrDSxphv0dYaLYiYpagZJ+fP0vs/yUQJlwRAsq/NCVPsSFDUiR8uEd6 liCA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1743185089; x=1743789889; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ToMds7a1iukk8k+ynJkA30yqjBpeuxVgmALggVXwSPI=; b=b23kgzGY/CqyeHwG30EGDFH2Gk0t8Y2ftn3fgrwRr50U8yUq+EULRcb0sZUNL511Ch DnqCF2CE4aTAmlBEnVIdxylijWbiD7bjmPA2K0JXcKWmAbdQnHNocjAqz2rOTWBQtg4d VCswRtObyIqN7D09b9xUucL7rQFOePqb24qmpClFm5yZx2h5SlVRYFw2Yss+IDrsAZxF 4IfI/fe/XpHBSysKlZYioci+kTIRreMup4A49fgmw1xNmsESjPjDpapk+2Prsj4BwkcS TcMuguiMzP1hw7ktN+bd/RX1Cs8re2KZRIa1xwRxcEbX+qiKZ/hVZnGVO3oxqkLuUsDA SQHA== X-Gm-Message-State: AOJu0YwvhNBFuiU0kR4/Zepy4f0FUDVa5heKAajiIbtviWyVDUtq1ltU EpbGiA7R8h/7tngGYRHE7zEvZzu8mtRwgSpc0CcJkNJQJ+9JWRJUV7ZPncTCPZAOwb4TzKq0EYk 8jAXsGaLR/QntVDpnFw8j6aWTjaM3yoFi X-Gm-Gg: ASbGncssmepcHuzB/fnu0iKe6B9HicUbTAehkzcDKyrH9l0ux7ZyCHIKsu7iWGjvVM6 ql3GAaVZ8Eh8IDT7JK/m+amYX5yUfcNibb58YMM44NLn3wkSTNJJrbUsA8DFL/eX+/clzBFssah LnXkhgAI3PaieaPRzxbMNNo2i8Yco7vBj4yzIu8eRrAERfSv7+lrXDm/mRrKMyDRWv/OjRNzQVV zXL70U6FcGno0PkDBIfiUYbD94ZgLJrgcUStCeyUYU6F1Zb0lPTWibdx4eAn3CeAmCv9/op83yz yv2TFWYBN2JximiCk+RGprAcw/0ad8Xt1+obWAFunkGX2+y+ X-Google-Smtp-Source: AGHT+IEqw+lKegEraS7WeFtb+fekn2SZ9vc6rfbQB4wWCBvh3x/gk+5IVeAG0hDMfpysnVPW9CQwnFYky0Ki X-Received: by 2002:a05:690c:112:b0:6ee:b726:62cd with SMTP id 00721157ae682-7025736bbf9mr2158077b3.9.1743185088693; Fri, 28 Mar 2025 11:04:48 -0700 (PDT) Received: from c7-smtp-2023.dev.purestorage.com ([208.88.159.129]) by smtp-relay.gmail.com with ESMTPS id 00721157ae682-7023a95d0d2sm2932487b3.49.2025.03.28.11.04.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 28 Mar 2025 11:04:48 -0700 (PDT) X-Relaying-Domain: purestorage.com Received: from dev-csander.dev.purestorage.com (dev-csander.dev.purestorage.com [10.7.70.37]) by c7-smtp-2023.dev.purestorage.com (Postfix) with ESMTP id 08A8B340721; Fri, 28 Mar 2025 12:04:48 -0600 (MDT) Received: by dev-csander.dev.purestorage.com (Postfix, from userid 1557716354) id 06FDEE412FD; Fri, 28 Mar 2025 12:04:48 -0600 (MDT) From: Caleb Sander Mateos To: Ming Lei , Jens Axboe Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, Caleb Sander Mateos Subject: [PATCH 5/5] ublk: store req in ublk_uring_cmd_pdu for ublk_cmd_tw_cb() Date: Fri, 28 Mar 2025 12:04:11 -0600 Message-ID: <20250328180411.2696494-6-csander@purestorage.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20250328180411.2696494-1-csander@purestorage.com> References: <20250328180411.2696494-1-csander@purestorage.com> Precedence: bulk X-Mailing-List: linux-block@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Pass struct request *rq to ublk_cmd_tw_cb() through ublk_uring_cmd_pdu, mirroring how it works for ublk_cmd_list_tw_cb(). This saves some pointer dereferences, as well as the bounds check in blk_mq_tag_to_rq(). Signed-off-by: Caleb Sander Mateos --- drivers/block/ublk_drv.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/drivers/block/ublk_drv.c b/drivers/block/ublk_drv.c index 23250471562a..466a23b89379 100644 --- a/drivers/block/ublk_drv.c +++ b/drivers/block/ublk_drv.c @@ -87,11 +87,14 @@ struct ublk_uring_cmd_pdu { * * It should have been stored to request payload, but we do want * to avoid extra pre-allocation, and uring_cmd payload is always * free for us */ - struct request *req_list; + union { + struct request *req; + struct request *req_list; + }; /* * The following two are valid in this cmd whole lifetime, and * setup in ublk uring_cmd handler */ @@ -1266,22 +1269,21 @@ static void ublk_dispatch_req(struct ublk_queue *ubq, static void ublk_cmd_tw_cb(struct io_uring_cmd *cmd, unsigned int issue_flags) { struct ublk_uring_cmd_pdu *pdu = ublk_get_uring_cmd_pdu(cmd); struct ublk_queue *ubq = pdu->ubq; - int tag = pdu->tag; - struct request *req = blk_mq_tag_to_rq( - ubq->dev->tag_set.tags[ubq->q_id], tag); - ublk_dispatch_req(ubq, req, issue_flags); + ublk_dispatch_req(ubq, pdu->req, issue_flags); } static void ublk_queue_cmd(struct ublk_queue *ubq, struct request *rq) { - struct ublk_io *io = &ubq->ios[rq->tag]; + struct io_uring_cmd *cmd = ubq->ios[rq->tag].cmd; + struct ublk_uring_cmd_pdu *pdu = ublk_get_uring_cmd_pdu(cmd); - io_uring_cmd_complete_in_task(io->cmd, ublk_cmd_tw_cb); + pdu->req = rq; + io_uring_cmd_complete_in_task(cmd, ublk_cmd_tw_cb); } static void ublk_cmd_list_tw_cb(struct io_uring_cmd *cmd, unsigned int issue_flags) {