@@ -1888,6 +1888,21 @@ static void blk_mq_map_swqueue(struct request_queue *q,
}
}
+/* The number of hw queues that are mapped by sw queues */
+int blk_mq_hctx_mapped(struct request_queue *q)
+{
+ struct blk_mq_hw_ctx *hctx;
+ unsigned int i;
+ int mapped = 0;
+
+ queue_for_each_hw_ctx(q, hctx, i)
+ if (blk_mq_hw_queue_mapped(hctx))
+ mapped++;
+
+ return mapped;
+}
+EXPORT_SYMBOL_GPL(blk_mq_hctx_mapped);
+
static void queue_set_hctx_shared(struct request_queue *q, bool shared)
{
struct blk_mq_hw_ctx *hctx;
@@ -250,6 +250,7 @@ void blk_mq_freeze_queue_start(struct request_queue *q);
int blk_mq_reinit_tagset(struct blk_mq_tag_set *set);
void blk_mq_update_nr_hw_queues(struct blk_mq_tag_set *set, int nr_hw_queues);
+int blk_mq_hctx_mapped(struct request_queue *q);
/*
* Driver command data is immediately after the request. So subtract request