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 <[email protected]>
---
 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 3a0d80bbf78da..c26a0a2358309 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,
@@ -641,7 +642,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;
 
-- 
2.43.5

_______________________________________________
Devel mailing list
[email protected]
https://lists.openvz.org/mailman/listinfo/devel

Reply via email to