Whamcloud - gitweb
LU-1245 lprocfs: use correct cpu number
authorBobi Jam <bobijam@whamcloud.com>
Wed, 18 Apr 2012 01:14:57 +0000 (09:14 +0800)
committerOleg Drokin <green@whamcloud.com>
Fri, 20 Apr 2012 20:11:48 +0000 (16:11 -0400)
Take care of correct cpu number in lprocfs_stats_collector().

Signed-off-by: Bobi Jam <bobijam@whamcloud.com>
Change-Id: Ib7bad581e216daa48bb6dc903b1720b44ddba9c0
Reviewed-on: http://review.whamcloud.com/2579
Tested-by: Hudson
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/include/lprocfs_status.h

index 4a35afd..6df4466 100644 (file)
@@ -423,13 +423,17 @@ static inline __u64 lprocfs_stats_collector(struct lprocfs_stats *stats,
                                             int idx,
                                             enum lprocfs_fields_flags field)
 {
-        __u64 ret = 0;
-        int i;
+        __u64        ret = 0;
+        int          i;
+        unsigned int num_cpu;
 
         LASSERT(stats != NULL);
-        for (i = 0; i < cfs_num_possible_cpus(); i++)
+
+        num_cpu = lprocfs_stats_lock(stats, LPROCFS_GET_NUM_CPU);
+        for (i = 0; i < num_cpu; i++)
                 ret += lprocfs_read_helper(&(stats->ls_percpu[i]->lp_cntr[idx]),
                                            field);
+        lprocfs_stats_unlock(stats, LPROCFS_GET_NUM_CPU);
         return ret;
 }