#ifdef CONFIG_PROC_FS
-#define OBD_COUNTER_OFFSET(op) \
- ((offsetof(struct obd_ops, o_ ## op) - \
- offsetof(struct obd_ops, o_iocontrol)) \
- / sizeof(((struct obd_ops *)NULL)->o_iocontrol))
-
-/* The '- 1' below is for o_owner. */
-#define NUM_OBD_STATS \
- (sizeof(struct obd_ops) / \
- sizeof(((struct obd_ops *)NULL)->o_iocontrol) - 1)
-
-#define OBD_COUNTER_INCREMENT(obd, op) \
- lprocfs_counter_incr((obd)->obd_stats, \
- (obd)->obd_cntr_base + OBD_COUNTER_OFFSET(op))
-
-#define EXP_COUNTER_INCREMENT(exp, op) \
- do { \
- unsigned int _off; \
- _off = (exp)->exp_obd->obd_cntr_base + OBD_COUNTER_OFFSET(op); \
- lprocfs_counter_incr((exp)->exp_obd->obd_stats, _off); \
- if ((exp)->exp_obd->obd_uses_nid_stats && \
- (exp)->exp_nid_stats != NULL) \
- lprocfs_counter_incr((exp)->exp_nid_stats->nid_stats, \
- _off); \
- } while (0)
-
#define _MD_COUNTER_OFFSET(m_op) \
((offsetof(struct md_ops, m_op) - \
offsetof(struct md_ops, MD_STATS_FIRST_OP)) / \
} while (0)
#else
-#define OBD_COUNTER_OFFSET(op)
-#define OBD_COUNTER_INCREMENT(obd, op)
-#define EXP_COUNTER_INCREMENT(exp, op)
#define EXP_MD_COUNTER_INCREMENT(exp, op)
#endif
(exp)->exp_obd->obd_name, __func__);
RETURN(-ENOTSUPP);
}
- EXP_COUNTER_INCREMENT(exp, get_info);
rc = OBP(exp->exp_obd, get_info)(env, exp, keylen, key, vallen, val);
RETURN(rc);
(exp)->exp_obd->obd_name, __func__);
RETURN(-ENOTSUPP);
}
- EXP_COUNTER_INCREMENT(exp, set_info_async);
rc = OBP(exp->exp_obd, set_info_async)(env, exp, keylen, key, vallen,
val, set);
__func__);
RETURN(-EOPNOTSUPP);
}
- OBD_COUNTER_INCREMENT(obd, setup);
rc = OBP(obd, setup)(obd, cfg);
}
RETURN(rc);
if (!obd->obd_type->typ_dt_ops->o_precleanup)
RETURN(0);
- OBD_COUNTER_INCREMENT(obd, precleanup);
-
rc = OBP(obd, precleanup)(obd);
RETURN(rc);
}
if (!obd->obd_type->typ_dt_ops->o_cleanup)
RETURN(0);
- OBD_COUNTER_INCREMENT(obd, cleanup);
-
rc = OBP(obd, cleanup)(obd);
RETURN(rc);
}
}
rc = OBP(obd, process_config)(obd, datalen, data);
}
- OBD_COUNTER_INCREMENT(obd, process_config);
+
obd->obd_process_conf = 0;
RETURN(rc);
(exp)->exp_obd->obd_name, __func__);
RETURN(-ENOTSUPP);
}
- EXP_COUNTER_INCREMENT(exp, create);
rc = OBP(exp->exp_obd, create)(env, exp, obdo);
RETURN(rc);
(exp)->exp_obd->obd_name, __func__);
RETURN(-ENOTSUPP);
}
- EXP_COUNTER_INCREMENT(exp, destroy);
rc = OBP(exp->exp_obd, destroy)(env, exp, obdo);
RETURN(rc);
(exp)->exp_obd->obd_name, __func__);
RETURN(-ENOTSUPP);
}
- EXP_COUNTER_INCREMENT(exp, getattr);
+
rc = OBP(exp->exp_obd, getattr)(env, exp, oa);
RETURN(rc);
(exp)->exp_obd->obd_name, __func__);
RETURN(-ENOTSUPP);
}
- EXP_COUNTER_INCREMENT(exp, setattr);
+
rc = OBP(exp->exp_obd, setattr)(env, exp, oa);
RETURN(rc);
CERROR("%s: no %s operation\n", obd->obd_name, __func__);
RETURN(-EOPNOTSUPP);
}
- OBD_COUNTER_INCREMENT(obd, add_conn);
rc = OBP(obd, add_conn)(imp, uuid, priority);
RETURN(rc);
CERROR("%s: no %s operation\n", obd->obd_name, __func__);
RETURN(-EOPNOTSUPP);
}
- OBD_COUNTER_INCREMENT(obd, del_conn);
rc = OBP(obd, del_conn)(imp, uuid);
RETURN(rc);
!exp->exp_obd->obd_type->typ_dt_ops->o_get_uuid)
RETURN(NULL);
- EXP_COUNTER_INCREMENT(exp, get_uuid);
-
uuid = OBP(exp->exp_obd, get_uuid)(exp);
RETURN(uuid);
}
CERROR("%s: no %s operation\n", obd->obd_name, __func__);
RETURN(-EOPNOTSUPP);
}
- OBD_COUNTER_INCREMENT(obd, connect);
rc = OBP(obd, connect)(env, exp, obd, cluuid, data, localdata);
/* check that only subset is granted */
if (!obd->obd_type || !obd->obd_type->typ_dt_ops->o_reconnect)
RETURN(0);
- OBD_COUNTER_INCREMENT(obd, reconnect);
-
rc = OBP(obd, reconnect)(env, exp, obd, cluuid, d, localdata);
/* check that only subset is granted */
LASSERT(ergo(d != NULL,
(exp)->exp_obd->obd_name, __func__);
RETURN(-ENOTSUPP);
}
- EXP_COUNTER_INCREMENT(exp, disconnect);
rc = OBP(exp->exp_obd, disconnect)(exp);
RETURN(rc);
if (!obd->obd_type || !obd->obd_type->typ_dt_ops->o_fid_init)
RETURN(0);
- OBD_COUNTER_INCREMENT(obd, fid_init);
rc = OBP(obd, fid_init)(obd, exp, type);
RETURN(rc);
ENTRY;
if (!obd->obd_type || !obd->obd_type->typ_dt_ops->o_fid_fini)
RETURN(0);
- OBD_COUNTER_INCREMENT(obd, fid_fini);
rc = OBP(obd, fid_fini)(obd);
RETURN(rc);
(exp)->exp_obd->obd_name, __func__);
RETURN(-ENOTSUPP);
}
- EXP_COUNTER_INCREMENT(exp, fid_alloc);
rc = OBP(exp->exp_obd, fid_alloc)(env, exp, fid, op_data);
RETURN(rc);
!exp->exp_obd->obd_type->typ_dt_ops->o_ping)
RETURN(0);
- EXP_COUNTER_INCREMENT(exp, ping);
-
rc = OBP(exp->exp_obd, ping)(env, exp);
RETURN(rc);
}
CERROR("%s: no %s operation\n", obd->obd_name, __func__);
RETURN(-EOPNOTSUPP);
}
- OBD_COUNTER_INCREMENT(obd, pool_new);
rc = OBP(obd, pool_new)(obd, poolname);
RETURN(rc);
CERROR("%s: no %s operation\n", obd->obd_name, __func__);
RETURN(-EOPNOTSUPP);
}
- OBD_COUNTER_INCREMENT(obd, pool_del);
rc = OBP(obd, pool_del)(obd, poolname);
RETURN(rc);
CERROR("%s: no %s operation\n", obd->obd_name, __func__);
RETURN(-EOPNOTSUPP);
}
- OBD_COUNTER_INCREMENT(obd, pool_add);
rc = OBP(obd, pool_add)(obd, poolname, ostname);
RETURN(rc);
CERROR("%s: no %s operation\n", obd->obd_name, __func__);
RETURN(-EOPNOTSUPP);
}
- OBD_COUNTER_INCREMENT(obd, pool_rem);
rc = OBP(obd, pool_rem)(obd, poolname, ostname);
RETURN(rc);
CERROR("%s: no %s operation\n", obd->obd_name, __func__);
RETURN(-EOPNOTSUPP);
}
- OBD_COUNTER_INCREMENT(obd, statfs);
CDEBUG(D_SUPER, "%s: osfs %p age %lld, max_age %lld\n",
obd->obd_name, &obd->obd_osfs, obd->obd_osfs_age, max_age);
CERROR("%s: no %s operation\n", obd->obd_name, __func__);
RETURN(-EOPNOTSUPP);
}
- OBD_COUNTER_INCREMENT(obd, statfs);
CDEBUG(D_SUPER, "osfs %lld, max_age %lld\n",
obd->obd_osfs_age, max_age);
(exp)->exp_obd->obd_name, __func__);
RETURN(-ENOTSUPP);
}
- EXP_COUNTER_INCREMENT(exp, preprw);
+
rc = OBP(exp->exp_obd, preprw)(env, cmd, exp, oa, objcount, obj, remote,
pages, local);
(exp)->exp_obd->obd_name, __func__);
RETURN(-ENOTSUPP);
}
- EXP_COUNTER_INCREMENT(exp, commitrw);
+
rc = OBP(exp->exp_obd, commitrw)(env, cmd, exp, oa, objcount, obj,
rnb, pages, local, rc);
(exp)->exp_obd->obd_name, __func__);
RETURN(-ENOTSUPP);
}
- EXP_COUNTER_INCREMENT(exp, iocontrol);
rc = OBP(exp->exp_obd, iocontrol)(cmd, exp, len, karg, uarg);
RETURN(rc);
EXIT;
return;
}
- if (obd->obd_set_up && OBP(obd, import_event)) {
- OBD_COUNTER_INCREMENT(obd, import_event);
+
+ if (obd->obd_set_up && OBP(obd, import_event))
OBP(obd, import_event)(obd, imp, event);
- }
+
EXIT;
}
RETURN(-ENOSYS);
}
- OBD_COUNTER_INCREMENT(obd, notify);
rc = OBP(obd, notify)(obd, watched, ev);
RETURN(rc);
(exp)->exp_obd->obd_name, __func__);
RETURN(-ENOTSUPP);
}
- EXP_COUNTER_INCREMENT(exp, quotactl);
rc = OBP(exp->exp_obd, quotactl)(exp->exp_obd, exp, oqctl);
RETURN(rc);
return 0;
}
-#define LPROCFS_OBD_OP_INIT(base, stats, op) \
-do { \
- unsigned int coffset = base + OBD_COUNTER_OFFSET(op); \
- LASSERT(coffset < stats->ls_num); \
- lprocfs_counter_init(stats, coffset, 0, #op, "reqs"); \
-} while (0)
-
-void lprocfs_init_ops_stats(int num_private_stats, struct lprocfs_stats *stats)
-{
- LPROCFS_OBD_OP_INIT(num_private_stats, stats, iocontrol);
- LPROCFS_OBD_OP_INIT(num_private_stats, stats, get_info);
- LPROCFS_OBD_OP_INIT(num_private_stats, stats, set_info_async);
- LPROCFS_OBD_OP_INIT(num_private_stats, stats, setup);
- LPROCFS_OBD_OP_INIT(num_private_stats, stats, precleanup);
- LPROCFS_OBD_OP_INIT(num_private_stats, stats, cleanup);
- LPROCFS_OBD_OP_INIT(num_private_stats, stats, process_config);
- LPROCFS_OBD_OP_INIT(num_private_stats, stats, postrecov);
- LPROCFS_OBD_OP_INIT(num_private_stats, stats, add_conn);
- LPROCFS_OBD_OP_INIT(num_private_stats, stats, del_conn);
- LPROCFS_OBD_OP_INIT(num_private_stats, stats, connect);
- LPROCFS_OBD_OP_INIT(num_private_stats, stats, reconnect);
- LPROCFS_OBD_OP_INIT(num_private_stats, stats, disconnect);
- LPROCFS_OBD_OP_INIT(num_private_stats, stats, fid_init);
- LPROCFS_OBD_OP_INIT(num_private_stats, stats, fid_fini);
- LPROCFS_OBD_OP_INIT(num_private_stats, stats, fid_alloc);
- LPROCFS_OBD_OP_INIT(num_private_stats, stats, statfs);
- LPROCFS_OBD_OP_INIT(num_private_stats, stats, statfs_async);
- LPROCFS_OBD_OP_INIT(num_private_stats, stats, create);
- LPROCFS_OBD_OP_INIT(num_private_stats, stats, destroy);
- LPROCFS_OBD_OP_INIT(num_private_stats, stats, setattr);
- LPROCFS_OBD_OP_INIT(num_private_stats, stats, getattr);
- LPROCFS_OBD_OP_INIT(num_private_stats, stats, preprw);
- LPROCFS_OBD_OP_INIT(num_private_stats, stats, commitrw);
- LPROCFS_OBD_OP_INIT(num_private_stats, stats, init_export);
- LPROCFS_OBD_OP_INIT(num_private_stats, stats, destroy_export);
- LPROCFS_OBD_OP_INIT(num_private_stats, stats, import_event);
- LPROCFS_OBD_OP_INIT(num_private_stats, stats, notify);
- LPROCFS_OBD_OP_INIT(num_private_stats, stats, health_check);
- LPROCFS_OBD_OP_INIT(num_private_stats, stats, get_uuid);
- LPROCFS_OBD_OP_INIT(num_private_stats, stats, quotactl);
- LPROCFS_OBD_OP_INIT(num_private_stats, stats, ping);
- LPROCFS_OBD_OP_INIT(num_private_stats, stats, pool_new);
- LPROCFS_OBD_OP_INIT(num_private_stats, stats, pool_del);
- LPROCFS_OBD_OP_INIT(num_private_stats, stats, pool_add);
- LPROCFS_OBD_OP_INIT(num_private_stats, stats, pool_rem);
-
- CLASSERT(NUM_OBD_STATS == OBD_COUNTER_OFFSET(pool_rem) + 1);
-}
-EXPORT_SYMBOL(lprocfs_init_ops_stats);
-
-int lprocfs_alloc_obd_stats(struct obd_device *obd, unsigned num_private_stats)
+int lprocfs_alloc_obd_stats(struct obd_device *obd, unsigned int num_stats)
{
struct lprocfs_stats *stats;
- unsigned int num_stats;
- int rc, i;
+ int rc;
LASSERT(obd->obd_stats == NULL);
LASSERT(obd->obd_proc_entry != NULL);
- LASSERT(obd->obd_cntr_base == 0);
- num_stats = NUM_OBD_STATS + num_private_stats;
stats = lprocfs_alloc_stats(num_stats, 0);
if (stats == NULL)
return -ENOMEM;
- lprocfs_init_ops_stats(num_private_stats, stats);
-
- for (i = num_private_stats; i < num_stats; i++) {
- /* If this LBUGs, it is likely that an obd
- * operation was added to struct obd_ops in
- * <obd.h>, and that the corresponding line item
- * LPROCFS_OBD_OP_INIT(.., .., opname)
- * is missing from the list above. */
- LASSERTF(stats->ls_cnt_header[i].lc_name != NULL,
- "Missing obd_stat initializer obd_op "
- "operation at offset %d.\n", i - num_private_stats);
- }
rc = lprocfs_register_stats(obd->obd_proc_entry, "stats", stats);
- if (rc < 0) {
+ if (rc < 0)
lprocfs_free_stats(&stats);
- } else {
- obd->obd_stats = stats;
- obd->obd_cntr_base = num_private_stats;
- }
+ else
+ obd->obd_stats = stats;
+
return rc;
}
EXPORT_SYMBOL(lprocfs_alloc_obd_stats);