]> git.karo-electronics.de Git - linux-beck.git/commitdiff
staging/lustre/llite: Move all remaining procfs entries to debugfs
authorOleg Drokin <green@linuxhacker.ru>
Sun, 31 May 2015 03:27:00 +0000 (23:27 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 31 May 2015 06:26:38 +0000 (15:26 +0900)
This moves all remaining procfs handling in llite layer to debugfs.

Signed-off-by: Dmitry Eremin <dmitry.eremin@intel.com>
Signed-off-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/lustre/lustre/llite/llite_internal.h
drivers/staging/lustre/lustre/llite/llite_lib.c
drivers/staging/lustre/lustre/llite/lproc_llite.c
drivers/staging/lustre/lustre/llite/super25.c
drivers/staging/lustre/lustre/llite/vvp_dev.c

index e180912d0e08ba3eeec98029f809adcb17af27e8..b30eb85a53c958b9f6c2074c2552f2a29e8c455f 100644 (file)
@@ -465,7 +465,7 @@ struct ll_sb_info {
        struct obd_uuid    ll_sb_uuid;
        struct obd_export       *ll_md_exp;
        struct obd_export       *ll_dt_exp;
-       struct proc_dir_entry*    ll_proc_root;
+       struct dentry           *ll_debugfs_entry;
        struct lu_fid        ll_root_fid; /* root object fid */
 
        int                    ll_flags;
@@ -636,7 +636,7 @@ struct lov_stripe_md;
 
 extern spinlock_t inode_lock;
 
-extern struct proc_dir_entry *proc_lustre_fs_root;
+extern struct dentry *llite_root;
 extern struct kset *llite_kset;
 
 static inline struct inode *ll_info2i(struct ll_inode_info *lli)
@@ -664,20 +664,25 @@ struct ll_ra_read *ll_ra_read_get(struct file *f);
 
 /* llite/lproc_llite.c */
 #if defined (CONFIG_PROC_FS)
-int lprocfs_register_mountpoint(struct proc_dir_entry *parent,
-                               struct super_block *sb, char *osc, char *mdc);
-void lprocfs_unregister_mountpoint(struct ll_sb_info *sbi);
+int ldebugfs_register_mountpoint(struct dentry *parent,
+                                struct super_block *sb, char *osc, char *mdc);
+void ldebugfs_unregister_mountpoint(struct ll_sb_info *sbi);
 void ll_stats_ops_tally(struct ll_sb_info *sbi, int op, int count);
 void lprocfs_llite_init_vars(struct lprocfs_static_vars *lvars);
 void ll_rw_stats_tally(struct ll_sb_info *sbi, pid_t pid,
                       struct ll_file_data *file, loff_t pos,
                       size_t count, int rw);
-#else
-static inline int lprocfs_register_mountpoint(struct proc_dir_entry *parent,
-                       struct super_block *sb, char *osc, char *mdc){return 0;}
-static inline void lprocfs_unregister_mountpoint(struct ll_sb_info *sbi) {}
+#else /* CONFIG_PROC_FS */
+static inline
+int ldebugfs_register_mountpoint(struct dentry *parent,
+                                struct super_block *sb, char *osc, char *mdc)
+{ return 0; }
 static inline
-void ll_stats_ops_tally(struct ll_sb_info *sbi, int op, int count) {}
+void ldebugfs_unregister_mountpoint(struct ll_sb_info *sbi)
+{}
+static inline
+void ll_stats_ops_tally(struct ll_sb_info *sbi, int op, int count)
+{}
 static inline void lprocfs_llite_init_vars(struct lprocfs_static_vars *lvars)
 {
        memset(lvars, 0, sizeof(*lvars));
@@ -685,7 +690,7 @@ static inline void lprocfs_llite_init_vars(struct lprocfs_static_vars *lvars)
 static inline void ll_rw_stats_tally(struct ll_sb_info *sbi, pid_t pid,
                                     struct ll_file_data *file, loff_t pos,
                                     size_t count, int rw) {}
-#endif
+#endif /* CONFIG_PROC_FS */
 
 
 /* llite/dir.c */
index 4c9fd4acedeaab563ee4560f04e3ea2795350131..25139885b5a769eeedab0fd2859986c1c4684d19 100644 (file)
@@ -57,7 +57,7 @@
 #include "llite_internal.h"
 
 struct kmem_cache *ll_file_data_slab;
-struct proc_dir_entry *proc_lustre_fs_root;
+struct dentry *llite_root;
 struct kset *llite_kset;
 
 static LIST_HEAD(ll_super_blocks);
@@ -184,11 +184,10 @@ static int client_common_fill_super(struct super_block *sb, char *md, char *dt,
                return -ENOMEM;
        }
 
-       if (proc_lustre_fs_root) {
-               err = lprocfs_register_mountpoint(proc_lustre_fs_root, sb,
-                                                 dt, md);
+       if (llite_root != NULL) {
+               err = ldebugfs_register_mountpoint(llite_root, sb, dt, md);
                if (err < 0)
-                       CERROR("could not register mount in /proc/fs/lustre\n");
+                       CERROR("could not register mount in <debugfs>/lustre/llite\n");
        }
 
        /* indicate the features supported by this client */
@@ -601,7 +600,7 @@ out_md:
 out:
        kfree(data);
        kfree(osfs);
-       lprocfs_unregister_mountpoint(sbi);
+       ldebugfs_unregister_mountpoint(sbi);
        return err;
 }
 
@@ -682,7 +681,7 @@ static void client_common_put_super(struct super_block *sb)
         * see LU-2543. */
        obd_zombie_barrier();
 
-       lprocfs_unregister_mountpoint(sbi);
+       ldebugfs_unregister_mountpoint(sbi);
 
        obd_fid_fini(sbi->ll_md_exp->exp_obd);
        obd_disconnect(sbi->ll_md_exp);
index 2c84bed3f6ce3e892ad203281e146e8799b49775..486dca6077de2e692d1bc0b7d58751be4a664b2b 100644 (file)
@@ -950,12 +950,13 @@ static const char *ra_stat_string[] = {
        [RA_STAT_WRONG_GRAB_PAGE] = "wrong page from grab_cache_page",
 };
 
-int lprocfs_register_mountpoint(struct proc_dir_entry *parent,
-                               struct super_block *sb, char *osc, char *mdc)
+int ldebugfs_register_mountpoint(struct dentry *parent,
+                                struct super_block *sb, char *osc, char *mdc)
 {
        struct lustre_sb_info *lsi = s2lsi(sb);
        struct ll_sb_info *sbi = ll_s2sbi(sb);
        struct obd_device *obd;
+       struct dentry *dir;
        char name[MAX_STRING_SIZE + 1], *ptr;
        int err, id, len, rc;
 
@@ -976,30 +977,32 @@ int lprocfs_register_mountpoint(struct proc_dir_entry *parent,
        snprintf(name, MAX_STRING_SIZE, "%.*s-%p", len,
                 lsi->lsi_lmd->lmd_profile, sb);
 
-       sbi->ll_proc_root = lprocfs_register(name, parent, NULL, NULL);
-       if (IS_ERR(sbi->ll_proc_root)) {
-               err = PTR_ERR(sbi->ll_proc_root);
-               sbi->ll_proc_root = NULL;
+       dir = ldebugfs_register(name, parent, NULL, NULL);
+       if (IS_ERR_OR_NULL(dir)) {
+               err = dir ? PTR_ERR(dir) : -ENOMEM;
+               sbi->ll_debugfs_entry = NULL;
                return err;
        }
+       sbi->ll_debugfs_entry = dir;
 
-       rc = lprocfs_seq_create(sbi->ll_proc_root, "dump_page_cache", 0444,
-                               &vvp_dump_pgcache_file_ops, sbi);
+       rc = ldebugfs_seq_create(sbi->ll_debugfs_entry, "dump_page_cache", 0444,
+                                &vvp_dump_pgcache_file_ops, sbi);
        if (rc)
                CWARN("Error adding the dump_page_cache file\n");
 
-       rc = lprocfs_seq_create(sbi->ll_proc_root, "extents_stats", 0644,
-                               &ll_rw_extents_stats_fops, sbi);
+       rc = ldebugfs_seq_create(sbi->ll_debugfs_entry, "extents_stats", 0644,
+                                &ll_rw_extents_stats_fops, sbi);
        if (rc)
                CWARN("Error adding the extent_stats file\n");
 
-       rc = lprocfs_seq_create(sbi->ll_proc_root, "extents_stats_per_process",
-                               0644, &ll_rw_extents_stats_pp_fops, sbi);
+       rc = ldebugfs_seq_create(sbi->ll_debugfs_entry,
+                                 "extents_stats_per_process",
+                                0644, &ll_rw_extents_stats_pp_fops, sbi);
        if (rc)
                CWARN("Error adding the extents_stats_per_process file\n");
 
-       rc = lprocfs_seq_create(sbi->ll_proc_root, "offset_stats", 0644,
-                               &ll_rw_offset_stats_fops, sbi);
+       rc = ldebugfs_seq_create(sbi->ll_debugfs_entry, "offset_stats", 0644,
+                                &ll_rw_offset_stats_fops, sbi);
        if (rc)
                CWARN("Error adding the offset_stats file\n");
 
@@ -1025,7 +1028,8 @@ int lprocfs_register_mountpoint(struct proc_dir_entry *parent,
                                     (type & LPROCFS_CNTR_AVGMINMAX),
                                     llite_opcode_table[id].opname, ptr);
        }
-       err = lprocfs_register_stats(sbi->ll_proc_root, "stats", sbi->ll_stats);
+       err = ldebugfs_register_stats(sbi->ll_debugfs_entry, "stats",
+                                    sbi->ll_stats);
        if (err)
                goto out;
 
@@ -1039,13 +1043,15 @@ int lprocfs_register_mountpoint(struct proc_dir_entry *parent,
        for (id = 0; id < ARRAY_SIZE(ra_stat_string); id++)
                lprocfs_counter_init(sbi->ll_ra_stats, id, 0,
                                     ra_stat_string[id], "pages");
-       err = lprocfs_register_stats(sbi->ll_proc_root, "read_ahead_stats",
+
+       err = ldebugfs_register_stats(sbi->ll_debugfs_entry, "read_ahead_stats",
                                     sbi->ll_ra_stats);
        if (err)
                goto out;
 
 
-       err = lprocfs_add_vars(sbi->ll_proc_root, lprocfs_llite_obd_vars, sb);
+       err = ldebugfs_add_vars(sbi->ll_debugfs_entry,
+                               lprocfs_llite_obd_vars, sb);
        if (err)
                goto out;
 
@@ -1071,17 +1077,17 @@ int lprocfs_register_mountpoint(struct proc_dir_entry *parent,
                                obd->obd_type->typ_name);
 out:
        if (err) {
-               lprocfs_remove(&sbi->ll_proc_root);
+               ldebugfs_remove(&sbi->ll_debugfs_entry);
                lprocfs_free_stats(&sbi->ll_ra_stats);
                lprocfs_free_stats(&sbi->ll_stats);
        }
        return err;
 }
 
-void lprocfs_unregister_mountpoint(struct ll_sb_info *sbi)
+void ldebugfs_unregister_mountpoint(struct ll_sb_info *sbi)
 {
-       if (sbi->ll_proc_root) {
-               lprocfs_remove(&sbi->ll_proc_root);
+       if (sbi->ll_debugfs_entry) {
+               ldebugfs_remove(&sbi->ll_debugfs_entry);
                kobject_put(&sbi->ll_kobj);
                wait_for_completion(&sbi->ll_kobj_unregister);
                lprocfs_free_stats(&sbi->ll_ra_stats);
index 8753560809faf09f7421266f9ae40333b3f4848c..e4020ce8cb7b85d8c771f42b05cc9c77335709cd 100644 (file)
@@ -89,7 +89,6 @@ void lustre_register_client_process_config(int (*cpc)(struct lustre_cfg *lcfg));
 
 static int __init init_lustre_lite(void)
 {
-       struct proc_dir_entry *entry;
        lnet_process_id_t lnet_id;
        struct timeval tv;
        int i, rc, seed[2];
@@ -128,20 +127,17 @@ static int __init init_lustre_lite(void)
        if (ll_rmtperm_hash_cachep == NULL)
                goto out_cache;
 
-       entry = lprocfs_register("llite", proc_lustre_root, NULL, NULL);
-       if (IS_ERR(entry)) {
-               rc = PTR_ERR(entry);
-               CERROR("cannot register '/proc/fs/lustre/llite': rc = %d\n",
-                      rc);
+       llite_root = debugfs_create_dir("llite", debugfs_lustre_root);
+       if (IS_ERR_OR_NULL(llite_root)) {
+               rc = llite_root ? PTR_ERR(llite_root) : -ENOMEM;
+               llite_root = NULL;
                goto out_cache;
        }
 
-       proc_lustre_fs_root = entry;
-
        llite_kset = kset_create_and_add("llite", NULL, lustre_kobj);
        if (!llite_kset) {
                rc = -ENOMEM;
-               goto out_proc;
+               goto out_debugfs;
        }
 
        cfs_get_random_bytes(seed, sizeof(seed));
@@ -184,8 +180,8 @@ out_capa:
        ll_capa_thread_stop();
 out_sysfs:
        kset_unregister(llite_kset);
-out_proc:
-       lprocfs_remove(&proc_lustre_fs_root);
+out_debugfs:
+       debugfs_remove(llite_root);
 out_cache:
        if (ll_inode_cachep != NULL)
                kmem_cache_destroy(ll_inode_cachep);
@@ -208,7 +204,7 @@ static void __exit exit_lustre_lite(void)
        lustre_register_kill_super_cb(NULL);
        lustre_register_client_process_config(NULL);
 
-       lprocfs_remove(&proc_lustre_fs_root);
+       debugfs_remove(llite_root);
        kset_unregister(llite_kset);
 
        ll_xattr_fini();
index fde41d7c5e3d8e1aaa12da5514281732d0c8cb25..6d9622acb44fda0cad9232eca81f4cfbb2a3ef2e 100644 (file)
@@ -253,7 +253,7 @@ int cl_sb_fini(struct super_block *sb)
 
 /****************************************************************************
  *
- * /proc/fs/lustre/llite/$MNT/dump_page_cache
+ * debugfs/lustre/llite/$MNT/dump_page_cache
  *
  ****************************************************************************/
 
@@ -526,16 +526,17 @@ static struct seq_operations vvp_pgcache_ops = {
 
 static int vvp_dump_pgcache_seq_open(struct inode *inode, struct file *filp)
 {
-       struct ll_sb_info     *sbi = PDE_DATA(inode);
-       struct seq_file       *seq;
-       int                 result;
+       struct seq_file *seq;
+       int rc;
 
-       result = seq_open(filp, &vvp_pgcache_ops);
-       if (result == 0) {
-               seq = filp->private_data;
-               seq->private = sbi;
-       }
-       return result;
+       rc = seq_open(filp, &vvp_pgcache_ops);
+       if (rc)
+               return rc;
+
+       seq = filp->private_data;
+       seq->private = inode->i_private ?: PDE_DATA(inode);
+
+       return 0;
 }
 
 const struct file_operations vvp_dump_pgcache_file_ops = {