#include <linux/lustre_fsfilt.h>
#if defined(LPROCFS) && defined(__KERNEL__)
-
struct proc_dir_entry *lprocfs_srch(struct proc_dir_entry *head,
const char *name)
{
}
/* lprocfs API calls */
-
int lprocfs_add_vars(struct proc_dir_entry *root, struct lprocfs_vars *list,
void *data)
{
.release = seq_release,
};
-int lprocfs_register_stats(struct proc_dir_entry *root, const char *name,
+int lprocfs_register_stats(struct proc_dir_entry *root,
+ const char *name,
struct lprocfs_stats *stats)
{
struct proc_dir_entry *entry;
}
void lprocfs_counter_init(struct lprocfs_stats *stats, int index,
- unsigned conf, const char *name, const char *units)
+ unsigned conf, const char *name,
+ const char *units)
{
struct lprocfs_counter *c;
int i;
lprocfs_counter_init(stats, coffset, 0, #op, "reqs"); \
} while (0)
-int lprocfs_alloc_obd_stats(struct obd_device *obd, unsigned num_private_stats)
+int lprocfs_alloc_obd_stats(struct obd_device *obd,
+ unsigned num_private_stats)
{
struct lprocfs_stats *stats;
unsigned int num_stats;
LPROCFS_OBD_OP_INIT(num_private_stats, stats, queue_group_io);
LPROCFS_OBD_OP_INIT(num_private_stats, stats, trigger_group_io);
LPROCFS_OBD_OP_INIT(num_private_stats, stats, teardown_async_page);
+ LPROCFS_OBD_OP_INIT(num_private_stats, stats, adjust_kms);
LPROCFS_OBD_OP_INIT(num_private_stats, stats, punch);
LPROCFS_OBD_OP_INIT(num_private_stats, stats, sync);
LPROCFS_OBD_OP_INIT(num_private_stats, stats, migrate);
LPROCFS_OBD_OP_INIT(num_private_stats, stats, init_ea_size);
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
- * <linux/obd.h>, and that the corresponding line item
- * LPROCFS_OBD_OP_INIT(.., .., opname)
+ /* if this LBUGs, it is likely that an obd operation was added
+ * to struct obd_ops in <linux/obd.h>, and that the
+ * corresponding line item LPROCFS_OBD_OP_INIT(.., .., opname)
* is missing from the list above. */
if (stats->ls_percpu[0]->lp_cntr[i].lc_name == NULL) {
CERROR("Missing obd_stat initializer obd_op "
}
}
+#define LPROCFS_MD_OP_INIT(base, stats, op) \
+do { \
+ unsigned int coffset = base + MD_COUNTER_OFFSET(op); \
+ LASSERT(coffset < stats->ls_num); \
+ lprocfs_counter_init(stats, coffset, 0, #op, "reqs"); \
+} while (0)
+
+int lprocfs_alloc_md_stats(struct obd_device *obd,
+ unsigned num_private_stats)
+{
+ struct lprocfs_stats *stats;
+ unsigned int num_stats;
+ int rc, i;
+
+ LASSERT(obd->md_stats == NULL);
+ LASSERT(obd->obd_proc_entry != NULL);
+ LASSERT(obd->md_cntr_base == 0);
+
+ num_stats = 1 + MD_COUNTER_OFFSET(delete_inode) +
+ num_private_stats;
+ stats = lprocfs_alloc_stats(num_stats);
+ if (stats == NULL)
+ return -ENOMEM;
+
+ LPROCFS_MD_OP_INIT(num_private_stats, stats, getstatus);
+ LPROCFS_MD_OP_INIT(num_private_stats, stats, change_cbdata);
+ LPROCFS_MD_OP_INIT(num_private_stats, stats, change_cbdata_name);
+ LPROCFS_MD_OP_INIT(num_private_stats, stats, close);
+ LPROCFS_MD_OP_INIT(num_private_stats, stats, create);
+ LPROCFS_MD_OP_INIT(num_private_stats, stats, done_writing);
+ LPROCFS_MD_OP_INIT(num_private_stats, stats, enqueue);
+ LPROCFS_MD_OP_INIT(num_private_stats, stats, getattr);
+ LPROCFS_MD_OP_INIT(num_private_stats, stats, access_check);
+ LPROCFS_MD_OP_INIT(num_private_stats, stats, getattr_lock);
+ LPROCFS_MD_OP_INIT(num_private_stats, stats, intent_lock);
+ LPROCFS_MD_OP_INIT(num_private_stats, stats, link);
+ LPROCFS_MD_OP_INIT(num_private_stats, stats, rename);
+ LPROCFS_MD_OP_INIT(num_private_stats, stats, setattr);
+ LPROCFS_MD_OP_INIT(num_private_stats, stats, sync);
+ LPROCFS_MD_OP_INIT(num_private_stats, stats, readpage);
+ LPROCFS_MD_OP_INIT(num_private_stats, stats, unlink);
+ LPROCFS_MD_OP_INIT(num_private_stats, stats, valid_attrs);
+ LPROCFS_MD_OP_INIT(num_private_stats, stats, get_real_obd);
+ LPROCFS_MD_OP_INIT(num_private_stats, stats, req2lustre_md);
+ LPROCFS_MD_OP_INIT(num_private_stats, stats, set_open_replay_data);
+ LPROCFS_MD_OP_INIT(num_private_stats, stats, clear_open_replay_data);
+ LPROCFS_MD_OP_INIT(num_private_stats, stats, store_inode_generation);
+ LPROCFS_MD_OP_INIT(num_private_stats, stats, set_lock_data);
+ LPROCFS_MD_OP_INIT(num_private_stats, stats, delete_inode);
+
+ for (i = num_private_stats; i < num_stats; i++) {
+ if (stats->ls_percpu[0]->lp_cntr[i].lc_name == NULL) {
+ CERROR("Missing md_stat initializer md_op "
+ "operation at offset %d. Aborting.\n",
+ i - num_private_stats);
+ LBUG();
+ }
+ }
+ rc = lprocfs_register_stats(obd->obd_proc_entry, "stats", stats);
+ if (rc < 0) {
+ lprocfs_free_stats(stats);
+ } else {
+ obd->md_stats = stats;
+ obd->md_cntr_base = num_private_stats;
+ }
+ return rc;
+}
+
+void lprocfs_free_md_stats(struct obd_device *obd)
+{
+ struct lprocfs_stats *stats = obd->md_stats;
+
+ if (stats != NULL) {
+ obd->md_stats = NULL;
+ lprocfs_free_stats(stats);
+ }
+}
+
int lprocfs_write_helper(const char *buffer, unsigned long count,
int *val)
{
kernbuf[count] = '\0';
- *val = simple_strtoull(kernbuf, &end, 0);
+ if (kernbuf[0] == '-')
+ *val = -simple_strtoull(kernbuf + 1, &end, 0);
+ else
+ *val = simple_strtoull(kernbuf, &end, 0);
if (kernbuf == end)
return -EINVAL;
return ((large->tv_sec - small->tv_sec) * 1000000) +
(large->tv_usec - small->tv_usec);
}
+
void lprocfs_stime_record(struct obd_service_time *stime, struct timeval *large,
struct timeval *small)
{
EXPORT_SYMBOL(lprocfs_register_stats);
EXPORT_SYMBOL(lprocfs_alloc_obd_stats);
EXPORT_SYMBOL(lprocfs_free_obd_stats);
+EXPORT_SYMBOL(lprocfs_alloc_md_stats);
+EXPORT_SYMBOL(lprocfs_free_md_stats);
EXPORT_SYMBOL(lprocfs_rd_u64);
EXPORT_SYMBOL(lprocfs_rd_uuid);