diff mbox series

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

Message ID 20220215091657.104079-4-vshankar@redhat.com (mailing list archive)
State New, archived
Headers show
Series ceph: forward average read/write/metadata latency | expand

Commit Message

Venky Shankar Feb. 15, 2022, 9:16 a.m. UTC
Signed-off-by: Venky Shankar <vshankar@redhat.com>
---
 fs/ceph/debugfs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Jeff Layton Feb. 15, 2022, 11:36 a.m. UTC | #1
On Tue, 2022-02-15 at 14:46 +0530, Venky Shankar wrote:
> Signed-off-by: Venky Shankar <vshankar@redhat.com>
> ---
>  fs/ceph/debugfs.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/ceph/debugfs.c b/fs/ceph/debugfs.c
> index 3cf7c9c1085b..acc5cb3ad0ef 100644
> --- a/fs/ceph/debugfs.c
> +++ b/fs/ceph/debugfs.c
> @@ -186,7 +186,7 @@ static int metrics_latency_show(struct seq_file *s, void *p)
>  		spin_lock(&m->lock);
>  		total = m->total;
>  		sum = m->latency_sum;
> -		avg = total > 0 ? DIV64_U64_ROUND_CLOSEST(sum, total) : 0;
> +		avg = m->latency_avg;
>  		min = m->latency_min;
>  		max = m->latency_max;
>  		sq = m->latency_sq_sum;

I see this warning with this patch:

fs/ceph/debugfs.c: In function ‘metrics_latency_show’:
fs/ceph/debugfs.c:178:20: warning: variable ‘sum’ set but not used [-Wunused-but-set-variable]
  178 |         s64 total, sum, avg, min, max, sq;
      |                    ^~~

I think the "sum" var can be eliminated from this function now? I'll go
ahead and make that change in there. You don't need resend.
diff mbox series

Patch

diff --git a/fs/ceph/debugfs.c b/fs/ceph/debugfs.c
index 3cf7c9c1085b..acc5cb3ad0ef 100644
--- a/fs/ceph/debugfs.c
+++ b/fs/ceph/debugfs.c
@@ -186,7 +186,7 @@  static int metrics_latency_show(struct seq_file *s, void *p)
 		spin_lock(&m->lock);
 		total = m->total;
 		sum = m->latency_sum;
-		avg = total > 0 ? DIV64_U64_ROUND_CLOSEST(sum, total) : 0;
+		avg = m->latency_avg;
 		min = m->latency_min;
 		max = m->latency_max;
 		sq = m->latency_sq_sum;