+ lnet_nid_t *client_nid4 = localdata;
+ struct nid_stat *stats;
+ int rc;
+ ENTRY;
+
+ if (client_nid4) {
+ struct lnet_nid client_nid;
+
+ lnet_nid4_to_nid(*client_nid4, &client_nid);
+ rc = lprocfs_exp_setup(exp, &client_nid);
+ } else
+ rc = lprocfs_exp_setup(exp, NULL);
+ if (rc != 0)
+ /* Mask error for already created /proc entries */
+ RETURN(rc == -EALREADY ? 0 : rc);
+
+ stats = exp->exp_nid_stats;
+ stats->nid_stats = lprocfs_alloc_stats(LPROC_MDT_LAST,
+ LPROCFS_STATS_FLAG_NOPERCPU);
+ if (stats->nid_stats == NULL)
+ RETURN(-ENOMEM);
+
+ mdt_stats_counter_init(stats->nid_stats, 0);
+
+ rc = lprocfs_register_stats(stats->nid_proc, "stats", stats->nid_stats);
+ if (rc != 0) {
+ lprocfs_free_stats(&stats->nid_stats);
+ GOTO(out, rc);
+ }