summaryrefslogtreecommitdiff
path: root/block/blk-mq.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2022-10-20 08:48:16 +0200
committerJens Axboe <axboe@kernel.dk>2022-10-23 18:59:17 -0600
commitdd6f7f17bf5831ac94d2b8ffe3d67dac201a9b97 (patch)
treec2898bdc5199cb3de5027f38df1afd042f6a78c6 /block/blk-mq.c
parent671fae5e51297fc76b3758ca2edd514858734a6a (diff)
block: add proper helpers for elevator_type module refcount management
Make sure we have helpers for all relevant module refcount operations on the elevator_type in elevator.h, and use them. Move the call to the get helper in blk_mq_elv_switch_none a bit so that it is obvious with a less verbose comment. Signed-off-by: Christoph Hellwig <hch@lst.de> Link: https://lore.kernel.org/r/20221020064819.1469928-2-hch@lst.de Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'block/blk-mq.c')
-rw-r--r--block/blk-mq.c11
1 files changed, 2 insertions, 9 deletions
diff --git a/block/blk-mq.c b/block/blk-mq.c
index 33292c01875d..9db8814cdd02 100644
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -4554,17 +4554,10 @@ static bool blk_mq_elv_switch_none(struct list_head *head,
INIT_LIST_HEAD(&qe->node);
qe->q = q;
+ /* keep a reference to the elevator module as we'll switch back */
+ __elevator_get(qe->type);
qe->type = q->elevator->type;
list_add(&qe->node, head);
-
- /*
- * After elevator_switch, the previous elevator_queue will be
- * released by elevator_release. The reference of the io scheduler
- * module get by elevator_get will also be put. So we need to get
- * a reference of the io scheduler module here to prevent it to be
- * removed.
- */
- __module_get(qe->type->elevator_owner);
elevator_switch(q, NULL);
mutex_unlock(&q->sysfs_lock);