diff options
author | Jens Axboe <axboe@kernel.dk> | 2018-08-23 11:34:46 -0400 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2018-08-23 11:34:46 -0400 |
commit | c125311d96b1bfcce0f5930a4f0fdfe39ea14f7c (patch) | |
tree | 64bef9e91ac97c6c1d4fbd39b6f259b08ddc1670 | |
parent | c45e6a037a536530bd25781ac7c989e52deb2a63 (diff) |
blk-wbt: don't maintain inflight counts if disabled
A previous commit removed the ability to have per-rq flags. We used
those flags to maintain inflight counts. Since we don't have those
anymore, we have to always maintain inflight counts, even if wbt is
disabled. This is clearly suboptimal.
Add a queue quiesce around changing the wbt latency settings from sysfs
to work around this. With that, we can reliably put the enabled check in
our bio_to_wbt_flags(), since we know the WBT_TRACKED flag will be
consistent for the lifetime of the request.
Fixes: c1c80384c8f ("block: remove external dependency on wbt_flags")
Reviewed-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
-rw-r--r-- | block/blk-sysfs.c | 19 | ||||
-rw-r--r-- | block/blk-wbt.c | 3 |
2 files changed, 21 insertions, 1 deletions
diff --git a/block/blk-sysfs.c b/block/blk-sysfs.c index bb109bb0a055..3772671cf2bc 100644 --- a/block/blk-sysfs.c +++ b/block/blk-sysfs.c | |||
@@ -453,9 +453,26 @@ static ssize_t queue_wb_lat_store(struct request_queue *q, const char *page, | |||
453 | else if (val >= 0) | 453 | else if (val >= 0) |
454 | val *= 1000ULL; | 454 | val *= 1000ULL; |
455 | 455 | ||
456 | wbt_set_min_lat(q, val); | 456 | /* |
457 | * Ensure that the queue is idled, in case the latency update | ||
458 | * ends up either enabling or disabling wbt completely. We can't | ||
459 | * have IO inflight if that happens. | ||
460 | */ | ||
461 | if (q->mq_ops) { | ||
462 | blk_mq_freeze_queue(q); | ||
463 | blk_mq_quiesce_queue(q); | ||
464 | } else | ||
465 | blk_queue_bypass_start(q); | ||
457 | 466 | ||
467 | wbt_set_min_lat(q, val); | ||
458 | wbt_update_limits(q); | 468 | wbt_update_limits(q); |
469 | |||
470 | if (q->mq_ops) { | ||
471 | blk_mq_unquiesce_queue(q); | ||
472 | blk_mq_unfreeze_queue(q); | ||
473 | } else | ||
474 | blk_queue_bypass_end(q); | ||
475 | |||
459 | return count; | 476 | return count; |
460 | } | 477 | } |
461 | 478 | ||
diff --git a/block/blk-wbt.c b/block/blk-wbt.c index c9358f1981fb..84507d3e9a98 100644 --- a/block/blk-wbt.c +++ b/block/blk-wbt.c | |||
@@ -540,6 +540,9 @@ static enum wbt_flags bio_to_wbt_flags(struct rq_wb *rwb, struct bio *bio) | |||
540 | { | 540 | { |
541 | enum wbt_flags flags = 0; | 541 | enum wbt_flags flags = 0; |
542 | 542 | ||
543 | if (!rwb_enabled(rwb)) | ||
544 | return 0; | ||
545 | |||
543 | if (bio_op(bio) == REQ_OP_READ) { | 546 | if (bio_op(bio) == REQ_OP_READ) { |
544 | flags = WBT_READ; | 547 | flags = WBT_READ; |
545 | } else if (wbt_should_throttle(rwb, bio)) { | 548 | } else if (wbt_should_throttle(rwb, bio)) { |