block: avoid setting none scheduler if it's already none

There's no reason to freeze queue and remove scheduler
if there's no scheduler already.

Signed-off-by: Aleksei Zakharov <zakharov.a.g@yandex.ru>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
Aleksei Zakharov 2019-02-11 13:50:37 +03:00 committed by Jens Axboe
parent b7143fe67b
commit fbd72127c9
1 changed files with 4 additions and 1 deletions

View File

@ -667,8 +667,11 @@ static int __elevator_change(struct request_queue *q, const char *name)
/*
* Special case for mq, turn off scheduling
*/
if (!strncmp(name, "none", 4))
if (!strncmp(name, "none", 4)) {
if (!q->elevator)
return 0;
return elevator_switch(q, NULL);
}
strlcpy(elevator_name, name, sizeof(elevator_name));
e = elevator_get(q, strstrip(elevator_name), true);