dm_stats_print() emits each row as "<start_sector>+<length> counters".
For a region whose length is not an exact multiple of the configured
step, the last row is shorter than step. The code already clips the row
end to s->end, but still prints step as the length.

Print end - start so the final partial row describes the range that is
actually covered by that row.

Assisted-by: Codex:gpt-5.5-cyber-preview
Signed-off-by: Samuel Moelius <[email protected]>
---
 drivers/md/dm-stats.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/md/dm-stats.c b/drivers/md/dm-stats.c
index c53cf07ab7b0..99e767f892a0 100644
--- a/drivers/md/dm-stats.c
+++ b/drivers/md/dm-stats.c
@@ -895,7 +895,7 @@ static int dm_stats_print(struct dm_stats *stats, int id,
 
                DMEMIT("%llu+%llu %llu %llu %llu %llu %llu %llu %llu %llu %d 
%llu %llu %llu %llu",
                       (unsigned long long)start,
-                      (unsigned long long)step,
+                      (unsigned long long)(end - start),
                       shared->tmp.ios[READ],
                       shared->tmp.merges[READ],
                       shared->tmp.sectors[READ],
-- 
2.43.0


Reply via email to