Commit 82765049 authored by Dmitry Eremin's avatar Dmitry Eremin Committed by Greg Kroah-Hartman

staging/lustre/fld: move all files from procfs to debugfs

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