summaryrefslogtreecommitdiff
path: root/block
diff options
context:
space:
mode:
authorChengming Zhou <zhouchengming@bytedance.com>2023-08-04 10:06:09 +0300
committerJens Axboe <axboe@kernel.dk>2023-08-10 01:04:14 +0300
commitf099a108cabf72a1184b1e14e4a09f4ca3375750 (patch)
tree83155b0d8dfc15959c2c8da449cf9d970a1ce6ce /block
parent2bc057692599a5b3dc93d75a3dff34f72576355d (diff)
downloadlinux-f099a108cabf72a1184b1e14e4a09f4ca3375750.tar.xz
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>
Diffstat (limited to 'block')
-rw-r--r--block/blk-iocost.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/block/blk-iocost.c b/block/blk-iocost.c
index dd64e2066f01..089fcb9cfce3 100644
--- a/block/blk-iocost.c
+++ b/block/blk-iocost.c
@@ -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;
}