Thread (7 messages) 7 messages, 3 authors, 2017-11-21

Re: [PATCH v2 2/2] blk-throttle: fix wrong initialization in case of dm device

From: Shaohua Li <shli@kernel.org>
Date: 2017-11-20 17:15:13

On Mon, Nov 20, 2017 at 10:00:27AM +0800, Joseph Qi wrote:
quoted hunk ↗ jump to hunk
From: Joseph Qi <redacted>

dm device set QUEUE_FLAG_NONROT in resume, which is after register
queue. 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 <redacted>
---
 block/blk-throttle.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
diff --git a/block/blk-throttle.c b/block/blk-throttle.c
index bf52035..6d6b220 100644
--- a/block/blk-throttle.c
+++ b/block/blk-throttle.c
@@ -541,6 +541,23 @@ 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;
+
+	/*
+	 * dm device set QUEUE_FLAG_NONROT in resume, which is after resister
+	 * queue, 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;
if CONFIG_BLK_DEV_THROTTLING_LOW isn't not set, we use old slice, can you do
the same thing here? Otherwise,
Reviewed-by: Shaohua Li <shli@kernel.org>
+		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;
+		}
+	}
 }
 
 /*
-- 
1.9.4
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help