Commit b26d4cd3 authored by Al Viro's avatar Al Viro

consolidate simple ->d_delete() instances

Rename simple_delete_dentry() to always_delete_dentry() and export it.
Export simple_dentry_operations, while we are at it, and get rid of
their duplicates
Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent 951b4bd5
...@@ -2166,12 +2166,6 @@ static const struct file_operations pfm_file_ops = { ...@@ -2166,12 +2166,6 @@ static const struct file_operations pfm_file_ops = {
.flush = pfm_flush .flush = pfm_flush
}; };
static int
pfmfs_delete_dentry(const struct dentry *dentry)
{
return 1;
}
static char *pfmfs_dname(struct dentry *dentry, char *buffer, int buflen) static char *pfmfs_dname(struct dentry *dentry, char *buffer, int buflen)
{ {
return dynamic_dname(dentry, buffer, buflen, "pfm:[%lu]", return dynamic_dname(dentry, buffer, buflen, "pfm:[%lu]",
...@@ -2179,7 +2173,7 @@ static char *pfmfs_dname(struct dentry *dentry, char *buffer, int buflen) ...@@ -2179,7 +2173,7 @@ static char *pfmfs_dname(struct dentry *dentry, char *buffer, int buflen)
} }
static const struct dentry_operations pfmfs_dentry_operations = { static const struct dentry_operations pfmfs_dentry_operations = {
.d_delete = pfmfs_delete_dentry, .d_delete = always_delete_dentry,
.d_dname = pfmfs_dname, .d_dname = pfmfs_dname,
}; };
......
...@@ -42,23 +42,6 @@ ...@@ -42,23 +42,6 @@
#include "v9fs_vfs.h" #include "v9fs_vfs.h"
#include "fid.h" #include "fid.h"
/**
* v9fs_dentry_delete - called when dentry refcount equals 0
* @dentry: dentry in question
*
* By returning 1 here we should remove cacheing of unused
* dentry components.
*
*/
static int v9fs_dentry_delete(const struct dentry *dentry)
{
p9_debug(P9_DEBUG_VFS, " dentry: %s (%p)\n",
dentry->d_name.name, dentry);
return 1;
}
/** /**
* v9fs_cached_dentry_delete - called when dentry refcount equals 0 * v9fs_cached_dentry_delete - called when dentry refcount equals 0
* @dentry: dentry in question * @dentry: dentry in question
...@@ -134,6 +117,6 @@ const struct dentry_operations v9fs_cached_dentry_operations = { ...@@ -134,6 +117,6 @@ const struct dentry_operations v9fs_cached_dentry_operations = {
}; };
const struct dentry_operations v9fs_dentry_operations = { const struct dentry_operations v9fs_dentry_operations = {
.d_delete = v9fs_dentry_delete, .d_delete = always_delete_dentry,
.d_release = v9fs_dentry_release, .d_release = v9fs_dentry_release,
}; };
...@@ -66,19 +66,9 @@ static void configfs_d_iput(struct dentry * dentry, ...@@ -66,19 +66,9 @@ static void configfs_d_iput(struct dentry * dentry,
iput(inode); iput(inode);
} }
/*
* We _must_ delete our dentries on last dput, as the chain-to-parent
* behavior is required to clear the parents of default_groups.
*/
static int configfs_d_delete(const struct dentry *dentry)
{
return 1;
}
const struct dentry_operations configfs_dentry_ops = { const struct dentry_operations configfs_dentry_ops = {
.d_iput = configfs_d_iput, .d_iput = configfs_d_iput,
/* simple_delete_dentry() isn't exported */ .d_delete = always_delete_dentry,
.d_delete = configfs_d_delete,
}; };
#ifdef CONFIG_LOCKDEP #ifdef CONFIG_LOCKDEP
......
...@@ -83,19 +83,10 @@ static int efivarfs_d_hash(const struct dentry *dentry, struct qstr *qstr) ...@@ -83,19 +83,10 @@ static int efivarfs_d_hash(const struct dentry *dentry, struct qstr *qstr)
return 0; return 0;
} }
/*
* Retaining negative dentries for an in-memory filesystem just wastes
* memory and lookup time: arrange for them to be deleted immediately.
*/
static int efivarfs_delete_dentry(const struct dentry *dentry)
{
return 1;
}
static struct dentry_operations efivarfs_d_ops = { static struct dentry_operations efivarfs_d_ops = {
.d_compare = efivarfs_d_compare, .d_compare = efivarfs_d_compare,
.d_hash = efivarfs_d_hash, .d_hash = efivarfs_d_hash,
.d_delete = efivarfs_delete_dentry, .d_delete = always_delete_dentry,
}; };
static struct dentry *efivarfs_alloc_dentry(struct dentry *parent, char *name) static struct dentry *efivarfs_alloc_dentry(struct dentry *parent, char *name)
......
...@@ -33,15 +33,6 @@ static inline struct hostfs_inode_info *HOSTFS_I(struct inode *inode) ...@@ -33,15 +33,6 @@ static inline struct hostfs_inode_info *HOSTFS_I(struct inode *inode)
#define FILE_HOSTFS_I(file) HOSTFS_I(file_inode(file)) #define FILE_HOSTFS_I(file) HOSTFS_I(file_inode(file))
static int hostfs_d_delete(const struct dentry *dentry)
{
return 1;
}
static const struct dentry_operations hostfs_dentry_ops = {
.d_delete = hostfs_d_delete,
};
/* Changed in hostfs_args before the kernel starts running */ /* Changed in hostfs_args before the kernel starts running */
static char *root_ino = ""; static char *root_ino = "";
static int append = 0; static int append = 0;
...@@ -925,7 +916,7 @@ static int hostfs_fill_sb_common(struct super_block *sb, void *d, int silent) ...@@ -925,7 +916,7 @@ static int hostfs_fill_sb_common(struct super_block *sb, void *d, int silent)
sb->s_blocksize_bits = 10; sb->s_blocksize_bits = 10;
sb->s_magic = HOSTFS_SUPER_MAGIC; sb->s_magic = HOSTFS_SUPER_MAGIC;
sb->s_op = &hostfs_sbops; sb->s_op = &hostfs_sbops;
sb->s_d_op = &hostfs_dentry_ops; sb->s_d_op = &simple_dentry_operations;
sb->s_maxbytes = MAX_LFS_FILESIZE; sb->s_maxbytes = MAX_LFS_FILESIZE;
/* NULL is printed as <NULL> by sprintf: avoid that. */ /* NULL is printed as <NULL> by sprintf: avoid that. */
......
...@@ -47,10 +47,16 @@ EXPORT_SYMBOL(simple_statfs); ...@@ -47,10 +47,16 @@ EXPORT_SYMBOL(simple_statfs);
* Retaining negative dentries for an in-memory filesystem just wastes * Retaining negative dentries for an in-memory filesystem just wastes
* memory and lookup time: arrange for them to be deleted immediately. * memory and lookup time: arrange for them to be deleted immediately.
*/ */
static int simple_delete_dentry(const struct dentry *dentry) int always_delete_dentry(const struct dentry *dentry)
{ {
return 1; return 1;
} }
EXPORT_SYMBOL(always_delete_dentry);
const struct dentry_operations simple_dentry_operations = {
.d_delete = always_delete_dentry,
};
EXPORT_SYMBOL(simple_dentry_operations);
/* /*
* Lookup the data. This is trivial - if the dentry didn't already * Lookup the data. This is trivial - if the dentry didn't already
...@@ -58,10 +64,6 @@ static int simple_delete_dentry(const struct dentry *dentry) ...@@ -58,10 +64,6 @@ static int simple_delete_dentry(const struct dentry *dentry)
*/ */
struct dentry *simple_lookup(struct inode *dir, struct dentry *dentry, unsigned int flags) struct dentry *simple_lookup(struct inode *dir, struct dentry *dentry, unsigned int flags)
{ {
static const struct dentry_operations simple_dentry_operations = {
.d_delete = simple_delete_dentry,
};
if (dentry->d_name.len > NAME_MAX) if (dentry->d_name.len > NAME_MAX)
return ERR_PTR(-ENAMETOOLONG); return ERR_PTR(-ENAMETOOLONG);
if (!dentry->d_sb->s_d_op) if (!dentry->d_sb->s_d_op)
......
...@@ -174,22 +174,6 @@ static const struct inode_operations proc_link_inode_operations = { ...@@ -174,22 +174,6 @@ static const struct inode_operations proc_link_inode_operations = {
.follow_link = proc_follow_link, .follow_link = proc_follow_link,
}; };
/*
* As some entries in /proc are volatile, we want to
* get rid of unused dentries. This could be made
* smarter: we could keep a "volatile" flag in the
* inode to indicate which ones to keep.
*/
static int proc_delete_dentry(const struct dentry * dentry)
{
return 1;
}
static const struct dentry_operations proc_dentry_operations =
{
.d_delete = proc_delete_dentry,
};
/* /*
* Don't create negative dentries here, return -ENOENT by hand * Don't create negative dentries here, return -ENOENT by hand
* instead. * instead.
...@@ -209,7 +193,7 @@ struct dentry *proc_lookup_de(struct proc_dir_entry *de, struct inode *dir, ...@@ -209,7 +193,7 @@ struct dentry *proc_lookup_de(struct proc_dir_entry *de, struct inode *dir,
inode = proc_get_inode(dir->i_sb, de); inode = proc_get_inode(dir->i_sb, de);
if (!inode) if (!inode)
return ERR_PTR(-ENOMEM); return ERR_PTR(-ENOMEM);
d_set_d_op(dentry, &proc_dentry_operations); d_set_d_op(dentry, &simple_dentry_operations);
d_add(dentry, inode); d_add(dentry, inode);
return NULL; return NULL;
} }
......
...@@ -42,12 +42,6 @@ static const struct inode_operations ns_inode_operations = { ...@@ -42,12 +42,6 @@ static const struct inode_operations ns_inode_operations = {
.setattr = proc_setattr, .setattr = proc_setattr,
}; };
static int ns_delete_dentry(const struct dentry *dentry)
{
/* Don't cache namespace inodes when not in use */
return 1;
}
static char *ns_dname(struct dentry *dentry, char *buffer, int buflen) static char *ns_dname(struct dentry *dentry, char *buffer, int buflen)
{ {
struct inode *inode = dentry->d_inode; struct inode *inode = dentry->d_inode;
...@@ -59,7 +53,7 @@ static char *ns_dname(struct dentry *dentry, char *buffer, int buflen) ...@@ -59,7 +53,7 @@ static char *ns_dname(struct dentry *dentry, char *buffer, int buflen)
const struct dentry_operations ns_dentry_operations = const struct dentry_operations ns_dentry_operations =
{ {
.d_delete = ns_delete_dentry, .d_delete = always_delete_dentry,
.d_dname = ns_dname, .d_dname = ns_dname,
}; };
......
...@@ -2622,7 +2622,9 @@ extern int simple_write_begin(struct file *file, struct address_space *mapping, ...@@ -2622,7 +2622,9 @@ extern int simple_write_begin(struct file *file, struct address_space *mapping,
extern int simple_write_end(struct file *file, struct address_space *mapping, extern int simple_write_end(struct file *file, struct address_space *mapping,
loff_t pos, unsigned len, unsigned copied, loff_t pos, unsigned len, unsigned copied,
struct page *page, void *fsdata); struct page *page, void *fsdata);
extern int always_delete_dentry(const struct dentry *);
extern struct inode *alloc_anon_inode(struct super_block *); extern struct inode *alloc_anon_inode(struct super_block *);
extern const struct dentry_operations simple_dentry_operations;
extern struct dentry *simple_lookup(struct inode *, struct dentry *, unsigned int flags); extern struct dentry *simple_lookup(struct inode *, struct dentry *, unsigned int flags);
extern ssize_t generic_read_dir(struct file *, char __user *, size_t, loff_t *); extern ssize_t generic_read_dir(struct file *, char __user *, size_t, loff_t *);
......
...@@ -895,11 +895,6 @@ static void cgroup_diput(struct dentry *dentry, struct inode *inode) ...@@ -895,11 +895,6 @@ static void cgroup_diput(struct dentry *dentry, struct inode *inode)
iput(inode); iput(inode);
} }
static int cgroup_delete(const struct dentry *d)
{
return 1;
}
static void remove_dir(struct dentry *d) static void remove_dir(struct dentry *d)
{ {
struct dentry *parent = dget(d->d_parent); struct dentry *parent = dget(d->d_parent);
...@@ -1486,7 +1481,7 @@ static int cgroup_get_rootdir(struct super_block *sb) ...@@ -1486,7 +1481,7 @@ static int cgroup_get_rootdir(struct super_block *sb)
{ {
static const struct dentry_operations cgroup_dops = { static const struct dentry_operations cgroup_dops = {
.d_iput = cgroup_diput, .d_iput = cgroup_diput,
.d_delete = cgroup_delete, .d_delete = always_delete_dentry,
}; };
struct inode *inode = struct inode *inode =
......
...@@ -471,15 +471,6 @@ struct rpc_filelist { ...@@ -471,15 +471,6 @@ struct rpc_filelist {
umode_t mode; umode_t mode;
}; };
static int rpc_delete_dentry(const struct dentry *dentry)
{
return 1;
}
static const struct dentry_operations rpc_dentry_operations = {
.d_delete = rpc_delete_dentry,
};
static struct inode * static struct inode *
rpc_get_inode(struct super_block *sb, umode_t mode) rpc_get_inode(struct super_block *sb, umode_t mode)
{ {
...@@ -1266,7 +1257,7 @@ rpc_fill_super(struct super_block *sb, void *data, int silent) ...@@ -1266,7 +1257,7 @@ rpc_fill_super(struct super_block *sb, void *data, int silent)
sb->s_blocksize_bits = PAGE_CACHE_SHIFT; sb->s_blocksize_bits = PAGE_CACHE_SHIFT;
sb->s_magic = RPCAUTH_GSSMAGIC; sb->s_magic = RPCAUTH_GSSMAGIC;
sb->s_op = &s_ops; sb->s_op = &s_ops;
sb->s_d_op = &rpc_dentry_operations; sb->s_d_op = &simple_dentry_operations;
sb->s_time_gran = 1; sb->s_time_gran = 1;
inode = rpc_get_inode(sb, S_IFDIR | S_IRUGO | S_IXUGO); inode = rpc_get_inode(sb, S_IFDIR | S_IRUGO | S_IXUGO);
......
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