]> www.infradead.org Git - users/jedix/linux-maple.git/commit
blk-throttle: Fix wrong tg->[bytes/io]_disp update in __tg_update_carryover()
authorZizhi Wo <wozizhi@huawei.com>
Thu, 17 Apr 2025 13:20:52 +0000 (21:20 +0800)
committerJens Axboe <axboe@kernel.dk>
Tue, 6 May 2025 01:08:34 +0000 (19:08 -0600)
commitf66cf69eb8765341bbeff0e92a7d0d2027f62452
treee2ec2e263a3bf659f75f13128d406921b8a19087
parente371b9d3368ccb6b55fe9747be12c3107b2817b3
blk-throttle: Fix wrong tg->[bytes/io]_disp update in __tg_update_carryover()

In commit 6cc477c36875 ("blk-throttle: carry over directly"), the carryover
bytes/ios was be carried to [bytes/io]_disp. However, its update mechanism
has some issues.

In __tg_update_carryover(), we calculate "bytes" and "ios" to represent the
carryover, but the computation when updating [bytes/io]_disp is incorrect.
And if the sq->nr_queued is empty, we may not update tg->[bytes/io]_disp to
0 in tg_update_carryover(). We should set it to 0 in non carryover case.
This patch fixes the issue.

Fixes: 6cc477c36875 ("blk-throttle: carry over directly")
Signed-off-by: Zizhi Wo <wozizhi@huawei.com>
Reviewed-by: Yu Kuai <yukuai3@huawei.com>
Reviewed-by: Ming Lei <ming.lei@redhat.com>
Link: https://lore.kernel.org/r/20250417132054.2866409-2-wozizhi@huaweicloud.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
block/blk-throttle.c