Commit 3a5088c8 authored by Ming Lei's avatar Ming Lei Committed by Jens Axboe

block: respect BLK_MQ_F_NO_SCHED

If one driver claims that it doesn't support io scheduler via
BLK_MQ_F_NO_SCHED, we should not allow to change and show the
availabe io schedulers.

This patch adds check to enhance this behaviour.
Signed-off-by: default avatarMing Lei <ming.lei@redhat.com>
Signed-off-by: default avatarJens Axboe <axboe@fb.com>
parent 005882e5
...@@ -1098,12 +1098,20 @@ int elevator_change(struct request_queue *q, const char *name) ...@@ -1098,12 +1098,20 @@ int elevator_change(struct request_queue *q, const char *name)
} }
EXPORT_SYMBOL(elevator_change); EXPORT_SYMBOL(elevator_change);
static inline bool elv_support_iosched(struct request_queue *q)
{
if (q->mq_ops && q->tag_set && (q->tag_set->flags &
BLK_MQ_F_NO_SCHED))
return false;
return true;
}
ssize_t elv_iosched_store(struct request_queue *q, const char *name, ssize_t elv_iosched_store(struct request_queue *q, const char *name,
size_t count) size_t count)
{ {
int ret; int ret;
if (!(q->mq_ops || q->request_fn)) if (!(q->mq_ops || q->request_fn) || !elv_support_iosched(q))
return count; return count;
ret = __elevator_change(q, name); ret = __elevator_change(q, name);
...@@ -1135,7 +1143,7 @@ ssize_t elv_iosched_show(struct request_queue *q, char *name) ...@@ -1135,7 +1143,7 @@ ssize_t elv_iosched_show(struct request_queue *q, char *name)
len += sprintf(name+len, "[%s] ", elv->elevator_name); len += sprintf(name+len, "[%s] ", elv->elevator_name);
continue; continue;
} }
if (__e->uses_mq && q->mq_ops) if (__e->uses_mq && q->mq_ops && elv_support_iosched(q))
len += sprintf(name+len, "%s ", __e->elevator_name); len += sprintf(name+len, "%s ", __e->elevator_name);
else if (!__e->uses_mq && !q->mq_ops) else if (!__e->uses_mq && !q->mq_ops)
len += sprintf(name+len, "%s ", __e->elevator_name); len += sprintf(name+len, "%s ", __e->elevator_name);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment