staging/lustre/fld: move all files from procfs to debugfs
authorDmitry Eremin <dmitry4ever@gmail.com>
Thu, 21 May 2015 19:32:26 +0000 (15:32 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 31 May 2015 02:19:57 +0000 (11:19 +0900)
Signed-off-by: Dmitry Eremin <dmiter4ever@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/lustre/lustre/fld/fld_internal.h
drivers/staging/lustre/lustre/fld/fld_request.c
drivers/staging/lustre/lustre/fld/lproc_fld.c
drivers/staging/lustre/lustre/include/lustre_fld.h
drivers/staging/lustre/lustre/lmv/lmv_obd.c

index 68bec76584632a0a75445991ad268770aebb1bf9..844576b9bc6f54cd5fb40e09b054d5f7702234fa 100644 (file)
@@ -142,10 +142,7 @@ extern struct lu_fld_hash fld_hash[];
 int fld_client_rpc(struct obd_export *exp,
                   struct lu_seq_range *range, __u32 fld_op);
 
-#if defined(CONFIG_PROC_FS)
-extern struct lprocfs_vars fld_client_proc_list[];
-#endif
-
+extern struct lprocfs_vars fld_client_debugfs_list[];
 
 struct fld_cache *fld_cache_init(const char *name,
                                 int cache_size, int cache_threshold);
index 075eb5ceedb64cb53874e6c945e830eb1de93d27..c3b47f2346df6bd2e0a074869545e6ee0b7056ae 100644 (file)
@@ -277,58 +277,44 @@ int fld_client_del_target(struct lu_client_fld *fld, __u64 idx)
 }
 EXPORT_SYMBOL(fld_client_del_target);
 
-static struct proc_dir_entry *fld_type_proc_dir;
+static struct dentry *fld_debugfs_dir;
 
-#if defined(CONFIG_PROC_FS)
-static int fld_client_proc_init(struct lu_client_fld *fld)
+static int fld_client_debugfs_init(struct lu_client_fld *fld)
 {
        int rc;
 
-       fld->lcf_proc_dir = lprocfs_register(fld->lcf_name,
-                                            fld_type_proc_dir,
-                                            NULL, NULL);
+       fld->lcf_debugfs_entry = ldebugfs_register(fld->lcf_name,
+                                                  fld_debugfs_dir,
+                                                  NULL, NULL);
 
-       if (IS_ERR(fld->lcf_proc_dir)) {
-               CERROR("%s: LProcFS failed in fld-init\n",
-                      fld->lcf_name);
-               rc = PTR_ERR(fld->lcf_proc_dir);
+       if (IS_ERR_OR_NULL(fld->lcf_debugfs_entry)) {
+               CERROR("%s: LdebugFS failed in fld-init\n", fld->lcf_name);
+               rc = fld->lcf_debugfs_entry ? PTR_ERR(fld->lcf_debugfs_entry)
+                                           : -ENOMEM;
+               fld->lcf_debugfs_entry = NULL;
                return rc;
        }
 
-       rc = lprocfs_add_vars(fld->lcf_proc_dir,
-                             fld_client_proc_list, fld);
+       rc = ldebugfs_add_vars(fld->lcf_debugfs_entry,
+                              fld_client_debugfs_list, fld);
        if (rc) {
-               CERROR("%s: Can't init FLD proc, rc %d\n",
-                      fld->lcf_name, rc);
+               CERROR("%s: Can't init FLD debufs, rc %d\n", fld->lcf_name, rc);
                goto out_cleanup;
        }
 
        return 0;
 
 out_cleanup:
-       fld_client_proc_fini(fld);
+       fld_client_debugfs_fini(fld);
        return rc;
 }
 
-void fld_client_proc_fini(struct lu_client_fld *fld)
+void fld_client_debugfs_fini(struct lu_client_fld *fld)
 {
-       if (fld->lcf_proc_dir) {
-               if (!IS_ERR(fld->lcf_proc_dir))
-                       lprocfs_remove(&fld->lcf_proc_dir);
-               fld->lcf_proc_dir = NULL;
-       }
-}
-#else
-static int fld_client_proc_init(struct lu_client_fld *fld)
-{
-       return 0;
+       if (!IS_ERR_OR_NULL(fld->lcf_debugfs_entry))
+               ldebugfs_remove(&fld->lcf_debugfs_entry);
 }
-
-void fld_client_proc_fini(struct lu_client_fld *fld)
-{
-}
-#endif
-EXPORT_SYMBOL(fld_client_proc_fini);
+EXPORT_SYMBOL(fld_client_debugfs_fini);
 
 static inline int hash_is_sane(int hash)
 {
@@ -372,7 +358,7 @@ int fld_client_init(struct lu_client_fld *fld,
                goto out;
        }
 
-       rc = fld_client_proc_init(fld);
+       rc = fld_client_debugfs_init(fld);
        if (rc)
                goto out;
 out:
@@ -504,18 +490,16 @@ EXPORT_SYMBOL(fld_client_flush);
 
 static int __init fld_mod_init(void)
 {
-       fld_type_proc_dir = lprocfs_register(LUSTRE_FLD_NAME,
-                                            proc_lustre_root,
-                                            NULL, NULL);
-       return PTR_ERR_OR_ZERO(fld_type_proc_dir);
+       fld_debugfs_dir = ldebugfs_register(LUSTRE_FLD_NAME,
+                                           debugfs_lustre_root,
+                                           NULL, NULL);
+       return PTR_ERR_OR_ZERO(fld_debugfs_dir);
 }
 
 static void __exit fld_mod_exit(void)
 {
-       if (fld_type_proc_dir != NULL && !IS_ERR(fld_type_proc_dir)) {
-               lprocfs_remove(&fld_type_proc_dir);
-               fld_type_proc_dir = NULL;
-       }
+       if (!IS_ERR_OR_NULL(fld_debugfs_dir))
+               ldebugfs_remove(&fld_debugfs_dir);
 }
 
 MODULE_AUTHOR("Sun Microsystems, Inc. <http://www.lustre.org/>");
index f53fdcfae34e2ad7ed10a4f183fed38a867d8e70..b35ff288dbd5ea6ed84797b6138c15a066d46641 100644 (file)
@@ -56,7 +56,7 @@
 #include "fld_internal.h"
 
 static int
-fld_proc_targets_seq_show(struct seq_file *m, void *unused)
+fld_debugfs_targets_seq_show(struct seq_file *m, void *unused)
 {
        struct lu_client_fld *fld = (struct lu_client_fld *)m->private;
        struct lu_fld_target *target;
@@ -73,7 +73,7 @@ fld_proc_targets_seq_show(struct seq_file *m, void *unused)
 }
 
 static int
-fld_proc_hash_seq_show(struct seq_file *m, void *unused)
+fld_debugfs_hash_seq_show(struct seq_file *m, void *unused)
 {
        struct lu_client_fld *fld = (struct lu_client_fld *)m->private;
 
@@ -87,9 +87,9 @@ fld_proc_hash_seq_show(struct seq_file *m, void *unused)
 }
 
 static ssize_t
-fld_proc_hash_seq_write(struct file *file,
-                               const char __user *buffer,
-                               size_t count, loff_t *off)
+fld_debugfs_hash_seq_write(struct file *file,
+                          const char __user *buffer,
+                          size_t count, loff_t *off)
 {
        struct lu_client_fld *fld;
        struct lu_fld_hash *hash = NULL;
@@ -128,8 +128,8 @@ fld_proc_hash_seq_write(struct file *file,
 }
 
 static ssize_t
-fld_proc_cache_flush_write(struct file *file, const char __user *buffer,
-                              size_t count, loff_t *pos)
+fld_debugfs_cache_flush_write(struct file *file, const char __user *buffer,
+                             size_t count, loff_t *pos)
 {
        struct lu_client_fld *fld = file->private_data;
 
@@ -142,31 +142,33 @@ fld_proc_cache_flush_write(struct file *file, const char __user *buffer,
        return count;
 }
 
-static int fld_proc_cache_flush_open(struct inode *inode, struct file *file)
+static int
+fld_debugfs_cache_flush_open(struct inode *inode, struct file *file)
 {
-       file->private_data = PDE_DATA(inode);
+       file->private_data = inode->i_private;
        return 0;
 }
 
-static int fld_proc_cache_flush_release(struct inode *inode, struct file *file)
+static int
+fld_debugfs_cache_flush_release(struct inode *inode, struct file *file)
 {
        file->private_data = NULL;
        return 0;
 }
 
-static struct file_operations fld_proc_cache_flush_fops = {
+static struct file_operations fld_debugfs_cache_flush_fops = {
        .owner          = THIS_MODULE,
-       .open           = fld_proc_cache_flush_open,
-       .write          = fld_proc_cache_flush_write,
-       .release        = fld_proc_cache_flush_release,
+       .open           = fld_debugfs_cache_flush_open,
+       .write          = fld_debugfs_cache_flush_write,
+       .release        = fld_debugfs_cache_flush_release,
 };
 
-LPROC_SEQ_FOPS_RO(fld_proc_targets);
-LPROC_SEQ_FOPS(fld_proc_hash);
+LPROC_SEQ_FOPS_RO(fld_debugfs_targets);
+LPROC_SEQ_FOPS(fld_debugfs_hash);
 
-struct lprocfs_vars fld_client_proc_list[] = {
-       { "targets", &fld_proc_targets_fops },
-       { "hash", &fld_proc_hash_fops },
-       { "cache_flush", &fld_proc_cache_flush_fops },
+struct lprocfs_vars fld_client_debugfs_list[] = {
+       { "targets",     &fld_debugfs_targets_fops },
+       { "hash",        &fld_debugfs_hash_fops },
+       { "cache_flush", &fld_debugfs_cache_flush_fops },
        { NULL }
 };
index 5ee4b1ed099502c18a9d0b638409ecc5c317086d..588cdd5a291c3ae65991b65cce2b1c42da7360ca 100644 (file)
@@ -99,8 +99,8 @@ struct lu_server_fld {
 
 struct lu_client_fld {
        /**
-        * Client side proc entry. */
-       struct proc_dir_entry    *lcf_proc_dir;
+        * Client side debugfs entry. */
+       struct dentry           *lcf_debugfs_entry;
 
        /**
         * List of exports client FLD knows about. */
@@ -123,10 +123,10 @@ struct lu_client_fld {
        struct fld_cache        *lcf_cache;
 
        /**
-        * Client fld proc entry name. */
-       char                 lcf_name[LUSTRE_MDT_MAXNAMELEN];
+        * Client fld debugfs entry name. */
+       char                     lcf_name[LUSTRE_MDT_MAXNAMELEN];
 
-       int                   lcf_flags;
+       int                      lcf_flags;
 };
 
 /* Client methods */
@@ -153,7 +153,7 @@ int fld_client_add_target(struct lu_client_fld *fld,
 int fld_client_del_target(struct lu_client_fld *fld,
                          __u64 idx);
 
-void fld_client_proc_fini(struct lu_client_fld *fld);
+void fld_client_debugfs_fini(struct lu_client_fld *fld);
 
 /** @} fld */
 
index 695a4ed9e62745163187b0e0c561a438c64df3d4..65c01383725cd6e78cb18afc2a6b5f8570b20bc2 100644 (file)
@@ -2277,7 +2277,7 @@ static int lmv_precleanup(struct obd_device *obd, enum obd_cleanup_stage stage)
                 * stack. */
                break;
        case OBD_CLEANUP_EXPORTS:
-               fld_client_proc_fini(&lmv->lmv_fld);
+               fld_client_debugfs_fini(&lmv->lmv_fld);
                lprocfs_obd_cleanup(obd);
                break;
        default: