struct obd_device *exp_obd;
struct obd_import *exp_imp_reverse; /* to make RPCs backwards */
struct nid_stat *exp_nid_stats;
- struct lprocfs_stats *exp_ops_stats;
struct ptlrpc_connection *exp_connection;
__u32 exp_conn_cnt;
lustre_hash_t *exp_lock_hash; /* existing lock hash */
void mgs_counter_incr(struct obd_export *exp, int opcode)
{
- lprocfs_counter_incr(exp->exp_obd->obd_stats, opcode);
- lprocfs_counter_incr(exp->exp_ops_stats, opcode);
+ if (exp->exp_obd && exp->exp_obd->obd_stats)
+ lprocfs_counter_incr(exp->exp_obd->obd_stats, opcode);
+ if (exp->exp_nid_stats && exp->exp_nid_stats->nid_stats)
+ lprocfs_counter_incr(exp->exp_nid_stats->nid_stats, opcode);
}
void mgs_stats_counter_init(struct lprocfs_stats *stats)
}
if (newnid) {
+ struct nid_stat *tmp = exp->exp_nid_stats;
+
num_stats = (sizeof(*obd->obd_type->typ_ops) / sizeof(void *)) +
LPROC_MGS_LAST - 1;
- exp->exp_ops_stats = lprocfs_alloc_stats(num_stats,
+ tmp->nid_stats = lprocfs_alloc_stats(num_stats,
LPROCFS_STATS_FLAG_NOPERCPU);
- if (exp->exp_ops_stats == NULL)
+ if (tmp->nid_stats == NULL)
return -ENOMEM;
- lprocfs_init_ops_stats(LPROC_MGS_LAST, exp->exp_ops_stats);
- mgs_stats_counter_init(exp->exp_ops_stats);
- lprocfs_register_stats(exp->exp_nid_stats->nid_proc, "stats",
- exp->exp_ops_stats);
+
+ 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)
+ return rc;
/* Always add in ldlm_stats */
- exp->exp_nid_stats->nid_ldlm_stats =
+ tmp->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)
+ if (tmp->nid_ldlm_stats == NULL)
return -ENOMEM;
- lprocfs_init_ldlm_stats(exp->exp_nid_stats->nid_ldlm_stats);
+ lprocfs_init_ldlm_stats(tmp->nid_ldlm_stats);
- rc = lprocfs_register_stats(exp->exp_nid_stats->nid_proc,
- "ldlm_stats",
- exp->exp_nid_stats->nid_ldlm_stats);
+ rc = lprocfs_register_stats(tmp->nid_proc, "ldlm_stats",
+ tmp->nid_ldlm_stats);
+ if (rc)
+ return rc;
}
return 0;