virtio-devices: block: Correct the latency for the first op

There is a "LATENCY_SCALE" being used for calculating cumulative average
latency, so it should also be used for the latency of the first op.

See: #5712

Signed-off-by: Bo Chen <chen.bo@intel.com>
This commit is contained in:
Bo Chen 2023-09-07 10:38:06 -07:00 committed by Rob Bradford
parent 07d1208dd5
commit e2db476f6e

View File

@ -307,7 +307,7 @@ impl BlockEpollHandler {
// Special case the first real latency report
read_avg = if read_avg == u64::MAX {
latency
latency * LATENCY_SCALE
} else {
read_avg
+ ((latency * LATENCY_SCALE) - read_avg)
@ -337,7 +337,7 @@ impl BlockEpollHandler {
// Special case the first real latency report
write_avg = if write_avg == u64::MAX {
latency
latency * LATENCY_SCALE
} else {
write_avg
+ ((latency * LATENCY_SCALE) - write_avg)