Commit 863d7d9c authored by Kinglong Mee's avatar Kinglong Mee Committed by Anna Schumaker

sunrpc/nfs: cleanup procfs/pipefs entry in cache_detail

Record flush/channel/content entries is useless, remove them.
Signed-off-by: default avatarKinglong Mee <kinglongmee@gmail.com>
Signed-off-by: default avatarAnna Schumaker <Anna.Schumaker@Netapp.com>
parent 2864486b
...@@ -141,8 +141,7 @@ int nfs_cache_register_net(struct net *net, struct cache_detail *cd) ...@@ -141,8 +141,7 @@ int nfs_cache_register_net(struct net *net, struct cache_detail *cd)
void nfs_cache_unregister_sb(struct super_block *sb, struct cache_detail *cd) void nfs_cache_unregister_sb(struct super_block *sb, struct cache_detail *cd)
{ {
if (cd->u.pipefs.dir) sunrpc_cache_unregister_pipefs(cd);
sunrpc_cache_unregister_pipefs(cd);
} }
void nfs_cache_unregister_net(struct net *net, struct cache_detail *cd) void nfs_cache_unregister_net(struct net *net, struct cache_detail *cd)
......
...@@ -63,15 +63,6 @@ struct cache_head { ...@@ -63,15 +63,6 @@ struct cache_head {
#define CACHE_NEW_EXPIRY 120 /* keep new things pending confirmation for 120 seconds */ #define CACHE_NEW_EXPIRY 120 /* keep new things pending confirmation for 120 seconds */
struct cache_detail_procfs {
struct proc_dir_entry *proc_ent;
struct proc_dir_entry *flush_ent, *channel_ent, *content_ent;
};
struct cache_detail_pipefs {
struct dentry *dir;
};
struct cache_detail { struct cache_detail {
struct module * owner; struct module * owner;
int hash_size; int hash_size;
...@@ -123,9 +114,9 @@ struct cache_detail { ...@@ -123,9 +114,9 @@ struct cache_detail {
time_t last_warn; /* when we last warned about no readers */ time_t last_warn; /* when we last warned about no readers */
union { union {
struct cache_detail_procfs procfs; struct proc_dir_entry *procfs;
struct cache_detail_pipefs pipefs; struct dentry *pipefs;
} u; };
struct net *net; struct net *net;
}; };
......
...@@ -1600,21 +1600,12 @@ static const struct file_operations cache_flush_operations_procfs = { ...@@ -1600,21 +1600,12 @@ static const struct file_operations cache_flush_operations_procfs = {
.llseek = no_llseek, .llseek = no_llseek,
}; };
static void remove_cache_proc_entries(struct cache_detail *cd, struct net *net) static void remove_cache_proc_entries(struct cache_detail *cd)
{ {
struct sunrpc_net *sn; if (cd->procfs) {
proc_remove(cd->procfs);
if (cd->u.procfs.proc_ent == NULL) cd->procfs = NULL;
return; }
if (cd->u.procfs.flush_ent)
remove_proc_entry("flush", cd->u.procfs.proc_ent);
if (cd->u.procfs.channel_ent)
remove_proc_entry("channel", cd->u.procfs.proc_ent);
if (cd->u.procfs.content_ent)
remove_proc_entry("content", cd->u.procfs.proc_ent);
cd->u.procfs.proc_ent = NULL;
sn = net_generic(net, sunrpc_net_id);
remove_proc_entry(cd->name, sn->proc_net_rpc);
} }
#ifdef CONFIG_PROC_FS #ifdef CONFIG_PROC_FS
...@@ -1624,38 +1615,30 @@ static int create_cache_proc_entries(struct cache_detail *cd, struct net *net) ...@@ -1624,38 +1615,30 @@ static int create_cache_proc_entries(struct cache_detail *cd, struct net *net)
struct sunrpc_net *sn; struct sunrpc_net *sn;
sn = net_generic(net, sunrpc_net_id); sn = net_generic(net, sunrpc_net_id);
cd->u.procfs.proc_ent = proc_mkdir(cd->name, sn->proc_net_rpc); cd->procfs = proc_mkdir(cd->name, sn->proc_net_rpc);
if (cd->u.procfs.proc_ent == NULL) if (cd->procfs == NULL)
goto out_nomem; goto out_nomem;
cd->u.procfs.channel_ent = NULL;
cd->u.procfs.content_ent = NULL;
p = proc_create_data("flush", S_IFREG|S_IRUSR|S_IWUSR, p = proc_create_data("flush", S_IFREG|S_IRUSR|S_IWUSR,
cd->u.procfs.proc_ent, cd->procfs, &cache_flush_operations_procfs, cd);
&cache_flush_operations_procfs, cd);
cd->u.procfs.flush_ent = p;
if (p == NULL) if (p == NULL)
goto out_nomem; goto out_nomem;
if (cd->cache_request || cd->cache_parse) { if (cd->cache_request || cd->cache_parse) {
p = proc_create_data("channel", S_IFREG|S_IRUSR|S_IWUSR, p = proc_create_data("channel", S_IFREG|S_IRUSR|S_IWUSR,
cd->u.procfs.proc_ent, cd->procfs, &cache_file_operations_procfs, cd);
&cache_file_operations_procfs, cd);
cd->u.procfs.channel_ent = p;
if (p == NULL) if (p == NULL)
goto out_nomem; goto out_nomem;
} }
if (cd->cache_show) { if (cd->cache_show) {
p = proc_create_data("content", S_IFREG|S_IRUSR, p = proc_create_data("content", S_IFREG|S_IRUSR,
cd->u.procfs.proc_ent, cd->procfs, &content_file_operations_procfs, cd);
&content_file_operations_procfs, cd);
cd->u.procfs.content_ent = p;
if (p == NULL) if (p == NULL)
goto out_nomem; goto out_nomem;
} }
return 0; return 0;
out_nomem: out_nomem:
remove_cache_proc_entries(cd, net); remove_cache_proc_entries(cd);
return -ENOMEM; return -ENOMEM;
} }
#else /* CONFIG_PROC_FS */ #else /* CONFIG_PROC_FS */
...@@ -1684,7 +1667,7 @@ EXPORT_SYMBOL_GPL(cache_register_net); ...@@ -1684,7 +1667,7 @@ EXPORT_SYMBOL_GPL(cache_register_net);
void cache_unregister_net(struct cache_detail *cd, struct net *net) void cache_unregister_net(struct cache_detail *cd, struct net *net)
{ {
remove_cache_proc_entries(cd, net); remove_cache_proc_entries(cd);
sunrpc_destroy_cache_detail(cd); sunrpc_destroy_cache_detail(cd);
} }
EXPORT_SYMBOL_GPL(cache_unregister_net); EXPORT_SYMBOL_GPL(cache_unregister_net);
...@@ -1843,15 +1826,17 @@ int sunrpc_cache_register_pipefs(struct dentry *parent, ...@@ -1843,15 +1826,17 @@ int sunrpc_cache_register_pipefs(struct dentry *parent,
struct dentry *dir = rpc_create_cache_dir(parent, name, umode, cd); struct dentry *dir = rpc_create_cache_dir(parent, name, umode, cd);
if (IS_ERR(dir)) if (IS_ERR(dir))
return PTR_ERR(dir); return PTR_ERR(dir);
cd->u.pipefs.dir = dir; cd->pipefs = dir;
return 0; return 0;
} }
EXPORT_SYMBOL_GPL(sunrpc_cache_register_pipefs); EXPORT_SYMBOL_GPL(sunrpc_cache_register_pipefs);
void sunrpc_cache_unregister_pipefs(struct cache_detail *cd) void sunrpc_cache_unregister_pipefs(struct cache_detail *cd)
{ {
rpc_remove_cache_dir(cd->u.pipefs.dir); if (cd->pipefs) {
cd->u.pipefs.dir = NULL; rpc_remove_cache_dir(cd->pipefs);
cd->pipefs = NULL;
}
} }
EXPORT_SYMBOL_GPL(sunrpc_cache_unregister_pipefs); EXPORT_SYMBOL_GPL(sunrpc_cache_unregister_pipefs);
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