Skip to contentSkip to conversation

dm-stats: fix merge accounting

PATCH New Mikulas Patocka 1 participant 1 message Jul 10 Device mapper

lore
Share & tools
lore

Mikulas Patocka

author maintainer
#0 lore raw

PATCH 1/1 dm-stats: fix merge accounting

There were wrong parentheses when setting stats_aux->merged, so that merging was never properly accounted. This commit fixes it.

Assisted-by Claude:claude-opus-4-6
Fixes fd2ed4d25270 ("dm: add statistics support")
---
 drivers/md/dm-stats.c |    6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/md/dm-stats.c +2 -4
Index: linux-2.6/drivers/md/dm-stats.c
===================================================================
@@ -692,10 +692,8 @@ void dm_stats_account_io(struct dm_stats
 		 */
 		last = raw_cpu_ptr(stats->last);
 		stats_aux->merged =
-			(bi_sector == (READ_ONCE(last->last_sector) &&
-				       ((bi_rw == WRITE) ==
-					(READ_ONCE(last->last_rw) == WRITE))
-				       ));
+			bi_sector == READ_ONCE(last->last_sector) &&
+				(bi_rw == WRITE) == (READ_ONCE(last->last_rw) == WRITE);
 		WRITE_ONCE(last->last_sector, end_sector);
 		WRITE_ONCE(last->last_rw, bi_rw);
 	} else