Commit f0c6ae09 authored by Yufen Yu's avatar Yufen Yu Committed by Jens Axboe

block: fix comment and add lockdep assert

After commit b89f625e ("block: don't release queue's sysfs
lock during switching elevator"), whole elevator register and
unregister function are covered by sysfs_lock. So, remove wrong
comment and add lockdep assert.
Signed-off-by: default avatarYufen Yu <yuyufen@huawei.com>
Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent 0841031a
...@@ -479,16 +479,13 @@ static struct kobj_type elv_ktype = { ...@@ -479,16 +479,13 @@ static struct kobj_type elv_ktype = {
.release = elevator_release, .release = elevator_release,
}; };
/*
* elv_register_queue is called from either blk_register_queue or
* elevator_switch, elevator switch is prevented from being happen
* in the two paths, so it is safe to not hold q->sysfs_lock.
*/
int elv_register_queue(struct request_queue *q, bool uevent) int elv_register_queue(struct request_queue *q, bool uevent)
{ {
struct elevator_queue *e = q->elevator; struct elevator_queue *e = q->elevator;
int error; int error;
lockdep_assert_held(&q->sysfs_lock);
error = kobject_add(&e->kobj, &q->kobj, "%s", "iosched"); error = kobject_add(&e->kobj, &q->kobj, "%s", "iosched");
if (!error) { if (!error) {
struct elv_fs_entry *attr = e->type->elevator_attrs; struct elv_fs_entry *attr = e->type->elevator_attrs;
...@@ -507,13 +504,10 @@ int elv_register_queue(struct request_queue *q, bool uevent) ...@@ -507,13 +504,10 @@ int elv_register_queue(struct request_queue *q, bool uevent)
return error; return error;
} }
/*
* elv_unregister_queue is called from either blk_unregister_queue or
* elevator_switch, elevator switch is prevented from being happen
* in the two paths, so it is safe to not hold q->sysfs_lock.
*/
void elv_unregister_queue(struct request_queue *q) void elv_unregister_queue(struct request_queue *q)
{ {
lockdep_assert_held(&q->sysfs_lock);
if (q) { if (q) {
struct elevator_queue *e = q->elevator; struct elevator_queue *e = q->elevator;
......
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