Re: [PATCH BUGFIX] block: make elevator_get robust against cross blk/blk-mq choice
From: Bart Van Assche
Date: Mon Feb 13 2017 - 16:14:16 EST
On Mon, 2017-02-13 at 22:01 +0100, Paolo Valente wrote:
> -static struct elevator_type *elevator_get(const char *name, bool try_loading)
> +static struct elevator_type *elevator_get(const char *name, bool try_loading,
> + bool mq_ops)
Please choose a better name for that argument, e.q. "mq". To me the name "mq_ops"
means "a pointer to a data structure with operation function pointers".
> + if (e && (e->uses_mq != mq_ops)) {
> + pr_err("ERROR: attempted to choose %s %s I/O scheduler in blk%s",
> + name, e->uses_mq ? "blk-mq" : "legacy", mq_ops ? "-mq" : "");
> + e = NULL;
> + }
How about changing the above into:
+ if (e && e->uses_mq != mq) {
+ pr_err("ERROR: attempt to configure %s as I/O scheduler for a %s queue\n",
+ name, mq ? "blk-mq" : "legacy");
+ e = NULL;
+ }
Thanks,
Bart.