Whamcloud - gitweb
LU-56 lnet: cleanup for rtrpool and LNet counter
[fs/lustre-release.git] / lnet / lnet / router_proc.c
index 2e8f0fa..60e0dda 100644 (file)
@@ -97,10 +97,8 @@ static int __proc_lnet_stats(void *data, int write,
         const int        tmpsiz = 256; /* 7 %u and 4 LPU64 */
 
         if (write) {
-                LNET_LOCK();
-                memset(&the_lnet.ln_counters, 0, sizeof(the_lnet.ln_counters));
-                LNET_UNLOCK();
-                return 0;
+               lnet_counters_reset();
+               return 0;
         }
 
         /* read */
@@ -115,9 +113,7 @@ static int __proc_lnet_stats(void *data, int write,
                 return -ENOMEM;
         }
 
-        LNET_LOCK();
-        *ctrs = the_lnet.ln_counters;
-        LNET_UNLOCK();
+       lnet_counters_get(ctrs);
 
         len = snprintf(tmpstr, tmpsiz,
                        "%u %u %u %u %u %u %u "LPU64" "LPU64" "
@@ -566,6 +562,9 @@ static int __proc_lnet_buffers(void *data, int write,
                       "pages", "count", "credits", "min");
         LASSERT (tmpstr + tmpsiz - s > 0);
 
+       if (the_lnet.ln_rtrpools == NULL)
+               goto out; /* I'm not a router */
+
         LNET_LOCK();
 
         for (idx = 0; idx < LNET_NRBPOOLS; idx++) {
@@ -584,6 +583,7 @@ static int __proc_lnet_buffers(void *data, int write,
 
         LNET_UNLOCK();
 
+ out:
         len = s - tmpstr;
 
         if (pos >= min_t(int, len, strlen(tmpstr)))