diff options
author | Christoph Hellwig <hch@lst.de> | 2022-10-30 11:07:09 +0100 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2022-11-01 08:02:47 -0600 |
commit | 81eaca442ea962c43bdb1e9cbb9eddb41b97491d (patch) | |
tree | 83dc663c1e33376b1dc2f40e3fc82eac2ac67d5d /block/elevator.c | |
parent | eb5bca73655cb6aa3bb608253e1e47283240c933 (diff) |
block: cleanup elevator_get
Do the request_module and repeated lookup in the only caller that cares,
pick a saner name that explains where are actually doing a lookup and
use a sane calling conventions that passes the queue first.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Link: https://lore.kernel.org/r/20221030100714.876891-3-hch@lst.de
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'block/elevator.c')
-rw-r--r-- | block/elevator.c | 25 |
1 files changed, 10 insertions, 15 deletions
diff --git a/block/elevator.c b/block/elevator.c index d26aa787e29f..9793af0a75a7 100644 --- a/block/elevator.c +++ b/block/elevator.c @@ -132,24 +132,15 @@ static struct elevator_type *elevator_find(const char *name, return NULL; } -static struct elevator_type *elevator_get(struct request_queue *q, - const char *name, bool try_loading) +static struct elevator_type *elevator_find_get(struct request_queue *q, + const char *name) { struct elevator_type *e; spin_lock(&elv_list_lock); - e = elevator_find(name, q->required_elevator_features); - if (!e && try_loading) { - spin_unlock(&elv_list_lock); - request_module("%s-iosched", name); - spin_lock(&elv_list_lock); - e = elevator_find(name, q->required_elevator_features); - } - if (e && !elevator_tryget(e)) e = NULL; - spin_unlock(&elv_list_lock); return e; } @@ -634,7 +625,7 @@ static struct elevator_type *elevator_get_default(struct request_queue *q) !blk_mq_is_shared_tags(q->tag_set->flags)) return NULL; - return elevator_get(q, "mq-deadline", false); + return elevator_find_get(q, "mq-deadline"); } /* @@ -757,9 +748,13 @@ static int elevator_change(struct request_queue *q, const char *elevator_name) if (q->elevator && elevator_match(q->elevator->type, elevator_name, 0)) return 0; - e = elevator_get(q, elevator_name, true); - if (!e) - return -EINVAL; + e = elevator_find_get(q, elevator_name); + if (!e) { + request_module("%s-iosched", elevator_name); + e = elevator_find_get(q, elevator_name); + if (!e) + return -EINVAL; + } ret = elevator_switch(q, e); elevator_put(e); return ret; |