From 827650494fbe9390052502d0498c8b90b2e329ec Mon Sep 17 00:00:00 2001 From: Dmitry Eremin Date: Thu, 21 May 2015 15:32:26 -0400 Subject: [PATCH] staging/lustre/fld: move all files from procfs to debugfs Signed-off-by: Dmitry Eremin Signed-off-by: Greg Kroah-Hartman --- .../staging/lustre/lustre/fld/fld_internal.h | 5 +- .../staging/lustre/lustre/fld/fld_request.c | 66 +++++++------------ drivers/staging/lustre/lustre/fld/lproc_fld.c | 42 ++++++------ .../lustre/lustre/include/lustre_fld.h | 12 ++-- drivers/staging/lustre/lustre/lmv/lmv_obd.c | 2 +- 5 files changed, 55 insertions(+), 72 deletions(-) diff --git a/drivers/staging/lustre/lustre/fld/fld_internal.h b/drivers/staging/lustre/lustre/fld/fld_internal.h index 68bec7658463..844576b9bc6f 100644 --- a/drivers/staging/lustre/lustre/fld/fld_internal.h +++ b/drivers/staging/lustre/lustre/fld/fld_internal.h @@ -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); diff --git a/drivers/staging/lustre/lustre/fld/fld_request.c b/drivers/staging/lustre/lustre/fld/fld_request.c index 075eb5ceedb6..c3b47f2346df 100644 --- a/drivers/staging/lustre/lustre/fld/fld_request.c +++ b/drivers/staging/lustre/lustre/fld/fld_request.c @@ -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. "); diff --git a/drivers/staging/lustre/lustre/fld/lproc_fld.c b/drivers/staging/lustre/lustre/fld/lproc_fld.c index f53fdcfae34e..b35ff288dbd5 100644 --- a/drivers/staging/lustre/lustre/fld/lproc_fld.c +++ b/drivers/staging/lustre/lustre/fld/lproc_fld.c @@ -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 } }; diff --git a/drivers/staging/lustre/lustre/include/lustre_fld.h b/drivers/staging/lustre/lustre/include/lustre_fld.h index 5ee4b1ed0995..588cdd5a291c 100644 --- a/drivers/staging/lustre/lustre/include/lustre_fld.h +++ b/drivers/staging/lustre/lustre/include/lustre_fld.h @@ -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 */ diff --git a/drivers/staging/lustre/lustre/lmv/lmv_obd.c b/drivers/staging/lustre/lustre/lmv/lmv_obd.c index 695a4ed9e627..65c01383725c 100644 --- a/drivers/staging/lustre/lustre/lmv/lmv_obd.c +++ b/drivers/staging/lustre/lustre/lmv/lmv_obd.c @@ -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: -- 2.20.1