aboutsummaryrefslogtreecommitdiff
path: root/block/elevator.c
diff options
context:
space:
mode:
authorChristoph Hellwig2022-03-08 06:51:59 +0100
committerJens Axboe2022-03-08 19:40:01 -0700
commit28883074fc104f16ab181207d556ab75df6c6526 (patch)
treedf4ea7c1faaffe2ffc3399a4ecf8db52e9596008 /block/elevator.c
parent28ce942fa2d5d80af5367ba9d39f2e0b4af37bfd (diff)
block: do more work in elevator_exit
Move the calls to ioc_clear_queue and blk_mq_sched_free_rqs into elevator_exit. Except for one call where we know we can't have io_cq structures yet these always go together, and that extra call in an error path is harmless. Signed-off-by: Christoph Hellwig <hch@lst.de> Link: https://lore.kernel.org/r/20220308055200.735835-14-hch@lst.de Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'block/elevator.c')
-rw-r--r--block/elevator.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/block/elevator.c b/block/elevator.c
index a842e4b8ebc6..20a4e7c7c774 100644
--- a/block/elevator.c
+++ b/block/elevator.c
@@ -192,6 +192,9 @@ void elevator_exit(struct request_queue *q)
{
struct elevator_queue *e = q->elevator;
+ ioc_clear_queue(q);
+ blk_mq_sched_free_rqs(q);
+
mutex_lock(&e->sysfs_lock);
blk_mq_exit_sched(q, e);
mutex_unlock(&e->sysfs_lock);
@@ -596,8 +599,6 @@ int elevator_switch_mq(struct request_queue *q,
if (q->elevator) {
elv_unregister_queue(q);
- ioc_clear_queue(q);
- blk_mq_sched_free_rqs(q);
elevator_exit(q);
}
@@ -608,7 +609,6 @@ 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);
goto out;
}