summaryrefslogtreecommitdiffstats
path: root/block/elevator.c
diff options
context:
space:
mode:
authorMing Lei <ming.lei@redhat.com>2017-04-15 20:38:22 +0800
committerJens Axboe <axboe@fb.com>2017-04-19 14:15:43 -0600
commit3a5088c8c11ac9d56f7e90acaaae9e0e98c1ff94 (patch)
treeea83e5447676e30b767103c665668932656c239b /block/elevator.c
parent005882e53d62f25dae10351a8d3f13326051e8f5 (diff)
downloadlinux-stable-3a5088c8c11ac9d56f7e90acaaae9e0e98c1ff94.tar.gz
linux-stable-3a5088c8c11ac9d56f7e90acaaae9e0e98c1ff94.tar.bz2
linux-stable-3a5088c8c11ac9d56f7e90acaaae9e0e98c1ff94.zip
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: Ming Lei <ming.lei@redhat.com> Signed-off-by: Jens Axboe <axboe@fb.com>
Diffstat (limited to 'block/elevator.c')
-rw-r--r--block/elevator.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/block/elevator.c b/block/elevator.c
index dbeecf7be719..4d9084a14c10 100644
--- a/block/elevator.c
+++ b/block/elevator.c
@@ -1098,12 +1098,20 @@ int elevator_change(struct request_queue *q, const char *name)
}
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,
size_t count)
{
int ret;
- if (!(q->mq_ops || q->request_fn))
+ if (!(q->mq_ops || q->request_fn) || !elv_support_iosched(q))
return count;
ret = __elevator_change(q, name);
@@ -1135,7 +1143,7 @@ ssize_t elv_iosched_show(struct request_queue *q, char *name)
len += sprintf(name+len, "[%s] ", elv->elevator_name);
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);
else if (!__e->uses_mq && !q->mq_ops)
len += sprintf(name+len, "%s ", __e->elevator_name);