stat: sum sync_stat before reassigning bool first
authorNiklas Cassel <niklas.cassel@wdc.com>
Wed, 15 Dec 2021 12:26:04 +0000 (12:26 +0000)
committerJens Axboe <axboe@kernel.dk>
Wed, 15 Dec 2021 15:45:32 +0000 (08:45 -0700)
commite86afa536b175a90546e20d7d19f2418ee1bca78
tree011dceb0be9395ab7aea4c5ed430699db33ac6e5
parent9ffe433d729101a34d9709030d7d4dd2444347ef
stat: sum sync_stat before reassigning bool first

Currently, sum_stat(&dst->sync_stat, &src->sync_stat, first, false)
is called after the summing the stats on a per ddir level.

The for-loop that sums the stats on a per ddir level will reassign
bool first to false when unified_rw_rep is used.

This means that the call to sum_stat() for sync_stat will be called
with first == false, even when it is the first sync_stat being summed,
leading to incorrect sync_stat calculations when unified_rw_rep is used.

In order to ensure that sync_stat is not incorrectly affected by the
reassignment of first, move the sync_stat summing before the for-loop.

Signed-off-by: Niklas Cassel <niklas.cassel@wdc.com>
Link: https://lore.kernel.org/r/20211215122557.95600-1-Niklas.Cassel@wdc.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
stat.c