Skip to content

Commit 33b9372

Browse files
Christoph Hellwigaxboe
authored andcommitted
nvme: fix setting the queue depth in nvme_alloc_io_tag_set
While the CAP.MQES field in NVMe is a 0s based filed with a natural one off, we also need to account for the queue wrap condition and fix undo the one off again in nvme_alloc_io_tag_set. This was never properly done by the fabrics drivers, but they don't seem to care because there is no actual physical queue that can wrap around, but it became a problem when converting over the PCIe driver. Also add back the BLK_MQ_MAX_DEPTH check that was lost in the same commit. Fixes: 0da7fea ("nvme-pci: use the tagset alloc/free helpers") Reported-by: Hugh Dickins <[email protected]> Signed-off-by: Christoph Hellwig <[email protected]> Tested-by: Hugh Dickins <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jens Axboe <[email protected]>
1 parent 246cf66 commit 33b9372

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/nvme/host/core.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4897,7 +4897,7 @@ int nvme_alloc_io_tag_set(struct nvme_ctrl *ctrl, struct blk_mq_tag_set *set,
48974897

48984898
memset(set, 0, sizeof(*set));
48994899
set->ops = ops;
4900-
set->queue_depth = ctrl->sqsize + 1;
4900+
set->queue_depth = min_t(unsigned, ctrl->sqsize, BLK_MQ_MAX_DEPTH - 1);
49014901
/*
49024902
* Some Apple controllers requires tags to be unique across admin and
49034903
* the (only) I/O queue, so reserve the first 32 tags of the I/O queue.

0 commit comments

Comments
 (0)