summaryrefslogtreecommitdiff
path: root/block/blk-sysfs.c
diff options
context:
space:
mode:
Diffstat (limited to 'block/blk-sysfs.c')
-rw-r--r--block/blk-sysfs.c19
1 files changed, 18 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,
else if (val >= 0)
val *= 1000ULL;
- wbt_set_min_lat(q, val);
+ /*
+ * Ensure that the queue is idled, in case the latency update
+ * ends up either enabling or disabling wbt completely. We can't
+ * have IO inflight if that happens.
+ */
+ if (q->mq_ops) {
+ blk_mq_freeze_queue(q);
+ blk_mq_quiesce_queue(q);
+ } else
+ blk_queue_bypass_start(q);
+ wbt_set_min_lat(q, val);
wbt_update_limits(q);
+
+ if (q->mq_ops) {
+ blk_mq_unquiesce_queue(q);
+ blk_mq_unfreeze_queue(q);
+ } else
+ blk_queue_bypass_end(q);
+
return count;
}