diff --git a/block/blk-sysfs.c b/block/blk-sysfs.c index c079be1c58a37822b19600a0eaa83068ec69707a..1677eb4a680c47d32261430cfb4985853e58e29b 100644 --- a/block/blk-sysfs.c +++ b/block/blk-sysfs.c @@ -747,7 +747,7 @@ static void blk_exit_queue(struct request_queue *q) */ if (q->elevator) { ioc_clear_queue(q); - __elevator_exit(q, q->elevator); + elevator_exit(q, q->elevator); } /* diff --git a/block/blk.h b/block/blk.h index 1346085d89cee91b592022dde8edfe20afd18ee8..2266cb1f7df537f4353d485a19b5d7b296c09bc8 100644 --- a/block/blk.h +++ b/block/blk.h @@ -266,19 +266,10 @@ void blk_insert_flush(struct request *rq); int elevator_switch_mq(struct request_queue *q, struct elevator_type *new_e); -void __elevator_exit(struct request_queue *, struct elevator_queue *); +void elevator_exit(struct request_queue *, struct elevator_queue *); int elv_register_queue(struct request_queue *q, bool uevent); void elv_unregister_queue(struct request_queue *q); -static inline void elevator_exit(struct request_queue *q, - struct elevator_queue *e) -{ - lockdep_assert_held(&q->sysfs_lock); - - blk_mq_sched_free_rqs(q); - __elevator_exit(q, e); -} - ssize_t part_size_show(struct device *dev, struct device_attribute *attr, char *buf); ssize_t part_stat_show(struct device *dev, struct device_attribute *attr, diff --git a/block/elevator.c b/block/elevator.c index 19a78d5516ba7e7fd1b999739657f266f29a8044..3536cdd5fa12988fedd55f4796a79c5b595d214f 100644 --- a/block/elevator.c +++ b/block/elevator.c @@ -188,7 +188,7 @@ static void elevator_release(struct kobject *kobj) kfree(e); } -void __elevator_exit(struct request_queue *q, struct elevator_queue *e) +void elevator_exit(struct request_queue *q, struct elevator_queue *e) { mutex_lock(&e->sysfs_lock); blk_mq_exit_sched(q, e); @@ -595,6 +595,7 @@ int elevator_switch_mq(struct request_queue *q, elv_unregister_queue(q); ioc_clear_queue(q); + blk_mq_sched_free_rqs(q); elevator_exit(q, q->elevator); } @@ -605,6 +606,7 @@ int elevator_switch_mq(struct request_queue *q, if (new_e) { ret = elv_register_queue(q, true); if (ret) { + blk_mq_sched_free_rqs(q); elevator_exit(q, q->elevator); goto out; }