Skip to content

Commit bf392a5

Browse files
committed
nvme-pci: Remove tag from process cq
The only user for tagged completion was for timeout handling. That user, though, really only cares if the timed out command is completed, which we can safely check within the timeout handler. Remove the tag check to simplify completion handling. Reviewed-by: Sagi Grimberg <[email protected]> Reviewed-by: Christoph Hellwig <[email protected]> Signed-off-by: Keith Busch <[email protected]>
1 parent e2a366a commit bf392a5

File tree

1 file changed

+11
-12
lines changed

1 file changed

+11
-12
lines changed

drivers/nvme/host/pci.c

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -989,14 +989,13 @@ static inline void nvme_update_cq_head(struct nvme_queue *nvmeq)
989989
}
990990

991991
static inline int nvme_process_cq(struct nvme_queue *nvmeq, u16 *start,
992-
u16 *end, unsigned int tag)
992+
u16 *end)
993993
{
994994
int found = 0;
995995

996996
*start = nvmeq->cq_head;
997997
while (nvme_cqe_pending(nvmeq)) {
998-
if (tag == -1U || nvmeq->cqes[nvmeq->cq_head].command_id == tag)
999-
found++;
998+
found++;
1000999
nvme_update_cq_head(nvmeq);
10011000
}
10021001
*end = nvmeq->cq_head;
@@ -1017,7 +1016,7 @@ static irqreturn_t nvme_irq(int irq, void *data)
10171016
* the irq handler, even if that was on another CPU.
10181017
*/
10191018
rmb();
1020-
nvme_process_cq(nvmeq, &start, &end, -1);
1019+
nvme_process_cq(nvmeq, &start, &end);
10211020
wmb();
10221021

10231022
if (start != end) {
@@ -1040,7 +1039,7 @@ static irqreturn_t nvme_irq_check(int irq, void *data)
10401039
* Poll for completions any queue, including those not dedicated to polling.
10411040
* Can be called from any context.
10421041
*/
1043-
static int nvme_poll_irqdisable(struct nvme_queue *nvmeq, unsigned int tag)
1042+
static int nvme_poll_irqdisable(struct nvme_queue *nvmeq)
10441043
{
10451044
struct pci_dev *pdev = to_pci_dev(nvmeq->dev->dev);
10461045
u16 start, end;
@@ -1053,11 +1052,11 @@ static int nvme_poll_irqdisable(struct nvme_queue *nvmeq, unsigned int tag)
10531052
*/
10541053
if (test_bit(NVMEQ_POLLED, &nvmeq->flags)) {
10551054
spin_lock(&nvmeq->cq_poll_lock);
1056-
found = nvme_process_cq(nvmeq, &start, &end, tag);
1055+
found = nvme_process_cq(nvmeq, &start, &end);
10571056
spin_unlock(&nvmeq->cq_poll_lock);
10581057
} else {
10591058
disable_irq(pci_irq_vector(pdev, nvmeq->cq_vector));
1060-
found = nvme_process_cq(nvmeq, &start, &end, tag);
1059+
found = nvme_process_cq(nvmeq, &start, &end);
10611060
enable_irq(pci_irq_vector(pdev, nvmeq->cq_vector));
10621061
}
10631062

@@ -1075,8 +1074,7 @@ static int nvme_poll(struct blk_mq_hw_ctx *hctx)
10751074
return 0;
10761075

10771076
spin_lock(&nvmeq->cq_poll_lock);
1078-
found = nvme_process_cq(nvmeq, &start, &end, -1);
1079-
nvme_complete_cqes(nvmeq, start, end);
1077+
found = nvme_process_cq(nvmeq, &start, &end);
10801078
spin_unlock(&nvmeq->cq_poll_lock);
10811079

10821080
return found;
@@ -1253,7 +1251,8 @@ static enum blk_eh_timer_return nvme_timeout(struct request *req, bool reserved)
12531251
/*
12541252
* Did we miss an interrupt?
12551253
*/
1256-
if (nvme_poll_irqdisable(nvmeq, req->tag)) {
1254+
nvme_poll_irqdisable(nvmeq);
1255+
if (blk_mq_request_completed(req)) {
12571256
dev_warn(dev->ctrl.device,
12581257
"I/O %d QID %d timeout, completion polled\n",
12591258
req->tag, nvmeq->qid);
@@ -1396,7 +1395,7 @@ static void nvme_disable_admin_queue(struct nvme_dev *dev, bool shutdown)
13961395
else
13971396
nvme_disable_ctrl(&dev->ctrl);
13981397

1399-
nvme_poll_irqdisable(nvmeq, -1);
1398+
nvme_poll_irqdisable(nvmeq);
14001399
}
14011400

14021401
/*
@@ -1411,7 +1410,7 @@ static void nvme_reap_pending_cqes(struct nvme_dev *dev)
14111410
int i;
14121411

14131412
for (i = dev->ctrl.queue_count - 1; i > 0; i--) {
1414-
nvme_process_cq(&dev->queues[i], &start, &end, -1);
1413+
nvme_process_cq(&dev->queues[i], &start, &end);
14151414
nvme_complete_cqes(&dev->queues[i], start, end);
14161415
}
14171416
}

0 commit comments

Comments
 (0)