Commit b54c2ad9 authored by Jinlong Chen's avatar Jinlong Chen Committed by Jens Axboe

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: default avatarJinlong Chen <nickyc975@zju.edu.cn>
[hch: split from a larger patch]
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Link: https://lore.kernel.org/r/20221020064819.1469928-4-hch@lst.deSigned-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent 58367c8a
...@@ -751,16 +751,13 @@ static int elevator_change(struct request_queue *q, const char *elevator_name) ...@@ -751,16 +751,13 @@ static int elevator_change(struct request_queue *q, const char *elevator_name)
return elevator_switch(q, NULL); 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); e = elevator_get(q, elevator_name, true);
if (!e) if (!e)
return -EINVAL; return -EINVAL;
if (q->elevator &&
elevator_match(q->elevator->type, elevator_name, 0)) {
elevator_put(e);
return 0;
}
return elevator_switch(q, e); return elevator_switch(q, e);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment