@@ -638,6 +638,8 @@ void blk_mq_debugfs_register(struct request_queue *q)
blk_mq_debugfs_register_sched_hctx(q, hctx);
}
+ debugfs_create_dir("rqos", q->debugfs_dir);
+
if (q->rq_qos) {
struct rq_qos *rqos = q->rq_qos;
@@ -798,17 +800,19 @@ void blk_mq_debugfs_register_rqos(struct rq_qos *rqos)
{
struct request_queue *q = rqos->disk->queue;
const char *dir_name = rq_qos_id_to_name(rqos->id);
+ struct dentry *rqos_top;
lockdep_assert_held(&q->debugfs_mutex);
if (rqos->debugfs_dir || !rqos->ops->debugfs_attrs)
return;
- if (!q->rqos_debugfs_dir)
- q->rqos_debugfs_dir = debugfs_create_dir("rqos",
- q->debugfs_dir);
+ rqos_top = debugfs_lookup("rqos", q->debugfs_dir);
+ if (IS_ERR_OR_NULL(rqos_top))
+ return;
- rqos->debugfs_dir = debugfs_create_dir(dir_name, q->rqos_debugfs_dir);
+ rqos->debugfs_dir = debugfs_create_dir(dir_name, rqos_top);
+ dput(rqos_top);
debugfs_create_files(rqos->debugfs_dir, rqos, rqos->ops->debugfs_attrs);
}
@@ -748,7 +748,6 @@ static void blk_debugfs_remove(struct gendisk *disk)
blk_trace_shutdown(q);
debugfs_remove_recursive(q->debugfs_dir);
q->debugfs_dir = NULL;
- q->rqos_debugfs_dir = NULL;
mutex_unlock(&q->debugfs_mutex);
}
@@ -598,7 +598,6 @@ struct request_queue {
struct list_head tag_set_list;
struct dentry *debugfs_dir;
- struct dentry *rqos_debugfs_dir;
/*
* Serializes all debugfs metadata operations using the above dentries.
*/
For each request_queue, its rqos debugfs path is fixed, which can be queried from its parent dentry directly, so it isn't necessary to cache it in request_queue instance because it isn't used in fast path. Signed-off-by: Ming Lei <ming.lei@redhat.com> --- block/blk-mq-debugfs.c | 12 ++++++++---- block/blk-sysfs.c | 1 - include/linux/blkdev.h | 1 - 3 files changed, 8 insertions(+), 6 deletions(-)