Skip to content

Commit f099a10

Browse files
Chengming Zhouaxboe
authored andcommitted
blk-iocost: fix queue stats accounting
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. Signed-off-by: Chengming Zhou <zhouchengming@bytedance.com> Acked-by: Tejun Heo <tj@kernel.org> Link: https://lore.kernel.org/r/20230804070609.31623-1-chengming.zhou@linux.dev Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent 2bc0576 commit f099a10

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

block/blk-iocost.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3301,11 +3301,12 @@ static ssize_t ioc_qos_write(struct kernfs_open_file *of, char *input,
33013301
if (qos[QOS_MIN] > qos[QOS_MAX])
33023302
goto einval;
33033303

3304-
if (enable) {
3304+
if (enable && !ioc->enabled) {
33053305
blk_stat_enable_accounting(disk->queue);
33063306
blk_queue_flag_set(QUEUE_FLAG_RQ_ALLOC_TIME, disk->queue);
33073307
ioc->enabled = true;
3308-
} else {
3308+
} else if (!enable && ioc->enabled) {
3309+
blk_stat_disable_accounting(disk->queue);
33093310
blk_queue_flag_clear(QUEUE_FLAG_RQ_ALLOC_TIME, disk->queue);
33103311
ioc->enabled = false;
33113312
}

0 commit comments

Comments
 (0)