[PATCH] blk-mq: provide an explicit n:1 mapping for single queue devices

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This avoids having to deal with the nr_hw_queues = 1 case in the various
queue mapping helpers by special casing it in the blk-mq core.

Signed-off-by: Christoph Hellwig <hch@xxxxxx>
Reported-by: Shaohua Li <shli@xxxxxxxxxx>
---
 block/blk-mq.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/block/blk-mq.c b/block/blk-mq.c
index 041f7b7fa0d6..50d1f069d83b 100644
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -2458,9 +2458,20 @@ static int blk_mq_alloc_rq_maps(struct blk_mq_tag_set *set)
 	return 0;
 }
 
+static int blk_mq_map_single_queue(struct blk_mq_tag_set *set)
+{
+	int cpu;
+
+	for_each_possible_cpu(cpu)
+		set->mq_map[cpu] = 0;
+	return 0;
+}
+
 static int blk_mq_update_queue_map(struct blk_mq_tag_set *set)
 {
-	if (set->ops->map_queues)
+	if (set->nr_hw_queues == 1)
+		return blk_mq_map_single_queue(set);
+	else if (set->ops->map_queues)
 		return set->ops->map_queues(set);
 	else
 		return blk_mq_map_queues(set);
-- 
2.11.0




[Index of Archives]     [Linux RAID]     [Linux SCSI]     [Linux ATA RAID]     [IDE]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Device Mapper]

  Powered by Linux