From a66fef407cdf64feed8e68a7668feded1f34ad92 Mon Sep 17 00:00:00 2001 From: Wei Liu Date: Fri, 3 Jan 2025 04:23:42 +0000 Subject: [PATCH] block: vhdx: properly account for bytes read and written The counter value in vhdx_io::{read,write} should've been accumulated over the loop. Fixes: #6897 Signed-off-by: Wei Liu --- block/src/vhdx/vhdx_io.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/block/src/vhdx/vhdx_io.rs b/block/src/vhdx/vhdx_io.rs index 8c633e05f..c742368e7 100644 --- a/block/src/vhdx/vhdx_io.rs +++ b/block/src/vhdx/vhdx_io.rs @@ -133,7 +133,7 @@ pub fn read( }; sector_count -= sector.free_sectors; sector_index += sector.free_sectors; - read_count = sector.free_bytes as usize; + read_count += sector.free_bytes as usize; }; } Ok(read_count) @@ -219,7 +219,7 @@ pub fn write( }; sector_count -= sector.free_sectors; sector_index += sector.free_sectors; - write_count = sector.free_bytes as usize; + write_count += sector.free_bytes as usize; }; } Ok(write_count)