From 2d85b4ec2bd55011f73129306c200d16d352399c Mon Sep 17 00:00:00 2001 From: Sebastien GODARD Date: Sun, 22 Dec 2019 12:05:36 +0100 Subject: [PATCH] iostat: Indicate that flush ops are counted as writes before being merged Signed-off-by: Sebastien GODARD --- iostat.c | 6 +++++- man/iostat.in | 1 + rd_stats.c | 1 + 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/iostat.c b/iostat.c index 89bf2d0..1d3c8e1 100644 --- a/iostat.c +++ b/iostat.c @@ -986,6 +986,7 @@ void write_plain_ext_stat(unsigned long long itv, int fctr, int hpart, if (DISPLAY_SHORT_OUTPUT(flags)) { /* tps */ + /* Origin (unmerged) flush operations are counted as writes */ cprintf_f(NO_UNIT, 1, 8, 2, S_VALUE(ioj->rd_ios + ioj->wr_ios + ioj->dc_ios, ioi->rd_ios + ioi->wr_ios + ioi->dc_ios, itv)); @@ -1149,6 +1150,7 @@ void write_json_ext_stat(int tab, unsigned long long itv, int fctr, if (DISPLAY_SHORT_OUTPUT(flags)) { printf("\"tps\": %.2f, \"", + /* Origin (unmerged) flush operations are counted as writes */ S_VALUE(ioj->rd_ios + ioj->wr_ios + ioj->dc_ios, ioi->rd_ios + ioi->wr_ios + ioi->dc_ios, itv)); if (DISPLAY_MEGABYTES(flags)) { @@ -1390,6 +1392,7 @@ void write_plain_basic_stat(unsigned long long itv, int fctr, /* tps */ cprintf_f(NO_UNIT, 1, 8, 2, + /* Origin (unmerged) flush operations are counted as writes */ S_VALUE(ioj->rd_ios + ioj->wr_ios + ioj->dc_ios, ioi->rd_ios + ioi->wr_ios + ioi->dc_ios, itv)); @@ -1450,6 +1453,7 @@ void write_json_basic_stat(int tab, unsigned long long itv, int fctr, xprintf0(tab, "{\"disk_device\": \"%s\", \"tps\": %.2f, ", devname, + /* Origin (unmerged) flush operations are counted as writes */ S_VALUE(ioj->rd_ios + ioj->wr_ios + ioj->dc_ios, ioi->rd_ios + ioi->wr_ios + ioi->dc_ios, itv)); if (DISPLAY_KILOBYTES(flags)) { @@ -1636,7 +1640,7 @@ void write_stats(int curr, struct tm *rectime, int skip) ioi = d->dev_stats[curr]; ioj = d->dev_stats[!curr]; - + /* Origin (unmerged) flush operations are counted as writes */ if (!DISPLAY_UNFILTERED(flags)) { if (!ioi->rd_ios && !ioi->wr_ios && !ioi->dc_ios) continue; diff --git a/man/iostat.in b/man/iostat.in index d83e8ce..4120a9c 100644 --- a/man/iostat.in +++ b/man/iostat.in @@ -221,6 +221,7 @@ The number (after merges) of discard requests completed per second for the devic .RS The number (after merges) of flush requests completed per second for the device. This counts flush requests executed by disks. Flush requests are not tracked for partitions. +Before being merged, flush operations are counted as writes. .RE .B sec/s (kB/s, MB/s) diff --git a/rd_stats.c b/rd_stats.c index 2569fae..e17377b 100644 --- a/rd_stats.c +++ b/rd_stats.c @@ -373,6 +373,7 @@ void compute_ext_disk_stats(struct stats_disk *sdc, struct stats_disk *sdp, /* * Kernel gives ticks already in milliseconds for all platforms * => no need for further scaling. + * Origin (unmerged) flush operations are counted as writes. */ xds->await = (sdc->nr_ios - sdp->nr_ios) ? ((sdc->rd_ticks - sdp->rd_ticks) + (sdc->wr_ticks - sdp->wr_ticks) + (sdc->dc_ticks - sdp->dc_ticks)) / -- 2.40.0