block: avoid setting none scheduler if it's already none
diff mbox series

Message ID 1549882237-28183-1-git-send-email-zakharov.a.g@yandex.ru
State New
Headers show
Series
  • block: avoid setting none scheduler if it's already none
Related show

Commit Message

Aleksei Zakharov Feb. 11, 2019, 10:50 a.m. UTC
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>
---
 block/elevator.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Comments

Jens Axboe Feb. 11, 2019, 3:21 p.m. UTC | #1
On 2/11/19 3:50 AM, Aleksei Zakharov wrote:
> There's no reason to freeze queue and remove scheduler
> if there's no scheduler already.

Applied, thanks.

Patch
diff mbox series

diff --git a/block/elevator.c b/block/elevator.c
index f05e90d..d6d835a 100644
--- a/block/elevator.c
+++ b/block/elevator.c
@@ -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);