staging/lustre/ldlm: move all remaining files from procfs to debugfs
authorDmitry Eremin <dmitry4ever@gmail.com>
Thu, 21 May 2015 19:32:11 +0000 (15:32 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 31 May 2015 02:14:51 +0000 (11:14 +0900)
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>
drivers/staging/lustre/lustre/include/lustre_dlm.h
drivers/staging/lustre/lustre/include/lustre_net.h
drivers/staging/lustre/lustre/ldlm/ldlm_internal.h
drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c
drivers/staging/lustre/lustre/ldlm/ldlm_pool.c
drivers/staging/lustre/lustre/ldlm/ldlm_request.c
drivers/staging/lustre/lustre/ldlm/ldlm_resource.c
drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c
drivers/staging/lustre/lustre/ptlrpc/ptlrpc_internal.h
drivers/staging/lustre/lustre/ptlrpc/service.c

index b1e7d55..f6f4c03 100644 (file)
@@ -234,8 +234,8 @@ struct ldlm_pool_ops {
  * This feature is commonly referred to as lru_resize.
  */
 struct ldlm_pool {
-       /** Pool proc directory. */
-       struct proc_dir_entry   *pl_proc_dir;
+       /** Pool debugfs directory. */
+       struct dentry           *pl_debugfs_entry;
        /** Pool name, must be long enough to hold compound proc entry name. */
        char                    pl_name[100];
        /** Lock for protecting SLV/CLV updates. */
@@ -388,8 +388,8 @@ struct ldlm_namespace {
        /** Client side original connect flags supported by server. */
        __u64                   ns_orig_connect_flags;
 
-       /* namespace proc dir entry */
-       struct proc_dir_entry   *ns_proc_dir_entry;
+       /* namespace debugfs dir entry */
+       struct dentry           *ns_debugfs_entry;
 
        /**
         * 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);
 void ldlm_namespace_unregister(struct ldlm_namespace *ns, ldlm_side_t client);
 void ldlm_namespace_get(struct ldlm_namespace *ns);
 void ldlm_namespace_put(struct ldlm_namespace *ns);
-#if defined (CONFIG_PROC_FS)
-int ldlm_proc_setup(void);
-void ldlm_proc_cleanup(void);
-#else
-static inline int ldlm_proc_setup(void) { return 0; }
-static inline void ldlm_proc_cleanup(void) {}
-#endif
+int ldlm_debugfs_setup(void);
+void ldlm_debugfs_cleanup(void);
 
 /* resource.c - internal */
 struct ldlm_resource *ldlm_resource_get(struct ldlm_namespace *ns,
index 4fc987d..e65e7d8 100644 (file)
@@ -1978,8 +1978,8 @@ struct ptlrpc_service {
        int                             srv_nthrs_cpt_init;
        /** limit of threads number for each partition */
        int                             srv_nthrs_cpt_limit;
-       /** Root of /proc dir tree for this service */
-       struct proc_dir_entry      *srv_procroot;
+       /** Root of debugfs dir tree for this service */
+       struct dentry              *srv_debugfs_entry;
        /** Pointer to statistic data for this service */
        struct lprocfs_stats       *srv_stats;
        /** # hp per lp reqs to handle */
@@ -2530,7 +2530,7 @@ int ptlrpc_hpreq_handler(struct ptlrpc_request *req);
 struct ptlrpc_service *ptlrpc_register_service(
                                struct ptlrpc_service_conf *conf,
                                struct kset *parent,
-                               struct proc_dir_entry *proc_entry);
+                               struct dentry *debugfs_entry);
 void ptlrpc_stop_all_threads(struct ptlrpc_service *svc);
 
 int ptlrpc_start_threads(struct ptlrpc_service *svc);
index 636451d..cf81bdb 100644 (file)
@@ -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_no_ns_lock(struct ldlm_namespace *ns);
 
-extern struct proc_dir_entry *ldlm_svc_proc_dir;
-extern struct proc_dir_entry *ldlm_type_proc_dir;
+extern struct dentry *ldlm_svc_debugfs_dir;
 
 struct ldlm_state {
        struct ptlrpc_service *ldlm_cb_service;
index 4287edb..b7b6ca1 100644 (file)
@@ -1078,7 +1078,7 @@ static int ldlm_setup(void)
                goto out;
        }
 
-       rc = ldlm_proc_setup();
+       rc = ldlm_debugfs_setup();
        if (rc != 0)
                goto out;
 
@@ -1113,7 +1113,7 @@ static int ldlm_setup(void)
        };
        ldlm_state->ldlm_cb_service =
                        ptlrpc_register_service(&conf, ldlm_svc_kset,
-                                               ldlm_svc_proc_dir);
+                                               ldlm_svc_debugfs_dir);
        if (IS_ERR(ldlm_state->ldlm_cb_service)) {
                CERROR("failed to start service\n");
                rc = PTR_ERR(ldlm_state->ldlm_cb_service);
@@ -1204,8 +1204,7 @@ static int ldlm_cleanup(void)
        if (ldlm_kobj)
                kobject_put(ldlm_kobj);
 
-       ldlm_proc_cleanup();
-
+       ldlm_debugfs_cleanup();
 
        kfree(ldlm_state);
        ldlm_state = NULL;
index ed74735..310cc60 100644 (file)
@@ -654,7 +654,6 @@ int ldlm_pool_setup(struct ldlm_pool *pl, int limit)
 }
 EXPORT_SYMBOL(ldlm_pool_setup);
 
-#if defined(CONFIG_PROC_FS)
 static int lprocfs_pool_state_seq_show(struct seq_file *m, void *unused)
 {
        int granted, grant_rate, cancel_rate, grant_step;
@@ -745,7 +744,7 @@ LUSTRE_RW_ATTR(lock_volume_factor);
                snprintf(var_name, MAX_STRING_SIZE, #name);     \
                pool_vars[0].data = var;                        \
                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)
 
 /* 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)
        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 proc_dir_entry *parent_ns_proc;
+       struct dentry *debugfs_ns_parent;
        struct lprocfs_vars pool_vars[2];
        char *var_name = NULL;
        int rc = 0;
@@ -799,19 +798,19 @@ static int ldlm_pool_proc_init(struct ldlm_pool *pl)
        if (!var_name)
                return -ENOMEM;
 
-       parent_ns_proc = ns->ns_proc_dir_entry;
-       if (parent_ns_proc == NULL) {
-               CERROR("%s: proc entry is not initialized\n",
+       debugfs_ns_parent = ns->ns_debugfs_entry;
+       if (IS_ERR_OR_NULL(debugfs_ns_parent)) {
+               CERROR("%s: debugfs entry is not initialized\n",
                       ldlm_ns_name(ns));
                rc = -EINVAL;
                goto out_free_name;
        }
-       pl->pl_proc_dir = lprocfs_register("pool", parent_ns_proc,
-                                          NULL, NULL);
-       if (IS_ERR(pl->pl_proc_dir)) {
-               CERROR("LProcFS failed in ldlm-pool-init\n");
-               rc = PTR_ERR(pl->pl_proc_dir);
-               pl->pl_proc_dir = NULL;
+       pl->pl_debugfs_entry = ldebugfs_register("pool", debugfs_ns_parent,
+                                                NULL, NULL);
+       if (IS_ERR(pl->pl_debugfs_entry)) {
+               CERROR("LdebugFS failed in ldlm-pool-init\n");
+               rc = PTR_ERR(pl->pl_debugfs_entry);
+               pl->pl_debugfs_entry = NULL;
                goto out_free_name;
        }
 
@@ -819,7 +818,7 @@ static int ldlm_pool_proc_init(struct ldlm_pool *pl)
        memset(pool_vars, 0, sizeof(pool_vars));
        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 -
                                           LDLM_POOL_FIRST_STAT, 0);
@@ -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_CNTR_AVGMINMAX | LPROCFS_CNTR_STDDEV,
                             "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:
        kfree(var_name);
@@ -874,25 +874,17 @@ static void ldlm_pool_sysfs_fini(struct ldlm_pool *pl)
        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) {
                lprocfs_free_stats(&pl->pl_stats);
                pl->pl_stats = NULL;
        }
-       if (pl->pl_proc_dir != NULL) {
-               lprocfs_remove(&pl->pl_proc_dir);
-               pl->pl_proc_dir = NULL;
+       if (pl->pl_debugfs_entry != NULL) {
+               ldebugfs_remove(&pl->pl_debugfs_entry);
+               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 idx, ldlm_side_t client)
@@ -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_client_lock_volume = 0;
-       rc = ldlm_pool_proc_init(pl);
+       rc = ldlm_pool_debugfs_init(pl);
        if (rc)
                return rc;
 
@@ -940,7 +932,7 @@ EXPORT_SYMBOL(ldlm_pool_init);
 void ldlm_pool_fini(struct ldlm_pool *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
index 4f71318..6245a2c 100644 (file)
@@ -1462,7 +1462,7 @@ static ldlm_policy_res_t ldlm_cancel_lrur_policy(struct ldlm_namespace *ns,
                              lock->l_last_used));
        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);
 
        /* 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,
 }
 
 /**
- * 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
  * added and number of locks to be preferably canceled \a count.
  *
index 1e3190f..50e049b 100644 (file)
@@ -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
index 92d1ce9..8c0c995 100644 (file)
@@ -181,19 +181,19 @@ static const char *ll_eopcode2str(__u32 opcode)
        return ll_eopcode_table[opcode].opname;
 }
 
-#if defined(CONFIG_PROC_FS)
-static void ptlrpc_lprocfs_register(struct proc_dir_entry *root, char *dir,
-                                   char *name,
-                                   struct proc_dir_entry **procroot_ret,
-                                   struct lprocfs_stats **stats_ret)
+static void
+ptlrpc_ldebugfs_register(struct dentry *root, char *dir,
+                        char *name,
+                        struct dentry **debugfs_root_ret,
+                        struct lprocfs_stats **stats_ret)
 {
-       struct proc_dir_entry *svc_procroot;
+       struct dentry *svc_debugfs_entry;
        struct lprocfs_stats *svc_stats;
        int i, rc;
        unsigned int svc_counter_config = LPROCFS_CNTR_AVGMINMAX |
                                          LPROCFS_CNTR_STDDEV;
 
-       LASSERT(*procroot_ret == NULL);
+       LASSERT(*debugfs_root_ret == NULL);
        LASSERT(*stats_ret == NULL);
 
        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,
        if (svc_stats == NULL)
                return;
 
-       if (dir) {
-               svc_procroot = lprocfs_register(dir, root, NULL, NULL);
-               if (IS_ERR(svc_procroot)) {
+       if (dir != NULL) {
+               svc_debugfs_entry = ldebugfs_register(dir, root, NULL, NULL);
+               if (IS_ERR(svc_debugfs_entry)) {
                        lprocfs_free_stats(&svc_stats);
                        return;
                }
        } else {
-               svc_procroot = root;
+               svc_debugfs_entry = root;
        }
 
        lprocfs_counter_init(svc_stats, PTLRPC_REQWAIT_CNTR,
@@ -244,18 +244,19 @@ static void ptlrpc_lprocfs_register(struct proc_dir_entry *root, char *dir,
                                     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 (dir)
-                       lprocfs_remove(&svc_procroot);
+               if (dir != NULL)
+                       ldebugfs_remove(&svc_debugfs_entry);
                lprocfs_free_stats(&svc_stats);
        } else {
-               if (dir)
-                       *procroot_ret = svc_procroot;
+               if (dir != NULL)
+                       *debugfs_root_ret = svc_debugfs_entry;
                *stats_ret = svc_stats;
        }
 }
 
+#if defined(CONFIG_PROC_FS)
 static int
 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)
                return rc;
 
        seqf = file->private_data;
-       seqf->private = PDE_DATA(inode);
+       seqf->private = inode->i_private;
        return 0;
 }
 
@@ -1096,8 +1097,8 @@ int ptlrpc_sysfs_register_service(struct kset *parent,
        return rc;
 }
 
-void ptlrpc_lprocfs_register_service(struct proc_dir_entry *entry,
-                                    struct ptlrpc_service *svc)
+void ptlrpc_ldebugfs_register_service(struct dentry *entry,
+                                     struct ptlrpc_service *svc)
 {
        struct lprocfs_vars lproc_vars[] = {
                {.name       = "req_buffer_history_len",
@@ -1124,26 +1125,28 @@ void ptlrpc_lprocfs_register_service(struct proc_dir_entry *entry,
 
        int rc;
 
-       ptlrpc_lprocfs_register(entry, svc->srv_name,
-                               "stats", &svc->srv_procroot,
-                               &svc->srv_stats);
+       ptlrpc_ldebugfs_register(entry, svc->srv_name,
+                                "stats", &svc->srv_debugfs_entry,
+                                &svc->srv_stats);
 
-       if (svc->srv_procroot == NULL)
+       if (svc->srv_debugfs_entry == NULL)
                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",
-                               0400, &req_history_fops, svc);
+       rc = ldebugfs_seq_create(svc->srv_debugfs_entry, "req_history",
+                                0400, &req_history_fops, svc);
        if (rc)
                CWARN("Error adding the req_history file\n");
 }
 
 void ptlrpc_lprocfs_register_obd(struct obd_device *obddev)
 {
-       ptlrpc_lprocfs_register(obddev->obd_proc_entry, NULL, "stats",
-                               &obddev->obd_svc_procroot,
-                               &obddev->obd_svc_stats);
+/* TODO: enable after change type of obddev->obd_proc_entry
+ *     ptlrpc_ldebugfs_register(obddev->obd_proc_entry, NULL, "stats",
+ *                             &obddev->obd_svc_procroot,
+ *                             &obddev->obd_svc_stats);
+ */
 }
 EXPORT_SYMBOL(ptlrpc_lprocfs_register_obd);
 
@@ -1191,8 +1194,8 @@ EXPORT_SYMBOL(ptlrpc_lprocfs_brw);
 
 void ptlrpc_lprocfs_unregister_service(struct ptlrpc_service *svc)
 {
-       if (svc->srv_procroot != NULL)
-               lprocfs_remove(&svc->srv_procroot);
+       if (svc->srv_debugfs_entry != NULL)
+               ldebugfs_remove(&svc->srv_debugfs_entry);
 
        if (svc->srv_stats)
                lprocfs_free_stats(&svc->srv_stats);
index 8ea8221..9f9ef9a 100644 (file)
@@ -80,15 +80,14 @@ int ptlrpc_sysfs_register_service(struct kset *parent,
                                  struct ptlrpc_service *svc);
 void ptlrpc_sysfs_unregister_service(struct ptlrpc_service *svc);
 
+void ptlrpc_ldebugfs_register_service(struct dentry *debugfs_entry,
+                                     struct ptlrpc_service *svc);
 #if defined(CONFIG_PROC_FS)
-void ptlrpc_lprocfs_register_service(struct proc_dir_entry *proc_entry,
-                                    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_do_request_stat(struct ptlrpc_request *req,
                                     long q_usec, long work_usec);
 #else
-#define ptlrpc_lprocfs_register_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_do_request_stat(params...) do {} while (0)
index d6927e1..454d1a8 100644 (file)
@@ -681,7 +681,7 @@ free_reqs_array:
 struct ptlrpc_service *
 ptlrpc_register_service(struct ptlrpc_service_conf *conf,
                        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           *service;
@@ -805,8 +805,8 @@ ptlrpc_register_service(struct ptlrpc_service_conf *conf,
                        goto failed;
        }
 
-       if (proc_entry != NULL)
-               ptlrpc_lprocfs_register_service(proc_entry, service);
+       if (!IS_ERR_OR_NULL(debugfs_entry))
+               ptlrpc_ldebugfs_register_service(debugfs_entry, service);
 
        rc = ptlrpc_service_nrs_setup(service);
        if (rc != 0)