Tag set debugfs directories use numeric IDs that do not identify their attached disks. Starting from a disk's debugfs directory therefore gives no direct way to find its tag set configuration and CPU mappings. Add a tagset symlink in each blk-mq request queue's debugfs directory, pointing to ../../tagset/. Queues sharing a tag set link to the same directory. Create the link only when both debugfs directories exist. Signed-off-by: Lei Chen --- block/blk-mq-debugfs.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/block/blk-mq-debugfs.c b/block/blk-mq-debugfs.c index 298387607049..78a91a1095bb 100644 --- a/block/blk-mq-debugfs.c +++ b/block/blk-mq-debugfs.c @@ -644,11 +644,19 @@ static void debugfs_create_files(struct request_queue *q, struct dentry *parent, void blk_mq_debugfs_register(struct request_queue *q) { + struct blk_mq_tag_set *set = q->tag_set; struct blk_mq_hw_ctx *hctx; unsigned long i; + char target[32]; debugfs_create_files(q, q->debugfs_dir, q, blk_mq_debugfs_queue_attrs); + if (!IS_ERR_OR_NULL(q->debugfs_dir) && + !IS_ERR_OR_NULL(set->debugfs_dir) && set->debugfs_id >= 0) { + snprintf(target, sizeof(target), "../../tagset/%d", set->debugfs_id); + debugfs_create_symlink("tagset", q->debugfs_dir, target); + } + queue_for_each_hw_ctx(q, hctx, i) { if (!hctx->debugfs_dir) blk_mq_debugfs_register_hctx(q, hctx); -- 2.43.0