diff options
author | Christoph Hellwig <hch@lst.de> | 2022-10-20 08:48:16 +0200 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2022-10-23 18:59:17 -0600 |
commit | dd6f7f17bf5831ac94d2b8ffe3d67dac201a9b97 (patch) | |
tree | c2898bdc5199cb3de5027f38df1afd042f6a78c6 /block/elevator.c | |
parent | 671fae5e51297fc76b3758ca2edd514858734a6a (diff) | |
download | linux-dd6f7f17bf5831ac94d2b8ffe3d67dac201a9b97.tar.gz linux-dd6f7f17bf5831ac94d2b8ffe3d67dac201a9b97.tar.bz2 linux-dd6f7f17bf5831ac94d2b8ffe3d67dac201a9b97.zip |
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/elevator.c')
-rw-r--r-- | block/elevator.c | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/block/elevator.c b/block/elevator.c index 9e12706e8d8c..8fb404a89f2e 100644 --- a/block/elevator.c +++ b/block/elevator.c @@ -132,11 +132,6 @@ static struct elevator_type *elevator_find(const char *name, return NULL; } -static void elevator_put(struct elevator_type *e) -{ - module_put(e->elevator_owner); -} - static struct elevator_type *elevator_get(struct request_queue *q, const char *name, bool try_loading) { @@ -152,7 +147,7 @@ static struct elevator_type *elevator_get(struct request_queue *q, e = elevator_find(name, q->required_elevator_features); } - if (e && !try_module_get(e->elevator_owner)) + if (e && !elevator_tryget(e)) e = NULL; spin_unlock(&elv_list_lock); @@ -659,7 +654,7 @@ static struct elevator_type *elevator_get_by_features(struct request_queue *q) } } - if (found && !try_module_get(found->elevator_owner)) + if (found && !elevator_tryget(found)) found = NULL; spin_unlock(&elv_list_lock); |