- /* Always add in ldlm_stats */
- exp->exp_nid_stats->nid_ldlm_stats =
- lprocfs_alloc_stats(LDLM_LAST_OPC - LDLM_FIRST_OPC,
- LPROCFS_STATS_FLAG_NOPERCPU);
- if (exp->exp_nid_stats->nid_ldlm_stats == NULL)
- GOTO(clean, rc = -ENOMEM);
- lprocfs_init_ldlm_stats(exp->exp_nid_stats->nid_ldlm_stats);
- rc = lprocfs_register_stats(exp->exp_nid_stats->nid_proc,
- "ldlm_stats",
- exp->exp_nid_stats->nid_ldlm_stats);
+ struct nid_stat *tmp = exp->exp_nid_stats;
+ int num_stats = 0;
+
+ num_stats = (sizeof(*obd->obd_type->typ_dt_ops) / sizeof(void *)) +
+ LPROC_MGS_LAST - 1;
+ tmp->nid_stats = lprocfs_alloc_stats(num_stats,
+ LPROCFS_STATS_FLAG_NOPERCPU);
+ if (tmp->nid_stats == NULL)
+ return -ENOMEM;
+ lprocfs_init_ops_stats(LPROC_MGS_LAST, tmp->nid_stats);
+ mgs_stats_counter_init(tmp->nid_stats);
+ rc = lprocfs_register_stats(tmp->nid_proc, "stats",
+ tmp->nid_stats);
+ if (rc)
+ GOTO(clean, rc);
+
+ rc = lprocfs_nid_ldlm_stats_init(tmp);