Thread (10 messages) 10 messages, 2 authors, 2017-10-25

Re: [PATCH 1/3] elevator: lookup mq vs non-mq elevators

From: Omar Sandoval <osandov@osandov.com>
Date: 2017-10-25 18:27:08

On Wed, Oct 25, 2017 at 12:04:45PM -0600, Jens Axboe wrote:
quoted hunk ↗ jump to hunk
If an IO scheduler is selected via elevator= and it doesn't match
the driver in question wrt blk-mq support, then we fail to boot.

The elevator= parameter is deprecated and only supported for
non-mq devices. Augment the elevator lookup API so that we
pass in if we're looking for an mq capable scheduler or not,
so that we only ever return a valid type for the queue in
question.

Fixes: https://bugzilla.kernel.org/show_bug.cgi?id=196695
Signed-off-by: Jens Axboe <axboe@kernel.dk>
---
 block/elevator.c | 44 +++++++++++++++++++++-----------------------
 1 file changed, 21 insertions(+), 23 deletions(-)
diff --git a/block/elevator.c b/block/elevator.c
index 7ae50eb2732b..b70e69f795db 100644
--- a/block/elevator.c
+++ b/block/elevator.c
@@ -83,12 +83,15 @@ bool elv_bio_merge_ok(struct request *rq, struct bio *bio)
 }
 EXPORT_SYMBOL(elv_bio_merge_ok);
 
-static struct elevator_type *elevator_find(const char *name)
+/*
+ * Return scheduler with name 'name' and with matching 'mq capability
+ */
+static struct elevator_type *elevator_find(const char *name, bool mq)
 {
 	struct elevator_type *e;
 
 	list_for_each_entry(e, &elv_list, list) {
-		if (!strcmp(e->elevator_name, name))
+		if (!strcmp(e->elevator_name, name) && !(mq ^ e->uses_mq))

How about just (mq == e->uses_mq)?

Besides that, Reviewed-by: Omar Sandoval [off-list ref]
 			return e;
 	}
 
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help