Commit 6fc75f30 authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Jens Axboe

block: factor out a blk_debugfs_remove helper

Split the debugfs removal from blk_unregister_queue into a helper so that
the it can be reused for blk_register_queue error handling.
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Link: https://lore.kernel.org/r/20221114042637.1009333-3-hch@lst.deSigned-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent 450deb93
...@@ -800,6 +800,19 @@ struct kobj_type blk_queue_ktype = { ...@@ -800,6 +800,19 @@ struct kobj_type blk_queue_ktype = {
.release = blk_release_queue, .release = blk_release_queue,
}; };
static void blk_debugfs_remove(struct gendisk *disk)
{
struct request_queue *q = disk->queue;
mutex_lock(&q->debugfs_mutex);
blk_trace_shutdown(q);
debugfs_remove_recursive(q->debugfs_dir);
q->debugfs_dir = NULL;
q->sched_debugfs_dir = NULL;
q->rqos_debugfs_dir = NULL;
mutex_unlock(&q->debugfs_mutex);
}
/** /**
* blk_register_queue - register a block layer queue with sysfs * blk_register_queue - register a block layer queue with sysfs
* @disk: Disk of which the request queue should be registered with sysfs. * @disk: Disk of which the request queue should be registered with sysfs.
...@@ -925,11 +938,5 @@ void blk_unregister_queue(struct gendisk *disk) ...@@ -925,11 +938,5 @@ void blk_unregister_queue(struct gendisk *disk)
kobject_del(&q->kobj); kobject_del(&q->kobj);
mutex_unlock(&q->sysfs_dir_lock); mutex_unlock(&q->sysfs_dir_lock);
mutex_lock(&q->debugfs_mutex); blk_debugfs_remove(disk);
blk_trace_shutdown(q);
debugfs_remove_recursive(q->debugfs_dir);
q->debugfs_dir = NULL;
q->sched_debugfs_dir = NULL;
q->rqos_debugfs_dir = NULL;
mutex_unlock(&q->debugfs_mutex);
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment