diff mbox series

[v1,4/4] ceph: use tracked average r/w/m latencies to display metrics in debugfs

Message ID 20210913131311.1347903-5-vshankar@redhat.com
State New
Headers show
Series ceph: forward average read/write/metadata latency | expand

Commit Message

Venky Shankar Sept. 13, 2021, 1:13 p.m. UTC
Signed-off-by: Venky Shankar <vshankar@redhat.com>
---
 fs/ceph/debugfs.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/fs/ceph/debugfs.c b/fs/ceph/debugfs.c
index 9153bc233e08..e3fccf7c6fb5 100644
--- a/fs/ceph/debugfs.c
+++ b/fs/ceph/debugfs.c
@@ -173,7 +173,7 @@  static int metric_show(struct seq_file *s, void *p)
 	spin_lock(&m->read_latency_lock);
 	total = m->total_reads;
 	sum = m->read_latency_sum;
-	avg = total > 0 ? DIV64_U64_ROUND_CLOSEST(sum, total) : 0;
+	avg = m->avg_read_latency;
 	min = m->read_latency_min;
 	max = m->read_latency_max;
 	sq = m->read_latency_stdev;
@@ -183,7 +183,7 @@  static int metric_show(struct seq_file *s, void *p)
 	spin_lock(&m->write_latency_lock);
 	total = m->total_writes;
 	sum = m->write_latency_sum;
-	avg = total > 0 ? DIV64_U64_ROUND_CLOSEST(sum, total) : 0;
+	avg = m->avg_write_latency;
 	min = m->write_latency_min;
 	max = m->write_latency_max;
 	sq = m->write_latency_stdev;
@@ -193,7 +193,7 @@  static int metric_show(struct seq_file *s, void *p)
 	spin_lock(&m->metadata_latency_lock);
 	total = m->total_metadatas;
 	sum = m->metadata_latency_sum;
-	avg = total > 0 ? DIV64_U64_ROUND_CLOSEST(sum, total) : 0;
+	avg = m->avg_metadata_latency;
 	min = m->metadata_latency_min;
 	max = m->metadata_latency_max;
 	sq = m->metadata_latency_stdev;