[Devel] [PATCH RHEL10 COMMIT] drivers/md/dm-stats: account FUA writes in flush histograms

Konstantin Khorenko khorenko at virtuozzo.com
Fri Jul 31 15:11:47 MSK 2026


The commit is pushed to "branch-rh10-6.12.0-211.39.1.16.x.vz10-ovz" and will appear at git at bitbucket.org:openvz/vzkernel.git
after rh10-6.12.0-211.39.1.16.1.vz10
------>
commit b064b4df45469d9b7329f16fffe081bebaa50e97
Author: Andrey Zhadchenko <andrey.zhadchenko at virtuozzo.com>
Date:   Mon Jul 27 19:32:54 2026 +0300

    drivers/md/dm-stats: account FUA writes in flush histograms
    
    A REQ_FUA write forces the data to non-volatile media before
    completion, so its latency is relevant for both the write and the
    flush histograms. Classify such writes into both classes: they keep
    being accounted as ordinary writes by "histogram:" and
    "wr_histogram:", and additionally show up in "flush_histogram:".
    
    https://virtuozzo.atlassian.net/browse/VSTOR-103846
    Feature: dm-stats: latency and histogram enhancements
    Signed-off-by: Andrey Zhadchenko <andrey.zhadchenko at virtuozzo.com>
    Reviewed-by: Vasileios Almpanis <vasileios.almpanis at virtuozzo.com>
    Reviewed-by: Pavel Tikhomirov <ptikhomirov at virtuozzo.com>
---
 Documentation/admin-guide/device-mapper/statistics.rst | 10 ++++++----
 drivers/md/dm-stats.c                                  |  5 +++--
 2 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/Documentation/admin-guide/device-mapper/statistics.rst b/Documentation/admin-guide/device-mapper/statistics.rst
index ce02fd8a2873d..ea7dbfd0b30e6 100644
--- a/Documentation/admin-guide/device-mapper/statistics.rst
+++ b/Documentation/admin-guide/device-mapper/statistics.rst
@@ -103,10 +103,12 @@ Messages
 		account write requests.
 	  flush_histogram:n1,n2,n3,n4,...
 		collect a latency histogram like "histogram", but only
-		account data-less cache flushes.  Since a data-less
-		flush is not directed at any particular sector, it is
-		accounted in the first step-sized area of the region
-		and does not modify any other counters.
+		account cache flushes: data-less flush requests as well
+		as FUA writes (which are also accounted by "histogram"
+		and "wr_histogram" as ordinary writes).  Since a
+		data-less flush is not directed at any particular
+		sector, it is accounted in the first step-sized area of
+		the region and does not modify any other counters.
 	  Multiple histogram arguments may be specified for one region;
 	  each histogram is reported as an additional counter set in the
 	  @stats_print output, in the order the histograms were specified.
diff --git a/drivers/md/dm-stats.c b/drivers/md/dm-stats.c
index ad9c79c136782..788c5bea6b742 100644
--- a/drivers/md/dm-stats.c
+++ b/drivers/md/dm-stats.c
@@ -41,7 +41,8 @@ struct dm_stat_shared {
 
 /*
  * Histograms account I/O classes independently. An I/O is classified once
- * per dm_stats_account_io() and may belong to several classes at once.
+ * per dm_stats_account_io() and may belong to several classes at once:
+ * a write with REQ_FUA is both a write and a flush
  */
 enum {
 	DM_STAT_CLASS_READ,
@@ -642,7 +643,7 @@ static unsigned int dm_stat_io_classes(blk_opf_t bi_opf, unsigned int bi_sectors
 	if (bi_sectors)
 		classes |= 1 << (op_is_write(bi_opf) ? DM_STAT_CLASS_WRITE :
 						       DM_STAT_CLASS_READ);
-	if ((bi_opf & REQ_PREFLUSH) ||
+	if ((bi_opf & (REQ_PREFLUSH | REQ_FUA)) ||
 	    (bi_opf & REQ_OP_MASK) == REQ_OP_FLUSH)
 		classes |= 1 << DM_STAT_CLASS_FLUSH;
 


More information about the Devel mailing list