Skip to content

Commit

Permalink
blk-mq: fix nr_requests wrong value when modify it from sysfs
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
weiping zhang authored and Jens Axboe committed Nov 3, 2017
1 parent a116895 commit c2e82a2
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions block/blk-mq.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit c2e82a2

Please sign in to comment.