From 4b42d4c3f1066666f7195dc41cf22b7d22f805b4 Mon Sep 17 00:00:00 2001 From: bwzhou Date: Fri, 18 Apr 2008 04:47:53 +0000 Subject: [PATCH] Branch b1_6 b=15521 r=adilger, shadow correct the initialization of lc_min of struct lprocfs_counter --- lustre/include/lprocfs_status.h | 2 ++ lustre/lvfs/lvfs_lib.c | 2 +- lustre/obdclass/lprocfs_status.c | 12 ++++++------ 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/lustre/include/lprocfs_status.h b/lustre/include/lprocfs_status.h index d2d0697..cceec77 100644 --- a/lustre/include/lprocfs_status.h +++ b/lustre/include/lprocfs_status.h @@ -121,6 +121,8 @@ struct lprocfs_atomic { atomic_t la_exit; }; +#define LC_MIN_INIT ((~(__u64)0) >> 1) + struct lprocfs_counter { struct lprocfs_atomic lc_cntl; /* may need to move to per set */ unsigned int lc_config; diff --git a/lustre/lvfs/lvfs_lib.c b/lustre/lvfs/lvfs_lib.c index 237b4be..1a7bd01 100644 --- a/lustre/lvfs/lvfs_lib.c +++ b/lustre/lvfs/lvfs_lib.c @@ -118,7 +118,7 @@ EXPORT_SYMBOL(obd_memory); __s64 lprocfs_read_helper(struct lprocfs_counter *lc, enum lprocfs_fields_flags field) { - __u64 ret = 0; + __s64 ret = 0; int centry; if (!lc) diff --git a/lustre/obdclass/lprocfs_status.c b/lustre/obdclass/lprocfs_status.c index 11ad764..99edb9d 100644 --- a/lustre/obdclass/lprocfs_status.c +++ b/lustre/obdclass/lprocfs_status.c @@ -876,7 +876,7 @@ void lprocfs_clear_stats(struct lprocfs_stats *stats) atomic_inc(&percpu_cntr->lc_cntl.la_entry); percpu_cntr->lc_count = 0; percpu_cntr->lc_sum = 0; - percpu_cntr->lc_min = ~(__u64)0; + percpu_cntr->lc_min = LC_MIN_INIT; percpu_cntr->lc_max = 0; percpu_cntr->lc_sumsquare = 0; atomic_inc(&percpu_cntr->lc_cntl.la_exit); @@ -922,7 +922,7 @@ static int lprocfs_stats_seq_show(struct seq_file *p, void *v) { struct lprocfs_stats *stats = p->private; struct lprocfs_counter *cntr = v; - struct lprocfs_counter t, ret = { .lc_min = ~(__u64)0 }; + struct lprocfs_counter t, ret = { .lc_min = LC_MIN_INIT }; int i, idx, rc = 0; unsigned int num_cpu; @@ -967,18 +967,18 @@ static int lprocfs_stats_seq_show(struct seq_file *p, void *v) if (ret.lc_count == 0) goto out; - rc = seq_printf(p, "%-25s "LPU64" samples [%s]", cntr->lc_name, + rc = seq_printf(p, "%-25s "LPD64" samples [%s]", cntr->lc_name, ret.lc_count, cntr->lc_units); if (rc < 0) goto out; if ((cntr->lc_config & LPROCFS_CNTR_AVGMINMAX) && (ret.lc_count > 0)) { - rc = seq_printf(p, " "LPU64" "LPU64" "LPU64, + rc = seq_printf(p, " "LPD64" "LPD64" "LPD64, ret.lc_min, ret.lc_max, ret.lc_sum); if (rc < 0) goto out; if (cntr->lc_config & LPROCFS_CNTR_STDDEV) - rc = seq_printf(p, " "LPU64, ret.lc_sumsquare); + rc = seq_printf(p, " "LPD64, ret.lc_sumsquare); if (rc < 0) goto out; } @@ -1051,7 +1051,7 @@ void lprocfs_counter_init(struct lprocfs_stats *stats, int index, c->lc_config = conf; c->lc_count = 0; c->lc_sum = 0; - c->lc_min = ~(__u64)0; + c->lc_min = LC_MIN_INIT; c->lc_max = 0; c->lc_name = name; c->lc_units = units; -- 1.8.3.1