diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2013-10-25 18:47:37 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2013-11-15 22:04:17 -0500 |
commit | b26d4cd385fc51e8844e2cdf9ba2051f5bba11a5 (patch) | |
tree | fcfa7a889b494945abf5705562c0384f88924f78 /fs | |
parent | 951b4bd553e35a291e6b5732ab0124619e81da05 (diff) |
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: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/9p/vfs_dentry.c | 19 | ||||
-rw-r--r-- | fs/configfs/dir.c | 12 | ||||
-rw-r--r-- | fs/efivarfs/super.c | 11 | ||||
-rw-r--r-- | fs/hostfs/hostfs_kern.c | 11 | ||||
-rw-r--r-- | fs/libfs.c | 12 | ||||
-rw-r--r-- | fs/proc/generic.c | 18 | ||||
-rw-r--r-- | fs/proc/namespaces.c | 8 |
7 files changed, 13 insertions, 78 deletions
diff --git a/fs/9p/vfs_dentry.c b/fs/9p/vfs_dentry.c index f039b104a98e..b03dd23feda8 100644 --- a/fs/9p/vfs_dentry.c +++ b/fs/9p/vfs_dentry.c | |||
@@ -43,23 +43,6 @@ | |||
43 | #include "fid.h" | 43 | #include "fid.h" |
44 | 44 | ||
45 | /** | 45 | /** |
46 | * v9fs_dentry_delete - called when dentry refcount equals 0 | ||
47 | * @dentry: dentry in question | ||
48 | * | ||
49 | * By returning 1 here we should remove cacheing of unused | ||
50 | * dentry components. | ||
51 | * | ||
52 | */ | ||
53 | |||
54 | static int v9fs_dentry_delete(const struct dentry *dentry) | ||
55 | { | ||
56 | p9_debug(P9_DEBUG_VFS, " dentry: %s (%p)\n", | ||
57 | dentry->d_name.name, dentry); | ||
58 | |||
59 | return 1; | ||
60 | } | ||
61 | |||
62 | /** | ||
63 | * v9fs_cached_dentry_delete - called when dentry refcount equals 0 | 46 | * v9fs_cached_dentry_delete - called when dentry refcount equals 0 |
64 | * @dentry: dentry in question | 47 | * @dentry: dentry in question |
65 | * | 48 | * |
@@ -134,6 +117,6 @@ const struct dentry_operations v9fs_cached_dentry_operations = { | |||
134 | }; | 117 | }; |
135 | 118 | ||
136 | const struct dentry_operations v9fs_dentry_operations = { | 119 | const struct dentry_operations v9fs_dentry_operations = { |
137 | .d_delete = v9fs_dentry_delete, | 120 | .d_delete = always_delete_dentry, |
138 | .d_release = v9fs_dentry_release, | 121 | .d_release = v9fs_dentry_release, |
139 | }; | 122 | }; |
diff --git a/fs/configfs/dir.c b/fs/configfs/dir.c index 277bd1be21fd..4522e0755773 100644 --- a/fs/configfs/dir.c +++ b/fs/configfs/dir.c | |||
@@ -66,19 +66,9 @@ static void configfs_d_iput(struct dentry * dentry, | |||
66 | iput(inode); | 66 | iput(inode); |
67 | } | 67 | } |
68 | 68 | ||
69 | /* | ||
70 | * We _must_ delete our dentries on last dput, as the chain-to-parent | ||
71 | * behavior is required to clear the parents of default_groups. | ||
72 | */ | ||
73 | static int configfs_d_delete(const struct dentry *dentry) | ||
74 | { | ||
75 | return 1; | ||
76 | } | ||
77 | |||
78 | const struct dentry_operations configfs_dentry_ops = { | 69 | const struct dentry_operations configfs_dentry_ops = { |
79 | .d_iput = configfs_d_iput, | 70 | .d_iput = configfs_d_iput, |
80 | /* simple_delete_dentry() isn't exported */ | 71 | .d_delete = always_delete_dentry, |
81 | .d_delete = configfs_d_delete, | ||
82 | }; | 72 | }; |
83 | 73 | ||
84 | #ifdef CONFIG_LOCKDEP | 74 | #ifdef CONFIG_LOCKDEP |
diff --git a/fs/efivarfs/super.c b/fs/efivarfs/super.c index a8766b880c07..becc725a1953 100644 --- a/fs/efivarfs/super.c +++ b/fs/efivarfs/super.c | |||
@@ -83,19 +83,10 @@ static int efivarfs_d_hash(const struct dentry *dentry, struct qstr *qstr) | |||
83 | return 0; | 83 | return 0; |
84 | } | 84 | } |
85 | 85 | ||
86 | /* | ||
87 | * Retaining negative dentries for an in-memory filesystem just wastes | ||
88 | * memory and lookup time: arrange for them to be deleted immediately. | ||
89 | */ | ||
90 | static int efivarfs_delete_dentry(const struct dentry *dentry) | ||
91 | { | ||
92 | return 1; | ||
93 | } | ||
94 | |||
95 | static struct dentry_operations efivarfs_d_ops = { | 86 | static struct dentry_operations efivarfs_d_ops = { |
96 | .d_compare = efivarfs_d_compare, | 87 | .d_compare = efivarfs_d_compare, |
97 | .d_hash = efivarfs_d_hash, | 88 | .d_hash = efivarfs_d_hash, |
98 | .d_delete = efivarfs_delete_dentry, | 89 | .d_delete = always_delete_dentry, |
99 | }; | 90 | }; |
100 | 91 | ||
101 | static struct dentry *efivarfs_alloc_dentry(struct dentry *parent, char *name) | 92 | static struct dentry *efivarfs_alloc_dentry(struct dentry *parent, char *name) |
diff --git a/fs/hostfs/hostfs_kern.c b/fs/hostfs/hostfs_kern.c index 25437280a207..db23ce1bd903 100644 --- a/fs/hostfs/hostfs_kern.c +++ b/fs/hostfs/hostfs_kern.c | |||
@@ -33,15 +33,6 @@ static inline struct hostfs_inode_info *HOSTFS_I(struct inode *inode) | |||
33 | 33 | ||
34 | #define FILE_HOSTFS_I(file) HOSTFS_I(file_inode(file)) | 34 | #define FILE_HOSTFS_I(file) HOSTFS_I(file_inode(file)) |
35 | 35 | ||
36 | static int hostfs_d_delete(const struct dentry *dentry) | ||
37 | { | ||
38 | return 1; | ||
39 | } | ||
40 | |||
41 | static const struct dentry_operations hostfs_dentry_ops = { | ||
42 | .d_delete = hostfs_d_delete, | ||
43 | }; | ||
44 | |||
45 | /* Changed in hostfs_args before the kernel starts running */ | 36 | /* Changed in hostfs_args before the kernel starts running */ |
46 | static char *root_ino = ""; | 37 | static char *root_ino = ""; |
47 | static int append = 0; | 38 | static int append = 0; |
@@ -925,7 +916,7 @@ static int hostfs_fill_sb_common(struct super_block *sb, void *d, int silent) | |||
925 | sb->s_blocksize_bits = 10; | 916 | sb->s_blocksize_bits = 10; |
926 | sb->s_magic = HOSTFS_SUPER_MAGIC; | 917 | sb->s_magic = HOSTFS_SUPER_MAGIC; |
927 | sb->s_op = &hostfs_sbops; | 918 | sb->s_op = &hostfs_sbops; |
928 | sb->s_d_op = &hostfs_dentry_ops; | 919 | sb->s_d_op = &simple_dentry_operations; |
929 | sb->s_maxbytes = MAX_LFS_FILESIZE; | 920 | sb->s_maxbytes = MAX_LFS_FILESIZE; |
930 | 921 | ||
931 | /* NULL is printed as <NULL> by sprintf: avoid that. */ | 922 | /* NULL is printed as <NULL> by sprintf: avoid that. */ |
diff --git a/fs/libfs.c b/fs/libfs.c index 5de06947ba5e..a1844244246f 100644 --- a/fs/libfs.c +++ b/fs/libfs.c | |||
@@ -47,10 +47,16 @@ EXPORT_SYMBOL(simple_statfs); | |||
47 | * Retaining negative dentries for an in-memory filesystem just wastes | 47 | * Retaining negative dentries for an in-memory filesystem just wastes |
48 | * memory and lookup time: arrange for them to be deleted immediately. | 48 | * memory and lookup time: arrange for them to be deleted immediately. |
49 | */ | 49 | */ |
50 | static int simple_delete_dentry(const struct dentry *dentry) | 50 | int always_delete_dentry(const struct dentry *dentry) |
51 | { | 51 | { |
52 | return 1; | 52 | return 1; |
53 | } | 53 | } |
54 | EXPORT_SYMBOL(always_delete_dentry); | ||
55 | |||
56 | const struct dentry_operations simple_dentry_operations = { | ||
57 | .d_delete = always_delete_dentry, | ||
58 | }; | ||
59 | EXPORT_SYMBOL(simple_dentry_operations); | ||
54 | 60 | ||
55 | /* | 61 | /* |
56 | * Lookup the data. This is trivial - if the dentry didn't already | 62 | * 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 | */ | 64 | */ |
59 | struct dentry *simple_lookup(struct inode *dir, struct dentry *dentry, unsigned int flags) | 65 | struct dentry *simple_lookup(struct inode *dir, struct dentry *dentry, unsigned int flags) |
60 | { | 66 | { |
61 | static const struct dentry_operations simple_dentry_operations = { | ||
62 | .d_delete = simple_delete_dentry, | ||
63 | }; | ||
64 | |||
65 | if (dentry->d_name.len > NAME_MAX) | 67 | if (dentry->d_name.len > NAME_MAX) |
66 | return ERR_PTR(-ENAMETOOLONG); | 68 | return ERR_PTR(-ENAMETOOLONG); |
67 | if (!dentry->d_sb->s_d_op) | 69 | if (!dentry->d_sb->s_d_op) |
diff --git a/fs/proc/generic.c b/fs/proc/generic.c index 737e15615b04..cca93b6fb9a9 100644 --- a/fs/proc/generic.c +++ b/fs/proc/generic.c | |||
@@ -175,22 +175,6 @@ static const struct inode_operations proc_link_inode_operations = { | |||
175 | }; | 175 | }; |
176 | 176 | ||
177 | /* | 177 | /* |
178 | * As some entries in /proc are volatile, we want to | ||
179 | * get rid of unused dentries. This could be made | ||
180 | * smarter: we could keep a "volatile" flag in the | ||
181 | * inode to indicate which ones to keep. | ||
182 | */ | ||
183 | static int proc_delete_dentry(const struct dentry * dentry) | ||
184 | { | ||
185 | return 1; | ||
186 | } | ||
187 | |||
188 | static const struct dentry_operations proc_dentry_operations = | ||
189 | { | ||
190 | .d_delete = proc_delete_dentry, | ||
191 | }; | ||
192 | |||
193 | /* | ||
194 | * Don't create negative dentries here, return -ENOENT by hand | 178 | * Don't create negative dentries here, return -ENOENT by hand |
195 | * instead. | 179 | * instead. |
196 | */ | 180 | */ |
@@ -209,7 +193,7 @@ struct dentry *proc_lookup_de(struct proc_dir_entry *de, struct inode *dir, | |||
209 | inode = proc_get_inode(dir->i_sb, de); | 193 | inode = proc_get_inode(dir->i_sb, de); |
210 | if (!inode) | 194 | if (!inode) |
211 | return ERR_PTR(-ENOMEM); | 195 | return ERR_PTR(-ENOMEM); |
212 | d_set_d_op(dentry, &proc_dentry_operations); | 196 | d_set_d_op(dentry, &simple_dentry_operations); |
213 | d_add(dentry, inode); | 197 | d_add(dentry, inode); |
214 | return NULL; | 198 | return NULL; |
215 | } | 199 | } |
diff --git a/fs/proc/namespaces.c b/fs/proc/namespaces.c index 49a7fff2e83a..9ae46b87470d 100644 --- a/fs/proc/namespaces.c +++ b/fs/proc/namespaces.c | |||
@@ -42,12 +42,6 @@ static const struct inode_operations ns_inode_operations = { | |||
42 | .setattr = proc_setattr, | 42 | .setattr = proc_setattr, |
43 | }; | 43 | }; |
44 | 44 | ||
45 | static int ns_delete_dentry(const struct dentry *dentry) | ||
46 | { | ||
47 | /* Don't cache namespace inodes when not in use */ | ||
48 | return 1; | ||
49 | } | ||
50 | |||
51 | static char *ns_dname(struct dentry *dentry, char *buffer, int buflen) | 45 | static char *ns_dname(struct dentry *dentry, char *buffer, int buflen) |
52 | { | 46 | { |
53 | struct inode *inode = dentry->d_inode; | 47 | struct inode *inode = dentry->d_inode; |
@@ -59,7 +53,7 @@ static char *ns_dname(struct dentry *dentry, char *buffer, int buflen) | |||
59 | 53 | ||
60 | const struct dentry_operations ns_dentry_operations = | 54 | const struct dentry_operations ns_dentry_operations = |
61 | { | 55 | { |
62 | .d_delete = ns_delete_dentry, | 56 | .d_delete = always_delete_dentry, |
63 | .d_dname = ns_dname, | 57 | .d_dname = ns_dname, |
64 | }; | 58 | }; |
65 | 59 | ||