* [PATCH v3 2/2] blk-throttle: fix wrong initialization in case of dm device
@ 2017-11-21 1:42 Joseph Qi
0 siblings, 0 replies; only message in thread
From: Joseph Qi @ 2017-11-21 1:42 UTC (permalink / raw)
To: Jens Axboe
Cc: linux-block, device-mapper development, Shaohua Li, Mike Snitzer,
qijiang.qj
From: Joseph Qi <qijiang.qj@alibaba-inc.com>
DM device sets QUEUE_FLAG_NONROT after the queue is registered. That is
to mean, the previous initialization in blk_throtl_register_queue is
wrong in this case.
Fix it by checking and then updating the info during root tg
initialization as we don't have a better choice.
Signed-off-by: Joseph Qi <qijiang.qj@alibaba-inc.com>
Reviewed-by: Shaohua Li <shli@kernel.org>
---
block/blk-throttle.c | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/block/blk-throttle.c b/block/blk-throttle.c
index bf52035..7150f14 100644
--- a/block/blk-throttle.c
+++ b/block/blk-throttle.c
@@ -541,6 +541,25 @@ static void throtl_pd_init(struct blkg_policy_data *pd)
if (cgroup_subsys_on_dfl(io_cgrp_subsys) && blkg->parent)
sq->parent_sq = &blkg_to_tg(blkg->parent)->service_queue;
tg->td = td;
+
+#ifdef CONFIG_BLK_DEV_THROTTLING_LOW
+ /*
+ * DM device sets QUEUE_FLAG_NONROT after the queue is registered,
+ * so the previous initialization is wrong in this case. Check and
+ * update it here.
+ */
+ if (blk_queue_nonrot(blkg->q) &&
+ td->filtered_latency != LATENCY_FILTERED_SSD) {
+ int i;
+
+ td->throtl_slice = DFL_THROTL_SLICE_SSD;
+ td->filtered_latency = LATENCY_FILTERED_SSD;
+ for (i = 0; i < LATENCY_BUCKET_SIZE; i++) {
+ td->avg_buckets[READ][i].latency = 0;
+ td->avg_buckets[WRITE][i].latency = 0;
+ }
+ }
+#endif
}
/*
--
1.9.4
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2017-11-21 1:42 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-11-21 1:42 [PATCH v3 2/2] blk-throttle: fix wrong initialization in case of dm device Joseph Qi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox