Commit 14a23498 authored by Bart Van Assche's avatar Bart Van Assche Committed by Jens Axboe

block: Document scheduler modification locking requirements

This patch does not change any functionality.
Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
Signed-off-by: default avatarBart Van Assche <bart.vanassche@wdc.com>
Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent 83d016ac
...@@ -869,6 +869,8 @@ int elv_register_queue(struct request_queue *q) ...@@ -869,6 +869,8 @@ int elv_register_queue(struct request_queue *q)
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;
...@@ -889,6 +891,8 @@ int elv_register_queue(struct request_queue *q) ...@@ -889,6 +891,8 @@ int elv_register_queue(struct request_queue *q)
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;
...@@ -965,6 +969,8 @@ static int elevator_switch_mq(struct request_queue *q, ...@@ -965,6 +969,8 @@ static int elevator_switch_mq(struct request_queue *q,
{ {
int ret; int ret;
lockdep_assert_held(&q->sysfs_lock);
blk_mq_freeze_queue(q); blk_mq_freeze_queue(q);
blk_mq_quiesce_queue(q); blk_mq_quiesce_queue(q);
...@@ -1010,6 +1016,8 @@ static int elevator_switch(struct request_queue *q, struct elevator_type *new_e) ...@@ -1010,6 +1016,8 @@ static int elevator_switch(struct request_queue *q, struct elevator_type *new_e)
bool old_registered = false; bool old_registered = false;
int err; int err;
lockdep_assert_held(&q->sysfs_lock);
if (q->mq_ops) if (q->mq_ops)
return elevator_switch_mq(q, new_e); return elevator_switch_mq(q, new_e);
......
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