Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

nvme-pci: update sqsize when adjusting the queue depth

Update the core sqsize field in addition to the PCIe-specific
q_depth field as the core tagset allocation helpers rely on it.

Fixes: 0da7feaa5913 ("nvme-pci: use the tagset alloc/free helpers")
Signed-off-by: Christoph Hellwig <hch@lst.de>
Acked-by: Hugh Dickins <hughd@google.com>
Link: https://lore.kernel.org/r/20221225103234.226794-3-hch@lst.de
Signed-off-by: Jens Axboe <axboe@kernel.dk>

authored by

Christoph Hellwig and committed by
Jens Axboe
88d356ca 33b93727

+5 -4
+5 -4
drivers/nvme/host/pci.c
··· 2333 2333 if (dev->cmb_use_sqes) { 2334 2334 result = nvme_cmb_qdepth(dev, nr_io_queues, 2335 2335 sizeof(struct nvme_command)); 2336 - if (result > 0) 2336 + if (result > 0) { 2337 2337 dev->q_depth = result; 2338 - else 2338 + dev->ctrl.sqsize = result - 1; 2339 + } else { 2339 2340 dev->cmb_use_sqes = false; 2341 + } 2340 2342 } 2341 2343 2342 2344 do { ··· 2539 2537 2540 2538 dev->q_depth = min_t(u32, NVME_CAP_MQES(dev->ctrl.cap) + 1, 2541 2539 io_queue_depth); 2542 - dev->ctrl.sqsize = dev->q_depth - 1; /* 0's based queue depth */ 2543 2540 dev->db_stride = 1 << NVME_CAP_STRIDE(dev->ctrl.cap); 2544 2541 dev->dbs = dev->bar + 4096; 2545 2542 ··· 2579 2578 dev_warn(dev->ctrl.device, "IO queue depth clamped to %d\n", 2580 2579 dev->q_depth); 2581 2580 } 2582 - 2581 + dev->ctrl.sqsize = dev->q_depth - 1; /* 0's based queue depth */ 2583 2582 2584 2583 nvme_map_cmb(dev); 2585 2584