}
EXPORT_SYMBOL(lprocfs_counter_init);
-#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, attach);
- LPROCFS_OBD_OP_INIT(num_private_stats, stats, detach);
- 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, packmd);
- LPROCFS_OBD_OP_INIT(num_private_stats, stats, unpackmd);
- LPROCFS_OBD_OP_INIT(num_private_stats, stats, preallocate);
- 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, setattr_async);
- LPROCFS_OBD_OP_INIT(num_private_stats, stats, getattr);
- LPROCFS_OBD_OP_INIT(num_private_stats, stats, getattr_async);
- LPROCFS_OBD_OP_INIT(num_private_stats, stats, adjust_kms);
- 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, find_cbdata);
- 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, quotacheck);
- LPROCFS_OBD_OP_INIT(num_private_stats, stats, quotactl);
- LPROCFS_OBD_OP_INIT(num_private_stats, stats, pool_new);
- LPROCFS_OBD_OP_INIT(num_private_stats, stats, pool_rem);
- LPROCFS_OBD_OP_INIT(num_private_stats, stats, pool_add);
- LPROCFS_OBD_OP_INIT(num_private_stats, stats, pool_del);
- LPROCFS_OBD_OP_INIT(num_private_stats, stats, getref);
- LPROCFS_OBD_OP_INIT(num_private_stats, stats, putref);
-}
-EXPORT_SYMBOL(lprocfs_init_ops_stats);
-
-int lprocfs_alloc_obd_stats(struct obd_device *obd, unsigned num_private_stats)
-{
- struct lprocfs_stats *stats;
- unsigned int num_stats;
- int rc, i;
-
- LASSERT(obd->obd_stats == NULL);
- LASSERT(obd->obd_debugfs_entry != NULL);
- LASSERT(obd->obd_cntr_base == 0);
-
- num_stats = ((int)sizeof(*obd->obd_type->typ_dt_ops) / sizeof(void *)) +
- num_private_stats - 1 /* o_owner */;
- 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 = ldebugfs_register_stats(obd->obd_debugfs_entry, "stats", stats);
- if (rc < 0) {
- lprocfs_free_stats(&stats);
- } else {
- obd->obd_stats = stats;
- obd->obd_cntr_base = num_private_stats;
- }
- return rc;
-}
-EXPORT_SYMBOL(lprocfs_alloc_obd_stats);
-
-void lprocfs_free_obd_stats(struct obd_device *obd)
-{
- if (obd->obd_stats)
- lprocfs_free_stats(&obd->obd_stats);
-}
-EXPORT_SYMBOL(lprocfs_free_obd_stats);
-
#define LPROCFS_MD_OP_INIT(base, stats, op) \
do { \
unsigned int coffset = base + MD_COUNTER_OFFSET(op); \