blk-iocost: Reset vtime_base_rate in ioc_refresh_params
authorKemeng Shi <shikemeng@huawei.com>
Tue, 18 Oct 2022 12:19:29 +0000 (20:19 +0800)
committerJens Axboe <axboe@kernel.dk>
Thu, 1 Dec 2022 14:44:12 +0000 (07:44 -0700)
Since commit ac33e91e2daca("blk-iocost: implement vtime loss compensation")
split vtime_rate into vtime_rate and vtime_base_rate, we need reset both
vtime_base_rate and vtime_rate when device parameters are refreshed.
If vtime_base_rate is no reset here, vtime_rate will be overwritten with
old vtime_base_rate soon in ioc_refresh_vrate.

Signed-off-by: Kemeng Shi <shikemeng@huawei.com>
Acked-by: Tejun Heo <tj@kernel.org>
Link: https://lore.kernel.org/r/20221018121932.10792-3-shikemeng@huawei.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
block/blk-iocost.c

index 2b8abc4..c3945d4 100644 (file)
@@ -906,8 +906,10 @@ static bool ioc_refresh_params(struct ioc *ioc, bool force)
        if (idx == ioc->autop_idx && !force)
                return false;
 
-       if (idx != ioc->autop_idx)
+       if (idx != ioc->autop_idx) {
                atomic64_set(&ioc->vtime_rate, VTIME_PER_USEC);
+               ioc->vtime_base_rate = VTIME_PER_USEC;
+       }
 
        ioc->autop_idx = idx;
        ioc->autop_too_fast_at = 0;