Commit ae7c0f48 authored by Oleg Drokin's avatar Oleg Drokin Committed by Greg Kroah-Hartman

staging/lustre/llite: Move all remaining procfs entries to debugfs

This moves all remaining procfs handling in llite layer to debugfs.
Signed-off-by: default avatarDmitry Eremin <dmitry.eremin@intel.com>
Signed-off-by: default avatarOleg Drokin <oleg.drokin@intel.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 895875a3
...@@ -465,7 +465,7 @@ struct ll_sb_info { ...@@ -465,7 +465,7 @@ struct ll_sb_info {
struct obd_uuid ll_sb_uuid; struct obd_uuid ll_sb_uuid;
struct obd_export *ll_md_exp; struct obd_export *ll_md_exp;
struct obd_export *ll_dt_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 */ struct lu_fid ll_root_fid; /* root object fid */
int ll_flags; int ll_flags;
...@@ -636,7 +636,7 @@ struct lov_stripe_md; ...@@ -636,7 +636,7 @@ struct lov_stripe_md;
extern spinlock_t inode_lock; extern spinlock_t inode_lock;
extern struct proc_dir_entry *proc_lustre_fs_root; extern struct dentry *llite_root;
extern struct kset *llite_kset; extern struct kset *llite_kset;
static inline struct inode *ll_info2i(struct ll_inode_info *lli) 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); ...@@ -664,20 +664,25 @@ struct ll_ra_read *ll_ra_read_get(struct file *f);
/* llite/lproc_llite.c */ /* llite/lproc_llite.c */
#if defined (CONFIG_PROC_FS) #if defined (CONFIG_PROC_FS)
int lprocfs_register_mountpoint(struct proc_dir_entry *parent, int ldebugfs_register_mountpoint(struct dentry *parent,
struct super_block *sb, char *osc, char *mdc); struct super_block *sb, char *osc, char *mdc);
void lprocfs_unregister_mountpoint(struct ll_sb_info *sbi); void ldebugfs_unregister_mountpoint(struct ll_sb_info *sbi);
void ll_stats_ops_tally(struct ll_sb_info *sbi, int op, int count); 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 lprocfs_llite_init_vars(struct lprocfs_static_vars *lvars);
void ll_rw_stats_tally(struct ll_sb_info *sbi, pid_t pid, void ll_rw_stats_tally(struct ll_sb_info *sbi, pid_t pid,
struct ll_file_data *file, loff_t pos, struct ll_file_data *file, loff_t pos,
size_t count, int rw); size_t count, int rw);
#else #else /* CONFIG_PROC_FS */
static inline int lprocfs_register_mountpoint(struct proc_dir_entry *parent, static inline
struct super_block *sb, char *osc, char *mdc){return 0;} int ldebugfs_register_mountpoint(struct dentry *parent,
static inline void lprocfs_unregister_mountpoint(struct ll_sb_info *sbi) {} struct super_block *sb, char *osc, char *mdc)
{ return 0; }
static inline 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) static inline void lprocfs_llite_init_vars(struct lprocfs_static_vars *lvars)
{ {
memset(lvars, 0, sizeof(*lvars)); memset(lvars, 0, sizeof(*lvars));
...@@ -685,7 +690,7 @@ static inline void lprocfs_llite_init_vars(struct lprocfs_static_vars *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, static inline void ll_rw_stats_tally(struct ll_sb_info *sbi, pid_t pid,
struct ll_file_data *file, loff_t pos, struct ll_file_data *file, loff_t pos,
size_t count, int rw) {} size_t count, int rw) {}
#endif #endif /* CONFIG_PROC_FS */
/* llite/dir.c */ /* llite/dir.c */
......
...@@ -57,7 +57,7 @@ ...@@ -57,7 +57,7 @@
#include "llite_internal.h" #include "llite_internal.h"
struct kmem_cache *ll_file_data_slab; struct kmem_cache *ll_file_data_slab;
struct proc_dir_entry *proc_lustre_fs_root; struct dentry *llite_root;
struct kset *llite_kset; struct kset *llite_kset;
static LIST_HEAD(ll_super_blocks); static LIST_HEAD(ll_super_blocks);
...@@ -184,11 +184,10 @@ static int client_common_fill_super(struct super_block *sb, char *md, char *dt, ...@@ -184,11 +184,10 @@ static int client_common_fill_super(struct super_block *sb, char *md, char *dt,
return -ENOMEM; return -ENOMEM;
} }
if (proc_lustre_fs_root) { if (llite_root != NULL) {
err = lprocfs_register_mountpoint(proc_lustre_fs_root, sb, err = ldebugfs_register_mountpoint(llite_root, sb, dt, md);
dt, md);
if (err < 0) 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 */ /* indicate the features supported by this client */
...@@ -601,7 +600,7 @@ static int client_common_fill_super(struct super_block *sb, char *md, char *dt, ...@@ -601,7 +600,7 @@ static int client_common_fill_super(struct super_block *sb, char *md, char *dt,
out: out:
kfree(data); kfree(data);
kfree(osfs); kfree(osfs);
lprocfs_unregister_mountpoint(sbi); ldebugfs_unregister_mountpoint(sbi);
return err; return err;
} }
...@@ -682,7 +681,7 @@ static void client_common_put_super(struct super_block *sb) ...@@ -682,7 +681,7 @@ static void client_common_put_super(struct super_block *sb)
* see LU-2543. */ * see LU-2543. */
obd_zombie_barrier(); obd_zombie_barrier();
lprocfs_unregister_mountpoint(sbi); ldebugfs_unregister_mountpoint(sbi);
obd_fid_fini(sbi->ll_md_exp->exp_obd); obd_fid_fini(sbi->ll_md_exp->exp_obd);
obd_disconnect(sbi->ll_md_exp); obd_disconnect(sbi->ll_md_exp);
......
...@@ -950,12 +950,13 @@ static const char *ra_stat_string[] = { ...@@ -950,12 +950,13 @@ static const char *ra_stat_string[] = {
[RA_STAT_WRONG_GRAB_PAGE] = "wrong page from grab_cache_page", [RA_STAT_WRONG_GRAB_PAGE] = "wrong page from grab_cache_page",
}; };
int lprocfs_register_mountpoint(struct proc_dir_entry *parent, int ldebugfs_register_mountpoint(struct dentry *parent,
struct super_block *sb, char *osc, char *mdc) struct super_block *sb, char *osc, char *mdc)
{ {
struct lustre_sb_info *lsi = s2lsi(sb); struct lustre_sb_info *lsi = s2lsi(sb);
struct ll_sb_info *sbi = ll_s2sbi(sb); struct ll_sb_info *sbi = ll_s2sbi(sb);
struct obd_device *obd; struct obd_device *obd;
struct dentry *dir;
char name[MAX_STRING_SIZE + 1], *ptr; char name[MAX_STRING_SIZE + 1], *ptr;
int err, id, len, rc; int err, id, len, rc;
...@@ -976,30 +977,32 @@ int lprocfs_register_mountpoint(struct proc_dir_entry *parent, ...@@ -976,30 +977,32 @@ int lprocfs_register_mountpoint(struct proc_dir_entry *parent,
snprintf(name, MAX_STRING_SIZE, "%.*s-%p", len, snprintf(name, MAX_STRING_SIZE, "%.*s-%p", len,
lsi->lsi_lmd->lmd_profile, sb); lsi->lsi_lmd->lmd_profile, sb);
sbi->ll_proc_root = lprocfs_register(name, parent, NULL, NULL); dir = ldebugfs_register(name, parent, NULL, NULL);
if (IS_ERR(sbi->ll_proc_root)) { if (IS_ERR_OR_NULL(dir)) {
err = PTR_ERR(sbi->ll_proc_root); err = dir ? PTR_ERR(dir) : -ENOMEM;
sbi->ll_proc_root = NULL; sbi->ll_debugfs_entry = NULL;
return err; return err;
} }
sbi->ll_debugfs_entry = dir;
rc = lprocfs_seq_create(sbi->ll_proc_root, "dump_page_cache", 0444, rc = ldebugfs_seq_create(sbi->ll_debugfs_entry, "dump_page_cache", 0444,
&vvp_dump_pgcache_file_ops, sbi); &vvp_dump_pgcache_file_ops, sbi);
if (rc) if (rc)
CWARN("Error adding the dump_page_cache file\n"); CWARN("Error adding the dump_page_cache file\n");
rc = lprocfs_seq_create(sbi->ll_proc_root, "extents_stats", 0644, rc = ldebugfs_seq_create(sbi->ll_debugfs_entry, "extents_stats", 0644,
&ll_rw_extents_stats_fops, sbi); &ll_rw_extents_stats_fops, sbi);
if (rc) if (rc)
CWARN("Error adding the extent_stats file\n"); CWARN("Error adding the extent_stats file\n");
rc = lprocfs_seq_create(sbi->ll_proc_root, "extents_stats_per_process", rc = ldebugfs_seq_create(sbi->ll_debugfs_entry,
0644, &ll_rw_extents_stats_pp_fops, sbi); "extents_stats_per_process",
0644, &ll_rw_extents_stats_pp_fops, sbi);
if (rc) if (rc)
CWARN("Error adding the extents_stats_per_process file\n"); CWARN("Error adding the extents_stats_per_process file\n");
rc = lprocfs_seq_create(sbi->ll_proc_root, "offset_stats", 0644, rc = ldebugfs_seq_create(sbi->ll_debugfs_entry, "offset_stats", 0644,
&ll_rw_offset_stats_fops, sbi); &ll_rw_offset_stats_fops, sbi);
if (rc) if (rc)
CWARN("Error adding the offset_stats file\n"); CWARN("Error adding the offset_stats file\n");
...@@ -1025,7 +1028,8 @@ int lprocfs_register_mountpoint(struct proc_dir_entry *parent, ...@@ -1025,7 +1028,8 @@ int lprocfs_register_mountpoint(struct proc_dir_entry *parent,
(type & LPROCFS_CNTR_AVGMINMAX), (type & LPROCFS_CNTR_AVGMINMAX),
llite_opcode_table[id].opname, ptr); 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) if (err)
goto out; goto out;
...@@ -1039,13 +1043,15 @@ int lprocfs_register_mountpoint(struct proc_dir_entry *parent, ...@@ -1039,13 +1043,15 @@ int lprocfs_register_mountpoint(struct proc_dir_entry *parent,
for (id = 0; id < ARRAY_SIZE(ra_stat_string); id++) for (id = 0; id < ARRAY_SIZE(ra_stat_string); id++)
lprocfs_counter_init(sbi->ll_ra_stats, id, 0, lprocfs_counter_init(sbi->ll_ra_stats, id, 0,
ra_stat_string[id], "pages"); 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); sbi->ll_ra_stats);
if (err) if (err)
goto out; 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) if (err)
goto out; goto out;
...@@ -1071,17 +1077,17 @@ int lprocfs_register_mountpoint(struct proc_dir_entry *parent, ...@@ -1071,17 +1077,17 @@ int lprocfs_register_mountpoint(struct proc_dir_entry *parent,
obd->obd_type->typ_name); obd->obd_type->typ_name);
out: out:
if (err) { 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_ra_stats);
lprocfs_free_stats(&sbi->ll_stats); lprocfs_free_stats(&sbi->ll_stats);
} }
return err; 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) { if (sbi->ll_debugfs_entry) {
lprocfs_remove(&sbi->ll_proc_root); ldebugfs_remove(&sbi->ll_debugfs_entry);
kobject_put(&sbi->ll_kobj); kobject_put(&sbi->ll_kobj);
wait_for_completion(&sbi->ll_kobj_unregister); wait_for_completion(&sbi->ll_kobj_unregister);
lprocfs_free_stats(&sbi->ll_ra_stats); lprocfs_free_stats(&sbi->ll_ra_stats);
......
...@@ -89,7 +89,6 @@ void lustre_register_client_process_config(int (*cpc)(struct lustre_cfg *lcfg)); ...@@ -89,7 +89,6 @@ void lustre_register_client_process_config(int (*cpc)(struct lustre_cfg *lcfg));
static int __init init_lustre_lite(void) static int __init init_lustre_lite(void)
{ {
struct proc_dir_entry *entry;
lnet_process_id_t lnet_id; lnet_process_id_t lnet_id;
struct timeval tv; struct timeval tv;
int i, rc, seed[2]; int i, rc, seed[2];
...@@ -128,20 +127,17 @@ static int __init init_lustre_lite(void) ...@@ -128,20 +127,17 @@ static int __init init_lustre_lite(void)
if (ll_rmtperm_hash_cachep == NULL) if (ll_rmtperm_hash_cachep == NULL)
goto out_cache; goto out_cache;
entry = lprocfs_register("llite", proc_lustre_root, NULL, NULL); llite_root = debugfs_create_dir("llite", debugfs_lustre_root);
if (IS_ERR(entry)) { if (IS_ERR_OR_NULL(llite_root)) {
rc = PTR_ERR(entry); rc = llite_root ? PTR_ERR(llite_root) : -ENOMEM;
CERROR("cannot register '/proc/fs/lustre/llite': rc = %d\n", llite_root = NULL;
rc);
goto out_cache; goto out_cache;
} }
proc_lustre_fs_root = entry;
llite_kset = kset_create_and_add("llite", NULL, lustre_kobj); llite_kset = kset_create_and_add("llite", NULL, lustre_kobj);
if (!llite_kset) { if (!llite_kset) {
rc = -ENOMEM; rc = -ENOMEM;
goto out_proc; goto out_debugfs;
} }
cfs_get_random_bytes(seed, sizeof(seed)); cfs_get_random_bytes(seed, sizeof(seed));
...@@ -184,8 +180,8 @@ static int __init init_lustre_lite(void) ...@@ -184,8 +180,8 @@ static int __init init_lustre_lite(void)
ll_capa_thread_stop(); ll_capa_thread_stop();
out_sysfs: out_sysfs:
kset_unregister(llite_kset); kset_unregister(llite_kset);
out_proc: out_debugfs:
lprocfs_remove(&proc_lustre_fs_root); debugfs_remove(llite_root);
out_cache: out_cache:
if (ll_inode_cachep != NULL) if (ll_inode_cachep != NULL)
kmem_cache_destroy(ll_inode_cachep); kmem_cache_destroy(ll_inode_cachep);
...@@ -208,7 +204,7 @@ static void __exit exit_lustre_lite(void) ...@@ -208,7 +204,7 @@ static void __exit exit_lustre_lite(void)
lustre_register_kill_super_cb(NULL); lustre_register_kill_super_cb(NULL);
lustre_register_client_process_config(NULL); lustre_register_client_process_config(NULL);
lprocfs_remove(&proc_lustre_fs_root); debugfs_remove(llite_root);
kset_unregister(llite_kset); kset_unregister(llite_kset);
ll_xattr_fini(); ll_xattr_fini();
......
...@@ -253,7 +253,7 @@ int cl_sb_fini(struct super_block *sb) ...@@ -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 = { ...@@ -526,16 +526,17 @@ static struct seq_operations vvp_pgcache_ops = {
static int vvp_dump_pgcache_seq_open(struct inode *inode, struct file *filp) 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;
struct seq_file *seq; int rc;
int result;
result = seq_open(filp, &vvp_pgcache_ops); rc = seq_open(filp, &vvp_pgcache_ops);
if (result == 0) { if (rc)
seq = filp->private_data; return rc;
seq->private = sbi;
} seq = filp->private_data;
return result; seq->private = inode->i_private ?: PDE_DATA(inode);
return 0;
} }
const struct file_operations vvp_dump_pgcache_file_ops = { const struct file_operations vvp_dump_pgcache_file_ops = {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment