[Devel] [PATCH VZ10 v2 11/11] drivers/md/dm-stats: account FUA writes in flush histograms

Vasileios Almpanis vasileios.almpanis at virtuozzo.com
Wed Jul 29 17:09:18 MSK 2026


Reviewed-by: Vasileios Almpanis <vasileios.almpanis at virtuozzo.com>

On 7/27/26 6:32 PM, Andrey Zhadchenko wrote:
> 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
> Signed-off-by: Andrey Zhadchenko <andrey.zhadchenko 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;
>   

-- 
Best regards, Vasileios Almpanis
Software Developer, Virtuozzo.



More information about the Devel mailing list