diff options
author | Dmitry Eremin <dmitry4ever@gmail.com> | 2015-05-21 15:32:11 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2015-05-31 11:14:51 +0900 |
commit | 700815d47f9da0477229f009b6fa235f20da1e21 (patch) | |
tree | d2da4eb128240b09b39edd19c43662ff4375f3f9 /drivers/staging/lustre/lustre/ldlm/ldlm_resource.c | |
parent | b40881e579588360242bd3f8f79f978d2a871e0e (diff) | |
download | op-kernel-dev-700815d47f9da0477229f009b6fa235f20da1e21.zip op-kernel-dev-700815d47f9da0477229f009b6fa235f20da1e21.tar.gz |
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: Dmitry Eremin <dmiter4ever@gmail.com>
Signed-off-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/lustre/lustre/ldlm/ldlm_resource.c')
-rw-r--r-- | drivers/staging/lustre/lustre/ldlm/ldlm_resource.c | 128 |
1 files changed, 61 insertions, 67 deletions
diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_resource.c b/drivers/staging/lustre/lustre/ldlm/ldlm_resource.c index 1e3190f..50e049b 100644 --- a/drivers/staging/lustre/lustre/ldlm/ldlm_resource.c +++ b/drivers/staging/lustre/lustre/ldlm/ldlm_resource.c @@ -61,17 +61,17 @@ LIST_HEAD(ldlm_cli_active_namespace_list); /* Client namespaces that don't have any locks in them */ LIST_HEAD(ldlm_cli_inactive_namespace_list); -struct proc_dir_entry *ldlm_type_proc_dir = NULL; -static struct proc_dir_entry *ldlm_ns_proc_dir = NULL; -struct proc_dir_entry *ldlm_svc_proc_dir = NULL; +static struct dentry *ldlm_debugfs_dir; +static struct dentry *ldlm_ns_debugfs_dir; +struct dentry *ldlm_svc_debugfs_dir; /* during debug dump certain amount of granted locks for one resource to avoid * DDOS. */ unsigned int ldlm_dump_granted_max = 256; -#if defined(CONFIG_PROC_FS) -static ssize_t lprocfs_wr_dump_ns(struct file *file, const char __user *buffer, - size_t count, loff_t *off) +static ssize_t +lprocfs_wr_dump_ns(struct file *file, const char __user *buffer, + size_t count, loff_t *off) { ldlm_dump_all_namespaces(LDLM_NAMESPACE_SERVER, D_DLMTRACE); ldlm_dump_all_namespaces(LDLM_NAMESPACE_CLIENT, D_DLMTRACE); @@ -81,72 +81,74 @@ LPROC_SEQ_FOPS_WR_ONLY(ldlm, dump_ns); 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; - 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, - proc_lustre_root, - NULL, NULL); - if (IS_ERR(ldlm_type_proc_dir)) { + + ldlm_debugfs_dir = ldebugfs_register(OBD_LDLM_DEVICENAME, + debugfs_lustre_root, + NULL, NULL); + if (IS_ERR_OR_NULL(ldlm_debugfs_dir)) { 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; } - ldlm_ns_proc_dir = lprocfs_register("namespaces", - ldlm_type_proc_dir, - NULL, NULL); - if (IS_ERR(ldlm_ns_proc_dir)) { + ldlm_ns_debugfs_dir = ldebugfs_register("namespaces", + ldlm_debugfs_dir, + NULL, NULL); + if (IS_ERR_OR_NULL(ldlm_ns_debugfs_dir)) { 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; } - ldlm_svc_proc_dir = lprocfs_register("services", - ldlm_type_proc_dir, - NULL, NULL); - if (IS_ERR(ldlm_svc_proc_dir)) { + ldlm_svc_debugfs_dir = ldebugfs_register("services", + ldlm_debugfs_dir, + NULL, NULL); + if (IS_ERR_OR_NULL(ldlm_svc_debugfs_dir)) { 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; } - rc = lprocfs_add_vars(ldlm_type_proc_dir, list, NULL); + rc = ldebugfs_add_vars(ldlm_debugfs_dir, ldlm_debugfs_list, NULL); return 0; err_ns: - lprocfs_remove(&ldlm_ns_proc_dir); + ldebugfs_remove(&ldlm_ns_debugfs_dir); err_type: - lprocfs_remove(&ldlm_type_proc_dir); + ldebugfs_remove(&ldlm_debugfs_dir); err: - ldlm_svc_proc_dir = NULL; - ldlm_type_proc_dir = NULL; - ldlm_ns_proc_dir = NULL; + ldlm_svc_debugfs_dir = NULL; + ldlm_ns_debugfs_dir = NULL; + ldlm_debugfs_dir = NULL; return rc; } -void ldlm_proc_cleanup(void) +void ldlm_debugfs_cleanup(void) { - if (ldlm_svc_proc_dir) - lprocfs_remove(&ldlm_svc_proc_dir); + if (!IS_ERR_OR_NULL(ldlm_svc_debugfs_dir)) + ldebugfs_remove(&ldlm_svc_debugfs_dir); - if (ldlm_ns_proc_dir) - lprocfs_remove(&ldlm_ns_proc_dir); + if (!IS_ERR_OR_NULL(ldlm_ns_debugfs_dir)) + ldebugfs_remove(&ldlm_ns_debugfs_dir); - if (ldlm_type_proc_dir) - lprocfs_remove(&ldlm_type_proc_dir); + if (!IS_ERR_OR_NULL(ldlm_debugfs_dir)) + ldebugfs_remove(&ldlm_debugfs_dir); - ldlm_svc_proc_dir = NULL; - ldlm_type_proc_dir = NULL; - ldlm_ns_proc_dir = NULL; + ldlm_svc_debugfs_dir = NULL; + ldlm_ns_debugfs_dir = NULL; + ldlm_debugfs_dir = NULL; } static ssize_t resource_count_show(struct kobject *kobj, struct attribute *attr, @@ -369,13 +371,13 @@ static struct kobj_type ldlm_ns_ktype = { .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", ldlm_ns_name(ns)); else - lprocfs_remove(&ns->ns_proc_dir_entry); + ldebugfs_remove(&ns->ns_debugfs_entry); if (ns->ns_stats != NULL) lprocfs_free_stats(&ns->ns_stats); @@ -408,31 +410,23 @@ int ldlm_namespace_sysfs_register(struct ldlm_namespace *ns) 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; - - LASSERT(ns != NULL); - LASSERT(ns->ns_rs_hash != NULL); + struct dentry *ns_entry; - if (ns->ns_proc_dir_entry != NULL) { - ns_pde = ns->ns_proc_dir_entry; + if (!IS_ERR_OR_NULL(ns->ns_debugfs_entry)) { + ns_entry = ns->ns_debugfs_entry; } else { - ns_pde = proc_mkdir(ldlm_ns_name(ns), ldlm_ns_proc_dir); - if (ns_pde == NULL) + ns_entry = debugfs_create_dir(ldlm_ns_name(ns), + ldlm_ns_debugfs_dir); + if (ns_entry == NULL) return -ENOMEM; - ns->ns_proc_dir_entry = ns_pde; + ns->ns_debugfs_entry = ns_entry; } return 0; } #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, const void *key, unsigned mask) @@ -680,7 +674,7 @@ struct ldlm_namespace *ldlm_namespace_new(struct obd_device *obd, char *name, goto out_hash; } - rc = ldlm_namespace_proc_register(ns); + rc = ldlm_namespace_debugfs_register(ns); if (rc != 0) { CERROR("Can't initialize ns proc, rc %d\n", rc); goto out_sysfs; @@ -696,7 +690,7 @@ struct ldlm_namespace *ldlm_namespace_new(struct obd_device *obd, char *name, ldlm_namespace_register(ns, client); return ns; out_proc: - ldlm_namespace_proc_unregister(ns); + ldlm_namespace_debugfs_unregister(ns); out_sysfs: ldlm_namespace_sysfs_unregister(ns); ldlm_namespace_cleanup(ns, 0); @@ -944,7 +938,7 @@ void ldlm_namespace_free_post(struct ldlm_namespace *ns) * Removing it after @dir may cause oops. */ ldlm_pool_fini(&ns->ns_pool); - ldlm_namespace_proc_unregister(ns); + ldlm_namespace_debugfs_unregister(ns); cfs_hash_putref(ns->ns_rs_hash); /* Namespace \a ns should be not on list at this time, otherwise * this will cause issues related to using freed \a ns in poold |