From: Christoph Hellwig <hch@lst.de>
To: Keith Busch <kbusch@kernel.org>, Christoph Hellwig <hch@lst.de>,
Sagi Grimberg <sagi@grimberg.me>
Cc: Caleb Sander Mateos <csander@purestorage.com>,
Leon Romanovsky <leon@kernel.org>,
linux-nvme@lists.infradead.org,
Leon Romanovsky <leonro@nvidia.com>
Subject: [PATCH 2/7] nvme-pci: store aborted state in flags variable
Date: Tue, 13 May 2025 09:00:18 +0200 [thread overview]
Message-ID: <20250513070025.830930-3-hch@lst.de> (raw)
In-Reply-To: <20250513070025.830930-1-hch@lst.de>
From: Leon Romanovsky <leon@kernel.org>
Instead of keeping dedicated "bool aborted" variable, let's reuse
newly introduced flags variable and save space.
Signed-off-by: Leon Romanovsky <leonro@nvidia.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
drivers/nvme/host/pci.c | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
index 24f5292a349b..51430f5e6a66 100644
--- a/drivers/nvme/host/pci.c
+++ b/drivers/nvme/host/pci.c
@@ -230,6 +230,12 @@ union nvme_descriptor {
__le64 *prp_list;
};
+/* bits for iod->flags */
+enum nvme_iod_flags {
+ /* this command has been aborted by the timeout handler */
+ IOD_ABORTED = 1U << 0,
+};
+
/*
* The nvme_iod describes the data in an I/O.
*
@@ -239,7 +245,7 @@ union nvme_descriptor {
struct nvme_iod {
struct nvme_request req;
struct nvme_command cmd;
- bool aborted;
+ u8 flags;
s8 nr_allocations; /* PRP list pool allocations. 0 means small
pool in use */
unsigned int dma_len; /* length of single DMA segment mapping */
@@ -984,7 +990,7 @@ static blk_status_t nvme_prep_rq(struct nvme_dev *dev, struct request *req)
struct nvme_iod *iod = blk_mq_rq_to_pdu(req);
blk_status_t ret;
- iod->aborted = false;
+ iod->flags = 0;
iod->nr_allocations = -1;
iod->sgt.nents = 0;
iod->meta_sgt.nents = 0;
@@ -1551,7 +1557,7 @@ static enum blk_eh_timer_return nvme_timeout(struct request *req)
* returned to the driver, or if this is the admin queue.
*/
opcode = nvme_req(req)->cmd->common.opcode;
- if (!nvmeq->qid || iod->aborted) {
+ if (!nvmeq->qid || (iod->flags & IOD_ABORTED)) {
dev_warn(dev->ctrl.device,
"I/O tag %d (%04x) opcode %#x (%s) QID %d timeout, reset controller\n",
req->tag, nvme_cid(req), opcode,
@@ -1564,7 +1570,7 @@ static enum blk_eh_timer_return nvme_timeout(struct request *req)
atomic_inc(&dev->ctrl.abort_limit);
return BLK_EH_RESET_TIMER;
}
- iod->aborted = true;
+ iod->flags |= IOD_ABORTED;
cmd.abort.opcode = nvme_admin_abort_cmd;
cmd.abort.cid = nvme_cid(req);
--
2.47.2
next prev parent reply other threads:[~2025-05-13 7:00 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-13 7:00 misc cleanups for nvme-pci Christoph Hellwig
2025-05-13 7:00 ` [PATCH 1/7] nvme-pci: don't try to use SGLs for metadata on the admin queue Christoph Hellwig
2025-05-13 7:28 ` Leon Romanovsky
2025-05-13 7:39 ` Christoph Hellwig
2025-05-13 7:45 ` Leon Romanovsky
2025-05-13 7:47 ` Christoph Hellwig
2025-05-13 7:51 ` Leon Romanovsky
2025-05-13 7:00 ` Christoph Hellwig [this message]
2025-05-13 14:13 ` [PATCH 2/7] nvme-pci: store aborted state in flags variable Kanchan Joshi/Kanchan Joshi
2025-05-14 0:44 ` Caleb Sander Mateos
2025-05-14 5:06 ` Christoph Hellwig
2025-05-13 7:00 ` [PATCH 3/7] nvme-pci: remove struct nvme_descriptor Christoph Hellwig
2025-05-13 14:15 ` Kanchan Joshi/Kanchan Joshi
2025-05-14 1:07 ` Caleb Sander Mateos
2025-05-14 5:15 ` Christoph Hellwig
2025-05-13 7:00 ` [PATCH 4/7] nvme-pci: rename the descriptor pools Christoph Hellwig
2025-05-13 7:35 ` Leon Romanovsky
2025-05-13 14:16 ` Kanchan Joshi/Kanchan Joshi
2025-05-14 1:03 ` Caleb Sander Mateos
2025-05-13 7:00 ` [PATCH 5/7] nvme-pci: use a better encoding for small prp pool allocations Christoph Hellwig
2025-05-13 7:39 ` Leon Romanovsky
2025-05-13 7:40 ` Christoph Hellwig
2025-05-13 7:49 ` Leon Romanovsky
2025-05-13 14:49 ` Kanchan Joshi/Kanchan Joshi
2025-05-13 15:06 ` Keith Busch
2025-05-14 5:12 ` Christoph Hellwig
2025-05-14 13:06 ` Keith Busch
2025-05-14 14:00 ` Christoph Hellwig
2025-05-14 17:48 ` Caleb Sander Mateos
2025-05-14 17:47 ` Caleb Sander Mateos
2025-05-13 7:00 ` [PATCH 6/7] nvme-pci: add a symolic name for the small pool size Christoph Hellwig
2025-05-13 14:51 ` Kanchan Joshi/Kanchan Joshi
2025-05-14 18:24 ` Caleb Sander Mateos
2025-05-13 7:00 ` [PATCH 7/7] nvme-pci: use struct_size for allocation struct nvme_dev Christoph Hellwig
2025-05-13 7:20 ` Leon Romanovsky
2025-05-13 14:54 ` Kanchan Joshi/Kanchan Joshi
2025-05-14 18:28 ` Caleb Sander Mateos
2025-05-13 15:34 ` misc cleanups for nvme-pci Keith Busch
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250513070025.830930-3-hch@lst.de \
--to=hch@lst.de \
--cc=csander@purestorage.com \
--cc=kbusch@kernel.org \
--cc=leon@kernel.org \
--cc=leonro@nvidia.com \
--cc=linux-nvme@lists.infradead.org \
--cc=sagi@grimberg.me \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox