@@ -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");