block: avoid setting none scheduler if it's already none
authorAleksei Zakharov <zakharov.a.g@yandex.ru>
Mon, 11 Feb 2019 10:50:37 +0000 (13:50 +0300)
committerJens Axboe <axboe@kernel.dk>
Mon, 11 Feb 2019 15:21:40 +0000 (08:21 -0700)
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>
block/elevator.c

index f05e90d4e695a3f5f5a04ae89c997cd11ad1263c..d6d835a08de685a33bb0e95e1b038ac2e4e4621c 100644 (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);