]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
nvme-pci: store aborted state in flags variable
authorLeon Romanovsky <leonro@nvidia.com>
Sat, 10 May 2025 03:47:03 +0000 (05:47 +0200)
committerChristoph Hellwig <hch@lst.de>
Tue, 20 May 2025 03:34:27 +0000 (05:34 +0200)
Instead of keeping dedicated "bool aborted" variable, switch to a flags
flags that can be used for other flags as well.

Signed-off-by: Leon Romanovsky <leon@kernel.org>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Keith Busch <kbusch@kernel.org>
Reviewed-by: Kanchan Joshi <joshi.k@samsung.com>
Reviewed-by: Caleb Sander Mateos <csander@purestorage.com>
drivers/nvme/host/pci.c

index 24f5292a349b9198b0e4bc5e39af2a87576cdb55..51430f5e6a66363827fe780ec49da5f6f23c7546 100644 (file)
@@ -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);