diff --git a/lustre/include/lprocfs_status.h b/lustre/include/lprocfs_status.h index 07f5c8fdc5f0f3bb0f82126e6d83ca05e0730e46..0f4d9b305ed93fb752e6fe405aa5d803e7883ef7 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 a83c171d0d6b95e2186595b865cc6592d7c9fcee..5725e25fe5ed64710f0d1888f1e7b99c33e6ebec 100644 --- a/lustre/lvfs/lvfs_lib.c +++ b/lustre/lvfs/lvfs_lib.c @@ -145,7 +145,7 @@ void lprocfs_counter_add(struct lprocfs_stats *stats, int idx, if (percpu_cntr->lc_config & LPROCFS_CNTR_AVGMINMAX) { percpu_cntr->lc_sum += amount; if (percpu_cntr->lc_config & LPROCFS_CNTR_STDDEV) - percpu_cntr->lc_sumsquare += (__u64)amount * amount; + percpu_cntr->lc_sumsquare += (__s64)amount * amount; if (amount < percpu_cntr->lc_min) percpu_cntr->lc_min = amount; if (amount > percpu_cntr->lc_max) diff --git a/lustre/lvfs/lvfs_linux.c b/lustre/lvfs/lvfs_linux.c index e342eebae9573a0e4f96101d91453b791b5a9e57..fef69969c79948fd99d614c64e8506fe634d4f1d 100644 --- a/lustre/lvfs/lvfs_linux.c +++ b/lustre/lvfs/lvfs_linux.c @@ -727,7 +727,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 002b4ae81698cf6a158c8d03b4b29ae5467d7681..608af88af41e0c2e4c339089d46d1b6516d3d90c 100644 --- a/lustre/obdclass/lprocfs_status.c +++ b/lustre/obdclass/lprocfs_status.c @@ -844,7 +844,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); @@ -890,7 +890,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; unsigned int num_cpu; @@ -932,18 +932,18 @@ static int lprocfs_stats_seq_show(struct seq_file *p, void *v) ret.lc_sumsquare += t.lc_sumsquare; } - 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; } @@ -1015,7 +1015,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;