Skip to content

Commit

Permalink
block: Document scheduler modification locking requirements
Browse files Browse the repository at this point in the history
This patch does not change any functionality.

Reviewed-by: Christoph Hellwig <[email protected]>
Signed-off-by: Bart Van Assche <[email protected]>
Signed-off-by: Jens Axboe <[email protected]>
  • Loading branch information
KAGA-KOKO authored and axboe committed Jan 18, 2018
1 parent 83d016a commit 14a2349
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions block/elevator.c
Original file line number Diff line number Diff line change
Expand Up @@ -869,6 +869,8 @@ int elv_register_queue(struct request_queue *q)
struct elevator_queue *e = q->elevator;
int error;

lockdep_assert_held(&q->sysfs_lock);

error = kobject_add(&e->kobj, &q->kobj, "%s", "iosched");
if (!error) {
struct elv_fs_entry *attr = e->type->elevator_attrs;
Expand All @@ -889,6 +891,8 @@ int elv_register_queue(struct request_queue *q)

void elv_unregister_queue(struct request_queue *q)
{
lockdep_assert_held(&q->sysfs_lock);

if (q) {
struct elevator_queue *e = q->elevator;

Expand Down Expand Up @@ -965,6 +969,8 @@ static int elevator_switch_mq(struct request_queue *q,
{
int ret;

lockdep_assert_held(&q->sysfs_lock);

blk_mq_freeze_queue(q);
blk_mq_quiesce_queue(q);

Expand Down Expand Up @@ -1010,6 +1016,8 @@ static int elevator_switch(struct request_queue *q, struct elevator_type *new_e)
bool old_registered = false;
int err;

lockdep_assert_held(&q->sysfs_lock);

if (q->mq_ops)
return elevator_switch_mq(q, new_e);

Expand Down

0 comments on commit 14a2349

Please sign in to comment.