From: Bobi Jam Date: Tue, 27 Mar 2012 02:50:06 +0000 (+0800) Subject: LU-1245 lprocfs: use correct cpu number X-Git-Tag: 2.2.51~8 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=debb9042dbe9f004d58e9dd89bcb259e55490b17;p=fs%2Flustre-release.git LU-1245 lprocfs: use correct cpu number Take care of correct cpu number in lprocfs_stats_collector(). Signed-off-by: Bobi Jam Change-Id: Ifb149f64ee6d5b67a029331c0d0452fc29533c6b Reviewed-on: http://review.whamcloud.com/2384 Tested-by: Hudson Tested-by: Maloo Reviewed-by: Fan Yong Reviewed-by: Oleg Drokin --- diff --git a/lustre/include/lprocfs_status.h b/lustre/include/lprocfs_status.h index c7f7833..d9b69fb 100644 --- a/lustre/include/lprocfs_status.h +++ b/lustre/include/lprocfs_status.h @@ -422,13 +422,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; }