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

vfs: fix the stupidity with i_dentry in inode destructors

Seeing that just about every destructor got that INIT_LIST_HEAD() copied into
it, there is no point whatsoever keeping this INIT_LIST_HEAD in inode_init_once();
the cost of taking it into inode_init_always() will be negligible for pipes
and sockets and negative for everything else. Not to mention the removal of
boilerplate code from ->destroy_inode() instances...

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>

Al Viro 6b520e05 2a79f17e

+1 -55
-1
arch/powerpc/platforms/cell/spufs/inode.c
··· 74 74 static void spufs_i_callback(struct rcu_head *head) 75 75 { 76 76 struct inode *inode = container_of(head, struct inode, i_rcu); 77 - INIT_LIST_HEAD(&inode->i_dentry); 78 77 kmem_cache_free(spufs_inode_cache, SPUFS_I(inode)); 79 78 } 80 79
-1
drivers/staging/pohmelfs/inode.c
··· 830 830 static void pohmelfs_i_callback(struct rcu_head *head) 831 831 { 832 832 struct inode *inode = container_of(head, struct inode, i_rcu); 833 - INIT_LIST_HEAD(&inode->i_dentry); 834 833 kmem_cache_free(pohmelfs_inode_cache, POHMELFS_I(inode)); 835 834 } 836 835
-1
fs/9p/vfs_inode.c
··· 251 251 static void v9fs_i_callback(struct rcu_head *head) 252 252 { 253 253 struct inode *inode = container_of(head, struct inode, i_rcu); 254 - INIT_LIST_HEAD(&inode->i_dentry); 255 254 kmem_cache_free(v9fs_inode_cache, V9FS_I(inode)); 256 255 } 257 256
-1
fs/affs/super.c
··· 98 98 static void affs_i_callback(struct rcu_head *head) 99 99 { 100 100 struct inode *inode = container_of(head, struct inode, i_rcu); 101 - INIT_LIST_HEAD(&inode->i_dentry); 102 101 kmem_cache_free(affs_inode_cachep, AFFS_I(inode)); 103 102 } 104 103
-1
fs/afs/super.c
··· 495 495 { 496 496 struct inode *inode = container_of(head, struct inode, i_rcu); 497 497 struct afs_vnode *vnode = AFS_FS_I(inode); 498 - INIT_LIST_HEAD(&inode->i_dentry); 499 498 kmem_cache_free(afs_inode_cachep, vnode); 500 499 } 501 500
-1
fs/befs/linuxvfs.c
··· 286 286 static void befs_i_callback(struct rcu_head *head) 287 287 { 288 288 struct inode *inode = container_of(head, struct inode, i_rcu); 289 - INIT_LIST_HEAD(&inode->i_dentry); 290 289 kmem_cache_free(befs_inode_cachep, BEFS_I(inode)); 291 290 } 292 291
-1
fs/bfs/inode.c
··· 251 251 static void bfs_i_callback(struct rcu_head *head) 252 252 { 253 253 struct inode *inode = container_of(head, struct inode, i_rcu); 254 - INIT_LIST_HEAD(&inode->i_dentry); 255 254 kmem_cache_free(bfs_inode_cachep, BFS_I(inode)); 256 255 } 257 256
-1
fs/block_dev.c
··· 425 425 struct inode *inode = container_of(head, struct inode, i_rcu); 426 426 struct bdev_inode *bdi = BDEV_I(inode); 427 427 428 - INIT_LIST_HEAD(&inode->i_dentry); 429 428 kmem_cache_free(bdev_cachep, bdi); 430 429 } 431 430
-1
fs/btrfs/inode.c
··· 6761 6761 static void btrfs_i_callback(struct rcu_head *head) 6762 6762 { 6763 6763 struct inode *inode = container_of(head, struct inode, i_rcu); 6764 - INIT_LIST_HEAD(&inode->i_dentry); 6765 6764 kmem_cache_free(btrfs_inode_cachep, BTRFS_I(inode)); 6766 6765 } 6767 6766
-1
fs/ceph/inode.c
··· 384 384 struct inode *inode = container_of(head, struct inode, i_rcu); 385 385 struct ceph_inode_info *ci = ceph_inode(inode); 386 386 387 - INIT_LIST_HEAD(&inode->i_dentry); 388 387 kmem_cache_free(ceph_inode_cachep, ci); 389 388 } 390 389
-1
fs/coda/inode.c
··· 58 58 static void coda_i_callback(struct rcu_head *head) 59 59 { 60 60 struct inode *inode = container_of(head, struct inode, i_rcu); 61 - INIT_LIST_HEAD(&inode->i_dentry); 62 61 kmem_cache_free(coda_inode_cachep, ITOC(inode)); 63 62 } 64 63
-1
fs/ecryptfs/super.c
··· 69 69 struct ecryptfs_inode_info *inode_info; 70 70 inode_info = ecryptfs_inode_to_private(inode); 71 71 72 - INIT_LIST_HEAD(&inode->i_dentry); 73 72 kmem_cache_free(ecryptfs_inode_info_cache, inode_info); 74 73 } 75 74
-1
fs/efs/super.c
··· 68 68 static void efs_i_callback(struct rcu_head *head) 69 69 { 70 70 struct inode *inode = container_of(head, struct inode, i_rcu); 71 - INIT_LIST_HEAD(&inode->i_dentry); 72 71 kmem_cache_free(efs_inode_cachep, INODE_INFO(inode)); 73 72 } 74 73
-1
fs/exofs/super.c
··· 166 166 static void exofs_i_callback(struct rcu_head *head) 167 167 { 168 168 struct inode *inode = container_of(head, struct inode, i_rcu); 169 - INIT_LIST_HEAD(&inode->i_dentry); 170 169 kmem_cache_free(exofs_inode_cachep, exofs_i(inode)); 171 170 } 172 171
-1
fs/ext2/super.c
··· 173 173 static void ext2_i_callback(struct rcu_head *head) 174 174 { 175 175 struct inode *inode = container_of(head, struct inode, i_rcu); 176 - INIT_LIST_HEAD(&inode->i_dentry); 177 176 kmem_cache_free(ext2_inode_cachep, EXT2_I(inode)); 178 177 } 179 178
-1
fs/ext3/super.c
··· 511 511 static void ext3_i_callback(struct rcu_head *head) 512 512 { 513 513 struct inode *inode = container_of(head, struct inode, i_rcu); 514 - INIT_LIST_HEAD(&inode->i_dentry); 515 514 kmem_cache_free(ext3_inode_cachep, EXT3_I(inode)); 516 515 } 517 516
-1
fs/ext4/super.c
··· 930 930 static void ext4_i_callback(struct rcu_head *head) 931 931 { 932 932 struct inode *inode = container_of(head, struct inode, i_rcu); 933 - INIT_LIST_HEAD(&inode->i_dentry); 934 933 kmem_cache_free(ext4_inode_cachep, EXT4_I(inode)); 935 934 } 936 935
-1
fs/fat/inode.c
··· 518 518 static void fat_i_callback(struct rcu_head *head) 519 519 { 520 520 struct inode *inode = container_of(head, struct inode, i_rcu); 521 - INIT_LIST_HEAD(&inode->i_dentry); 522 521 kmem_cache_free(fat_inode_cachep, MSDOS_I(inode)); 523 522 } 524 523
-1
fs/freevxfs/vxfs_inode.c
··· 340 340 static void vxfs_i_callback(struct rcu_head *head) 341 341 { 342 342 struct inode *inode = container_of(head, struct inode, i_rcu); 343 - INIT_LIST_HEAD(&inode->i_dentry); 344 343 kmem_cache_free(vxfs_inode_cachep, inode->i_private); 345 344 } 346 345
-1
fs/fuse/inode.c
··· 107 107 static void fuse_i_callback(struct rcu_head *head) 108 108 { 109 109 struct inode *inode = container_of(head, struct inode, i_rcu); 110 - INIT_LIST_HEAD(&inode->i_dentry); 111 110 kmem_cache_free(fuse_inode_cachep, inode); 112 111 } 113 112
-1
fs/gfs2/super.c
··· 1582 1582 static void gfs2_i_callback(struct rcu_head *head) 1583 1583 { 1584 1584 struct inode *inode = container_of(head, struct inode, i_rcu); 1585 - INIT_LIST_HEAD(&inode->i_dentry); 1586 1585 kmem_cache_free(gfs2_inode_cachep, inode); 1587 1586 } 1588 1587
-1
fs/hfs/super.c
··· 170 170 static void hfs_i_callback(struct rcu_head *head) 171 171 { 172 172 struct inode *inode = container_of(head, struct inode, i_rcu); 173 - INIT_LIST_HEAD(&inode->i_dentry); 174 173 kmem_cache_free(hfs_inode_cachep, HFS_I(inode)); 175 174 } 176 175
-1
fs/hfsplus/super.c
··· 558 558 { 559 559 struct inode *inode = container_of(head, struct inode, i_rcu); 560 560 561 - INIT_LIST_HEAD(&inode->i_dentry); 562 561 kmem_cache_free(hfsplus_inode_cachep, HFSPLUS_I(inode)); 563 562 } 564 563
-1
fs/hostfs/hostfs_kern.c
··· 250 250 static void hostfs_i_callback(struct rcu_head *head) 251 251 { 252 252 struct inode *inode = container_of(head, struct inode, i_rcu); 253 - INIT_LIST_HEAD(&inode->i_dentry); 254 253 kfree(HOSTFS_I(inode)); 255 254 } 256 255
-1
fs/hpfs/super.c
··· 181 181 static void hpfs_i_callback(struct rcu_head *head) 182 182 { 183 183 struct inode *inode = container_of(head, struct inode, i_rcu); 184 - INIT_LIST_HEAD(&inode->i_dentry); 185 184 kmem_cache_free(hpfs_inode_cachep, hpfs_i(inode)); 186 185 } 187 186
-1
fs/hppfs/hppfs.c
··· 622 622 static void hppfs_i_callback(struct rcu_head *head) 623 623 { 624 624 struct inode *inode = container_of(head, struct inode, i_rcu); 625 - INIT_LIST_HEAD(&inode->i_dentry); 626 625 kfree(HPPFS_I(inode)); 627 626 } 628 627
-1
fs/hugetlbfs/inode.c
··· 666 666 static void hugetlbfs_i_callback(struct rcu_head *head) 667 667 { 668 668 struct inode *inode = container_of(head, struct inode, i_rcu); 669 - INIT_LIST_HEAD(&inode->i_dentry); 670 669 kmem_cache_free(hugetlbfs_inode_cachep, HUGETLBFS_I(inode)); 671 670 } 672 671
+1 -2
fs/inode.c
··· 191 191 } 192 192 inode->i_private = NULL; 193 193 inode->i_mapping = mapping; 194 + INIT_LIST_HEAD(&inode->i_dentry); /* buggered by rcu freeing */ 194 195 #ifdef CONFIG_FS_POSIX_ACL 195 196 inode->i_acl = inode->i_default_acl = ACL_NOT_CACHED; 196 197 #endif ··· 255 254 static void i_callback(struct rcu_head *head) 256 255 { 257 256 struct inode *inode = container_of(head, struct inode, i_rcu); 258 - INIT_LIST_HEAD(&inode->i_dentry); 259 257 kmem_cache_free(inode_cachep, inode); 260 258 } 261 259 ··· 290 290 { 291 291 memset(inode, 0, sizeof(*inode)); 292 292 INIT_HLIST_NODE(&inode->i_hash); 293 - INIT_LIST_HEAD(&inode->i_dentry); 294 293 INIT_LIST_HEAD(&inode->i_devices); 295 294 INIT_LIST_HEAD(&inode->i_wb_list); 296 295 INIT_LIST_HEAD(&inode->i_lru);
-1
fs/isofs/inode.c
··· 85 85 static void isofs_i_callback(struct rcu_head *head) 86 86 { 87 87 struct inode *inode = container_of(head, struct inode, i_rcu); 88 - INIT_LIST_HEAD(&inode->i_dentry); 89 88 kmem_cache_free(isofs_inode_cachep, ISOFS_I(inode)); 90 89 } 91 90
-1
fs/jffs2/super.c
··· 45 45 static void jffs2_i_callback(struct rcu_head *head) 46 46 { 47 47 struct inode *inode = container_of(head, struct inode, i_rcu); 48 - INIT_LIST_HEAD(&inode->i_dentry); 49 48 kmem_cache_free(jffs2_inode_cachep, JFFS2_INODE_INFO(inode)); 50 49 } 51 50
-1
fs/jfs/super.c
··· 119 119 { 120 120 struct inode *inode = container_of(head, struct inode, i_rcu); 121 121 struct jfs_inode_info *ji = JFS_IP(inode); 122 - INIT_LIST_HEAD(&inode->i_dentry); 123 122 kmem_cache_free(jfs_inode_cachep, ji); 124 123 } 125 124
-1
fs/logfs/inode.c
··· 144 144 static void logfs_i_callback(struct rcu_head *head) 145 145 { 146 146 struct inode *inode = container_of(head, struct inode, i_rcu); 147 - INIT_LIST_HEAD(&inode->i_dentry); 148 147 kmem_cache_free(logfs_inode_cache, logfs_inode(inode)); 149 148 } 150 149
-1
fs/minix/inode.c
··· 71 71 static void minix_i_callback(struct rcu_head *head) 72 72 { 73 73 struct inode *inode = container_of(head, struct inode, i_rcu); 74 - INIT_LIST_HEAD(&inode->i_dentry); 75 74 kmem_cache_free(minix_inode_cachep, minix_i(inode)); 76 75 } 77 76
-1
fs/ncpfs/inode.c
··· 60 60 static void ncp_i_callback(struct rcu_head *head) 61 61 { 62 62 struct inode *inode = container_of(head, struct inode, i_rcu); 63 - INIT_LIST_HEAD(&inode->i_dentry); 64 63 kmem_cache_free(ncp_inode_cachep, NCP_FINFO(inode)); 65 64 } 66 65
-1
fs/nfs/inode.c
··· 1464 1464 static void nfs_i_callback(struct rcu_head *head) 1465 1465 { 1466 1466 struct inode *inode = container_of(head, struct inode, i_rcu); 1467 - INIT_LIST_HEAD(&inode->i_dentry); 1468 1467 kmem_cache_free(nfs_inode_cachep, NFS_I(inode)); 1469 1468 } 1470 1469
-2
fs/nilfs2/super.c
··· 175 175 struct inode *inode = container_of(head, struct inode, i_rcu); 176 176 struct nilfs_mdt_info *mdi = NILFS_MDT(inode); 177 177 178 - INIT_LIST_HEAD(&inode->i_dentry); 179 - 180 178 if (mdi) { 181 179 kfree(mdi->mi_bgl); /* kfree(NULL) is safe */ 182 180 kfree(mdi);
-1
fs/ntfs/inode.c
··· 335 335 static void ntfs_i_callback(struct rcu_head *head) 336 336 { 337 337 struct inode *inode = container_of(head, struct inode, i_rcu); 338 - INIT_LIST_HEAD(&inode->i_dentry); 339 338 kmem_cache_free(ntfs_big_inode_cache, NTFS_I(inode)); 340 339 } 341 340
-1
fs/ocfs2/dlmfs/dlmfs.c
··· 354 354 static void dlmfs_i_callback(struct rcu_head *head) 355 355 { 356 356 struct inode *inode = container_of(head, struct inode, i_rcu); 357 - INIT_LIST_HEAD(&inode->i_dentry); 358 357 kmem_cache_free(dlmfs_inode_cache, DLMFS_I(inode)); 359 358 } 360 359
-1
fs/ocfs2/super.c
··· 569 569 static void ocfs2_i_callback(struct rcu_head *head) 570 570 { 571 571 struct inode *inode = container_of(head, struct inode, i_rcu); 572 - INIT_LIST_HEAD(&inode->i_dentry); 573 572 kmem_cache_free(ocfs2_inode_cachep, OCFS2_I(inode)); 574 573 } 575 574
-1
fs/openpromfs/inode.c
··· 346 346 static void openprom_i_callback(struct rcu_head *head) 347 347 { 348 348 struct inode *inode = container_of(head, struct inode, i_rcu); 349 - INIT_LIST_HEAD(&inode->i_dentry); 350 349 kmem_cache_free(op_inode_cachep, OP_I(inode)); 351 350 } 352 351
-1
fs/proc/inode.c
··· 77 77 static void proc_i_callback(struct rcu_head *head) 78 78 { 79 79 struct inode *inode = container_of(head, struct inode, i_rcu); 80 - INIT_LIST_HEAD(&inode->i_dentry); 81 80 kmem_cache_free(proc_inode_cachep, PROC_I(inode)); 82 81 } 83 82
-1
fs/qnx4/inode.c
··· 427 427 static void qnx4_i_callback(struct rcu_head *head) 428 428 { 429 429 struct inode *inode = container_of(head, struct inode, i_rcu); 430 - INIT_LIST_HEAD(&inode->i_dentry); 431 430 kmem_cache_free(qnx4_inode_cachep, qnx4_i(inode)); 432 431 } 433 432
-1
fs/reiserfs/super.c
··· 532 532 static void reiserfs_i_callback(struct rcu_head *head) 533 533 { 534 534 struct inode *inode = container_of(head, struct inode, i_rcu); 535 - INIT_LIST_HEAD(&inode->i_dentry); 536 535 kmem_cache_free(reiserfs_inode_cachep, REISERFS_I(inode)); 537 536 } 538 537
-1
fs/romfs/super.c
··· 403 403 static void romfs_i_callback(struct rcu_head *head) 404 404 { 405 405 struct inode *inode = container_of(head, struct inode, i_rcu); 406 - INIT_LIST_HEAD(&inode->i_dentry); 407 406 kmem_cache_free(romfs_inode_cachep, ROMFS_I(inode)); 408 407 } 409 408
-1
fs/squashfs/super.c
··· 464 464 static void squashfs_i_callback(struct rcu_head *head) 465 465 { 466 466 struct inode *inode = container_of(head, struct inode, i_rcu); 467 - INIT_LIST_HEAD(&inode->i_dentry); 468 467 kmem_cache_free(squashfs_inode_cachep, squashfs_i(inode)); 469 468 } 470 469
-1
fs/sysv/inode.c
··· 336 336 static void sysv_i_callback(struct rcu_head *head) 337 337 { 338 338 struct inode *inode = container_of(head, struct inode, i_rcu); 339 - INIT_LIST_HEAD(&inode->i_dentry); 340 339 kmem_cache_free(sysv_inode_cachep, SYSV_I(inode)); 341 340 } 342 341
-1
fs/ubifs/super.c
··· 276 276 { 277 277 struct inode *inode = container_of(head, struct inode, i_rcu); 278 278 struct ubifs_inode *ui = ubifs_inode(inode); 279 - INIT_LIST_HEAD(&inode->i_dentry); 280 279 kmem_cache_free(ubifs_inode_slab, ui); 281 280 } 282 281
-1
fs/udf/super.c
··· 138 138 static void udf_i_callback(struct rcu_head *head) 139 139 { 140 140 struct inode *inode = container_of(head, struct inode, i_rcu); 141 - INIT_LIST_HEAD(&inode->i_dentry); 142 141 kmem_cache_free(udf_inode_cachep, UDF_I(inode)); 143 142 } 144 143
-1
fs/ufs/super.c
··· 1425 1425 static void ufs_i_callback(struct rcu_head *head) 1426 1426 { 1427 1427 struct inode *inode = container_of(head, struct inode, i_rcu); 1428 - INIT_LIST_HEAD(&inode->i_dentry); 1429 1428 kmem_cache_free(ufs_inode_cachep, UFS_I(inode)); 1430 1429 } 1431 1430
-1
fs/xfs/xfs_iget.c
··· 107 107 struct inode *inode = container_of(head, struct inode, i_rcu); 108 108 struct xfs_inode *ip = XFS_I(inode); 109 109 110 - INIT_LIST_HEAD(&inode->i_dentry); 111 110 kmem_zone_free(xfs_inode_zone, ip); 112 111 } 113 112
-1
ipc/mqueue.c
··· 243 243 static void mqueue_i_callback(struct rcu_head *head) 244 244 { 245 245 struct inode *inode = container_of(head, struct inode, i_rcu); 246 - INIT_LIST_HEAD(&inode->i_dentry); 247 246 kmem_cache_free(mqueue_inode_cachep, MQUEUE_I(inode)); 248 247 } 249 248
-1
mm/shmem.c
··· 2234 2234 static void shmem_destroy_callback(struct rcu_head *head) 2235 2235 { 2236 2236 struct inode *inode = container_of(head, struct inode, i_rcu); 2237 - INIT_LIST_HEAD(&inode->i_dentry); 2238 2237 kmem_cache_free(shmem_inode_cachep, SHMEM_I(inode)); 2239 2238 } 2240 2239
-1
net/sunrpc/rpc_pipe.c
··· 185 185 rpc_i_callback(struct rcu_head *head) 186 186 { 187 187 struct inode *inode = container_of(head, struct inode, i_rcu); 188 - INIT_LIST_HEAD(&inode->i_dentry); 189 188 kmem_cache_free(rpc_inode_cachep, RPC_I(inode)); 190 189 } 191 190