[PATCH] nvme-fabrics: don't repeat HCTX_TYPE_DEFAULT code
Chaitanya Kulkarni
kch at nvidia.com
Thu Feb 8 13:35:18 PST 2024
In function nvmf_map_queues() setting up the HCTX_TYPE_DEFAULT map's
nr_queues and queue offset values code is duplicated when read/write
queues are separate and shared, creating unnecessary confusion if
those values differ for both cases or not.
Move common code from both cases & set those values before we process
the separate or shared read/write queues case.
Signed-off-by: Chaitanya Kulkarni <kch at nvidia.com>
---
drivers/nvme/host/fabrics.c | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/drivers/nvme/host/fabrics.c b/drivers/nvme/host/fabrics.c
index 3499acbf6a82..9922ee7f1493 100644
--- a/drivers/nvme/host/fabrics.c
+++ b/drivers/nvme/host/fabrics.c
@@ -1101,20 +1101,16 @@ void nvmf_map_queues(struct blk_mq_tag_set *set, struct nvme_ctrl *ctrl,
{
struct nvmf_ctrl_options *opts = ctrl->opts;
+ set->map[HCTX_TYPE_DEFAULT].nr_queues = io_queues[HCTX_TYPE_DEFAULT];
+ set->map[HCTX_TYPE_DEFAULT].queue_offset = 0;
if (opts->nr_write_queues && io_queues[HCTX_TYPE_READ]) {
/* separate read/write queues */
- set->map[HCTX_TYPE_DEFAULT].nr_queues =
- io_queues[HCTX_TYPE_DEFAULT];
- set->map[HCTX_TYPE_DEFAULT].queue_offset = 0;
set->map[HCTX_TYPE_READ].nr_queues =
io_queues[HCTX_TYPE_READ];
set->map[HCTX_TYPE_READ].queue_offset =
io_queues[HCTX_TYPE_DEFAULT];
} else {
/* shared read/write queues */
- set->map[HCTX_TYPE_DEFAULT].nr_queues =
- io_queues[HCTX_TYPE_DEFAULT];
- set->map[HCTX_TYPE_DEFAULT].queue_offset = 0;
set->map[HCTX_TYPE_READ].nr_queues =
io_queues[HCTX_TYPE_DEFAULT];
set->map[HCTX_TYPE_READ].queue_offset = 0;
--
2.40.0
More information about the Linux-nvme
mailing list