Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

Al Viro b26d4cd3 951b4bd5

+18 -101
+1 -7
arch/ia64/kernel/perfmon.c
··· 2166 2166 .flush = pfm_flush 2167 2167 }; 2168 2168 2169 - static int 2170 - pfmfs_delete_dentry(const struct dentry *dentry) 2171 - { 2172 - return 1; 2173 - } 2174 - 2175 2169 static char *pfmfs_dname(struct dentry *dentry, char *buffer, int buflen) 2176 2170 { 2177 2171 return dynamic_dname(dentry, buffer, buflen, "pfm:[%lu]", ··· 2173 2179 } 2174 2180 2175 2181 static const struct dentry_operations pfmfs_dentry_operations = { 2176 - .d_delete = pfmfs_delete_dentry, 2182 + .d_delete = always_delete_dentry, 2177 2183 .d_dname = pfmfs_dname, 2178 2184 }; 2179 2185
+1 -18
fs/9p/vfs_dentry.c
··· 43 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 46 * v9fs_cached_dentry_delete - called when dentry refcount equals 0 64 47 * @dentry: dentry in question 65 48 * ··· 117 134 }; 118 135 119 136 const struct dentry_operations v9fs_dentry_operations = { 120 - .d_delete = v9fs_dentry_delete, 137 + .d_delete = always_delete_dentry, 121 138 .d_release = v9fs_dentry_release, 122 139 };
+1 -11
fs/configfs/dir.c
··· 66 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 69 const struct dentry_operations configfs_dentry_ops = { 79 70 .d_iput = configfs_d_iput, 80 - /* simple_delete_dentry() isn't exported */ 81 - .d_delete = configfs_d_delete, 71 + .d_delete = always_delete_dentry, 82 72 }; 83 73 84 74 #ifdef CONFIG_LOCKDEP
+1 -10
fs/efivarfs/super.c
··· 83 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 86 static struct dentry_operations efivarfs_d_ops = { 96 87 .d_compare = efivarfs_d_compare, 97 88 .d_hash = efivarfs_d_hash, 98 - .d_delete = efivarfs_delete_dentry, 89 + .d_delete = always_delete_dentry, 99 90 }; 100 91 101 92 static struct dentry *efivarfs_alloc_dentry(struct dentry *parent, char *name)
+1 -10
fs/hostfs/hostfs_kern.c
··· 33 33 34 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 36 /* Changed in hostfs_args before the kernel starts running */ 46 37 static char *root_ino = ""; 47 38 static int append = 0; ··· 916 925 sb->s_blocksize_bits = 10; 917 926 sb->s_magic = HOSTFS_SUPER_MAGIC; 918 927 sb->s_op = &hostfs_sbops; 919 - sb->s_d_op = &hostfs_dentry_ops; 928 + sb->s_d_op = &simple_dentry_operations; 920 929 sb->s_maxbytes = MAX_LFS_FILESIZE; 921 930 922 931 /* NULL is printed as <NULL> by sprintf: avoid that. */
+7 -5
fs/libfs.c
··· 47 47 * Retaining negative dentries for an in-memory filesystem just wastes 48 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 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 62 * Lookup the data. This is trivial - if the dentry didn't already ··· 64 58 */ 65 59 struct dentry *simple_lookup(struct inode *dir, struct dentry *dentry, unsigned int flags) 66 60 { 67 - static const struct dentry_operations simple_dentry_operations = { 68 - .d_delete = simple_delete_dentry, 69 - }; 70 - 71 61 if (dentry->d_name.len > NAME_MAX) 72 62 return ERR_PTR(-ENAMETOOLONG); 73 63 if (!dentry->d_sb->s_d_op)
+1 -17
fs/proc/generic.c
··· 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 178 * Don't create negative dentries here, return -ENOENT by hand 195 179 * instead. 196 180 */ ··· 193 209 inode = proc_get_inode(dir->i_sb, de); 194 210 if (!inode) 195 211 return ERR_PTR(-ENOMEM); 196 - d_set_d_op(dentry, &proc_dentry_operations); 212 + d_set_d_op(dentry, &simple_dentry_operations); 197 213 d_add(dentry, inode); 198 214 return NULL; 199 215 }
+1 -7
fs/proc/namespaces.c
··· 42 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 45 static char *ns_dname(struct dentry *dentry, char *buffer, int buflen) 52 46 { 53 47 struct inode *inode = dentry->d_inode; ··· 53 59 54 60 const struct dentry_operations ns_dentry_operations = 55 61 { 56 - .d_delete = ns_delete_dentry, 62 + .d_delete = always_delete_dentry, 57 63 .d_dname = ns_dname, 58 64 }; 59 65
+2
include/linux/fs.h
··· 2622 2622 extern int simple_write_end(struct file *file, struct address_space *mapping, 2623 2623 loff_t pos, unsigned len, unsigned copied, 2624 2624 struct page *page, void *fsdata); 2625 + extern int always_delete_dentry(const struct dentry *); 2625 2626 extern struct inode *alloc_anon_inode(struct super_block *); 2627 + extern const struct dentry_operations simple_dentry_operations; 2626 2628 2627 2629 extern struct dentry *simple_lookup(struct inode *, struct dentry *, unsigned int flags); 2628 2630 extern ssize_t generic_read_dir(struct file *, char __user *, size_t, loff_t *);
+1 -6
kernel/cgroup.c
··· 895 895 iput(inode); 896 896 } 897 897 898 - static int cgroup_delete(const struct dentry *d) 899 - { 900 - return 1; 901 - } 902 - 903 898 static void remove_dir(struct dentry *d) 904 899 { 905 900 struct dentry *parent = dget(d->d_parent); ··· 1481 1486 { 1482 1487 static const struct dentry_operations cgroup_dops = { 1483 1488 .d_iput = cgroup_diput, 1484 - .d_delete = cgroup_delete, 1489 + .d_delete = always_delete_dentry, 1485 1490 }; 1486 1491 1487 1492 struct inode *inode =
+1 -10
net/sunrpc/rpc_pipe.c
··· 471 471 umode_t mode; 472 472 }; 473 473 474 - static int rpc_delete_dentry(const struct dentry *dentry) 475 - { 476 - return 1; 477 - } 478 - 479 - static const struct dentry_operations rpc_dentry_operations = { 480 - .d_delete = rpc_delete_dentry, 481 - }; 482 - 483 474 static struct inode * 484 475 rpc_get_inode(struct super_block *sb, umode_t mode) 485 476 { ··· 1257 1266 sb->s_blocksize_bits = PAGE_CACHE_SHIFT; 1258 1267 sb->s_magic = RPCAUTH_GSSMAGIC; 1259 1268 sb->s_op = &s_ops; 1260 - sb->s_d_op = &rpc_dentry_operations; 1269 + sb->s_d_op = &simple_dentry_operations; 1261 1270 sb->s_time_gran = 1; 1262 1271 1263 1272 inode = rpc_get_inode(sb, S_IFDIR | S_IRUGO | S_IXUGO);