diff mbox series

[v4,1/4] ceph: switch to DIV64_U64_ROUND_CLOSEST to support 32-bit arches

Message ID 1584510355-6936-2-git-send-email-xiubli@redhat.com (mailing list archive)
State New, archived
Headers show
Series ceph: add min/max/stdev latency support | expand

Commit Message

Xiubo Li March 18, 2020, 5:45 a.m. UTC
From: Xiubo Li <xiubli@redhat.com>

fs/ceph/debugfs.c:140: undefined reference to `__divdi3'
Use math64 helpers to avoid 64-bit div on 32-bit arches.

Reported-by: kbuild test robot <lkp@intel.com>
Signed-off-by: Xiubo Li <xiubli@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 60f3e307..95e8693 100644
--- a/fs/ceph/debugfs.c
+++ b/fs/ceph/debugfs.c
@@ -137,19 +137,19 @@  static int metric_show(struct seq_file *s, void *p)
 	total = percpu_counter_sum(&mdsc->metric.total_reads);
 	sum = percpu_counter_sum(&mdsc->metric.read_latency_sum);
 	sum = jiffies_to_usecs(sum);
-	avg = total ? sum / total : 0;
+	avg = total ? DIV64_U64_ROUND_CLOSEST(sum, total) : 0;
 	seq_printf(s, "%-14s%-12lld%-16lld%lld\n", "read", total, sum, avg);
 
 	total = percpu_counter_sum(&mdsc->metric.total_writes);
 	sum = percpu_counter_sum(&mdsc->metric.write_latency_sum);
 	sum = jiffies_to_usecs(sum);
-	avg = total ? sum / total : 0;
+	avg = total ? DIV64_U64_ROUND_CLOSEST(sum, total) : 0;
 	seq_printf(s, "%-14s%-12lld%-16lld%lld\n", "write", total, sum, avg);
 
 	total = percpu_counter_sum(&mdsc->metric.total_metadatas);
 	sum = percpu_counter_sum(&mdsc->metric.metadata_latency_sum);
 	sum = jiffies_to_usecs(sum);
-	avg = total ? sum / total : 0;
+	avg = total ? DIV64_U64_ROUND_CLOSEST(sum, total) : 0;
 	seq_printf(s, "%-14s%-12lld%-16lld%lld\n", "metadata", total, sum, avg);
 
 	seq_printf(s, "\n");