From d62360b7f27faa839bd303bbce636fb2b6bc897d Mon Sep 17 00:00:00 2001
From: nathan <nathan>
Date: Mon, 22 Sep 2008 22:20:42 +0000
Subject: [PATCH] b=15521 missing b1_6 patch to skip 0 stats

---
 lustre/obdclass/lprocfs_status.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/lustre/obdclass/lprocfs_status.c b/lustre/obdclass/lprocfs_status.c
index 82366e4b28..76e91ba200 100644
--- a/lustre/obdclass/lprocfs_status.c
+++ b/lustre/obdclass/lprocfs_status.c
@@ -1000,7 +1000,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 = LC_MIN_INIT };
-       int i, idx, rc;
+       int i, idx, rc = 0;
        unsigned int num_cpu;
 
        if (cntr == &(stats->ls_percpu[0])->lp_cntr[0]) {
@@ -1041,6 +1041,9 @@ static int lprocfs_stats_seq_show(struct seq_file *p, void *v)
                ret.lc_sumsquare += t.lc_sumsquare;
        }
 
+       if (ret.lc_count == 0)
+               goto out;
+
        rc = seq_printf(p, "%-25s "LPD64" samples [%s]", cntr->lc_name,
                        ret.lc_count, cntr->lc_units);
        if (rc < 0)
@@ -1535,8 +1538,8 @@ int lprocfs_exp_setup(struct obd_export *exp, lnet_nid_t *nid, int *newnid)
             !exp->exp_obd->obd_nid_stats_hash)
                 RETURN(-EINVAL);
 
-	/* not test against zero because eric say:
-	 * You may only test nid against another nid, or LNET_NID_ANY.
+        /* not test against zero because eric say:
+         * You may only test nid against another nid, or LNET_NID_ANY.
          * Anything else is nonsense.*/
         if (!nid || *nid == LNET_NID_ANY)
                 RETURN(0);
-- 
GitLab