Now nvme support three type hardware queues, read, poll and default, this patch rename write_queues to read_queues to set the number of read queues more explicitly. This patch alos is prepared for nvme support WRR(weighted round robin) that we can get the number of each queue type easily. Signed-off-by: Weiping Zhang <zhangweiping@xxxxxxxxxxxxxx> --- drivers/nvme/host/pci.c | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c index e460c7310187..1002f3f0349c 100644 --- a/drivers/nvme/host/pci.c +++ b/drivers/nvme/host/pci.c @@ -68,10 +68,10 @@ static int io_queue_depth = 1024; module_param_cb(io_queue_depth, &io_queue_depth_ops, &io_queue_depth, 0644); MODULE_PARM_DESC(io_queue_depth, "set io queue depth, should >= 2"); -static unsigned int write_queues; -module_param(write_queues, uint, 0644); -MODULE_PARM_DESC(write_queues, - "Number of queues to use for writes. If not set, reads and writes " +static unsigned int read_queues; +module_param(read_queues, uint, 0644); +MODULE_PARM_DESC(read_queues, + "Number of queues to use for read. If not set, reads and writes " "will share a queue set."); static unsigned int poll_queues; @@ -211,7 +211,7 @@ struct nvme_iod { static unsigned int max_io_queues(void) { - return num_possible_cpus() + write_queues + poll_queues; + return num_possible_cpus() + read_queues + poll_queues; } static unsigned int max_queue_count(void) @@ -2016,18 +2016,16 @@ static void nvme_calc_irq_sets(struct irq_affinity *affd, unsigned int nrirqs) * If only one interrupt is available or 'write_queue' == 0, combine * write and read queues. * - * If 'write_queues' > 0, ensure it leaves room for at least one read + * If 'read_queues' > 0, ensure it leaves room for at least one write * queue. */ - if (!nrirqs) { + if (!nrirqs || nrirqs == 1) { nrirqs = 1; nr_read_queues = 0; - } else if (nrirqs == 1 || !write_queues) { - nr_read_queues = 0; - } else if (write_queues >= nrirqs) { - nr_read_queues = 1; + } else if (read_queues >= nrirqs) { + nr_read_queues = nrirqs - 1; } else { - nr_read_queues = nrirqs - write_queues; + nr_read_queues = read_queues; } dev->io_queues[HCTX_TYPE_DEFAULT] = nrirqs - nr_read_queues; @@ -3143,7 +3141,7 @@ static int __init nvme_init(void) BUILD_BUG_ON(sizeof(struct nvme_delete_queue) != 64); BUILD_BUG_ON(IRQ_AFFINITY_MAX_SETS < 2); - write_queues = min(write_queues, num_possible_cpus()); + read_queues = min(read_queues, num_possible_cpus()); poll_queues = min(poll_queues, num_possible_cpus()); return pci_register_driver(&nvme_driver); } -- 2.14.1