Whamcloud - gitweb
LU-8066 ldlm: move all remaining files from procfs to debugfs 55/29255/7
authorDmitry Eremin <dmitry.eremin@intel.com>
Thu, 8 Mar 2018 14:44:11 +0000 (09:44 -0500)
committerOleg Drokin <oleg.drokin@intel.com>
Wed, 2 May 2018 02:22:37 +0000 (02:22 +0000)
Move all files except stats. It will be moved later after change
type of obddev->obd_proc_entry member.

Linux-commit: 700815d47f9da0477229f009b6fa235f20da1e21

Clean up the helper functions used to implement "dump_granted_max" in
debugfs.

Change-Id: Id0a0b2c663295c7164c52f89d81525dbefbb992a
Signed-off-by: Dmitry Eremin <dmiter4ever@gmail.com>
Signed-off-by: Oleg Drokin <green@linuxhacker.ru>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: James Simmons <uja.ornl@yahoo.com>
Reviewed-on: https://review.whamcloud.com/29255
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Dmitry Eremin <dmitry.eremin@intel.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
19 files changed:
lustre/include/lustre_dlm.h
lustre/include/lustre_net.h
lustre/include/obd.h
lustre/ldlm/ldlm_internal.h
lustre/ldlm/ldlm_lockd.c
lustre/ldlm/ldlm_pool.c
lustre/ldlm/ldlm_request.c
lustre/ldlm/ldlm_resource.c
lustre/mdt/mdt_mds.c
lustre/mgs/mgs_handler.c
lustre/osp/osp_dev.c
lustre/ost/ost_handler.c
lustre/ptlrpc/lproc_ptlrpc.c
lustre/ptlrpc/nrs_crr.c
lustre/ptlrpc/nrs_delay.c
lustre/ptlrpc/nrs_orr.c
lustre/ptlrpc/nrs_tbf.c
lustre/ptlrpc/ptlrpc_internal.h
lustre/ptlrpc/service.c

index 9e833cc..10438ce 100644 (file)
@@ -232,8 +232,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. */
@@ -393,8 +393,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
@@ -1481,9 +1481,9 @@ void ldlm_namespace_unregister(struct ldlm_namespace *ns,
                               enum ldlm_side client);
 void ldlm_namespace_get(struct ldlm_namespace *ns);
 void ldlm_namespace_put(struct ldlm_namespace *ns);
-int ldlm_proc_setup(void);
-#ifdef CONFIG_PROC_FS
-void ldlm_proc_cleanup(void);
+
+int ldlm_debugfs_setup(void);
+void ldlm_debugfs_cleanup(void);
 
 static inline void ldlm_svc_get_eopc(const struct ldlm_request *dlm_req,
                                     struct lprocfs_stats *srv_stats)
@@ -1515,11 +1515,6 @@ static inline void ldlm_svc_get_eopc(const struct ldlm_request *dlm_req,
 
        return;
 }
-#else
-static inline void ldlm_proc_cleanup(void) {}
-static inline void ldlm_svc_get_eopc(const struct ldlm_request *dlm_req,
-                                    struct lprocfs_stats *srv_stats) {}
-#endif
 
 /* resource.c - internal */
 struct ldlm_resource *ldlm_resource_get(struct ldlm_namespace *ns,
index 15f294a..335cfe0 100644 (file)
@@ -1683,8 +1683,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 */
@@ -2283,7 +2283,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 e270aa5..9372539 100644 (file)
@@ -709,7 +709,7 @@ struct obd_device {
        struct dentry                   *obd_debugfs_entry;
        struct proc_dir_entry   *obd_proc_entry;
        struct proc_dir_entry   *obd_proc_exports_entry;
-       struct proc_dir_entry   *obd_svc_procroot;
+       struct dentry                   *obd_svc_debugfs_entry;
        struct lprocfs_stats    *obd_svc_stats;
        struct attribute_group           obd_attrs_group;
        struct attribute               **obd_attrs;
index 92f2d58..0afd9e2 100644 (file)
@@ -218,7 +218,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 dentry *ldlm_svc_debugfs_dir;
 
 struct ldlm_state {
         struct ptlrpc_service *ldlm_cb_service;
@@ -338,13 +338,13 @@ enum ldlm_policy_res {
        struct __##var##__dummy_write {; } /* semicolon catcher */
 
 static inline void
-ldlm_add_var(struct lprocfs_vars *vars, struct proc_dir_entry *proc_dir,
+ldlm_add_var(struct lprocfs_vars *vars, struct dentry *debugfs_entry,
             const char *name, void *data, const struct file_operations *ops)
 {
        snprintf((char *)vars->name, MAX_STRING_SIZE, "%s", name);
        vars->data = data;
        vars->fops = ops;
-       lprocfs_add_vars(proc_dir, vars, NULL);
+       ldebugfs_add_vars(debugfs_entry, vars, NULL);
 }
 
 static inline int is_granted_or_cancelled(struct ldlm_lock *lock)
index b1def6d..81ed655 100644 (file)
@@ -2817,11 +2817,9 @@ static int ldlm_setup(void)
        if (!ldlm_svc_kset)
                GOTO(out, -ENOMEM);
 
-#ifdef CONFIG_PROC_FS
-       rc = ldlm_proc_setup();
+       rc = ldlm_debugfs_setup();
        if (rc != 0)
                GOTO(out, rc);
-#endif /* CONFIG_PROC_FS */
 
        memset(&conf, 0, sizeof(conf));
        conf = (typeof(conf)) {
@@ -2854,7 +2852,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);
@@ -2898,7 +2896,7 @@ static int ldlm_setup(void)
        };
        ldlm_state->ldlm_cancel_service = \
                        ptlrpc_register_service(&conf, ldlm_svc_kset,
-                                               ldlm_svc_proc_dir);
+                                               ldlm_svc_debugfs_dir);
        if (IS_ERR(ldlm_state->ldlm_cancel_service)) {
                CERROR("failed to start service\n");
                rc = PTR_ERR(ldlm_state->ldlm_cancel_service);
@@ -3014,7 +3012,7 @@ static int ldlm_cleanup(void)
                kobject_put(ldlm_kobj);
        }
 
-       ldlm_proc_cleanup();
+       ldlm_debugfs_cleanup();
 
 #ifdef HAVE_SERVER_SUPPORT
        if (expired_lock_thread_state != ELT_STOPPED) {
index 282546d..dd1856b 100644 (file)
@@ -695,7 +695,8 @@ static int lprocfs_pool_state_seq_show(struct seq_file *m, void *unused)
                   granted, limit);
        return 0;
 }
-LPROC_SEQ_FOPS_RO(lprocfs_pool_state);
+
+LDEBUGFS_SEQ_FOPS_RO(lprocfs_pool_state);
 
 static ssize_t grant_speed_show(struct kobject *kobj, struct attribute *attr,
                                char *buf)
@@ -779,10 +780,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;
@@ -792,18 +793,18 @@ 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));
                GOTO(out_free_name, rc = -EINVAL);
        }
-       pl->pl_proc_dir = lprocfs_register("pool", parent_ns_proc,
-                                          NULL, NULL);
-       if (IS_ERR(pl->pl_proc_dir)) {
-               rc = PTR_ERR(pl->pl_proc_dir);
-               pl->pl_proc_dir = NULL;
-               CERROR("%s: cannot create 'pool' proc entry: rc = %d\n",
+       pl->pl_debugfs_entry = ldebugfs_register("pool", debugfs_ns_parent,
+                                                NULL, NULL);
+       if (IS_ERR(pl->pl_debugfs_entry)) {
+               rc = PTR_ERR(pl->pl_debugfs_entry);
+               pl->pl_debugfs_entry = NULL;
+               CERROR("%s: cannot create 'pool' debugfs entry: rc = %d\n",
                       ldlm_ns_name(ns), rc);
                GOTO(out_free_name, rc);
        }
@@ -812,7 +813,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_add_var(&pool_vars[0], pl->pl_proc_dir, "state", pl,
+       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 -
@@ -853,7 +854,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);
 
         EXIT;
 out_free_name:
@@ -867,15 +869,15 @@ 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;
         }
 }
 
@@ -909,7 +911,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);
 
@@ -926,7 +928,7 @@ void ldlm_pool_fini(struct ldlm_pool *pl)
 {
        ENTRY;
        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 1fc6b1a..3cdeea7 100644 (file)
@@ -1462,7 +1462,7 @@ static enum ldlm_policy_res ldlm_cancel_lrur_policy(struct ldlm_namespace *ns,
        la = ktime_to_ns(ktime_sub(cur, lock->l_last_used)) / NSEC_PER_SEC;
        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
@@ -1489,7 +1489,7 @@ ldlm_cancel_lrur_no_wait_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 bf45a6d..4c4bc96 100644 (file)
@@ -58,24 +58,24 @@ LIST_HEAD(ldlm_cli_active_namespace_list);
 /* Client namespaces that don't have any locks in them */
 LIST_HEAD(ldlm_cli_inactive_namespace_list);
 
-static struct proc_dir_entry *ldlm_type_proc_dir;
-static struct proc_dir_entry *ldlm_ns_proc_dir;
-struct proc_dir_entry *ldlm_svc_proc_dir;
+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. */
 static unsigned int ldlm_dump_granted_max = 256;
 
-#ifdef CONFIG_PROC_FS
-static ssize_t
-lprocfs_dump_ns_seq_write(struct file *file, const char __user *buffer,
-                         size_t count, loff_t *off)
+static ssize_t ldebugfs_dump_ns_seq_write(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);
        RETURN(count);
 }
-LPROC_SEQ_FOPS_WR_ONLY(ldlm, dump_ns);
+
+LDEBUGFS_FOPS_WR_ONLY(ldlm, dump_ns);
 
 static int ldlm_rw_uint_seq_show(struct seq_file *m, void *v)
 {
@@ -96,7 +96,7 @@ ldlm_rw_uint_seq_write(struct file *file, const char __user *buffer,
                                    (unsigned int *)seq->private);
 }
 
-LPROC_SEQ_FOPS(ldlm_rw_uint);
+LDEBUGFS_SEQ_FOPS(ldlm_rw_uint);
 
 #ifdef HAVE_SERVER_SUPPORT
 
@@ -163,7 +163,7 @@ static ssize_t seq_watermark_write(struct file *file,
 
 static int seq_watermark_open(struct inode *inode, struct file *file)
 {
-       return single_open(file, seq_watermark_show, PDE_DATA(inode));
+       return single_open(file, seq_watermark_show, inode->i_private);
 }
 
 static const struct file_operations ldlm_watermark_fops = {
@@ -184,7 +184,7 @@ static int seq_granted_show(struct seq_file *m, void *data)
 
 static int seq_granted_open(struct inode *inode, struct file *file)
 {
-       return single_open(file, seq_granted_show, PDE_DATA(inode));
+       return single_open(file, seq_granted_show, inode->i_private);
 }
 
 static const struct file_operations ldlm_granted_fops = {
@@ -197,59 +197,62 @@ static const struct file_operations ldlm_granted_fops = {
 
 #endif /* HAVE_SERVER_SUPPORT */
 
-int ldlm_proc_setup(void)
-{
-       int rc;
-       struct lprocfs_vars list[] = {
-               { .name =       "dump_namespaces",
-                 .fops =       &ldlm_dump_ns_fops,
-                 .proc_mode =  0222 },
-               { .name =       "dump_granted_max",
-                 .fops =       &ldlm_rw_uint_fops,
-                 .data =       &ldlm_dump_granted_max },
+static struct lprocfs_vars ldlm_debugfs_list[] = {
+       { .name =       "dump_namespaces",
+         .fops =       &ldlm_dump_ns_fops,
+         .proc_mode =  0222 },
+       { .name =       "dump_granted_max",
+         .fops =       &ldlm_rw_uint_fops,
+         .data =       &ldlm_dump_granted_max },
 #ifdef HAVE_SERVER_SUPPORT
-               { .name =       "lock_reclaim_threshold_mb",
-                 .fops =       &ldlm_watermark_fops,
-                 .data =       &ldlm_reclaim_threshold_mb },
-               { .name =       "lock_limit_mb",
-                 .fops =       &ldlm_watermark_fops,
-                 .data =       &ldlm_lock_limit_mb },
-               { .name =       "lock_granted_count",
-                 .fops =       &ldlm_granted_fops,
-                 .data =       &ldlm_granted_total },
+       { .name =       "lock_reclaim_threshold_mb",
+         .fops =       &ldlm_watermark_fops,
+         .data =       &ldlm_reclaim_threshold_mb },
+       { .name =       "lock_limit_mb",
+         .fops =       &ldlm_watermark_fops,
+         .data =       &ldlm_lock_limit_mb },
+       { .name =       "lock_granted_count",
+         .fops =       &ldlm_granted_fops,
+         .data =       &ldlm_granted_total },
 #endif
-               { NULL }};
-       ENTRY;
-       LASSERT(ldlm_ns_proc_dir == NULL);
+       { NULL }
+};
 
-       ldlm_type_proc_dir = lprocfs_register(OBD_LDLM_DEVICENAME,
-                                             proc_lustre_root,
-                                             NULL, NULL);
-       if (IS_ERR(ldlm_type_proc_dir)) {
-               CERROR("LProcFS failed in ldlm-init\n");
-               rc = PTR_ERR(ldlm_type_proc_dir);
+int ldlm_debugfs_setup(void)
+{
+       int rc;
+
+       ENTRY;
+       ldlm_debugfs_dir = ldebugfs_register(OBD_LDLM_DEVICENAME,
+                                            debugfs_lustre_root,
+                                            NULL, NULL);
+       if (IS_ERR_OR_NULL(ldlm_debugfs_dir)) {
+               CERROR("LDebugFS failed in ldlm-init\n");
+               rc = ldlm_debugfs_dir ? PTR_ERR(ldlm_debugfs_dir) : -ENOMEM;
                GOTO(err, rc);
        }
 
-       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, rc);
        }
 
-       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);
        }
 
-       rc = lprocfs_add_vars(ldlm_type_proc_dir, list, NULL);
+       rc = ldebugfs_add_vars(ldlm_debugfs_dir, ldlm_debugfs_list, NULL);
        if (rc != 0) {
                CERROR("LProcFS failed in ldlm-init\n");
                GOTO(err_svc, rc);
@@ -258,26 +261,32 @@ int ldlm_proc_setup(void)
        RETURN(0);
 
 err_svc:
-       lprocfs_remove(&ldlm_svc_proc_dir);
+       ldebugfs_remove(&ldlm_svc_debugfs_dir);
 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;
-        RETURN(rc);
+       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_debugfs_dir = NULL;
+       ldlm_ns_debugfs_dir = NULL;
+       ldlm_debugfs_dir = NULL;
 }
 
 static ssize_t resource_count_show(struct kobject *kobj, struct attribute *attr,
@@ -662,13 +671,13 @@ static struct kobj_type ldlm_ns_ktype = {
        .release        = ldlm_ns_release,
 };
 
-static 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);
@@ -701,31 +710,23 @@ int ldlm_namespace_sysfs_register(struct ldlm_namespace *ns)
        return err;
 }
 
-static 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);
-        LASSERT(ns->ns_rs_hash != NULL);
-
-       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)
                        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)
@@ -971,7 +972,7 @@ struct ldlm_namespace *ldlm_namespace_new(struct obd_device *obd, char *name,
                GOTO(out_hash, rc);
        }
 
-       rc = ldlm_namespace_proc_register(ns);
+       rc = ldlm_namespace_debugfs_register(ns);
        if (rc) {
                CERROR("Can't initialize ns proc, rc %d\n", rc);
                GOTO(out_sysfs, rc);
@@ -987,7 +988,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);
@@ -1253,7 +1254,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);
        ldlm_namespace_sysfs_unregister(ns);
        cfs_hash_putref(ns->ns_rs_hash);
        /* Namespace \a ns should be not on list at this time, otherwise
index e69ea49..0154081 100644 (file)
@@ -151,13 +151,9 @@ static int mds_start_ptlrpc_service(struct mds_device *m)
 {
        static struct ptlrpc_service_conf conf;
        struct obd_device *obd = m->mds_md_dev.md_lu_dev.ld_obd;
-       struct proc_dir_entry *procfs_entry;
        int rc = 0;
        ENTRY;
 
-       procfs_entry = obd->obd_proc_entry;
-       LASSERT(procfs_entry != NULL);
-
        conf = (typeof(conf)) {
                .psc_name               = LUSTRE_MDT_NAME,
                .psc_watchdog_factor    = MDT_SERVICE_WATCHDOG_FACTOR,
@@ -193,7 +189,7 @@ static int mds_start_ptlrpc_service(struct mds_device *m)
                },
        };
        m->mds_regular_service = ptlrpc_register_service(&conf, &obd->obd_kset,
-                                                        procfs_entry);
+                                                        obd->obd_debugfs_entry);
        if (IS_ERR(m->mds_regular_service)) {
                rc = PTR_ERR(m->mds_regular_service);
                CERROR("failed to start regular mdt service: %d\n", rc);
@@ -237,7 +233,7 @@ static int mds_start_ptlrpc_service(struct mds_device *m)
                },
        };
        m->mds_readpage_service = ptlrpc_register_service(&conf, &obd->obd_kset,
-                                                         procfs_entry);
+                                                         obd->obd_debugfs_entry);
        if (IS_ERR(m->mds_readpage_service)) {
                rc = PTR_ERR(m->mds_readpage_service);
                CERROR("failed to start readpage service: %d\n", rc);
@@ -285,7 +281,7 @@ static int mds_start_ptlrpc_service(struct mds_device *m)
                },
        };
        m->mds_setattr_service = ptlrpc_register_service(&conf, &obd->obd_kset,
-                                                        procfs_entry);
+                                                        obd->obd_debugfs_entry);
        if (IS_ERR(m->mds_setattr_service)) {
                rc = PTR_ERR(m->mds_setattr_service);
                CERROR("failed to start setattr service: %d\n", rc);
@@ -331,7 +327,7 @@ static int mds_start_ptlrpc_service(struct mds_device *m)
                },
        };
        m->mds_out_service = ptlrpc_register_service(&conf, &obd->obd_kset,
-                                                    procfs_entry);
+                                                    obd->obd_debugfs_entry);
        if (IS_ERR(m->mds_out_service)) {
                rc = PTR_ERR(m->mds_out_service);
                CERROR("failed to start out service: %d\n", rc);
@@ -367,7 +363,7 @@ static int mds_start_ptlrpc_service(struct mds_device *m)
                },
        };
        m->mds_mdsc_service = ptlrpc_register_service(&conf, &obd->obd_kset,
-                                                     procfs_entry);
+                                                     obd->obd_debugfs_entry);
        if (IS_ERR(m->mds_mdsc_service)) {
                rc = PTR_ERR(m->mds_mdsc_service);
                CERROR("failed to start seq controller service: %d\n", rc);
@@ -404,7 +400,7 @@ static int mds_start_ptlrpc_service(struct mds_device *m)
                },
        };
        m->mds_mdss_service = ptlrpc_register_service(&conf, &obd->obd_kset,
-                                                     procfs_entry);
+                                                     obd->obd_debugfs_entry);
        if (IS_ERR(m->mds_mdss_service)) {
                rc = PTR_ERR(m->mds_mdss_service);
                CERROR("failed to start metadata seq server service: %d\n", rc);
@@ -439,7 +435,7 @@ static int mds_start_ptlrpc_service(struct mds_device *m)
                },
        };
        m->mds_fld_service = ptlrpc_register_service(&conf, &obd->obd_kset,
-                                                    procfs_entry);
+                                                    obd->obd_debugfs_entry);
        if (IS_ERR(m->mds_fld_service)) {
                rc = PTR_ERR(m->mds_fld_service);
                CERROR("failed to start fld service: %d\n", rc);
@@ -478,7 +474,7 @@ static int mds_start_ptlrpc_service(struct mds_device *m)
                },
        };
        m->mds_io_service = ptlrpc_register_service(&conf, &obd->obd_kset,
-                                                   procfs_entry);
+                                                   obd->obd_debugfs_entry);
        if (IS_ERR(m->mds_io_service)) {
                rc = PTR_ERR(m->mds_io_service);
                CERROR("failed to start MDT I/O service: %d\n", rc);
@@ -613,7 +609,7 @@ static struct obd_ops mds_obd_device_ops = {
 
 int mds_mod_init(void)
 {
-       return class_register_type(&mds_obd_device_ops, NULL, true, NULL,
+       return class_register_type(&mds_obd_device_ops, NULL, false, NULL,
                                   LUSTRE_MDS_NAME, &mds_device_type);
 }
 
index ba3ef64..fd23d9d 100644 (file)
@@ -1402,7 +1402,7 @@ static int mgs_init0(const struct lu_env *env, struct mgs_device *mgs,
 
        /* Start the service threads */
        mgs->mgs_service = ptlrpc_register_service(&conf, &obd->obd_kset,
-                                                  obd->obd_proc_entry);
+                                                  obd->obd_debugfs_entry);
        if (IS_ERR(mgs->mgs_service)) {
                rc = PTR_ERR(mgs->mgs_service);
                CERROR("failed to start mgs service: %d\n", rc);
index 21dd9e7..33f03a4 100644 (file)
@@ -1942,7 +1942,7 @@ static int __init osp_init(void)
                return rc;
        }
 
-       rc = class_register_type(&lwp_obd_device_ops, NULL, true, NULL,
+       rc = class_register_type(&lwp_obd_device_ops, NULL, false, NULL,
                                 LUSTRE_LWP_NAME, &lwp_device_type);
        if (rc != 0) {
                class_unregister_type(LUSTRE_OSP_NAME);
index 0c95d7a..c866b7e 100644 (file)
@@ -114,7 +114,7 @@ static int ost_setup(struct obd_device *obd, struct lustre_cfg* lcfg)
        };
        ost->ost_service = ptlrpc_register_service(&svc_conf,
                                                   &obd->obd_kset,
-                                                  obd->obd_proc_entry);
+                                                  obd->obd_debugfs_entry);
        if (IS_ERR(ost->ost_service)) {
                rc = PTR_ERR(ost->ost_service);
                CERROR("failed to start service: %d\n", rc);
@@ -153,7 +153,7 @@ static int ost_setup(struct obd_device *obd, struct lustre_cfg* lcfg)
        };
        ost->ost_create_service = ptlrpc_register_service(&svc_conf,
                                                          &obd->obd_kset,
-                                                         obd->obd_proc_entry);
+                                                         obd->obd_debugfs_entry);
        if (IS_ERR(ost->ost_create_service)) {
                rc = PTR_ERR(ost->ost_create_service);
                CERROR("failed to start OST create service: %d\n", rc);
@@ -222,7 +222,7 @@ static int ost_setup(struct obd_device *obd, struct lustre_cfg* lcfg)
        };
        ost->ost_io_service = ptlrpc_register_service(&svc_conf,
                                                      &obd->obd_kset,
-                                                     obd->obd_proc_entry);
+                                                     obd->obd_debugfs_entry);
        if (IS_ERR(ost->ost_io_service)) {
                rc = PTR_ERR(ost->ost_io_service);
                CERROR("failed to start OST I/O service: %d\n", rc);
@@ -264,7 +264,7 @@ static int ost_setup(struct obd_device *obd, struct lustre_cfg* lcfg)
        };
        ost->ost_seq_service = ptlrpc_register_service(&svc_conf,
                                                       &obd->obd_kset,
-                                                      obd->obd_proc_entry);
+                                                      obd->obd_debugfs_entry);
        if (IS_ERR(ost->ost_seq_service)) {
                rc = PTR_ERR(ost->ost_seq_service);
                CERROR("failed to start OST seq service: %d\n", rc);
@@ -311,7 +311,7 @@ static int ost_setup(struct obd_device *obd, struct lustre_cfg* lcfg)
        };
        ost->ost_out_service = ptlrpc_register_service(&svc_conf,
                                                       &obd->obd_kset,
-                                                      obd->obd_proc_entry);
+                                                      obd->obd_debugfs_entry);
        if (IS_ERR(ost->ost_out_service)) {
                rc = PTR_ERR(ost->ost_out_service);
                CERROR("failed to start out service: %d\n", rc);
@@ -406,7 +406,7 @@ static int __init ost_init(void)
 
        ENTRY;
 
-       rc = class_register_type(&ost_obd_ops, NULL, true, NULL,
+       rc = class_register_type(&ost_obd_ops, NULL, false, NULL,
                                 LUSTRE_OSS_NAME, NULL);
 
         RETURN(rc);
index f46f3d5..400ce64 100644 (file)
@@ -194,32 +194,33 @@ static const char *ll_eopcode2str(__u32 opcode)
         return ll_eopcode_table[opcode].opname;
 }
 
-#ifdef 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(*stats_ret == NULL);
+       LASSERT(!*debugfs_root_ret);
+       LASSERT(!*stats_ret);
 
-        svc_stats = lprocfs_alloc_stats(EXTRA_MAX_OPCODES+LUSTRE_MAX_OPCODES,0);
-        if (svc_stats == NULL)
+       svc_stats = lprocfs_alloc_stats(EXTRA_MAX_OPCODES + LUSTRE_MAX_OPCODES,
+                                       0);
+       if (!svc_stats)
                 return;
 
         if (dir) {
-               svc_procroot = lprocfs_register(dir, root, NULL, NULL);
-                if (IS_ERR(svc_procroot)) {
+               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,
@@ -235,7 +236,7 @@ static void ptlrpc_lprocfs_register(struct proc_dir_entry *root, char *dir,
         for (i = 0; i < EXTRA_LAST_OPC; i++) {
                 char *units;
 
-                switch(i) {
+               switch (i) {
                 case BRW_WRITE_BYTES:
                 case BRW_READ_BYTES:
                         units = "bytes";
@@ -255,14 +256,14 @@ 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);
+                       ldebugfs_remove(&svc_debugfs_entry);
                 lprocfs_free_stats(&svc_stats);
         } else {
                 if (dir)
-                        *procroot_ret = svc_procroot;
+                       *debugfs_root_ret = svc_debugfs_entry;
                 *stats_ret = svc_stats;
         }
 }
@@ -281,7 +282,9 @@ ptlrpc_lprocfs_req_history_len_seq_show(struct seq_file *m, void *v)
        seq_printf(m, "%d\n", total);
        return 0;
 }
-LPROC_SEQ_FOPS_RO(ptlrpc_lprocfs_req_history_len);
+
+
+LDEBUGFS_SEQ_FOPS_RO(ptlrpc_lprocfs_req_history_len);
 
 static int
 ptlrpc_lprocfs_req_history_max_seq_show(struct seq_file *m, void *n)
@@ -340,7 +343,8 @@ ptlrpc_lprocfs_req_history_max_seq_write(struct file *file,
 
        return count;
 }
-LPROC_SEQ_FOPS(ptlrpc_lprocfs_req_history_max);
+
+LDEBUGFS_SEQ_FOPS(ptlrpc_lprocfs_req_history_max);
 
 static int
 ptlrpc_lprocfs_req_buffers_max_seq_show(struct seq_file *m, void *n)
@@ -376,7 +380,8 @@ ptlrpc_lprocfs_req_buffers_max_seq_write(struct file *file,
 
        return count;
 }
-LPROC_SEQ_FOPS(ptlrpc_lprocfs_req_buffers_max);
+
+LDEBUGFS_SEQ_FOPS(ptlrpc_lprocfs_req_buffers_max);
 
 static ssize_t threads_min_show(struct kobject *kobj, struct attribute *attr,
                                char *buf)
@@ -784,7 +789,8 @@ out:
 
        RETURN(rc < 0 ? rc : count);
 }
-LPROC_SEQ_FOPS(ptlrpc_lprocfs_nrs);
+
+LDEBUGFS_SEQ_FOPS(ptlrpc_lprocfs_nrs);
 
 /** @} nrs */
 
@@ -1069,7 +1075,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;
 }
 
@@ -1103,7 +1109,8 @@ static int ptlrpc_lprocfs_timeouts_seq_show(struct seq_file *m, void *n)
 
        return 0;
 }
-LPROC_SEQ_FOPS_RO(ptlrpc_lprocfs_timeouts);
+
+LDEBUGFS_SEQ_FOPS_RO(ptlrpc_lprocfs_timeouts);
 
 static ssize_t high_priority_ratio_show(struct kobject *kobj,
                                        struct attribute *attr,
@@ -1177,8 +1184,8 @@ int ptlrpc_sysfs_register_service(struct kset *parent,
                                    &parent->kobj, "%s", svc->srv_name);
 }
 
-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",
@@ -1208,25 +1215,24 @@ 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);
-       if (svc->srv_procroot == NULL)
+       ptlrpc_ldebugfs_register(entry, svc->srv_name, "stats",
+                                &svc->srv_debugfs_entry, &svc->srv_stats);
+       if (IS_ERR_OR_NULL(svc->srv_debugfs_entry))
                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);
+       ptlrpc_ldebugfs_register(obddev->obd_debugfs_entry, NULL, "stats",
+                                &obddev->obd_svc_debugfs_entry,
+                                &obddev->obd_svc_stats);
 }
 EXPORT_SYMBOL(ptlrpc_lprocfs_register_obd);
 
@@ -1274,8 +1280,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 (!IS_ERR_OR_NULL(svc->srv_debugfs_entry))
+               ldebugfs_remove(&svc->srv_debugfs_entry);
 
         if (svc->srv_stats)
                 lprocfs_free_stats(&svc->srv_stats);
@@ -1288,8 +1294,8 @@ void ptlrpc_lprocfs_unregister_obd(struct obd_device *obd)
         */
        lprocfs_obd_cleanup(obd);
 
-        if (obd->obd_svc_procroot)
-                lprocfs_remove(&obd->obd_svc_procroot);
+       if (!IS_ERR_OR_NULL(obd->obd_svc_debugfs_entry))
+               ldebugfs_remove(&obd->obd_svc_debugfs_entry);
 
         if (obd->obd_svc_stats)
                 lprocfs_free_stats(&obd->obd_svc_stats);
@@ -1450,5 +1456,3 @@ lprocfs_pinger_recov_seq_write(struct file *file, const char __user *buffer,
        return count;
 }
 EXPORT_SYMBOL(lprocfs_pinger_recov_seq_write);
-
-#endif /* CONFIG_PROC_FS */
index a909606..2d56bdb 100644 (file)
@@ -610,10 +610,8 @@ static void nrs_crrn_req_stop(struct ptlrpc_nrs_policy *policy,
               libcfs_id2str(req->rq_peer), nrq->nr_u.crr.cr_round);
 }
 
-#ifdef CONFIG_PROC_FS
-
 /**
- * lprocfs interface
+ * debugfs interface
  */
 
 /**
@@ -808,7 +806,8 @@ ptlrpc_lprocfs_nrs_crrn_quantum_seq_write(struct file *file,
 
        return rc == -ENODEV && rc2 == -ENODEV ? -ENODEV : count;
 }
-LPROC_SEQ_FOPS(ptlrpc_lprocfs_nrs_crrn_quantum);
+
+LDEBUGFS_SEQ_FOPS(ptlrpc_lprocfs_nrs_crrn_quantum);
 
 /**
  * Initializes a CRR-N policy's lprocfs interface for service \a svc
@@ -827,27 +826,12 @@ static int nrs_crrn_lprocfs_init(struct ptlrpc_service *svc)
                { NULL }
        };
 
-       if (svc->srv_procroot == NULL)
+       if (IS_ERR_OR_NULL(svc->srv_debugfs_entry))
                return 0;
 
-       return lprocfs_add_vars(svc->srv_procroot, nrs_crrn_lprocfs_vars, NULL);
-}
-
-/**
- * Cleans up a CRR-N policy's lprocfs interface for service \a svc
- *
- * \param[in] svc the service
- */
-static void nrs_crrn_lprocfs_fini(struct ptlrpc_service *svc)
-{
-       if (svc->srv_procroot == NULL)
-               return;
-
-       lprocfs_remove_proc_entry("nrs_crrn_quantum", svc->srv_procroot);
+       return ldebugfs_add_vars(svc->srv_debugfs_entry, nrs_crrn_lprocfs_vars, NULL);
 }
 
-#endif /* CONFIG_PROC_FS */
-
 /**
  * CRR-N policy operations
  */
@@ -861,10 +845,7 @@ static const struct ptlrpc_nrs_pol_ops nrs_crrn_ops = {
        .op_req_enqueue         = nrs_crrn_req_add,
        .op_req_dequeue         = nrs_crrn_req_del,
        .op_req_stop            = nrs_crrn_req_stop,
-#ifdef CONFIG_PROC_FS
        .op_lprocfs_init        = nrs_crrn_lprocfs_init,
-       .op_lprocfs_fini        = nrs_crrn_lprocfs_fini,
-#endif
 };
 
 /**
index 77da1c1..fec9c2f 100644 (file)
@@ -362,11 +362,9 @@ static int nrs_delay_ctl(struct ptlrpc_nrs_policy *policy,
 }
 
 /**
- * lprocfs interface
+ * debugfs interface
  */
 
-#ifdef CONFIG_PROC_FS
-
 /* nrs_delay_min and nrs_delay_max are bounded by these values */
 #define LPROCFS_NRS_DELAY_LOWER_BOUND          0
 #define LPROCFS_NRS_DELAY_UPPER_BOUND          65535
@@ -607,7 +605,7 @@ ptlrpc_lprocfs_nrs_delay_min_seq_write(struct file *file,
                                                  svc, NRS_POL_NAME_DELAY,
                                                  NRS_CTL_DELAY_WR_MIN, false);
 }
-LPROC_SEQ_FOPS(ptlrpc_lprocfs_nrs_delay_min);
+LDEBUGFS_SEQ_FOPS(ptlrpc_lprocfs_nrs_delay_min);
 
 /**
  * Retrieves the value of the maximum delay for delay policy instances on both
@@ -690,7 +688,7 @@ ptlrpc_lprocfs_nrs_delay_max_seq_write(struct file *file,
                                                  svc, NRS_POL_NAME_DELAY,
                                                  NRS_CTL_DELAY_WR_MAX, false);
 }
-LPROC_SEQ_FOPS(ptlrpc_lprocfs_nrs_delay_max);
+LDEBUGFS_SEQ_FOPS(ptlrpc_lprocfs_nrs_delay_max);
 
 /**
  * Retrieves the value of the percentage of requests which should be delayed
@@ -774,7 +772,8 @@ ptlrpc_lprocfs_nrs_delay_pct_seq_write(struct file *file,
                                                  svc, NRS_POL_NAME_DELAY,
                                                  NRS_CTL_DELAY_WR_PCT, false);
 }
-LPROC_SEQ_FOPS(ptlrpc_lprocfs_nrs_delay_pct);
+
+LDEBUGFS_SEQ_FOPS(ptlrpc_lprocfs_nrs_delay_pct);
 
 static int nrs_delay_lprocfs_init(struct ptlrpc_service *svc)
 {
@@ -791,25 +790,13 @@ static int nrs_delay_lprocfs_init(struct ptlrpc_service *svc)
                { NULL }
        };
 
-       if (svc->srv_procroot == NULL)
+       if (IS_ERR_OR_NULL(svc->srv_debugfs_entry))
                return 0;
 
-       return lprocfs_add_vars(svc->srv_procroot, nrs_delay_lprocfs_vars,
-                               NULL);
+       return ldebugfs_add_vars(svc->srv_debugfs_entry, nrs_delay_lprocfs_vars,
+                                NULL);
 }
 
-static void nrs_delay_lprocfs_fini(struct ptlrpc_service *svc)
-{
-       if (svc->srv_procroot == NULL)
-               return;
-
-       lprocfs_remove_proc_entry("nrs_delay_min", svc->srv_procroot);
-       lprocfs_remove_proc_entry("nrs_delay_max", svc->srv_procroot);
-       lprocfs_remove_proc_entry("nrs_delay_pct", svc->srv_procroot);
-}
-
-#endif /* CONFIG_PROC_FS */
-
 /**
  * Delay policy operations
  */
@@ -822,10 +809,7 @@ static const struct ptlrpc_nrs_pol_ops nrs_delay_ops = {
        .op_req_enqueue         = nrs_delay_req_add,
        .op_req_dequeue         = nrs_delay_req_del,
        .op_req_stop            = nrs_delay_req_stop,
-#ifdef CONFIG_PROC_FS
        .op_lprocfs_init        = nrs_delay_lprocfs_init,
-       .op_lprocfs_fini        = nrs_delay_lprocfs_fini,
-#endif
 };
 
 /**
index 6b6caea..85fc3a3 100644 (file)
@@ -1160,11 +1160,9 @@ static void nrs_orr_req_stop(struct ptlrpc_nrs_policy *policy,
 }
 
 /**
- * lprocfs interface
+ * debugfs interface
  */
 
-#ifdef CONFIG_PROC_FS
-
 /**
  * This allows to bundle the policy name into the lprocfs_vars::data pointer
  * so that lprocfs read/write functions can be used by both the ORR and TRR
@@ -1386,7 +1384,8 @@ ptlrpc_lprocfs_nrs_orr_quantum_seq_write(struct file *file,
 
        return rc == -ENODEV && rc2 == -ENODEV ? -ENODEV : count;
 }
-LPROC_SEQ_FOPS(ptlrpc_lprocfs_nrs_orr_quantum);
+
+LDEBUGFS_SEQ_FOPS(ptlrpc_lprocfs_nrs_orr_quantum);
 
 #define LPROCFS_NRS_OFF_NAME_REG               "reg_offset_type:"
 #define LPROCFS_NRS_OFF_NAME_HP                        "hp_offset_type:"
@@ -1606,7 +1605,8 @@ ptlrpc_lprocfs_nrs_orr_offset_type_seq_write(struct file *file,
 
        return rc == -ENODEV && rc2 == -ENODEV ? -ENODEV : count;
 }
-LPROC_SEQ_FOPS(ptlrpc_lprocfs_nrs_orr_offset_type);
+
+LDEBUGFS_SEQ_FOPS(ptlrpc_lprocfs_nrs_orr_offset_type);
 
 #define NRS_LPROCFS_REQ_SUPP_NAME_REG          "reg_supported:"
 #define NRS_LPROCFS_REQ_SUPP_NAME_HP           "hp_supported:"
@@ -1857,7 +1857,8 @@ ptlrpc_lprocfs_nrs_orr_supported_seq_write(struct file *file,
 
        return rc == -ENODEV && rc2 == -ENODEV ? -ENODEV : count;
 }
-LPROC_SEQ_FOPS(ptlrpc_lprocfs_nrs_orr_supported);
+
+LDEBUGFS_SEQ_FOPS(ptlrpc_lprocfs_nrs_orr_supported);
 
 static int nrs_orr_lprocfs_init(struct ptlrpc_service *svc)
 {
@@ -1873,7 +1874,7 @@ static int nrs_orr_lprocfs_init(struct ptlrpc_service *svc)
                { NULL }
        };
 
-       if (svc->srv_procroot == NULL)
+       if (IS_ERR_OR_NULL(svc->srv_debugfs_entry))
                return 0;
 
        lprocfs_orr_data.svc = svc;
@@ -1881,21 +1882,10 @@ static int nrs_orr_lprocfs_init(struct ptlrpc_service *svc)
        for (i = 0; i < ARRAY_SIZE(nrs_orr_lprocfs_vars); i++)
                nrs_orr_lprocfs_vars[i].data = &lprocfs_orr_data;
 
-       return lprocfs_add_vars(svc->srv_procroot, nrs_orr_lprocfs_vars, NULL);
-}
-
-static void nrs_orr_lprocfs_fini(struct ptlrpc_service *svc)
-{
-       if (svc->srv_procroot == NULL)
-               return;
-
-       lprocfs_remove_proc_entry("nrs_orr_quantum", svc->srv_procroot);
-       lprocfs_remove_proc_entry("nrs_orr_offset_type", svc->srv_procroot);
-       lprocfs_remove_proc_entry("nrs_orr_supported", svc->srv_procroot);
+       return ldebugfs_add_vars(svc->srv_debugfs_entry, nrs_orr_lprocfs_vars,
+                                NULL);
 }
 
-#endif /* CONFIG_PROC_FS */
-
 static const struct ptlrpc_nrs_pol_ops nrs_orr_ops = {
        .op_policy_init         = nrs_orr_init,
        .op_policy_start        = nrs_orr_start,
@@ -1907,10 +1897,7 @@ static const struct ptlrpc_nrs_pol_ops nrs_orr_ops = {
        .op_req_enqueue         = nrs_orr_req_add,
        .op_req_dequeue         = nrs_orr_req_del,
        .op_req_stop            = nrs_orr_req_stop,
-#ifdef CONFIG_PROC_FS
        .op_lprocfs_init        = nrs_orr_lprocfs_init,
-       .op_lprocfs_fini        = nrs_orr_lprocfs_fini,
-#endif
 };
 
 struct ptlrpc_nrs_pol_conf nrs_conf_orr = {
@@ -1925,9 +1912,6 @@ struct ptlrpc_nrs_pol_conf nrs_conf_orr = {
  *
  * TRR reuses much of the functions and data structures of ORR
  */
-
-#ifdef CONFIG_PROC_FS
-
 static int nrs_trr_lprocfs_init(struct ptlrpc_service *svc)
 {
        int     i;
@@ -1942,7 +1926,7 @@ static int nrs_trr_lprocfs_init(struct ptlrpc_service *svc)
                { NULL }
        };
 
-       if (svc->srv_procroot == NULL)
+       if (IS_ERR_OR_NULL(svc->srv_debugfs_entry))
                return 0;
 
        lprocfs_trr_data.svc = svc;
@@ -1950,21 +1934,10 @@ static int nrs_trr_lprocfs_init(struct ptlrpc_service *svc)
        for (i = 0; i < ARRAY_SIZE(nrs_trr_lprocfs_vars); i++)
                nrs_trr_lprocfs_vars[i].data = &lprocfs_trr_data;
 
-       return lprocfs_add_vars(svc->srv_procroot, nrs_trr_lprocfs_vars, NULL);
+       return ldebugfs_add_vars(svc->srv_debugfs_entry, nrs_trr_lprocfs_vars,
+                                NULL);
 }
 
-static void nrs_trr_lprocfs_fini(struct ptlrpc_service *svc)
-{
-       if (svc->srv_procroot == NULL)
-               return;
-
-       lprocfs_remove_proc_entry("nrs_trr_quantum", svc->srv_procroot);
-       lprocfs_remove_proc_entry("nrs_trr_offset_type", svc->srv_procroot);
-       lprocfs_remove_proc_entry("nrs_trr_supported", svc->srv_procroot);
-}
-
-#endif /* CONFIG_PROC_FS */
-
 /**
  * Reuse much of the ORR functionality for TRR.
  */
@@ -1979,10 +1952,7 @@ static const struct ptlrpc_nrs_pol_ops nrs_trr_ops = {
        .op_req_enqueue         = nrs_orr_req_add,
        .op_req_dequeue         = nrs_orr_req_del,
        .op_req_stop            = nrs_orr_req_stop,
-#ifdef CONFIG_PROC_FS
        .op_lprocfs_init        = nrs_trr_lprocfs_init,
-       .op_lprocfs_fini        = nrs_trr_lprocfs_fini,
-#endif
 };
 
 struct ptlrpc_nrs_pol_conf nrs_conf_trr = {
index fdf409e..182515c 100644 (file)
@@ -3268,10 +3268,8 @@ static void nrs_tbf_req_stop(struct ptlrpc_nrs_policy *policy,
               nrq->nr_u.tbf.tr_sequence);
 }
 
-#ifdef CONFIG_PROC_FS
-
 /**
- * lprocfs interface
+ * debugfs interface
  */
 
 /**
@@ -3659,7 +3657,8 @@ out_free_kernbuff:
 out:
        return rc ? rc : count;
 }
-LPROC_SEQ_FOPS(ptlrpc_lprocfs_nrs_tbf_rule);
+
+LDEBUGFS_SEQ_FOPS(ptlrpc_lprocfs_nrs_tbf_rule);
 
 /**
  * Initializes a TBF policy's lprocfs interface for service \a svc
@@ -3678,28 +3677,14 @@ static int nrs_tbf_lprocfs_init(struct ptlrpc_service *svc)
                { NULL }
        };
 
-       if (svc->srv_procroot == NULL)
+       if (IS_ERR_OR_NULL(svc->srv_debugfs_entry))
                return 0;
 
-       return lprocfs_add_vars(svc->srv_procroot, nrs_tbf_lprocfs_vars, NULL);
+       return ldebugfs_add_vars(svc->srv_debugfs_entry, nrs_tbf_lprocfs_vars,
+                                NULL);
 }
 
 /**
- * Cleans up a TBF policy's lprocfs interface for service \a svc
- *
- * \param[in] svc the service
- */
-static void nrs_tbf_lprocfs_fini(struct ptlrpc_service *svc)
-{
-       if (svc->srv_procroot == NULL)
-               return;
-
-       lprocfs_remove_proc_entry("nrs_tbf_rule", svc->srv_procroot);
-}
-
-#endif /* CONFIG_PROC_FS */
-
-/**
  * TBF policy operations
  */
 static const struct ptlrpc_nrs_pol_ops nrs_tbf_ops = {
@@ -3712,10 +3697,7 @@ static const struct ptlrpc_nrs_pol_ops nrs_tbf_ops = {
        .op_req_enqueue         = nrs_tbf_req_add,
        .op_req_dequeue         = nrs_tbf_req_del,
        .op_req_stop            = nrs_tbf_req_stop,
-#ifdef CONFIG_PROC_FS
        .op_lprocfs_init        = nrs_tbf_lprocfs_init,
-       .op_lprocfs_fini        = nrs_tbf_lprocfs_fini,
-#endif
 };
 
 /**
index 9e878bf..623e3a0 100644 (file)
@@ -109,15 +109,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);
 #ifdef 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 38b9d75..89154e0 100644 (file)
@@ -687,7 +687,7 @@ ptlrpc_service_part_init(struct ptlrpc_service *svc,
 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;
@@ -813,8 +813,8 @@ ptlrpc_register_service(struct ptlrpc_service_conf *conf,
                        GOTO(failed, rc);
        }
 
-       if (proc_entry != NULL)
-               ptlrpc_lprocfs_register_service(proc_entry, service);
+       if (debugfs_entry != NULL)
+               ptlrpc_ldebugfs_register_service(debugfs_entry, service);
 
        rc = ptlrpc_service_nrs_setup(service);
        if (rc != 0)