Skip to contentSkip to conversation

blk-iocost: fix queue stats accounting

PATCH Applied [email protected] 3 participants 3 messages Aug 4, 2023 – Aug 8, 2023

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 blk-iocost: fix queue stats accounting

From: Chengming Zhou <[email protected]>

The q->stats->accounting is not only used by iocost, but iocost only increase this counter, never decrease it. So queue stats accounting will always enabled after using iocost once.

---
 block/blk-iocost.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
block/blk-iocost.c +3 -2
index dd64e2066f01..089fcb9cfce3 100644
@@ -3301,11 +3301,12 @@ static ssize_t ioc_qos_write(struct kernfs_open_file *of, char *input,
 	if (qos[QOS_MIN] > qos[QOS_MAX])
 		goto einval;
 
-	if (enable) {
+	if (enable && !ioc->enabled) {
 		blk_stat_enable_accounting(disk->queue);
 		blk_queue_flag_set(QUEUE_FLAG_RQ_ALLOC_TIME, disk->queue);
 		ioc->enabled = true;
-	} else {
+	} else if (!enable && ioc->enabled) {
+		blk_stat_disable_accounting(disk->queue);
 		blk_queue_flag_clear(QUEUE_FLAG_RQ_ALLOC_TIME, disk->queue);
 		ioc->enabled = false;
 	}
Signature · 1 line
2.41.0
maintainer Acked-by on v1 1/1
#1 lore raw
Quoted 7 lines · On Fri, Aug 04, 2023 at 03:06:09PM +0800, [email protected] wrote:

From: Chengming Zhou <[email protected]>

The q->stats->accounting is not only used by iocost, but iocost only increase this counter, never decrease it. So queue stats accounting will always enabled after using iocost once.

Thanks.

Signature · 1 line
tejun
maintainer Applied
#2 lore raw
In reply to [email protected]
Quoted 5 lines · On Fri, 04 Aug 2023 15:06:09 +0800, [email protected] wrote:

The q->stats->accounting is not only used by iocost, but iocost only increase this counter, never decrease it. So queue stats accounting will always enabled after using iocost once.

Applied, thanks!

[1/1] blk-iocost: fix queue stats accounting

      commit: c992226e984b93b316005ae4b12f2dce1e11630c

Best regards,

Signature · 1 line
Jens Axboe