summary refs log tree commit diff
path: root/block
diff options
context:
space:
mode:
authorweiping zhang <zhangweiping@didichuxing.com>2017-09-22 23:36:28 +0800
committerJens Axboe <axboe@kernel.dk>2017-11-03 12:21:06 -0600
commitc2e82a234873d905260a3bd0aca9577e85619bda (patch)
tree1d9b5b149222baab4164890c35e8e45bbb9b9af7 /block
parenta116895fc7b61de4f26548c9b635a06515ec7563 (diff)
downloadlinux-c2e82a234873d905260a3bd0aca9577e85619bda.tar.gz
blk-mq: fix nr_requests wrong value when modify it from sysfs
if blk-mq use "none" io scheduler, nr_request get a wrong value when
input a number > tag_set->queue_depth. blk_mq_tag_update_depth will get
the smaller one min(nr, set->queue_depth), and then q->nr_request get a
wrong value.

Reproduce:

echo none > /sys/block/nvme0n1/queue/scheduler
echo 1000000 > /sys/block/nvme0n1/queue/nr_requests
cat /sys/block/nvme0n1/queue/nr_requests
1000000

Signed-off-by: weiping zhang <zhangweiping@didichuxing.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'block')
-rw-r--r--block/blk-mq.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/block/blk-mq.c b/block/blk-mq.c
index 95ea5889b825..9eea67ce82d9 100644
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -2743,8 +2743,7 @@ int blk_mq_update_nr_requests(struct request_queue *q, unsigned int nr)
 		 * queue depth. This is similar to what the old code would do.
 		 */
 		if (!hctx->sched_tags) {
-			ret = blk_mq_tag_update_depth(hctx, &hctx->tags,
-							min(nr, set->queue_depth),
+			ret = blk_mq_tag_update_depth(hctx, &hctx->tags, nr,
 							false);
 		} else {
 			ret = blk_mq_tag_update_depth(hctx, &hctx->sched_tags,