This should be helpful to solve some problems.
Signed-off-by: Yu Kuai <yukuai3@xxxxxxxxxx>
---
block/blk-mq-debugfs.c | 54 ++++++++++++++++++++++++++++++++++++++----
1 file changed, 50 insertions(+), 4 deletions(-)
diff --git a/block/blk-mq-debugfs.c b/block/blk-mq-debugfs.c
index aa0349e9f083..3c6260df7a95 100644
--- a/block/blk-mq-debugfs.c
+++ b/block/blk-mq-debugfs.c
@@ -183,12 +183,52 @@ static ssize_t queue_state_write(void *data, const char __user *buf,
return count;
}
+static void __flags_show(unsigned long flags, struct seq_file *m);
+
+static int queue_tag_set_show(void *data, struct seq_file *m)
+{
+ struct request_queue *q = data;
+ struct blk_mq_tag_set *set = q->tag_set;
+ int i, j;
+
+ seq_puts(m, "map:\n");
+ for (i = 0; i < set->nr_maps; ++i) {
+ struct blk_mq_queue_map *map = &set->map[i];
+
+ if (!map) {
+ seq_puts(m, " NULL\n");
+ continue;
+ }
+
+ seq_printf(m, " nr_queues %u offset %u map:", map->nr_queues,
+ map->queue_offset);
+ if (!map->mq_map) {
+ seq_puts(m, " NULL\n");
+ continue;
+ }
+ for (j = 0; j < nr_cpu_ids; ++j)
+ seq_printf(m, " %u", map->mq_map[j]);
+ seq_puts(m, "\n");
+ }
+
+ seq_printf(m, "nr_hw_queues: %u\n", set->nr_hw_queues);
+ seq_printf(m, "queue_depth: %u\n", set->queue_depth);
+ seq_printf(m, "reserved_tags: %u\n", set->reserved_tags);
+ seq_printf(m, "cmd_size: %u\n", set->cmd_size);
+ seq_printf(m, "numa_node: %d\n", set->numa_node);
+ seq_printf(m, "timeout: %u\n", set->timeout);
+ __flags_show(set->flags, m);
+
+ return 0;
+}
+
static const struct blk_mq_debugfs_attr blk_mq_debugfs_queue_attrs[] = {
{ "poll_stat", 0400, queue_poll_stat_show },
{ "requeue_list", 0400, .seq_ops = &queue_requeue_list_seq_ops },
{ "pm_only", 0600, queue_pm_only_show, NULL },
{ "state", 0600, queue_state_show, queue_state_write },
{ "zone_wlock", 0400, queue_zone_wlock_show, NULL },
+ { "tag_set", 0400, queue_tag_set_show, NULL },
{ },
};
@@ -229,10 +269,9 @@ static const char *const hctx_flag_name[] = {
};
#undef HCTX_FLAG_NAME
-static int hctx_flags_show(void *data, struct seq_file *m)
+static void __flags_show(unsigned long flags, struct seq_file *m)
{
- struct blk_mq_hw_ctx *hctx = data;
- const int alloc_policy = BLK_MQ_FLAG_TO_ALLOC_POLICY(hctx->flags);
+ const int alloc_policy = BLK_MQ_FLAG_TO_ALLOC_POLICY(flags);
seq_puts(m, "alloc_policy=");
if (alloc_policy < ARRAY_SIZE(alloc_policy_name) &&
@@ -242,9 +281,16 @@ static int hctx_flags_show(void *data, struct seq_file *m)
seq_printf(m, "%d", alloc_policy);
seq_puts(m, " ");
blk_flags_show(m,
- hctx->flags ^ BLK_ALLOC_POLICY_TO_MQ_FLAG(alloc_policy),
+ flags ^ BLK_ALLOC_POLICY_TO_MQ_FLAG(alloc_policy),
hctx_flag_name, ARRAY_SIZE(hctx_flag_name));
seq_puts(m, "\n");
+}
+
+static int hctx_flags_show(void *data, struct seq_file *m)
+{
+ struct blk_mq_hw_ctx *hctx = data;
+
+ __flags_show(hctx->flags, m);
return 0;
}