Commit 700815d4 authored by Dmitry Eremin's avatar Dmitry Eremin Committed by Greg Kroah-Hartman

staging/lustre/ldlm: move all remaining files from procfs to debugfs

Move all files except stats. It will be moved later after change
type of obddev->obd_proc_entry member.
Signed-off-by: default avatarDmitry Eremin <dmiter4ever@gmail.com>
Signed-off-by: default avatarOleg Drokin <oleg.drokin@intel.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent b40881e5
...@@ -234,8 +234,8 @@ struct ldlm_pool_ops { ...@@ -234,8 +234,8 @@ struct ldlm_pool_ops {
* This feature is commonly referred to as lru_resize. * This feature is commonly referred to as lru_resize.
*/ */
struct ldlm_pool { struct ldlm_pool {
/** Pool proc directory. */ /** Pool debugfs directory. */
struct proc_dir_entry *pl_proc_dir; struct dentry *pl_debugfs_entry;
/** Pool name, must be long enough to hold compound proc entry name. */ /** Pool name, must be long enough to hold compound proc entry name. */
char pl_name[100]; char pl_name[100];
/** Lock for protecting SLV/CLV updates. */ /** Lock for protecting SLV/CLV updates. */
...@@ -388,8 +388,8 @@ struct ldlm_namespace { ...@@ -388,8 +388,8 @@ struct ldlm_namespace {
/** Client side original connect flags supported by server. */ /** Client side original connect flags supported by server. */
__u64 ns_orig_connect_flags; __u64 ns_orig_connect_flags;
/* namespace proc dir entry */ /* namespace debugfs dir entry */
struct proc_dir_entry *ns_proc_dir_entry; struct dentry *ns_debugfs_entry;
/** /**
* Position in global namespace list linking all namespaces on * Position in global namespace list linking all namespaces on
...@@ -1251,13 +1251,8 @@ void ldlm_namespace_register(struct ldlm_namespace *ns, ldlm_side_t client); ...@@ -1251,13 +1251,8 @@ void ldlm_namespace_register(struct ldlm_namespace *ns, ldlm_side_t client);
void ldlm_namespace_unregister(struct ldlm_namespace *ns, ldlm_side_t client); void ldlm_namespace_unregister(struct ldlm_namespace *ns, ldlm_side_t client);
void ldlm_namespace_get(struct ldlm_namespace *ns); void ldlm_namespace_get(struct ldlm_namespace *ns);
void ldlm_namespace_put(struct ldlm_namespace *ns); void ldlm_namespace_put(struct ldlm_namespace *ns);
#if defined (CONFIG_PROC_FS) int ldlm_debugfs_setup(void);
int ldlm_proc_setup(void); void ldlm_debugfs_cleanup(void);
void ldlm_proc_cleanup(void);
#else
static inline int ldlm_proc_setup(void) { return 0; }
static inline void ldlm_proc_cleanup(void) {}
#endif
/* resource.c - internal */ /* resource.c - internal */
struct ldlm_resource *ldlm_resource_get(struct ldlm_namespace *ns, struct ldlm_resource *ldlm_resource_get(struct ldlm_namespace *ns,
......
...@@ -1978,8 +1978,8 @@ struct ptlrpc_service { ...@@ -1978,8 +1978,8 @@ struct ptlrpc_service {
int srv_nthrs_cpt_init; int srv_nthrs_cpt_init;
/** limit of threads number for each partition */ /** limit of threads number for each partition */
int srv_nthrs_cpt_limit; int srv_nthrs_cpt_limit;
/** Root of /proc dir tree for this service */ /** Root of debugfs dir tree for this service */
struct proc_dir_entry *srv_procroot; struct dentry *srv_debugfs_entry;
/** Pointer to statistic data for this service */ /** Pointer to statistic data for this service */
struct lprocfs_stats *srv_stats; struct lprocfs_stats *srv_stats;
/** # hp per lp reqs to handle */ /** # hp per lp reqs to handle */
...@@ -2530,7 +2530,7 @@ int ptlrpc_hpreq_handler(struct ptlrpc_request *req); ...@@ -2530,7 +2530,7 @@ int ptlrpc_hpreq_handler(struct ptlrpc_request *req);
struct ptlrpc_service *ptlrpc_register_service( struct ptlrpc_service *ptlrpc_register_service(
struct ptlrpc_service_conf *conf, struct ptlrpc_service_conf *conf,
struct kset *parent, struct kset *parent,
struct proc_dir_entry *proc_entry); struct dentry *debugfs_entry);
void ptlrpc_stop_all_threads(struct ptlrpc_service *svc); void ptlrpc_stop_all_threads(struct ptlrpc_service *svc);
int ptlrpc_start_threads(struct ptlrpc_service *svc); int ptlrpc_start_threads(struct ptlrpc_service *svc);
......
...@@ -197,8 +197,7 @@ void ldlm_destroy_flock_export(struct obd_export *exp); ...@@ -197,8 +197,7 @@ void ldlm_destroy_flock_export(struct obd_export *exp);
void l_check_ns_lock(struct ldlm_namespace *ns); void l_check_ns_lock(struct ldlm_namespace *ns);
void l_check_no_ns_lock(struct ldlm_namespace *ns); void l_check_no_ns_lock(struct ldlm_namespace *ns);
extern struct proc_dir_entry *ldlm_svc_proc_dir; extern struct dentry *ldlm_svc_debugfs_dir;
extern struct proc_dir_entry *ldlm_type_proc_dir;
struct ldlm_state { struct ldlm_state {
struct ptlrpc_service *ldlm_cb_service; struct ptlrpc_service *ldlm_cb_service;
......
...@@ -1078,7 +1078,7 @@ static int ldlm_setup(void) ...@@ -1078,7 +1078,7 @@ static int ldlm_setup(void)
goto out; goto out;
} }
rc = ldlm_proc_setup(); rc = ldlm_debugfs_setup();
if (rc != 0) if (rc != 0)
goto out; goto out;
...@@ -1113,7 +1113,7 @@ static int ldlm_setup(void) ...@@ -1113,7 +1113,7 @@ static int ldlm_setup(void)
}; };
ldlm_state->ldlm_cb_service = ldlm_state->ldlm_cb_service =
ptlrpc_register_service(&conf, ldlm_svc_kset, ptlrpc_register_service(&conf, ldlm_svc_kset,
ldlm_svc_proc_dir); ldlm_svc_debugfs_dir);
if (IS_ERR(ldlm_state->ldlm_cb_service)) { if (IS_ERR(ldlm_state->ldlm_cb_service)) {
CERROR("failed to start service\n"); CERROR("failed to start service\n");
rc = PTR_ERR(ldlm_state->ldlm_cb_service); rc = PTR_ERR(ldlm_state->ldlm_cb_service);
...@@ -1204,8 +1204,7 @@ static int ldlm_cleanup(void) ...@@ -1204,8 +1204,7 @@ static int ldlm_cleanup(void)
if (ldlm_kobj) if (ldlm_kobj)
kobject_put(ldlm_kobj); kobject_put(ldlm_kobj);
ldlm_proc_cleanup(); ldlm_debugfs_cleanup();
kfree(ldlm_state); kfree(ldlm_state);
ldlm_state = NULL; ldlm_state = NULL;
......
...@@ -654,7 +654,6 @@ int ldlm_pool_setup(struct ldlm_pool *pl, int limit) ...@@ -654,7 +654,6 @@ int ldlm_pool_setup(struct ldlm_pool *pl, int limit)
} }
EXPORT_SYMBOL(ldlm_pool_setup); EXPORT_SYMBOL(ldlm_pool_setup);
#if defined(CONFIG_PROC_FS)
static int lprocfs_pool_state_seq_show(struct seq_file *m, void *unused) static int lprocfs_pool_state_seq_show(struct seq_file *m, void *unused)
{ {
int granted, grant_rate, cancel_rate, grant_step; int granted, grant_rate, cancel_rate, grant_step;
...@@ -745,7 +744,7 @@ LUSTRE_RW_ATTR(lock_volume_factor); ...@@ -745,7 +744,7 @@ LUSTRE_RW_ATTR(lock_volume_factor);
snprintf(var_name, MAX_STRING_SIZE, #name); \ snprintf(var_name, MAX_STRING_SIZE, #name); \
pool_vars[0].data = var; \ pool_vars[0].data = var; \
pool_vars[0].fops = ops; \ pool_vars[0].fops = ops; \
lprocfs_add_vars(pl->pl_proc_dir, pool_vars, NULL);\ ldebugfs_add_vars(pl->pl_debugfs_entry, pool_vars, NULL);\
} while (0) } while (0)
/* These are for pools in /sys/fs/lustre/ldlm/namespaces/.../pool */ /* These are for pools in /sys/fs/lustre/ldlm/namespaces/.../pool */
...@@ -787,10 +786,10 @@ static int ldlm_pool_sysfs_init(struct ldlm_pool *pl) ...@@ -787,10 +786,10 @@ static int ldlm_pool_sysfs_init(struct ldlm_pool *pl)
return err; return err;
} }
static int ldlm_pool_proc_init(struct ldlm_pool *pl) static int ldlm_pool_debugfs_init(struct ldlm_pool *pl)
{ {
struct ldlm_namespace *ns = ldlm_pl2ns(pl); struct ldlm_namespace *ns = ldlm_pl2ns(pl);
struct proc_dir_entry *parent_ns_proc; struct dentry *debugfs_ns_parent;
struct lprocfs_vars pool_vars[2]; struct lprocfs_vars pool_vars[2];
char *var_name = NULL; char *var_name = NULL;
int rc = 0; int rc = 0;
...@@ -799,19 +798,19 @@ static int ldlm_pool_proc_init(struct ldlm_pool *pl) ...@@ -799,19 +798,19 @@ static int ldlm_pool_proc_init(struct ldlm_pool *pl)
if (!var_name) if (!var_name)
return -ENOMEM; return -ENOMEM;
parent_ns_proc = ns->ns_proc_dir_entry; debugfs_ns_parent = ns->ns_debugfs_entry;
if (parent_ns_proc == NULL) { if (IS_ERR_OR_NULL(debugfs_ns_parent)) {
CERROR("%s: proc entry is not initialized\n", CERROR("%s: debugfs entry is not initialized\n",
ldlm_ns_name(ns)); ldlm_ns_name(ns));
rc = -EINVAL; rc = -EINVAL;
goto out_free_name; goto out_free_name;
} }
pl->pl_proc_dir = lprocfs_register("pool", parent_ns_proc, pl->pl_debugfs_entry = ldebugfs_register("pool", debugfs_ns_parent,
NULL, NULL); NULL, NULL);
if (IS_ERR(pl->pl_proc_dir)) { if (IS_ERR(pl->pl_debugfs_entry)) {
CERROR("LProcFS failed in ldlm-pool-init\n"); CERROR("LdebugFS failed in ldlm-pool-init\n");
rc = PTR_ERR(pl->pl_proc_dir); rc = PTR_ERR(pl->pl_debugfs_entry);
pl->pl_proc_dir = NULL; pl->pl_debugfs_entry = NULL;
goto out_free_name; goto out_free_name;
} }
...@@ -819,7 +818,7 @@ static int ldlm_pool_proc_init(struct ldlm_pool *pl) ...@@ -819,7 +818,7 @@ static int ldlm_pool_proc_init(struct ldlm_pool *pl)
memset(pool_vars, 0, sizeof(pool_vars)); memset(pool_vars, 0, sizeof(pool_vars));
pool_vars[0].name = var_name; pool_vars[0].name = var_name;
LDLM_POOL_ADD_VAR("state", pl, &lprocfs_pool_state_fops); LDLM_POOL_ADD_VAR(state, pl, &lprocfs_pool_state_fops);
pl->pl_stats = lprocfs_alloc_stats(LDLM_POOL_LAST_STAT - pl->pl_stats = lprocfs_alloc_stats(LDLM_POOL_LAST_STAT -
LDLM_POOL_FIRST_STAT, 0); LDLM_POOL_FIRST_STAT, 0);
...@@ -861,7 +860,8 @@ static int ldlm_pool_proc_init(struct ldlm_pool *pl) ...@@ -861,7 +860,8 @@ static int ldlm_pool_proc_init(struct ldlm_pool *pl)
lprocfs_counter_init(pl->pl_stats, LDLM_POOL_TIMING_STAT, lprocfs_counter_init(pl->pl_stats, LDLM_POOL_TIMING_STAT,
LPROCFS_CNTR_AVGMINMAX | LPROCFS_CNTR_STDDEV, LPROCFS_CNTR_AVGMINMAX | LPROCFS_CNTR_STDDEV,
"recalc_timing", "sec"); "recalc_timing", "sec");
rc = lprocfs_register_stats(pl->pl_proc_dir, "stats", pl->pl_stats); rc = ldebugfs_register_stats(pl->pl_debugfs_entry, "stats",
pl->pl_stats);
out_free_name: out_free_name:
kfree(var_name); kfree(var_name);
...@@ -874,25 +874,17 @@ static void ldlm_pool_sysfs_fini(struct ldlm_pool *pl) ...@@ -874,25 +874,17 @@ static void ldlm_pool_sysfs_fini(struct ldlm_pool *pl)
wait_for_completion(&pl->pl_kobj_unregister); wait_for_completion(&pl->pl_kobj_unregister);
} }
static void ldlm_pool_proc_fini(struct ldlm_pool *pl) static void ldlm_pool_debugfs_fini(struct ldlm_pool *pl)
{ {
if (pl->pl_stats != NULL) { if (pl->pl_stats != NULL) {
lprocfs_free_stats(&pl->pl_stats); lprocfs_free_stats(&pl->pl_stats);
pl->pl_stats = NULL; pl->pl_stats = NULL;
} }
if (pl->pl_proc_dir != NULL) { if (pl->pl_debugfs_entry != NULL) {
lprocfs_remove(&pl->pl_proc_dir); ldebugfs_remove(&pl->pl_debugfs_entry);
pl->pl_proc_dir = NULL; pl->pl_debugfs_entry = NULL;
} }
} }
#else /* !CONFIG_PROC_FS */
static int ldlm_pool_proc_init(struct ldlm_pool *pl)
{
return 0;
}
static void ldlm_pool_proc_fini(struct ldlm_pool *pl) {}
#endif /* CONFIG_PROC_FS */
int ldlm_pool_init(struct ldlm_pool *pl, struct ldlm_namespace *ns, int ldlm_pool_init(struct ldlm_pool *pl, struct ldlm_namespace *ns,
int idx, ldlm_side_t client) int idx, ldlm_side_t client)
...@@ -923,7 +915,7 @@ int ldlm_pool_init(struct ldlm_pool *pl, struct ldlm_namespace *ns, ...@@ -923,7 +915,7 @@ int ldlm_pool_init(struct ldlm_pool *pl, struct ldlm_namespace *ns,
pl->pl_recalc_period = LDLM_POOL_CLI_DEF_RECALC_PERIOD; pl->pl_recalc_period = LDLM_POOL_CLI_DEF_RECALC_PERIOD;
} }
pl->pl_client_lock_volume = 0; pl->pl_client_lock_volume = 0;
rc = ldlm_pool_proc_init(pl); rc = ldlm_pool_debugfs_init(pl);
if (rc) if (rc)
return rc; return rc;
...@@ -940,7 +932,7 @@ EXPORT_SYMBOL(ldlm_pool_init); ...@@ -940,7 +932,7 @@ EXPORT_SYMBOL(ldlm_pool_init);
void ldlm_pool_fini(struct ldlm_pool *pl) void ldlm_pool_fini(struct ldlm_pool *pl)
{ {
ldlm_pool_sysfs_fini(pl); ldlm_pool_sysfs_fini(pl);
ldlm_pool_proc_fini(pl); ldlm_pool_debugfs_fini(pl);
/* /*
* Pool should not be used after this point. We can't free it here as * Pool should not be used after this point. We can't free it here as
......
...@@ -1462,7 +1462,7 @@ static ldlm_policy_res_t ldlm_cancel_lrur_policy(struct ldlm_namespace *ns, ...@@ -1462,7 +1462,7 @@ static ldlm_policy_res_t ldlm_cancel_lrur_policy(struct ldlm_namespace *ns,
lock->l_last_used)); lock->l_last_used));
lv = lvf * la * unused; lv = lvf * la * unused;
/* Inform pool about current CLV to see it via proc. */ /* Inform pool about current CLV to see it via debugfs. */
ldlm_pool_set_clv(pl, lv); ldlm_pool_set_clv(pl, lv);
/* Stop when SLV is not yet come from server or lv is smaller than /* Stop when SLV is not yet come from server or lv is smaller than
...@@ -1472,7 +1472,7 @@ static ldlm_policy_res_t ldlm_cancel_lrur_policy(struct ldlm_namespace *ns, ...@@ -1472,7 +1472,7 @@ static ldlm_policy_res_t ldlm_cancel_lrur_policy(struct ldlm_namespace *ns,
} }
/** /**
* Callback function for proc used policy. Makes decision whether to keep * Callback function for debugfs used policy. Makes decision whether to keep
* \a lock in LRU for current \a LRU size \a unused, added in current scan \a * \a lock in LRU for current \a LRU size \a unused, added in current scan \a
* added and number of locks to be preferably canceled \a count. * added and number of locks to be preferably canceled \a count.
* *
......
...@@ -61,16 +61,16 @@ LIST_HEAD(ldlm_cli_active_namespace_list); ...@@ -61,16 +61,16 @@ LIST_HEAD(ldlm_cli_active_namespace_list);
/* Client namespaces that don't have any locks in them */ /* Client namespaces that don't have any locks in them */
LIST_HEAD(ldlm_cli_inactive_namespace_list); LIST_HEAD(ldlm_cli_inactive_namespace_list);
struct proc_dir_entry *ldlm_type_proc_dir = NULL; static struct dentry *ldlm_debugfs_dir;
static struct proc_dir_entry *ldlm_ns_proc_dir = NULL; static struct dentry *ldlm_ns_debugfs_dir;
struct proc_dir_entry *ldlm_svc_proc_dir = NULL; struct dentry *ldlm_svc_debugfs_dir;
/* during debug dump certain amount of granted locks for one resource to avoid /* during debug dump certain amount of granted locks for one resource to avoid
* DDOS. */ * DDOS. */
unsigned int ldlm_dump_granted_max = 256; unsigned int ldlm_dump_granted_max = 256;
#if defined(CONFIG_PROC_FS) static ssize_t
static ssize_t lprocfs_wr_dump_ns(struct file *file, const char __user *buffer, lprocfs_wr_dump_ns(struct file *file, const char __user *buffer,
size_t count, loff_t *off) size_t count, loff_t *off)
{ {
ldlm_dump_all_namespaces(LDLM_NAMESPACE_SERVER, D_DLMTRACE); ldlm_dump_all_namespaces(LDLM_NAMESPACE_SERVER, D_DLMTRACE);
...@@ -81,72 +81,74 @@ LPROC_SEQ_FOPS_WR_ONLY(ldlm, dump_ns); ...@@ -81,72 +81,74 @@ LPROC_SEQ_FOPS_WR_ONLY(ldlm, dump_ns);
LPROC_SEQ_FOPS_RW_TYPE(ldlm_rw, uint); LPROC_SEQ_FOPS_RW_TYPE(ldlm_rw, uint);
int ldlm_proc_setup(void) static struct lprocfs_vars ldlm_debugfs_list[] = {
{ "dump_namespaces", &ldlm_dump_ns_fops, NULL, 0222 },
{ "dump_granted_max", &ldlm_rw_uint_fops, &ldlm_dump_granted_max },
{ NULL }
};
int ldlm_debugfs_setup(void)
{ {
int rc; int rc;
struct lprocfs_vars list[] = {
{ "dump_namespaces", &ldlm_dump_ns_fops, NULL, 0222 },
{ "dump_granted_max", &ldlm_rw_uint_fops,
&ldlm_dump_granted_max },
{ NULL } };
LASSERT(ldlm_ns_proc_dir == NULL);
ldlm_type_proc_dir = lprocfs_register(OBD_LDLM_DEVICENAME, ldlm_debugfs_dir = ldebugfs_register(OBD_LDLM_DEVICENAME,
proc_lustre_root, debugfs_lustre_root,
NULL, NULL); NULL, NULL);
if (IS_ERR(ldlm_type_proc_dir)) { if (IS_ERR_OR_NULL(ldlm_debugfs_dir)) {
CERROR("LProcFS failed in ldlm-init\n"); CERROR("LProcFS failed in ldlm-init\n");
rc = PTR_ERR(ldlm_type_proc_dir); rc = ldlm_debugfs_dir ? PTR_ERR(ldlm_debugfs_dir) : -ENOMEM;
goto err; goto err;
} }
ldlm_ns_proc_dir = lprocfs_register("namespaces", ldlm_ns_debugfs_dir = ldebugfs_register("namespaces",
ldlm_type_proc_dir, ldlm_debugfs_dir,
NULL, NULL); NULL, NULL);
if (IS_ERR(ldlm_ns_proc_dir)) { if (IS_ERR_OR_NULL(ldlm_ns_debugfs_dir)) {
CERROR("LProcFS failed in ldlm-init\n"); CERROR("LProcFS failed in ldlm-init\n");
rc = PTR_ERR(ldlm_ns_proc_dir); rc = ldlm_ns_debugfs_dir ? PTR_ERR(ldlm_ns_debugfs_dir)
: -ENOMEM;
goto err_type; goto err_type;
} }
ldlm_svc_proc_dir = lprocfs_register("services", ldlm_svc_debugfs_dir = ldebugfs_register("services",
ldlm_type_proc_dir, ldlm_debugfs_dir,
NULL, NULL); NULL, NULL);
if (IS_ERR(ldlm_svc_proc_dir)) { if (IS_ERR_OR_NULL(ldlm_svc_debugfs_dir)) {
CERROR("LProcFS failed in ldlm-init\n"); CERROR("LProcFS failed in ldlm-init\n");
rc = PTR_ERR(ldlm_svc_proc_dir); rc = ldlm_svc_debugfs_dir ? PTR_ERR(ldlm_svc_debugfs_dir)
: -ENOMEM;
goto err_ns; goto err_ns;
} }
rc = lprocfs_add_vars(ldlm_type_proc_dir, list, NULL); rc = ldebugfs_add_vars(ldlm_debugfs_dir, ldlm_debugfs_list, NULL);
return 0; return 0;
err_ns: err_ns:
lprocfs_remove(&ldlm_ns_proc_dir); ldebugfs_remove(&ldlm_ns_debugfs_dir);
err_type: err_type:
lprocfs_remove(&ldlm_type_proc_dir); ldebugfs_remove(&ldlm_debugfs_dir);
err: err:
ldlm_svc_proc_dir = NULL; ldlm_svc_debugfs_dir = NULL;
ldlm_type_proc_dir = NULL; ldlm_ns_debugfs_dir = NULL;
ldlm_ns_proc_dir = NULL; ldlm_debugfs_dir = NULL;
return rc; return rc;
} }
void ldlm_proc_cleanup(void) void ldlm_debugfs_cleanup(void)
{ {
if (ldlm_svc_proc_dir) if (!IS_ERR_OR_NULL(ldlm_svc_debugfs_dir))
lprocfs_remove(&ldlm_svc_proc_dir); ldebugfs_remove(&ldlm_svc_debugfs_dir);
if (ldlm_ns_proc_dir) if (!IS_ERR_OR_NULL(ldlm_ns_debugfs_dir))
lprocfs_remove(&ldlm_ns_proc_dir); ldebugfs_remove(&ldlm_ns_debugfs_dir);
if (ldlm_type_proc_dir) if (!IS_ERR_OR_NULL(ldlm_debugfs_dir))
lprocfs_remove(&ldlm_type_proc_dir); ldebugfs_remove(&ldlm_debugfs_dir);
ldlm_svc_proc_dir = NULL; ldlm_svc_debugfs_dir = NULL;
ldlm_type_proc_dir = NULL; ldlm_ns_debugfs_dir = NULL;
ldlm_ns_proc_dir = NULL; ldlm_debugfs_dir = NULL;
} }
static ssize_t resource_count_show(struct kobject *kobj, struct attribute *attr, static ssize_t resource_count_show(struct kobject *kobj, struct attribute *attr,
...@@ -369,13 +371,13 @@ static struct kobj_type ldlm_ns_ktype = { ...@@ -369,13 +371,13 @@ static struct kobj_type ldlm_ns_ktype = {
.release = ldlm_ns_release, .release = ldlm_ns_release,
}; };
void ldlm_namespace_proc_unregister(struct ldlm_namespace *ns) static void ldlm_namespace_debugfs_unregister(struct ldlm_namespace *ns)
{ {
if (ns->ns_proc_dir_entry == NULL) if (IS_ERR_OR_NULL(ns->ns_debugfs_entry))
CERROR("dlm namespace %s has no procfs dir?\n", CERROR("dlm namespace %s has no procfs dir?\n",
ldlm_ns_name(ns)); ldlm_ns_name(ns));
else else
lprocfs_remove(&ns->ns_proc_dir_entry); ldebugfs_remove(&ns->ns_debugfs_entry);
if (ns->ns_stats != NULL) if (ns->ns_stats != NULL)
lprocfs_free_stats(&ns->ns_stats); lprocfs_free_stats(&ns->ns_stats);
...@@ -408,31 +410,23 @@ int ldlm_namespace_sysfs_register(struct ldlm_namespace *ns) ...@@ -408,31 +410,23 @@ int ldlm_namespace_sysfs_register(struct ldlm_namespace *ns)
return err; return err;
} }
int ldlm_namespace_proc_register(struct ldlm_namespace *ns) static int ldlm_namespace_debugfs_register(struct ldlm_namespace *ns)
{ {
struct proc_dir_entry *ns_pde; struct dentry *ns_entry;
LASSERT(ns != NULL); if (!IS_ERR_OR_NULL(ns->ns_debugfs_entry)) {
LASSERT(ns->ns_rs_hash != NULL); ns_entry = ns->ns_debugfs_entry;
if (ns->ns_proc_dir_entry != NULL) {
ns_pde = ns->ns_proc_dir_entry;
} else { } else {
ns_pde = proc_mkdir(ldlm_ns_name(ns), ldlm_ns_proc_dir); ns_entry = debugfs_create_dir(ldlm_ns_name(ns),
if (ns_pde == NULL) ldlm_ns_debugfs_dir);
if (ns_entry == NULL)
return -ENOMEM; return -ENOMEM;
ns->ns_proc_dir_entry = ns_pde; ns->ns_debugfs_entry = ns_entry;
} }
return 0; return 0;
} }
#undef MAX_STRING_SIZE #undef MAX_STRING_SIZE
#else /* CONFIG_PROC_FS */
#define ldlm_namespace_proc_unregister(ns) ({; })
#define ldlm_namespace_proc_register(ns) ({0; })
#endif /* CONFIG_PROC_FS */
static unsigned ldlm_res_hop_hash(struct cfs_hash *hs, static unsigned ldlm_res_hop_hash(struct cfs_hash *hs,
const void *key, unsigned mask) const void *key, unsigned mask)
...@@ -680,7 +674,7 @@ struct ldlm_namespace *ldlm_namespace_new(struct obd_device *obd, char *name, ...@@ -680,7 +674,7 @@ struct ldlm_namespace *ldlm_namespace_new(struct obd_device *obd, char *name,
goto out_hash; goto out_hash;
} }
rc = ldlm_namespace_proc_register(ns); rc = ldlm_namespace_debugfs_register(ns);
if (rc != 0) { if (rc != 0) {
CERROR("Can't initialize ns proc, rc %d\n", rc); CERROR("Can't initialize ns proc, rc %d\n", rc);
goto out_sysfs; goto out_sysfs;
...@@ -696,7 +690,7 @@ struct ldlm_namespace *ldlm_namespace_new(struct obd_device *obd, char *name, ...@@ -696,7 +690,7 @@ struct ldlm_namespace *ldlm_namespace_new(struct obd_device *obd, char *name,
ldlm_namespace_register(ns, client); ldlm_namespace_register(ns, client);
return ns; return ns;
out_proc: out_proc:
ldlm_namespace_proc_unregister(ns); ldlm_namespace_debugfs_unregister(ns);
out_sysfs: out_sysfs:
ldlm_namespace_sysfs_unregister(ns); ldlm_namespace_sysfs_unregister(ns);
ldlm_namespace_cleanup(ns, 0); ldlm_namespace_cleanup(ns, 0);
...@@ -944,7 +938,7 @@ void ldlm_namespace_free_post(struct ldlm_namespace *ns) ...@@ -944,7 +938,7 @@ void ldlm_namespace_free_post(struct ldlm_namespace *ns)
* Removing it after @dir may cause oops. */ * Removing it after @dir may cause oops. */
ldlm_pool_fini(&ns->ns_pool); ldlm_pool_fini(&ns->ns_pool);
ldlm_namespace_proc_unregister(ns); ldlm_namespace_debugfs_unregister(ns);
cfs_hash_putref(ns->ns_rs_hash); cfs_hash_putref(ns->ns_rs_hash);
/* Namespace \a ns should be not on list at this time, otherwise /* Namespace \a ns should be not on list at this time, otherwise
* this will cause issues related to using freed \a ns in poold * this will cause issues related to using freed \a ns in poold
......
...@@ -181,19 +181,19 @@ static const char *ll_eopcode2str(__u32 opcode) ...@@ -181,19 +181,19 @@ static const char *ll_eopcode2str(__u32 opcode)
return ll_eopcode_table[opcode].opname; return ll_eopcode_table[opcode].opname;
} }
#if defined(CONFIG_PROC_FS) static void
static void ptlrpc_lprocfs_register(struct proc_dir_entry *root, char *dir, ptlrpc_ldebugfs_register(struct dentry *root, char *dir,
char *name, char *name,
struct proc_dir_entry **procroot_ret, struct dentry **debugfs_root_ret,
struct lprocfs_stats **stats_ret) struct lprocfs_stats **stats_ret)
{ {
struct proc_dir_entry *svc_procroot; struct dentry *svc_debugfs_entry;
struct lprocfs_stats *svc_stats; struct lprocfs_stats *svc_stats;
int i, rc; int i, rc;
unsigned int svc_counter_config = LPROCFS_CNTR_AVGMINMAX | unsigned int svc_counter_config = LPROCFS_CNTR_AVGMINMAX |
LPROCFS_CNTR_STDDEV; LPROCFS_CNTR_STDDEV;
LASSERT(*procroot_ret == NULL); LASSERT(*debugfs_root_ret == NULL);
LASSERT(*stats_ret == NULL); LASSERT(*stats_ret == NULL);
svc_stats = lprocfs_alloc_stats(EXTRA_MAX_OPCODES+LUSTRE_MAX_OPCODES, svc_stats = lprocfs_alloc_stats(EXTRA_MAX_OPCODES+LUSTRE_MAX_OPCODES,
...@@ -201,14 +201,14 @@ static void ptlrpc_lprocfs_register(struct proc_dir_entry *root, char *dir, ...@@ -201,14 +201,14 @@ static void ptlrpc_lprocfs_register(struct proc_dir_entry *root, char *dir,
if (svc_stats == NULL) if (svc_stats == NULL)
return; return;
if (dir) { if (dir != NULL) {
svc_procroot = lprocfs_register(dir, root, NULL, NULL); svc_debugfs_entry = ldebugfs_register(dir, root, NULL, NULL);
if (IS_ERR(svc_procroot)) { if (IS_ERR(svc_debugfs_entry)) {
lprocfs_free_stats(&svc_stats); lprocfs_free_stats(&svc_stats);
return; return;
} }
} else { } else {
svc_procroot = root; svc_debugfs_entry = root;
} }
lprocfs_counter_init(svc_stats, PTLRPC_REQWAIT_CNTR, lprocfs_counter_init(svc_stats, PTLRPC_REQWAIT_CNTR,
...@@ -244,18 +244,19 @@ static void ptlrpc_lprocfs_register(struct proc_dir_entry *root, char *dir, ...@@ -244,18 +244,19 @@ static void ptlrpc_lprocfs_register(struct proc_dir_entry *root, char *dir,
ll_opcode2str(opcode), "usec"); ll_opcode2str(opcode), "usec");
} }
rc = lprocfs_register_stats(svc_procroot, name, svc_stats); rc = ldebugfs_register_stats(svc_debugfs_entry, name, svc_stats);
if (rc < 0) { if (rc < 0) {
if (dir) if (dir != NULL)
lprocfs_remove(&svc_procroot); ldebugfs_remove(&svc_debugfs_entry);
lprocfs_free_stats(&svc_stats); lprocfs_free_stats(&svc_stats);
} else { } else {
if (dir) if (dir != NULL)
*procroot_ret = svc_procroot; *debugfs_root_ret = svc_debugfs_entry;
*stats_ret = svc_stats; *stats_ret = svc_stats;
} }
} }
#if defined(CONFIG_PROC_FS)
static int static int
ptlrpc_lprocfs_req_history_len_seq_show(struct seq_file *m, void *v) ptlrpc_lprocfs_req_history_len_seq_show(struct seq_file *m, void *v)
{ {
...@@ -980,7 +981,7 @@ ptlrpc_lprocfs_svc_req_history_open(struct inode *inode, struct file *file) ...@@ -980,7 +981,7 @@ ptlrpc_lprocfs_svc_req_history_open(struct inode *inode, struct file *file)
return rc; return rc;
seqf = file->private_data; seqf = file->private_data;
seqf->private = PDE_DATA(inode); seqf->private = inode->i_private;
return 0; return 0;
} }
...@@ -1096,7 +1097,7 @@ int ptlrpc_sysfs_register_service(struct kset *parent, ...@@ -1096,7 +1097,7 @@ int ptlrpc_sysfs_register_service(struct kset *parent,
return rc; return rc;
} }
void ptlrpc_lprocfs_register_service(struct proc_dir_entry *entry, void ptlrpc_ldebugfs_register_service(struct dentry *entry,
struct ptlrpc_service *svc) struct ptlrpc_service *svc)
{ {
struct lprocfs_vars lproc_vars[] = { struct lprocfs_vars lproc_vars[] = {
...@@ -1124,16 +1125,16 @@ void ptlrpc_lprocfs_register_service(struct proc_dir_entry *entry, ...@@ -1124,16 +1125,16 @@ void ptlrpc_lprocfs_register_service(struct proc_dir_entry *entry,
int rc; int rc;
ptlrpc_lprocfs_register(entry, svc->srv_name, ptlrpc_ldebugfs_register(entry, svc->srv_name,
"stats", &svc->srv_procroot, "stats", &svc->srv_debugfs_entry,
&svc->srv_stats); &svc->srv_stats);
if (svc->srv_procroot == NULL) if (svc->srv_debugfs_entry == NULL)
return; return;
lprocfs_add_vars(svc->srv_procroot, lproc_vars, NULL); ldebugfs_add_vars(svc->srv_debugfs_entry, lproc_vars, NULL);
rc = lprocfs_seq_create(svc->srv_procroot, "req_history", rc = ldebugfs_seq_create(svc->srv_debugfs_entry, "req_history",
0400, &req_history_fops, svc); 0400, &req_history_fops, svc);
if (rc) if (rc)
CWARN("Error adding the req_history file\n"); CWARN("Error adding the req_history file\n");
...@@ -1141,9 +1142,11 @@ void ptlrpc_lprocfs_register_service(struct proc_dir_entry *entry, ...@@ -1141,9 +1142,11 @@ void ptlrpc_lprocfs_register_service(struct proc_dir_entry *entry,
void ptlrpc_lprocfs_register_obd(struct obd_device *obddev) void ptlrpc_lprocfs_register_obd(struct obd_device *obddev)
{ {
ptlrpc_lprocfs_register(obddev->obd_proc_entry, NULL, "stats", /* TODO: enable after change type of obddev->obd_proc_entry
&obddev->obd_svc_procroot, * ptlrpc_ldebugfs_register(obddev->obd_proc_entry, NULL, "stats",
&obddev->obd_svc_stats); * &obddev->obd_svc_procroot,
* &obddev->obd_svc_stats);
*/
} }
EXPORT_SYMBOL(ptlrpc_lprocfs_register_obd); EXPORT_SYMBOL(ptlrpc_lprocfs_register_obd);
...@@ -1191,8 +1194,8 @@ EXPORT_SYMBOL(ptlrpc_lprocfs_brw); ...@@ -1191,8 +1194,8 @@ EXPORT_SYMBOL(ptlrpc_lprocfs_brw);
void ptlrpc_lprocfs_unregister_service(struct ptlrpc_service *svc) void ptlrpc_lprocfs_unregister_service(struct ptlrpc_service *svc)
{ {
if (svc->srv_procroot != NULL) if (svc->srv_debugfs_entry != NULL)
lprocfs_remove(&svc->srv_procroot); ldebugfs_remove(&svc->srv_debugfs_entry);
if (svc->srv_stats) if (svc->srv_stats)
lprocfs_free_stats(&svc->srv_stats); lprocfs_free_stats(&svc->srv_stats);
......
...@@ -80,15 +80,14 @@ int ptlrpc_sysfs_register_service(struct kset *parent, ...@@ -80,15 +80,14 @@ int ptlrpc_sysfs_register_service(struct kset *parent,
struct ptlrpc_service *svc); struct ptlrpc_service *svc);
void ptlrpc_sysfs_unregister_service(struct ptlrpc_service *svc); void ptlrpc_sysfs_unregister_service(struct ptlrpc_service *svc);
#if defined(CONFIG_PROC_FS) void ptlrpc_ldebugfs_register_service(struct dentry *debugfs_entry,
void ptlrpc_lprocfs_register_service(struct proc_dir_entry *proc_entry,
struct ptlrpc_service *svc); struct ptlrpc_service *svc);
#if defined(CONFIG_PROC_FS)
void ptlrpc_lprocfs_unregister_service(struct ptlrpc_service *svc); void ptlrpc_lprocfs_unregister_service(struct ptlrpc_service *svc);
void ptlrpc_lprocfs_rpc_sent(struct ptlrpc_request *req, long amount); void ptlrpc_lprocfs_rpc_sent(struct ptlrpc_request *req, long amount);
void ptlrpc_lprocfs_do_request_stat(struct ptlrpc_request *req, void ptlrpc_lprocfs_do_request_stat(struct ptlrpc_request *req,
long q_usec, long work_usec); long q_usec, long work_usec);
#else #else
#define ptlrpc_lprocfs_register_service(params...) do {} while (0)
#define ptlrpc_lprocfs_unregister_service(params...) do {} while (0) #define ptlrpc_lprocfs_unregister_service(params...) do {} while (0)
#define ptlrpc_lprocfs_rpc_sent(params...) do {} while (0) #define ptlrpc_lprocfs_rpc_sent(params...) do {} while (0)
#define ptlrpc_lprocfs_do_request_stat(params...) do {} while (0) #define ptlrpc_lprocfs_do_request_stat(params...) do {} while (0)
......
...@@ -681,7 +681,7 @@ ptlrpc_service_part_init(struct ptlrpc_service *svc, ...@@ -681,7 +681,7 @@ ptlrpc_service_part_init(struct ptlrpc_service *svc,
struct ptlrpc_service * struct ptlrpc_service *
ptlrpc_register_service(struct ptlrpc_service_conf *conf, ptlrpc_register_service(struct ptlrpc_service_conf *conf,
struct kset *parent, struct kset *parent,
struct proc_dir_entry *proc_entry) struct dentry *debugfs_entry)
{ {
struct ptlrpc_service_cpt_conf *cconf = &conf->psc_cpt; struct ptlrpc_service_cpt_conf *cconf = &conf->psc_cpt;
struct ptlrpc_service *service; struct ptlrpc_service *service;
...@@ -805,8 +805,8 @@ ptlrpc_register_service(struct ptlrpc_service_conf *conf, ...@@ -805,8 +805,8 @@ ptlrpc_register_service(struct ptlrpc_service_conf *conf,
goto failed; goto failed;
} }
if (proc_entry != NULL) if (!IS_ERR_OR_NULL(debugfs_entry))
ptlrpc_lprocfs_register_service(proc_entry, service); ptlrpc_ldebugfs_register_service(debugfs_entry, service);
rc = ptlrpc_service_nrs_setup(service); rc = ptlrpc_service_nrs_setup(service);
if (rc != 0) if (rc != 0)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment