[Devel] [PATCH RHEL10 COMMIT] drivers/md/dm-stats: add flush_histogram option

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 be31ae4f6ff16e5cdc1aeed5f5468f4d142e23db
Author: Andrey Zhadchenko <andrey.zhadchenko at virtuozzo.com>
Date:   Mon Jul 27 19:32:53 2026 +0300

    drivers/md/dm-stats: add flush_histogram option
    
    Allow a region to collect a latency histogram of flushes.
    
    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 | 11 +++++++++--
 drivers/md/dm-stats.c                                  | 10 +++++++++-
 2 files changed, 18 insertions(+), 3 deletions(-)

diff --git a/Documentation/admin-guide/device-mapper/statistics.rst b/Documentation/admin-guide/device-mapper/statistics.rst
index 99b8ad45d47fd..ce02fd8a2873d 100644
--- a/Documentation/admin-guide/device-mapper/statistics.rst
+++ b/Documentation/admin-guide/device-mapper/statistics.rst
@@ -101,6 +101,12 @@ Messages
 	  wr_histogram:n1,n2,n3,n4,...
 		collect a latency histogram like "histogram", but only
 		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.
 	  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.
@@ -148,8 +154,9 @@ Messages
 	        precise_timestamps hist_total_latency histogram:n1,n2,n3,...
 
 	The strings "precise_timestamps", "hist_total_latency" and
-	"histogram" (also "rd_histogram" and "wr_histogram") are printed
-	only if they were specified when creating the region.
+	"histogram" (also "rd_histogram", "wr_histogram" and
+	"flush_histogram") are printed only if they were specified when
+	creating the region.
 
     @stats_print <region_id> [<starting_line> <number_of_lines>]
 	Print counters for each step-sized area of a region.
diff --git a/drivers/md/dm-stats.c b/drivers/md/dm-stats.c
index 1899549748cc3..ad9c79c136782 100644
--- a/drivers/md/dm-stats.c
+++ b/drivers/md/dm-stats.c
@@ -53,7 +53,7 @@ enum {
 #define DM_STAT_CLASSES_DATA	((1 << DM_STAT_CLASS_READ) | \
 				 (1 << DM_STAT_CLASS_WRITE))
 
-#define DM_STAT_MAX_HISTOGRAMS		3
+#define DM_STAT_MAX_HISTOGRAMS		4
 
 struct dm_stat_histogram {
 	unsigned int class_mask;	/* classes this histogram accounts */
@@ -549,6 +549,8 @@ static const char *dm_stat_histogram_name(unsigned int class_mask)
 		return "rd_histogram";
 	case 1 << DM_STAT_CLASS_WRITE:
 		return "wr_histogram";
+	case 1 << DM_STAT_CLASS_FLUSH:
+		return "flush_histogram";
 	default:
 		return "histogram";
 	}
@@ -1238,6 +1240,12 @@ static int message_stats_create(struct mapped_device *md,
 						  a + 13);
 				if (r)
 					goto ret;
+			} else if (!strncasecmp(a, "flush_histogram:", 16)) {
+				r = add_histogram(histograms, &n_histograms,
+						  1 << DM_STAT_CLASS_FLUSH,
+						  a + 16);
+				if (r)
+					goto ret;
 			} else
 				goto ret_einval;
 		}


More information about the Devel mailing list