enum lprocfs_fields_flags field);
extern struct lprocfs_stats *
-lprocfs_alloc_stats(unsigned int num, enum lprocfs_stats_flags flags);
-extern void lprocfs_clear_stats(struct lprocfs_stats *stats);
-extern void lprocfs_free_stats(struct lprocfs_stats **stats);
+lprocfs_stats_alloc(unsigned int num, enum lprocfs_stats_flags flags);
+extern void lprocfs_stats_clear(struct lprocfs_stats *stats);
+extern void lprocfs_stats_free(struct lprocfs_stats **stats);
extern void lprocfs_init_ldlm_stats(struct lprocfs_stats *ldlm_stats);
extern int lprocfs_alloc_obd_stats(struct obd_device *obd,
unsigned int num_stats);
size_t count, loff_t *off);
extern int lprocfs_nid_stats_clear_seq_show(struct seq_file *file, void *data);
#endif
-extern int lprocfs_register_stats(struct proc_dir_entry *root, const char *name,
+extern int lprocfs_stats_register(struct proc_dir_entry *root, const char *name,
struct lprocfs_stats *stats);
extern const struct file_operations ldebugfs_stats_seq_fops;
/* NB: we return !NULL to satisfy error checker */
static inline struct lprocfs_stats *
-lprocfs_alloc_stats(unsigned int num, enum lprocfs_stats_flags flags)
+lprocfs_stats_alloc(unsigned int num, enum lprocfs_stats_flags flags)
{ return (struct lprocfs_stats *)1; }
-static inline void lprocfs_clear_stats(struct lprocfs_stats *stats)
+static inline void lprocfs_stats_clear(struct lprocfs_stats *stats)
{ return; }
-static inline void lprocfs_free_stats(struct lprocfs_stats **stats)
+static inline void lprocfs_stats_free(struct lprocfs_stats **stats)
{ return; }
-static inline int lprocfs_register_stats(struct proc_dir_entry *root,
- const char *name,
- struct lprocfs_stats *stats)
+static inline int lprocfs_stats_register(struct proc_dir_entry *root,
+ const char *name,
+ struct lprocfs_stats *stats)
{ return 0; }
static inline void lprocfs_init_ldlm_stats(struct lprocfs_stats *ldlm_stats)
{ return; }
{
/* Always add in ldlm_stats */
tmp->nid_ldlm_stats =
- lprocfs_alloc_stats(LDLM_LAST_OPC - LDLM_FIRST_OPC,
+ lprocfs_stats_alloc(LDLM_LAST_OPC - LDLM_FIRST_OPC,
LPROCFS_STATS_FLAG_NOPERCPU);
if (tmp->nid_ldlm_stats == NULL)
return -ENOMEM;
lprocfs_init_ldlm_stats(tmp->nid_ldlm_stats);
- return lprocfs_register_stats(tmp->nid_proc, "ldlm_stats",
+ return lprocfs_stats_register(tmp->nid_proc, "ldlm_stats",
tmp->nid_ldlm_stats);
}
ldlm_add_var(&pool_vars[0], pl->pl_debugfs_entry, "state", pl,
&lprocfs_pool_state_fops);
- pl->pl_stats = lprocfs_alloc_stats(LDLM_POOL_LAST_STAT -
+ pl->pl_stats = lprocfs_stats_alloc(LDLM_POOL_LAST_STAT -
LDLM_POOL_FIRST_STAT, 0);
if (!pl->pl_stats)
GOTO(out, rc = -ENOMEM);
static void ldlm_pool_debugfs_fini(struct ldlm_pool *pl)
{
if (pl->pl_stats != NULL) {
- lprocfs_free_stats(&pl->pl_stats);
+ lprocfs_stats_free(&pl->pl_stats);
pl->pl_stats = NULL;
}
debugfs_remove_recursive(pl->pl_debugfs_entry);
debugfs_remove_recursive(ns->ns_debugfs_entry);
if (ns->ns_stats != NULL)
- lprocfs_free_stats(&ns->ns_stats);
+ lprocfs_stats_free(&ns->ns_stats);
}
void ldlm_namespace_sysfs_unregister(struct ldlm_namespace *ns)
err = kobject_init_and_add(&ns->ns_kobj, &ldlm_ns_ktype, NULL,
"%s", ldlm_ns_name(ns));
- ns->ns_stats = lprocfs_alloc_stats(LDLM_NSS_LAST, 0);
+ ns->ns_stats = lprocfs_stats_alloc(LDLM_NSS_LAST, 0);
if (!ns->ns_stats) {
kobject_put(&ns->ns_kobj);
return -ENOMEM;
sbi->ll_stats_track_type = STATS_TRACK_ALL;
else
sbi->ll_stats_track_type = type;
- lprocfs_clear_stats(sbi->ll_stats);
+ lprocfs_stats_clear(sbi->ll_stats);
return count;
}
&ll_rw_offset_stats_fops);
/* File operations stats */
- sbi->ll_stats = lprocfs_alloc_stats(LPROC_LL_FILE_OPCODES,
+ sbi->ll_stats = lprocfs_stats_alloc(LPROC_LL_FILE_OPCODES,
LPROCFS_STATS_FLAG_NONE);
if (sbi->ll_stats == NULL)
GOTO(out_debugfs, err = -ENOMEM);
debugfs_create_file("stats", 0644, sbi->ll_debugfs_entry,
sbi->ll_stats, &ldebugfs_stats_seq_fops);
- sbi->ll_ra_stats = lprocfs_alloc_stats(ARRAY_SIZE(ra_stat_string),
+ sbi->ll_ra_stats = lprocfs_stats_alloc(ARRAY_SIZE(ra_stat_string),
LPROCFS_STATS_FLAG_NONE);
if (sbi->ll_ra_stats == NULL)
GOTO(out_stats, err = -ENOMEM);
RETURN(0);
out_ra_stats:
- lprocfs_free_stats(&sbi->ll_ra_stats);
+ lprocfs_stats_free(&sbi->ll_ra_stats);
out_stats:
- lprocfs_free_stats(&sbi->ll_stats);
+ lprocfs_stats_free(&sbi->ll_stats);
out_debugfs:
debugfs_remove_recursive(sbi->ll_debugfs_entry);
kset_unregister(&sbi->ll_kset);
wait_for_completion(&sbi->ll_kobj_unregister);
- lprocfs_free_stats(&sbi->ll_ra_stats);
- lprocfs_free_stats(&sbi->ll_stats);
+ lprocfs_stats_free(&sbi->ll_ra_stats);
+ lprocfs_stats_free(&sbi->ll_stats);
}
#undef MAX_STRING_SIZE
RETURN(rc == -EALREADY ? 0 : rc);
stats = exp->exp_nid_stats;
- stats->nid_stats = lprocfs_alloc_stats(LPROC_MDT_LAST,
+ stats->nid_stats = lprocfs_stats_alloc(LPROC_MDT_LAST,
LPROCFS_STATS_FLAG_NOPERCPU);
if (stats->nid_stats == NULL)
RETURN(-ENOMEM);
mdt_stats_counter_init(stats->nid_stats, 0, LPROCFS_CNTR_HISTOGRAM);
- rc = lprocfs_register_stats(stats->nid_proc, "stats", stats->nid_stats);
+ rc = lprocfs_stats_register(stats->nid_proc, "stats", stats->nid_stats);
if (rc != 0) {
- lprocfs_free_stats(&stats->nid_stats);
+ lprocfs_stats_free(&stats->nid_stats);
GOTO(out, rc);
}
RETURN(rc == -EALREADY ? 0 : rc);
stats = exp->exp_nid_stats;
- stats->nid_stats = lprocfs_alloc_stats(LPROC_MGS_LAST,
+ stats->nid_stats = lprocfs_stats_alloc(LPROC_MGS_LAST,
LPROCFS_STATS_FLAG_NOPERCPU);
if (stats->nid_stats == NULL)
RETURN(-ENOMEM);
mgs_stats_counter_init(stats->nid_stats);
- rc = lprocfs_register_stats(stats->nid_proc, "stats", stats->nid_stats);
+ rc = lprocfs_stats_register(stats->nid_proc, "stats", stats->nid_stats);
if (rc != 0) {
- lprocfs_free_stats(&stats->nid_stats);
+ lprocfs_stats_free(&stats->nid_stats);
GOTO(out, rc);
}
return err;
#ifdef CONFIG_PROC_FS
- obd_memory = lprocfs_alloc_stats(OBD_STATS_NUM,
+ obd_memory = lprocfs_stats_alloc(OBD_STATS_NUM,
LPROCFS_STATS_FLAG_NONE |
LPROCFS_STATS_FLAG_IRQ_SAFE);
if (obd_memory == NULL) {
cleanup_obd_memory:
#ifdef CONFIG_PROC_FS
- lprocfs_free_stats(&obd_memory);
+ lprocfs_stats_free(&obd_memory);
#endif
unregister_oom_notifier(&obdclass_oom);
memory_leaked = obd_memory_sum();
memory_max = obd_memory_max();
- lprocfs_free_stats(&obd_memory);
+ lprocfs_stats_free(&obd_memory);
/* the below message is checked in test-framework.sh check_mem_leak() */
CDEBUG((memory_leaked) ? D_ERROR : D_INFO,
"obd_memory max: %llu, leaked: %llu\n",
list_del_init(&job->js_list);
write_unlock(&job->js_jobstats->ojs_lock);
- lprocfs_free_stats(&job->js_stats);
+ lprocfs_stats_free(&job->js_stats);
OBD_FREE_PTR(job);
}
if (job == NULL)
return NULL;
- job->js_stats = lprocfs_alloc_stats(jobs->ojs_cntr_num, 0);
+ job->js_stats = lprocfs_stats_alloc(jobs->ojs_cntr_num, 0);
if (job->js_stats == NULL) {
OBD_FREE_PTR(job);
return NULL;
return rc;
}
-struct lprocfs_stats *lprocfs_alloc_stats(unsigned int num,
+struct lprocfs_stats *lprocfs_stats_alloc(unsigned int num,
enum lprocfs_stats_flags flags)
{
struct lprocfs_stats *stats;
return stats;
fail:
- lprocfs_free_stats(&stats);
+ lprocfs_stats_free(&stats);
return NULL;
}
-EXPORT_SYMBOL(lprocfs_alloc_stats);
+EXPORT_SYMBOL(lprocfs_stats_alloc);
-void lprocfs_free_stats(struct lprocfs_stats **statsh)
+void lprocfs_stats_free(struct lprocfs_stats **statsh)
{
struct lprocfs_stats *stats = *statsh;
unsigned int num_entry;
LIBCFS_FREE(stats, offsetof(typeof(*stats), ls_percpu[num_entry]));
}
-EXPORT_SYMBOL(lprocfs_free_stats);
+EXPORT_SYMBOL(lprocfs_stats_free);
u64 lprocfs_stats_collector(struct lprocfs_stats *stats, int idx,
enum lprocfs_fields_flags field)
}
EXPORT_SYMBOL(lprocfs_stats_collector);
-void lprocfs_clear_stats(struct lprocfs_stats *stats)
+void lprocfs_stats_clear(struct lprocfs_stats *stats)
{
struct lprocfs_counter *percpu_cntr;
- int i, j;
unsigned int num_entry;
unsigned long flags = 0;
+ int i, j;
num_entry = lprocfs_stats_lock(stats, LPROCFS_GET_NUM_CPU, &flags);
lprocfs_stats_unlock(stats, LPROCFS_GET_NUM_CPU, &flags);
}
-EXPORT_SYMBOL(lprocfs_clear_stats);
+EXPORT_SYMBOL(lprocfs_stats_clear);
static ssize_t lprocfs_stats_seq_write(struct file *file,
const char __user *buf,
struct seq_file *seq = file->private_data;
struct lprocfs_stats *stats = seq->private;
- lprocfs_clear_stats(stats);
+ lprocfs_stats_clear(stats);
return len;
}
.proc_release = lprocfs_seq_release,
};
-int lprocfs_register_stats(struct proc_dir_entry *root, const char *name,
- struct lprocfs_stats *stats)
+int lprocfs_stats_register(struct proc_dir_entry *root, const char *name,
+ struct lprocfs_stats *stats)
{
struct proc_dir_entry *entry;
- LASSERT(root != NULL);
+ LASSERT(root != NULL);
entry = proc_create_data(name, 0644, root,
&lprocfs_stats_seq_fops, stats);
if (!entry)
return -ENOMEM;
+
return 0;
}
-EXPORT_SYMBOL(lprocfs_register_stats);
+EXPORT_SYMBOL(lprocfs_stats_register);
static const char *lprocfs_counter_config_units(const char *name,
enum lprocfs_counter_config config)
LASSERT(obd->obd_md_stats == NULL);
num_stats = ARRAY_SIZE(mps_stats) + num_private_stats;
- stats = lprocfs_alloc_stats(num_stats, 0);
+ stats = lprocfs_stats_alloc(num_stats, 0);
if (!stats)
return -ENOMEM;
}
}
- rc = lprocfs_register_stats(obd->obd_proc_entry, "md_stats", stats);
+ rc = lprocfs_stats_register(obd->obd_proc_entry, "md_stats", stats);
if (rc < 0) {
- lprocfs_free_stats(&stats);
+ lprocfs_stats_free(&stats);
} else {
obd->obd_md_stats = stats;
}
if (stats) {
obd->obd_md_stats = NULL;
- lprocfs_free_stats(&stats);
+ lprocfs_stats_free(&stats);
}
}
EXPORT_SYMBOL(lprocfs_free_md_stats);
lprocfs_remove(&client_stat->nid_proc);
if (client_stat->nid_stats)
- lprocfs_free_stats(&client_stat->nid_stats);
+ lprocfs_stats_free(&client_stat->nid_stats);
if (client_stat->nid_ldlm_stats)
- lprocfs_free_stats(&client_stat->nid_ldlm_stats);
+ lprocfs_stats_free(&client_stat->nid_ldlm_stats);
OBD_FREE_PTR(client_stat);
}
}
/* we has reference to object - only clear data*/
if (stat->nid_stats)
- lprocfs_clear_stats(stat->nid_stats);
+ lprocfs_stats_clear(stat->nid_stats);
RETURN(0);
}
LASSERT(obd->obd_stats == NULL);
LASSERT(obd->obd_proc_entry != NULL);
- stats = lprocfs_alloc_stats(num_stats, 0);
+ stats = lprocfs_stats_alloc(num_stats, 0);
if (stats == NULL)
return -ENOMEM;
- rc = lprocfs_register_stats(obd->obd_proc_entry, "stats", stats);
+ rc = lprocfs_stats_register(obd->obd_proc_entry, "stats", stats);
if (rc < 0)
- lprocfs_free_stats(&stats);
+ lprocfs_stats_free(&stats);
else
obd->obd_stats = stats;
void lprocfs_free_obd_stats(struct obd_device *obd)
{
if (obd->obd_stats)
- lprocfs_free_stats(&obd->obd_stats);
+ lprocfs_stats_free(&obd->obd_stats);
}
EXPORT_SYMBOL(lprocfs_free_obd_stats);
init_waitqueue_head(&bkt->lsb_waitq);
}
- s->ls_stats = lprocfs_alloc_stats(LU_SS_LAST_STAT, 0);
+ s->ls_stats = lprocfs_stats_alloc(LU_SS_LAST_STAT, 0);
if (s->ls_stats == NULL) {
OBD_FREE_PTR_ARRAY_LARGE(s->ls_bkts, s->ls_bkt_cnt);
s->ls_bkts = NULL;
s->ls_bkts = NULL;
}
- if (s->ls_top_dev != NULL) {
- s->ls_top_dev->ld_site = NULL;
- lu_ref_del(&s->ls_top_dev->ld_reference, "site-top", s);
- lu_device_put(s->ls_top_dev);
- s->ls_top_dev = NULL;
- }
+ if (s->ls_top_dev != NULL) {
+ s->ls_top_dev->ld_site = NULL;
+ lu_ref_del(&s->ls_top_dev->ld_reference, "site-top", s);
+ lu_device_put(s->ls_top_dev);
+ s->ls_top_dev = NULL;
+ }
- if (s->ls_stats != NULL)
- lprocfs_free_stats(&s->ls_stats);
+ if (s->ls_stats != NULL)
+ lprocfs_stats_free(&s->ls_stats);
}
EXPORT_SYMBOL(lu_site_fini);
*/
int lu_site_init_finish(struct lu_site *s)
{
- int result;
+ int result;
+
down_write(&lu_sites_guard);
- result = lu_context_refill(&lu_shrink_env.le_ctx);
- if (result == 0)
+ result = lu_context_refill(&lu_shrink_env.le_ctx);
+ if (result == 0)
list_add(&s->ls_linkage, &lu_sites);
up_write(&lu_sites_guard);
- return result;
+
+ return result;
}
EXPORT_SYMBOL(lu_site_init_finish);
RETURN(rc == -EALREADY ? 0 : rc);
stats = exp->exp_nid_stats;
- stats->nid_stats = lprocfs_alloc_stats(LPROC_OFD_STATS_LAST,
+ stats->nid_stats = lprocfs_stats_alloc(LPROC_OFD_STATS_LAST,
LPROCFS_STATS_FLAG_NOPERCPU);
if (!stats->nid_stats)
RETURN(-ENOMEM);
ofd_stats_counter_init(stats->nid_stats, 0, LPROCFS_CNTR_HISTOGRAM);
- rc = lprocfs_register_stats(stats->nid_proc, "stats", stats->nid_stats);
+ rc = lprocfs_stats_register(stats->nid_proc, "stats", stats->nid_stats);
if (rc != 0) {
- lprocfs_free_stats(&stats->nid_stats);
+ lprocfs_stats_free(&stats->nid_stats);
GOTO(out, rc);
}
int result = -ENOMEM;
ENTRY;
- osd->od_stats = lprocfs_alloc_stats(LPROC_OSD_LAST, 0);
+ osd->od_stats = lprocfs_stats_alloc(LPROC_OSD_LAST, 0);
if (osd->od_stats) {
lprocfs_counter_init(osd->od_stats, LPROC_OSD_GET_PAGE,
LPROCFS_TYPE_LATENCY, "get_page");
lprocfs_fini_brw_stats(&osd->od_brw_stats);
if (osd->od_stats)
- lprocfs_free_stats(&osd->od_stats);
+ lprocfs_stats_free(&osd->od_stats);
if (osd->od_proc_entry)
lprocfs_remove(&osd->od_proc_entry);
int result = -ENOMEM;
ENTRY;
- osd->od_stats = lprocfs_alloc_stats(LPROC_OSD_LAST, 0);
+ osd->od_stats = lprocfs_stats_alloc(LPROC_OSD_LAST, 0);
if (osd->od_stats) {
lprocfs_counter_init(osd->od_stats, LPROC_OSD_GET_PAGE,
LPROCFS_CNTR_AVGMINMAX | LPROCFS_CNTR_STDDEV |
lprocfs_fini_brw_stats(&osd->od_brw_stats);
if (osd->od_stats)
- lprocfs_free_stats(&osd->od_stats);
+ lprocfs_stats_free(&osd->od_stats);
if (osd->od_proc_entry) {
lprocfs_remove(&osd->od_proc_entry);
LASSERT(!*debugfs_root_ret);
LASSERT(!*stats_ret);
- svc_stats = lprocfs_alloc_stats(EXTRA_MAX_OPCODES + LUSTRE_MAX_OPCODES,
+ svc_stats = lprocfs_stats_alloc(EXTRA_MAX_OPCODES + LUSTRE_MAX_OPCODES,
0);
if (!svc_stats)
return;
debugfs_remove_recursive(svc->srv_debugfs_entry);
if (svc->srv_stats)
- lprocfs_free_stats(&svc->srv_stats);
+ lprocfs_stats_free(&svc->srv_stats);
}
void ptlrpc_lprocfs_unregister_obd(struct obd_device *obd)
debugfs_remove_recursive(obd->obd_svc_debugfs_entry);
if (obd->obd_svc_stats)
- lprocfs_free_stats(&obd->obd_svc_stats);
+ lprocfs_stats_free(&obd->obd_svc_stats);
}
EXPORT_SYMBOL(ptlrpc_lprocfs_unregister_obd);