summaryrefslogtreecommitdiff
path: root/block/elevator.c
diff options
context:
space:
mode:
authorJinlong Chen <nickyc975@zju.edu.cn>2022-10-20 08:48:18 +0200
committerJens Axboe <axboe@kernel.dk>2022-10-23 18:59:17 -0600
commitb54c2ad9b77de846e42104ecf94eb8329d2f03a3 (patch)
tree507461db15055975439c3e896e157678e815e92a /block/elevator.c
parent58367c8a5f845498fd341e5687bab513925e4ac0 (diff)
block: check for an unchanged elevator earlier in __elevator_change
No need to find the actual elevator_type struct for this comparism, the name is all that is needed. Signed-off-by: Jinlong Chen <nickyc975@zju.edu.cn> [hch: split from a larger patch] Signed-off-by: Christoph Hellwig <hch@lst.de> Link: https://lore.kernel.org/r/20221020064819.1469928-4-hch@lst.de Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'block/elevator.c')
-rw-r--r--block/elevator.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/block/elevator.c b/block/elevator.c
index 5b8fb8745e9a..61d5655a3819 100644
--- a/block/elevator.c
+++ b/block/elevator.c
@@ -751,16 +751,13 @@ static int elevator_change(struct request_queue *q, const char *elevator_name)
return elevator_switch(q, NULL);
}
+ if (q->elevator && elevator_match(q->elevator->type, elevator_name, 0))
+ return 0;
+
e = elevator_get(q, elevator_name, true);
if (!e)
return -EINVAL;
- if (q->elevator &&
- elevator_match(q->elevator->type, elevator_name, 0)) {
- elevator_put(e);
- return 0;
- }
-
return elevator_switch(q, e);
}