block: remove elevator_exit

Open code elevator_exit in it's only caller, and rename __elevator_exit to
elevator_exit.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Link: https://lore.kernel.org/r/20211123185312.1432157-3-hch@lst.de
Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
Christoph Hellwig 2021-11-23 19:53:06 +01:00 committed by Jens Axboe
parent 0281ed3cf4
commit f46b81c54b
3 changed files with 5 additions and 12 deletions

View File

@ -747,7 +747,7 @@ static void blk_exit_queue(struct request_queue *q)
*/ */
if (q->elevator) { if (q->elevator) {
ioc_clear_queue(q); ioc_clear_queue(q);
__elevator_exit(q, q->elevator); elevator_exit(q, q->elevator);
} }
/* /*

View File

@ -266,19 +266,10 @@ void blk_insert_flush(struct request *rq);
int elevator_switch_mq(struct request_queue *q, int elevator_switch_mq(struct request_queue *q,
struct elevator_type *new_e); 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); int elv_register_queue(struct request_queue *q, bool uevent);
void elv_unregister_queue(struct request_queue *q); 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, ssize_t part_size_show(struct device *dev, struct device_attribute *attr,
char *buf); char *buf);
ssize_t part_stat_show(struct device *dev, struct device_attribute *attr, ssize_t part_stat_show(struct device *dev, struct device_attribute *attr,

View File

@ -188,7 +188,7 @@ static void elevator_release(struct kobject *kobj)
kfree(e); 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); mutex_lock(&e->sysfs_lock);
blk_mq_exit_sched(q, e); blk_mq_exit_sched(q, e);
@ -595,6 +595,7 @@ int elevator_switch_mq(struct request_queue *q,
elv_unregister_queue(q); elv_unregister_queue(q);
ioc_clear_queue(q); ioc_clear_queue(q);
blk_mq_sched_free_rqs(q);
elevator_exit(q, q->elevator); elevator_exit(q, q->elevator);
} }
@ -605,6 +606,7 @@ int elevator_switch_mq(struct request_queue *q,
if (new_e) { if (new_e) {
ret = elv_register_queue(q, true); ret = elv_register_queue(q, true);
if (ret) { if (ret) {
blk_mq_sched_free_rqs(q);
elevator_exit(q, q->elevator); elevator_exit(q, q->elevator);
goto out; goto out;
} }