diff options
56 files changed, 178 insertions, 277 deletions
diff --git a/arch/powerpc/platforms/cell/spufs/inode.c b/arch/powerpc/platforms/cell/spufs/inode.c index a93f328a7317..7150730e2ff1 100644 --- a/arch/powerpc/platforms/cell/spufs/inode.c +++ b/arch/powerpc/platforms/cell/spufs/inode.c | |||
@@ -71,9 +71,7 @@ spufs_init_once(void *p, struct kmem_cache * cachep, unsigned long flags) | |||
71 | { | 71 | { |
72 | struct spufs_inode_info *ei = p; | 72 | struct spufs_inode_info *ei = p; |
73 | 73 | ||
74 | if (flags & SLAB_CTOR_CONSTRUCTOR) { | 74 | inode_init_once(&ei->vfs_inode); |
75 | inode_init_once(&ei->vfs_inode); | ||
76 | } | ||
77 | } | 75 | } |
78 | 76 | ||
79 | static struct inode * | 77 | static struct inode * |
diff --git a/drivers/mtd/ubi/eba.c b/drivers/mtd/ubi/eba.c index 3dba5733ed1f..74002945b71b 100644 --- a/drivers/mtd/ubi/eba.c +++ b/drivers/mtd/ubi/eba.c | |||
@@ -940,9 +940,6 @@ static void ltree_entry_ctor(void *obj, struct kmem_cache *cache, | |||
940 | { | 940 | { |
941 | struct ltree_entry *le = obj; | 941 | struct ltree_entry *le = obj; |
942 | 942 | ||
943 | if (flags & SLAB_CTOR_CONSTRUCTOR) | ||
944 | return; | ||
945 | |||
946 | le->users = 0; | 943 | le->users = 0; |
947 | init_rwsem(&le->mutex); | 944 | init_rwsem(&le->mutex); |
948 | } | 945 | } |
diff --git a/fs/adfs/super.c b/fs/adfs/super.c index 30c296508497..de2ed5ca3351 100644 --- a/fs/adfs/super.c +++ b/fs/adfs/super.c | |||
@@ -232,8 +232,7 @@ static void init_once(void * foo, struct kmem_cache * cachep, unsigned long flag | |||
232 | { | 232 | { |
233 | struct adfs_inode_info *ei = (struct adfs_inode_info *) foo; | 233 | struct adfs_inode_info *ei = (struct adfs_inode_info *) foo; |
234 | 234 | ||
235 | if (flags & SLAB_CTOR_CONSTRUCTOR) | 235 | inode_init_once(&ei->vfs_inode); |
236 | inode_init_once(&ei->vfs_inode); | ||
237 | } | 236 | } |
238 | 237 | ||
239 | static int init_inodecache(void) | 238 | static int init_inodecache(void) |
diff --git a/fs/affs/super.c b/fs/affs/super.c index beff7d21e6e2..b800d451cd60 100644 --- a/fs/affs/super.c +++ b/fs/affs/super.c | |||
@@ -87,11 +87,9 @@ static void init_once(void * foo, struct kmem_cache * cachep, unsigned long flag | |||
87 | { | 87 | { |
88 | struct affs_inode_info *ei = (struct affs_inode_info *) foo; | 88 | struct affs_inode_info *ei = (struct affs_inode_info *) foo; |
89 | 89 | ||
90 | if (flags & SLAB_CTOR_CONSTRUCTOR) { | 90 | init_MUTEX(&ei->i_link_lock); |
91 | init_MUTEX(&ei->i_link_lock); | 91 | init_MUTEX(&ei->i_ext_lock); |
92 | init_MUTEX(&ei->i_ext_lock); | 92 | inode_init_once(&ei->vfs_inode); |
93 | inode_init_once(&ei->vfs_inode); | ||
94 | } | ||
95 | } | 93 | } |
96 | 94 | ||
97 | static int init_inodecache(void) | 95 | static int init_inodecache(void) |
diff --git a/fs/afs/super.c b/fs/afs/super.c index 370cecc910db..8d47ad88a093 100644 --- a/fs/afs/super.c +++ b/fs/afs/super.c | |||
@@ -451,17 +451,15 @@ static void afs_i_init_once(void *_vnode, struct kmem_cache *cachep, | |||
451 | { | 451 | { |
452 | struct afs_vnode *vnode = _vnode; | 452 | struct afs_vnode *vnode = _vnode; |
453 | 453 | ||
454 | if (flags & SLAB_CTOR_CONSTRUCTOR) { | 454 | memset(vnode, 0, sizeof(*vnode)); |
455 | memset(vnode, 0, sizeof(*vnode)); | 455 | inode_init_once(&vnode->vfs_inode); |
456 | inode_init_once(&vnode->vfs_inode); | 456 | init_waitqueue_head(&vnode->update_waitq); |
457 | init_waitqueue_head(&vnode->update_waitq); | 457 | mutex_init(&vnode->permits_lock); |
458 | mutex_init(&vnode->permits_lock); | 458 | mutex_init(&vnode->validate_lock); |
459 | mutex_init(&vnode->validate_lock); | 459 | spin_lock_init(&vnode->writeback_lock); |
460 | spin_lock_init(&vnode->writeback_lock); | 460 | spin_lock_init(&vnode->lock); |
461 | spin_lock_init(&vnode->lock); | 461 | INIT_LIST_HEAD(&vnode->writebacks); |
462 | INIT_LIST_HEAD(&vnode->writebacks); | 462 | INIT_WORK(&vnode->cb_broken_work, afs_broken_callback_work); |
463 | INIT_WORK(&vnode->cb_broken_work, afs_broken_callback_work); | ||
464 | } | ||
465 | } | 463 | } |
466 | 464 | ||
467 | /* | 465 | /* |
diff --git a/fs/befs/linuxvfs.c b/fs/befs/linuxvfs.c index fe96108a788d..a5c5171c2828 100644 --- a/fs/befs/linuxvfs.c +++ b/fs/befs/linuxvfs.c | |||
@@ -292,10 +292,8 @@ befs_destroy_inode(struct inode *inode) | |||
292 | static void init_once(void * foo, struct kmem_cache * cachep, unsigned long flags) | 292 | static void init_once(void * foo, struct kmem_cache * cachep, unsigned long flags) |
293 | { | 293 | { |
294 | struct befs_inode_info *bi = (struct befs_inode_info *) foo; | 294 | struct befs_inode_info *bi = (struct befs_inode_info *) foo; |
295 | 295 | ||
296 | if (flags & SLAB_CTOR_CONSTRUCTOR) { | 296 | inode_init_once(&bi->vfs_inode); |
297 | inode_init_once(&bi->vfs_inode); | ||
298 | } | ||
299 | } | 297 | } |
300 | 298 | ||
301 | static void | 299 | static void |
diff --git a/fs/bfs/inode.c b/fs/bfs/inode.c index edc08d89aabc..58c7bd9f5301 100644 --- a/fs/bfs/inode.c +++ b/fs/bfs/inode.c | |||
@@ -248,8 +248,7 @@ static void init_once(void * foo, struct kmem_cache * cachep, unsigned long flag | |||
248 | { | 248 | { |
249 | struct bfs_inode_info *bi = foo; | 249 | struct bfs_inode_info *bi = foo; |
250 | 250 | ||
251 | if (flags & SLAB_CTOR_CONSTRUCTOR) | 251 | inode_init_once(&bi->vfs_inode); |
252 | inode_init_once(&bi->vfs_inode); | ||
253 | } | 252 | } |
254 | 253 | ||
255 | static int init_inodecache(void) | 254 | static int init_inodecache(void) |
diff --git a/fs/block_dev.c b/fs/block_dev.c index 742899240872..ea1480a16f51 100644 --- a/fs/block_dev.c +++ b/fs/block_dev.c | |||
@@ -458,17 +458,15 @@ static void init_once(void * foo, struct kmem_cache * cachep, unsigned long flag | |||
458 | struct bdev_inode *ei = (struct bdev_inode *) foo; | 458 | struct bdev_inode *ei = (struct bdev_inode *) foo; |
459 | struct block_device *bdev = &ei->bdev; | 459 | struct block_device *bdev = &ei->bdev; |
460 | 460 | ||
461 | if (flags & SLAB_CTOR_CONSTRUCTOR) { | 461 | memset(bdev, 0, sizeof(*bdev)); |
462 | memset(bdev, 0, sizeof(*bdev)); | 462 | mutex_init(&bdev->bd_mutex); |
463 | mutex_init(&bdev->bd_mutex); | 463 | sema_init(&bdev->bd_mount_sem, 1); |
464 | sema_init(&bdev->bd_mount_sem, 1); | 464 | INIT_LIST_HEAD(&bdev->bd_inodes); |
465 | INIT_LIST_HEAD(&bdev->bd_inodes); | 465 | INIT_LIST_HEAD(&bdev->bd_list); |
466 | INIT_LIST_HEAD(&bdev->bd_list); | ||
467 | #ifdef CONFIG_SYSFS | 466 | #ifdef CONFIG_SYSFS |
468 | INIT_LIST_HEAD(&bdev->bd_holder_list); | 467 | INIT_LIST_HEAD(&bdev->bd_holder_list); |
469 | #endif | 468 | #endif |
470 | inode_init_once(&ei->vfs_inode); | 469 | inode_init_once(&ei->vfs_inode); |
471 | } | ||
472 | } | 470 | } |
473 | 471 | ||
474 | static inline void __bd_forget(struct inode *inode) | 472 | static inline void __bd_forget(struct inode *inode) |
diff --git a/fs/buffer.c b/fs/buffer.c index aecd057cd0e0..3deeb886f6e6 100644 --- a/fs/buffer.c +++ b/fs/buffer.c | |||
@@ -2898,8 +2898,9 @@ static void recalc_bh_state(void) | |||
2898 | 2898 | ||
2899 | struct buffer_head *alloc_buffer_head(gfp_t gfp_flags) | 2899 | struct buffer_head *alloc_buffer_head(gfp_t gfp_flags) |
2900 | { | 2900 | { |
2901 | struct buffer_head *ret = kmem_cache_alloc(bh_cachep, gfp_flags); | 2901 | struct buffer_head *ret = kmem_cache_zalloc(bh_cachep, gfp_flags); |
2902 | if (ret) { | 2902 | if (ret) { |
2903 | INIT_LIST_HEAD(&ret->b_assoc_buffers); | ||
2903 | get_cpu_var(bh_accounting).nr++; | 2904 | get_cpu_var(bh_accounting).nr++; |
2904 | recalc_bh_state(); | 2905 | recalc_bh_state(); |
2905 | put_cpu_var(bh_accounting); | 2906 | put_cpu_var(bh_accounting); |
@@ -2918,17 +2919,6 @@ void free_buffer_head(struct buffer_head *bh) | |||
2918 | } | 2919 | } |
2919 | EXPORT_SYMBOL(free_buffer_head); | 2920 | EXPORT_SYMBOL(free_buffer_head); |
2920 | 2921 | ||
2921 | static void | ||
2922 | init_buffer_head(void *data, struct kmem_cache *cachep, unsigned long flags) | ||
2923 | { | ||
2924 | if (flags & SLAB_CTOR_CONSTRUCTOR) { | ||
2925 | struct buffer_head * bh = (struct buffer_head *)data; | ||
2926 | |||
2927 | memset(bh, 0, sizeof(*bh)); | ||
2928 | INIT_LIST_HEAD(&bh->b_assoc_buffers); | ||
2929 | } | ||
2930 | } | ||
2931 | |||
2932 | static void buffer_exit_cpu(int cpu) | 2922 | static void buffer_exit_cpu(int cpu) |
2933 | { | 2923 | { |
2934 | int i; | 2924 | int i; |
@@ -2955,12 +2945,8 @@ void __init buffer_init(void) | |||
2955 | { | 2945 | { |
2956 | int nrpages; | 2946 | int nrpages; |
2957 | 2947 | ||
2958 | bh_cachep = kmem_cache_create("buffer_head", | 2948 | bh_cachep = KMEM_CACHE(buffer_head, |
2959 | sizeof(struct buffer_head), 0, | 2949 | SLAB_RECLAIM_ACCOUNT|SLAB_PANIC|SLAB_MEM_SPREAD); |
2960 | (SLAB_RECLAIM_ACCOUNT|SLAB_PANIC| | ||
2961 | SLAB_MEM_SPREAD), | ||
2962 | init_buffer_head, | ||
2963 | NULL); | ||
2964 | 2950 | ||
2965 | /* | 2951 | /* |
2966 | * Limit the bh occupancy to 10% of ZONE_NORMAL | 2952 | * Limit the bh occupancy to 10% of ZONE_NORMAL |
diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c index 8568e100953c..d38c69b591cf 100644 --- a/fs/cifs/cifsfs.c +++ b/fs/cifs/cifsfs.c | |||
@@ -701,10 +701,8 @@ cifs_init_once(void *inode, struct kmem_cache * cachep, unsigned long flags) | |||
701 | { | 701 | { |
702 | struct cifsInodeInfo *cifsi = inode; | 702 | struct cifsInodeInfo *cifsi = inode; |
703 | 703 | ||
704 | if (flags & SLAB_CTOR_CONSTRUCTOR) { | 704 | inode_init_once(&cifsi->vfs_inode); |
705 | inode_init_once(&cifsi->vfs_inode); | 705 | INIT_LIST_HEAD(&cifsi->lockList); |
706 | INIT_LIST_HEAD(&cifsi->lockList); | ||
707 | } | ||
708 | } | 706 | } |
709 | 707 | ||
710 | static int | 708 | static int |
diff --git a/fs/coda/inode.c b/fs/coda/inode.c index 0aaff3651d14..dbff1bd4fb96 100644 --- a/fs/coda/inode.c +++ b/fs/coda/inode.c | |||
@@ -62,8 +62,7 @@ static void init_once(void * foo, struct kmem_cache * cachep, unsigned long flag | |||
62 | { | 62 | { |
63 | struct coda_inode_info *ei = (struct coda_inode_info *) foo; | 63 | struct coda_inode_info *ei = (struct coda_inode_info *) foo; |
64 | 64 | ||
65 | if (flags & SLAB_CTOR_CONSTRUCTOR) | 65 | inode_init_once(&ei->vfs_inode); |
66 | inode_init_once(&ei->vfs_inode); | ||
67 | } | 66 | } |
68 | 67 | ||
69 | int coda_init_inodecache(void) | 68 | int coda_init_inodecache(void) |
diff --git a/fs/ecryptfs/main.c b/fs/ecryptfs/main.c index 8cbf3f69ebe5..606128f5c927 100644 --- a/fs/ecryptfs/main.c +++ b/fs/ecryptfs/main.c | |||
@@ -583,8 +583,7 @@ inode_info_init_once(void *vptr, struct kmem_cache *cachep, unsigned long flags) | |||
583 | { | 583 | { |
584 | struct ecryptfs_inode_info *ei = (struct ecryptfs_inode_info *)vptr; | 584 | struct ecryptfs_inode_info *ei = (struct ecryptfs_inode_info *)vptr; |
585 | 585 | ||
586 | if (flags & SLAB_CTOR_CONSTRUCTOR) | 586 | inode_init_once(&ei->vfs_inode); |
587 | inode_init_once(&ei->vfs_inode); | ||
588 | } | 587 | } |
589 | 588 | ||
590 | static struct ecryptfs_cache_info { | 589 | static struct ecryptfs_cache_info { |
diff --git a/fs/efs/super.c b/fs/efs/super.c index ba7a8b9da0c1..e0a6839e68ae 100644 --- a/fs/efs/super.c +++ b/fs/efs/super.c | |||
@@ -72,8 +72,7 @@ static void init_once(void * foo, struct kmem_cache * cachep, unsigned long flag | |||
72 | { | 72 | { |
73 | struct efs_inode_info *ei = (struct efs_inode_info *) foo; | 73 | struct efs_inode_info *ei = (struct efs_inode_info *) foo; |
74 | 74 | ||
75 | if (flags & SLAB_CTOR_CONSTRUCTOR) | 75 | inode_init_once(&ei->vfs_inode); |
76 | inode_init_once(&ei->vfs_inode); | ||
77 | } | 76 | } |
78 | 77 | ||
79 | static int init_inodecache(void) | 78 | static int init_inodecache(void) |
diff --git a/fs/ext2/super.c b/fs/ext2/super.c index 685a1c287177..16337bff0272 100644 --- a/fs/ext2/super.c +++ b/fs/ext2/super.c | |||
@@ -160,13 +160,11 @@ static void init_once(void * foo, struct kmem_cache * cachep, unsigned long flag | |||
160 | { | 160 | { |
161 | struct ext2_inode_info *ei = (struct ext2_inode_info *) foo; | 161 | struct ext2_inode_info *ei = (struct ext2_inode_info *) foo; |
162 | 162 | ||
163 | if (flags & SLAB_CTOR_CONSTRUCTOR) { | 163 | rwlock_init(&ei->i_meta_lock); |
164 | rwlock_init(&ei->i_meta_lock); | ||
165 | #ifdef CONFIG_EXT2_FS_XATTR | 164 | #ifdef CONFIG_EXT2_FS_XATTR |
166 | init_rwsem(&ei->xattr_sem); | 165 | init_rwsem(&ei->xattr_sem); |
167 | #endif | 166 | #endif |
168 | inode_init_once(&ei->vfs_inode); | 167 | inode_init_once(&ei->vfs_inode); |
169 | } | ||
170 | } | 168 | } |
171 | 169 | ||
172 | static int init_inodecache(void) | 170 | static int init_inodecache(void) |
diff --git a/fs/ext3/super.c b/fs/ext3/super.c index 54d3c9041259..6e3062913a92 100644 --- a/fs/ext3/super.c +++ b/fs/ext3/super.c | |||
@@ -466,14 +466,12 @@ static void init_once(void * foo, struct kmem_cache * cachep, unsigned long flag | |||
466 | { | 466 | { |
467 | struct ext3_inode_info *ei = (struct ext3_inode_info *) foo; | 467 | struct ext3_inode_info *ei = (struct ext3_inode_info *) foo; |
468 | 468 | ||
469 | if (flags & SLAB_CTOR_CONSTRUCTOR) { | 469 | INIT_LIST_HEAD(&ei->i_orphan); |
470 | INIT_LIST_HEAD(&ei->i_orphan); | ||
471 | #ifdef CONFIG_EXT3_FS_XATTR | 470 | #ifdef CONFIG_EXT3_FS_XATTR |
472 | init_rwsem(&ei->xattr_sem); | 471 | init_rwsem(&ei->xattr_sem); |
473 | #endif | 472 | #endif |
474 | mutex_init(&ei->truncate_mutex); | 473 | mutex_init(&ei->truncate_mutex); |
475 | inode_init_once(&ei->vfs_inode); | 474 | inode_init_once(&ei->vfs_inode); |
476 | } | ||
477 | } | 475 | } |
478 | 476 | ||
479 | static int init_inodecache(void) | 477 | static int init_inodecache(void) |
diff --git a/fs/ext4/super.c b/fs/ext4/super.c index 719126932354..cb9afdd0e26e 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c | |||
@@ -517,14 +517,12 @@ static void init_once(void * foo, struct kmem_cache * cachep, unsigned long flag | |||
517 | { | 517 | { |
518 | struct ext4_inode_info *ei = (struct ext4_inode_info *) foo; | 518 | struct ext4_inode_info *ei = (struct ext4_inode_info *) foo; |
519 | 519 | ||
520 | if (flags & SLAB_CTOR_CONSTRUCTOR) { | 520 | INIT_LIST_HEAD(&ei->i_orphan); |
521 | INIT_LIST_HEAD(&ei->i_orphan); | ||
522 | #ifdef CONFIG_EXT4DEV_FS_XATTR | 521 | #ifdef CONFIG_EXT4DEV_FS_XATTR |
523 | init_rwsem(&ei->xattr_sem); | 522 | init_rwsem(&ei->xattr_sem); |
524 | #endif | 523 | #endif |
525 | mutex_init(&ei->truncate_mutex); | 524 | mutex_init(&ei->truncate_mutex); |
526 | inode_init_once(&ei->vfs_inode); | 525 | inode_init_once(&ei->vfs_inode); |
527 | } | ||
528 | } | 526 | } |
529 | 527 | ||
530 | static int init_inodecache(void) | 528 | static int init_inodecache(void) |
diff --git a/fs/fat/cache.c b/fs/fat/cache.c index 1959143c1d27..3c9c8a15ec73 100644 --- a/fs/fat/cache.c +++ b/fs/fat/cache.c | |||
@@ -40,8 +40,7 @@ static void init_once(void *foo, struct kmem_cache *cachep, unsigned long flags) | |||
40 | { | 40 | { |
41 | struct fat_cache *cache = (struct fat_cache *)foo; | 41 | struct fat_cache *cache = (struct fat_cache *)foo; |
42 | 42 | ||
43 | if (flags & SLAB_CTOR_CONSTRUCTOR) | 43 | INIT_LIST_HEAD(&cache->cache_list); |
44 | INIT_LIST_HEAD(&cache->cache_list); | ||
45 | } | 44 | } |
46 | 45 | ||
47 | int __init fat_cache_init(void) | 46 | int __init fat_cache_init(void) |
diff --git a/fs/fat/inode.c b/fs/fat/inode.c index 2c55e8dce793..479722d89667 100644 --- a/fs/fat/inode.c +++ b/fs/fat/inode.c | |||
@@ -500,14 +500,12 @@ static void init_once(void * foo, struct kmem_cache * cachep, unsigned long flag | |||
500 | { | 500 | { |
501 | struct msdos_inode_info *ei = (struct msdos_inode_info *)foo; | 501 | struct msdos_inode_info *ei = (struct msdos_inode_info *)foo; |
502 | 502 | ||
503 | if (flags & SLAB_CTOR_CONSTRUCTOR) { | 503 | spin_lock_init(&ei->cache_lru_lock); |
504 | spin_lock_init(&ei->cache_lru_lock); | 504 | ei->nr_caches = 0; |
505 | ei->nr_caches = 0; | 505 | ei->cache_valid_id = FAT_CACHE_VALID + 1; |
506 | ei->cache_valid_id = FAT_CACHE_VALID + 1; | 506 | INIT_LIST_HEAD(&ei->cache_lru); |
507 | INIT_LIST_HEAD(&ei->cache_lru); | 507 | INIT_HLIST_NODE(&ei->i_fat_hash); |
508 | INIT_HLIST_NODE(&ei->i_fat_hash); | 508 | inode_init_once(&ei->vfs_inode); |
509 | inode_init_once(&ei->vfs_inode); | ||
510 | } | ||
511 | } | 509 | } |
512 | 510 | ||
513 | static int __init fat_init_inodecache(void) | 511 | static int __init fat_init_inodecache(void) |
diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c index 1397018ff476..c3a2ad0da43c 100644 --- a/fs/fuse/inode.c +++ b/fs/fuse/inode.c | |||
@@ -687,8 +687,7 @@ static void fuse_inode_init_once(void *foo, struct kmem_cache *cachep, | |||
687 | { | 687 | { |
688 | struct inode * inode = foo; | 688 | struct inode * inode = foo; |
689 | 689 | ||
690 | if (flags & SLAB_CTOR_CONSTRUCTOR) | 690 | inode_init_once(inode); |
691 | inode_init_once(inode); | ||
692 | } | 691 | } |
693 | 692 | ||
694 | static int __init fuse_fs_init(void) | 693 | static int __init fuse_fs_init(void) |
diff --git a/fs/gfs2/main.c b/fs/gfs2/main.c index e460487c0557..787a0edef100 100644 --- a/fs/gfs2/main.c +++ b/fs/gfs2/main.c | |||
@@ -27,29 +27,27 @@ | |||
27 | static void gfs2_init_inode_once(void *foo, struct kmem_cache *cachep, unsigned long flags) | 27 | static void gfs2_init_inode_once(void *foo, struct kmem_cache *cachep, unsigned long flags) |
28 | { | 28 | { |
29 | struct gfs2_inode *ip = foo; | 29 | struct gfs2_inode *ip = foo; |
30 | if (flags & SLAB_CTOR_CONSTRUCTOR) { | 30 | |
31 | inode_init_once(&ip->i_inode); | 31 | inode_init_once(&ip->i_inode); |
32 | spin_lock_init(&ip->i_spin); | 32 | spin_lock_init(&ip->i_spin); |
33 | init_rwsem(&ip->i_rw_mutex); | 33 | init_rwsem(&ip->i_rw_mutex); |
34 | memset(ip->i_cache, 0, sizeof(ip->i_cache)); | 34 | memset(ip->i_cache, 0, sizeof(ip->i_cache)); |
35 | } | ||
36 | } | 35 | } |
37 | 36 | ||
38 | static void gfs2_init_glock_once(void *foo, struct kmem_cache *cachep, unsigned long flags) | 37 | static void gfs2_init_glock_once(void *foo, struct kmem_cache *cachep, unsigned long flags) |
39 | { | 38 | { |
40 | struct gfs2_glock *gl = foo; | 39 | struct gfs2_glock *gl = foo; |
41 | if (flags & SLAB_CTOR_CONSTRUCTOR) { | 40 | |
42 | INIT_HLIST_NODE(&gl->gl_list); | 41 | INIT_HLIST_NODE(&gl->gl_list); |
43 | spin_lock_init(&gl->gl_spin); | 42 | spin_lock_init(&gl->gl_spin); |
44 | INIT_LIST_HEAD(&gl->gl_holders); | 43 | INIT_LIST_HEAD(&gl->gl_holders); |
45 | INIT_LIST_HEAD(&gl->gl_waiters1); | 44 | INIT_LIST_HEAD(&gl->gl_waiters1); |
46 | INIT_LIST_HEAD(&gl->gl_waiters3); | 45 | INIT_LIST_HEAD(&gl->gl_waiters3); |
47 | gl->gl_lvb = NULL; | 46 | gl->gl_lvb = NULL; |
48 | atomic_set(&gl->gl_lvb_count, 0); | 47 | atomic_set(&gl->gl_lvb_count, 0); |
49 | INIT_LIST_HEAD(&gl->gl_reclaim); | 48 | INIT_LIST_HEAD(&gl->gl_reclaim); |
50 | INIT_LIST_HEAD(&gl->gl_ail_list); | 49 | INIT_LIST_HEAD(&gl->gl_ail_list); |
51 | atomic_set(&gl->gl_ail_count, 0); | 50 | atomic_set(&gl->gl_ail_count, 0); |
52 | } | ||
53 | } | 51 | } |
54 | 52 | ||
55 | /** | 53 | /** |
diff --git a/fs/hfs/super.c b/fs/hfs/super.c index 4f1888f16cf0..92cf8751e428 100644 --- a/fs/hfs/super.c +++ b/fs/hfs/super.c | |||
@@ -434,8 +434,7 @@ static void hfs_init_once(void *p, struct kmem_cache *cachep, unsigned long flag | |||
434 | { | 434 | { |
435 | struct hfs_inode_info *i = p; | 435 | struct hfs_inode_info *i = p; |
436 | 436 | ||
437 | if (flags & SLAB_CTOR_CONSTRUCTOR) | 437 | inode_init_once(&i->vfs_inode); |
438 | inode_init_once(&i->vfs_inode); | ||
439 | } | 438 | } |
440 | 439 | ||
441 | static int __init init_hfs_fs(void) | 440 | static int __init init_hfs_fs(void) |
diff --git a/fs/hfsplus/super.c b/fs/hfsplus/super.c index 37afbec8a761..ebd1b380cbbc 100644 --- a/fs/hfsplus/super.c +++ b/fs/hfsplus/super.c | |||
@@ -470,8 +470,7 @@ static void hfsplus_init_once(void *p, struct kmem_cache *cachep, unsigned long | |||
470 | { | 470 | { |
471 | struct hfsplus_inode_info *i = p; | 471 | struct hfsplus_inode_info *i = p; |
472 | 472 | ||
473 | if (flags & SLAB_CTOR_CONSTRUCTOR) | 473 | inode_init_once(&i->vfs_inode); |
474 | inode_init_once(&i->vfs_inode); | ||
475 | } | 474 | } |
476 | 475 | ||
477 | static int __init init_hfsplus_fs(void) | 476 | static int __init init_hfsplus_fs(void) |
diff --git a/fs/hpfs/super.c b/fs/hpfs/super.c index 1b95f39fbc37..fca1165d7192 100644 --- a/fs/hpfs/super.c +++ b/fs/hpfs/super.c | |||
@@ -176,11 +176,9 @@ static void init_once(void * foo, struct kmem_cache * cachep, unsigned long flag | |||
176 | { | 176 | { |
177 | struct hpfs_inode_info *ei = (struct hpfs_inode_info *) foo; | 177 | struct hpfs_inode_info *ei = (struct hpfs_inode_info *) foo; |
178 | 178 | ||
179 | if (flags & SLAB_CTOR_CONSTRUCTOR) { | 179 | mutex_init(&ei->i_mutex); |
180 | mutex_init(&ei->i_mutex); | 180 | mutex_init(&ei->i_parent_mutex); |
181 | mutex_init(&ei->i_parent_mutex); | 181 | inode_init_once(&ei->vfs_inode); |
182 | inode_init_once(&ei->vfs_inode); | ||
183 | } | ||
184 | } | 182 | } |
185 | 183 | ||
186 | static int init_inodecache(void) | 184 | static int init_inodecache(void) |
diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c index 98959b87cdf8..aa083dd34e92 100644 --- a/fs/hugetlbfs/inode.c +++ b/fs/hugetlbfs/inode.c | |||
@@ -556,8 +556,7 @@ static void init_once(void *foo, struct kmem_cache *cachep, unsigned long flags) | |||
556 | { | 556 | { |
557 | struct hugetlbfs_inode_info *ei = (struct hugetlbfs_inode_info *)foo; | 557 | struct hugetlbfs_inode_info *ei = (struct hugetlbfs_inode_info *)foo; |
558 | 558 | ||
559 | if (flags & SLAB_CTOR_CONSTRUCTOR) | 559 | inode_init_once(&ei->vfs_inode); |
560 | inode_init_once(&ei->vfs_inode); | ||
561 | } | 560 | } |
562 | 561 | ||
563 | const struct file_operations hugetlbfs_file_operations = { | 562 | const struct file_operations hugetlbfs_file_operations = { |
diff --git a/fs/inode.c b/fs/inode.c index df2ef15d03d2..9a012cc5b6cd 100644 --- a/fs/inode.c +++ b/fs/inode.c | |||
@@ -213,8 +213,7 @@ static void init_once(void * foo, struct kmem_cache * cachep, unsigned long flag | |||
213 | { | 213 | { |
214 | struct inode * inode = (struct inode *) foo; | 214 | struct inode * inode = (struct inode *) foo; |
215 | 215 | ||
216 | if (flags & SLAB_CTOR_CONSTRUCTOR) | 216 | inode_init_once(inode); |
217 | inode_init_once(inode); | ||
218 | } | 217 | } |
219 | 218 | ||
220 | /* | 219 | /* |
diff --git a/fs/isofs/inode.c b/fs/isofs/inode.c index e99f7ff4ecb4..5c3eecf7542e 100644 --- a/fs/isofs/inode.c +++ b/fs/isofs/inode.c | |||
@@ -77,8 +77,7 @@ static void init_once(void *foo, struct kmem_cache * cachep, unsigned long flags | |||
77 | { | 77 | { |
78 | struct iso_inode_info *ei = foo; | 78 | struct iso_inode_info *ei = foo; |
79 | 79 | ||
80 | if (flags & SLAB_CTOR_CONSTRUCTOR) | 80 | inode_init_once(&ei->vfs_inode); |
81 | inode_init_once(&ei->vfs_inode); | ||
82 | } | 81 | } |
83 | 82 | ||
84 | static int init_inodecache(void) | 83 | static int init_inodecache(void) |
diff --git a/fs/jffs2/super.c b/fs/jffs2/super.c index 45368f8bbe72..6488af43bc9b 100644 --- a/fs/jffs2/super.c +++ b/fs/jffs2/super.c | |||
@@ -47,10 +47,8 @@ static void jffs2_i_init_once(void * foo, struct kmem_cache * cachep, unsigned l | |||
47 | { | 47 | { |
48 | struct jffs2_inode_info *ei = (struct jffs2_inode_info *) foo; | 48 | struct jffs2_inode_info *ei = (struct jffs2_inode_info *) foo; |
49 | 49 | ||
50 | if (flags & SLAB_CTOR_CONSTRUCTOR) { | 50 | init_MUTEX(&ei->sem); |
51 | init_MUTEX(&ei->sem); | 51 | inode_init_once(&ei->vfs_inode); |
52 | inode_init_once(&ei->vfs_inode); | ||
53 | } | ||
54 | } | 52 | } |
55 | 53 | ||
56 | static int jffs2_sync_fs(struct super_block *sb, int wait) | 54 | static int jffs2_sync_fs(struct super_block *sb, int wait) |
diff --git a/fs/jfs/jfs_metapage.c b/fs/jfs/jfs_metapage.c index 6b3acb0b5781..43d4f69afbec 100644 --- a/fs/jfs/jfs_metapage.c +++ b/fs/jfs/jfs_metapage.c | |||
@@ -184,16 +184,14 @@ static void init_once(void *foo, struct kmem_cache *cachep, unsigned long flags) | |||
184 | { | 184 | { |
185 | struct metapage *mp = (struct metapage *)foo; | 185 | struct metapage *mp = (struct metapage *)foo; |
186 | 186 | ||
187 | if (flags & SLAB_CTOR_CONSTRUCTOR) { | 187 | mp->lid = 0; |
188 | mp->lid = 0; | 188 | mp->lsn = 0; |
189 | mp->lsn = 0; | 189 | mp->flag = 0; |
190 | mp->flag = 0; | 190 | mp->data = NULL; |
191 | mp->data = NULL; | 191 | mp->clsn = 0; |
192 | mp->clsn = 0; | 192 | mp->log = NULL; |
193 | mp->log = NULL; | 193 | set_bit(META_free, &mp->flag); |
194 | set_bit(META_free, &mp->flag); | 194 | init_waitqueue_head(&mp->wait); |
195 | init_waitqueue_head(&mp->wait); | ||
196 | } | ||
197 | } | 195 | } |
198 | 196 | ||
199 | static inline struct metapage *alloc_metapage(gfp_t gfp_mask) | 197 | static inline struct metapage *alloc_metapage(gfp_t gfp_mask) |
diff --git a/fs/jfs/super.c b/fs/jfs/super.c index ea9dc3e65dcf..20e4ac1c79a3 100644 --- a/fs/jfs/super.c +++ b/fs/jfs/super.c | |||
@@ -752,20 +752,18 @@ static void init_once(void *foo, struct kmem_cache * cachep, unsigned long flags | |||
752 | { | 752 | { |
753 | struct jfs_inode_info *jfs_ip = (struct jfs_inode_info *) foo; | 753 | struct jfs_inode_info *jfs_ip = (struct jfs_inode_info *) foo; |
754 | 754 | ||
755 | if (flags & SLAB_CTOR_CONSTRUCTOR) { | 755 | memset(jfs_ip, 0, sizeof(struct jfs_inode_info)); |
756 | memset(jfs_ip, 0, sizeof(struct jfs_inode_info)); | 756 | INIT_LIST_HEAD(&jfs_ip->anon_inode_list); |
757 | INIT_LIST_HEAD(&jfs_ip->anon_inode_list); | 757 | init_rwsem(&jfs_ip->rdwrlock); |
758 | init_rwsem(&jfs_ip->rdwrlock); | 758 | mutex_init(&jfs_ip->commit_mutex); |
759 | mutex_init(&jfs_ip->commit_mutex); | 759 | init_rwsem(&jfs_ip->xattr_sem); |
760 | init_rwsem(&jfs_ip->xattr_sem); | 760 | spin_lock_init(&jfs_ip->ag_lock); |
761 | spin_lock_init(&jfs_ip->ag_lock); | 761 | jfs_ip->active_ag = -1; |
762 | jfs_ip->active_ag = -1; | ||
763 | #ifdef CONFIG_JFS_POSIX_ACL | 762 | #ifdef CONFIG_JFS_POSIX_ACL |
764 | jfs_ip->i_acl = JFS_ACL_NOT_CACHED; | 763 | jfs_ip->i_acl = JFS_ACL_NOT_CACHED; |
765 | jfs_ip->i_default_acl = JFS_ACL_NOT_CACHED; | 764 | jfs_ip->i_default_acl = JFS_ACL_NOT_CACHED; |
766 | #endif | 765 | #endif |
767 | inode_init_once(&jfs_ip->vfs_inode); | 766 | inode_init_once(&jfs_ip->vfs_inode); |
768 | } | ||
769 | } | 767 | } |
770 | 768 | ||
771 | static int __init init_jfs_fs(void) | 769 | static int __init init_jfs_fs(void) |
diff --git a/fs/locks.c b/fs/locks.c index 8ec16ab5ef74..431a8b871fce 100644 --- a/fs/locks.c +++ b/fs/locks.c | |||
@@ -203,9 +203,6 @@ static void init_once(void *foo, struct kmem_cache *cache, unsigned long flags) | |||
203 | { | 203 | { |
204 | struct file_lock *lock = (struct file_lock *) foo; | 204 | struct file_lock *lock = (struct file_lock *) foo; |
205 | 205 | ||
206 | if (!(flags & SLAB_CTOR_CONSTRUCTOR)) | ||
207 | return; | ||
208 | |||
209 | locks_init_lock(lock); | 206 | locks_init_lock(lock); |
210 | } | 207 | } |
211 | 208 | ||
diff --git a/fs/minix/inode.c b/fs/minix/inode.c index 2f4d43a2a310..be4044614ac8 100644 --- a/fs/minix/inode.c +++ b/fs/minix/inode.c | |||
@@ -73,8 +73,7 @@ static void init_once(void * foo, struct kmem_cache * cachep, unsigned long flag | |||
73 | { | 73 | { |
74 | struct minix_inode_info *ei = (struct minix_inode_info *) foo; | 74 | struct minix_inode_info *ei = (struct minix_inode_info *) foo; |
75 | 75 | ||
76 | if (flags & SLAB_CTOR_CONSTRUCTOR) | 76 | inode_init_once(&ei->vfs_inode); |
77 | inode_init_once(&ei->vfs_inode); | ||
78 | } | 77 | } |
79 | 78 | ||
80 | static int init_inodecache(void) | 79 | static int init_inodecache(void) |
diff --git a/fs/ncpfs/inode.c b/fs/ncpfs/inode.c index c29f00ad495d..cf06eb9f050e 100644 --- a/fs/ncpfs/inode.c +++ b/fs/ncpfs/inode.c | |||
@@ -60,10 +60,8 @@ static void init_once(void * foo, struct kmem_cache * cachep, unsigned long flag | |||
60 | { | 60 | { |
61 | struct ncp_inode_info *ei = (struct ncp_inode_info *) foo; | 61 | struct ncp_inode_info *ei = (struct ncp_inode_info *) foo; |
62 | 62 | ||
63 | if (flags & SLAB_CTOR_CONSTRUCTOR) { | 63 | mutex_init(&ei->open_mutex); |
64 | mutex_init(&ei->open_mutex); | 64 | inode_init_once(&ei->vfs_inode); |
65 | inode_init_once(&ei->vfs_inode); | ||
66 | } | ||
67 | } | 65 | } |
68 | 66 | ||
69 | static int init_inodecache(void) | 67 | static int init_inodecache(void) |
diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c index 2a3fd9573207..2b26ad7c9770 100644 --- a/fs/nfs/inode.c +++ b/fs/nfs/inode.c | |||
@@ -1164,21 +1164,19 @@ static void init_once(void * foo, struct kmem_cache * cachep, unsigned long flag | |||
1164 | { | 1164 | { |
1165 | struct nfs_inode *nfsi = (struct nfs_inode *) foo; | 1165 | struct nfs_inode *nfsi = (struct nfs_inode *) foo; |
1166 | 1166 | ||
1167 | if (flags & SLAB_CTOR_CONSTRUCTOR) { | 1167 | inode_init_once(&nfsi->vfs_inode); |
1168 | inode_init_once(&nfsi->vfs_inode); | 1168 | spin_lock_init(&nfsi->req_lock); |
1169 | spin_lock_init(&nfsi->req_lock); | 1169 | INIT_LIST_HEAD(&nfsi->dirty); |
1170 | INIT_LIST_HEAD(&nfsi->dirty); | 1170 | INIT_LIST_HEAD(&nfsi->commit); |
1171 | INIT_LIST_HEAD(&nfsi->commit); | 1171 | INIT_LIST_HEAD(&nfsi->open_files); |
1172 | INIT_LIST_HEAD(&nfsi->open_files); | 1172 | INIT_LIST_HEAD(&nfsi->access_cache_entry_lru); |
1173 | INIT_LIST_HEAD(&nfsi->access_cache_entry_lru); | 1173 | INIT_LIST_HEAD(&nfsi->access_cache_inode_lru); |
1174 | INIT_LIST_HEAD(&nfsi->access_cache_inode_lru); | 1174 | INIT_RADIX_TREE(&nfsi->nfs_page_tree, GFP_ATOMIC); |
1175 | INIT_RADIX_TREE(&nfsi->nfs_page_tree, GFP_ATOMIC); | 1175 | atomic_set(&nfsi->data_updates, 0); |
1176 | atomic_set(&nfsi->data_updates, 0); | 1176 | nfsi->ndirty = 0; |
1177 | nfsi->ndirty = 0; | 1177 | nfsi->ncommit = 0; |
1178 | nfsi->ncommit = 0; | 1178 | nfsi->npages = 0; |
1179 | nfsi->npages = 0; | 1179 | nfs4_init_once(nfsi); |
1180 | nfs4_init_once(nfsi); | ||
1181 | } | ||
1182 | } | 1180 | } |
1183 | 1181 | ||
1184 | static int __init nfs_init_inodecache(void) | 1182 | static int __init nfs_init_inodecache(void) |
diff --git a/fs/ntfs/super.c b/fs/ntfs/super.c index 21d834e5ed73..4566b9182551 100644 --- a/fs/ntfs/super.c +++ b/fs/ntfs/super.c | |||
@@ -3085,8 +3085,7 @@ static void ntfs_big_inode_init_once(void *foo, struct kmem_cache *cachep, | |||
3085 | { | 3085 | { |
3086 | ntfs_inode *ni = (ntfs_inode *)foo; | 3086 | ntfs_inode *ni = (ntfs_inode *)foo; |
3087 | 3087 | ||
3088 | if (flags & SLAB_CTOR_CONSTRUCTOR) | 3088 | inode_init_once(VFS_I(ni)); |
3089 | inode_init_once(VFS_I(ni)); | ||
3090 | } | 3089 | } |
3091 | 3090 | ||
3092 | /* | 3091 | /* |
diff --git a/fs/ocfs2/dlm/dlmfs.c b/fs/ocfs2/dlm/dlmfs.c index 5671cf9d6383..fd8cb1badc9b 100644 --- a/fs/ocfs2/dlm/dlmfs.c +++ b/fs/ocfs2/dlm/dlmfs.c | |||
@@ -262,12 +262,10 @@ static void dlmfs_init_once(void *foo, | |||
262 | struct dlmfs_inode_private *ip = | 262 | struct dlmfs_inode_private *ip = |
263 | (struct dlmfs_inode_private *) foo; | 263 | (struct dlmfs_inode_private *) foo; |
264 | 264 | ||
265 | if (flags & SLAB_CTOR_CONSTRUCTOR) { | 265 | ip->ip_dlm = NULL; |
266 | ip->ip_dlm = NULL; | 266 | ip->ip_parent = NULL; |
267 | ip->ip_parent = NULL; | ||
268 | 267 | ||
269 | inode_init_once(&ip->ip_vfs_inode); | 268 | inode_init_once(&ip->ip_vfs_inode); |
270 | } | ||
271 | } | 269 | } |
272 | 270 | ||
273 | static struct inode *dlmfs_alloc_inode(struct super_block *sb) | 271 | static struct inode *dlmfs_alloc_inode(struct super_block *sb) |
diff --git a/fs/ocfs2/super.c b/fs/ocfs2/super.c index 7c5e3f5d6634..86b559c7dce9 100644 --- a/fs/ocfs2/super.c +++ b/fs/ocfs2/super.c | |||
@@ -937,31 +937,29 @@ static void ocfs2_inode_init_once(void *data, | |||
937 | { | 937 | { |
938 | struct ocfs2_inode_info *oi = data; | 938 | struct ocfs2_inode_info *oi = data; |
939 | 939 | ||
940 | if (flags & SLAB_CTOR_CONSTRUCTOR) { | 940 | oi->ip_flags = 0; |
941 | oi->ip_flags = 0; | 941 | oi->ip_open_count = 0; |
942 | oi->ip_open_count = 0; | 942 | spin_lock_init(&oi->ip_lock); |
943 | spin_lock_init(&oi->ip_lock); | 943 | ocfs2_extent_map_init(&oi->vfs_inode); |
944 | ocfs2_extent_map_init(&oi->vfs_inode); | 944 | INIT_LIST_HEAD(&oi->ip_io_markers); |
945 | INIT_LIST_HEAD(&oi->ip_io_markers); | 945 | oi->ip_created_trans = 0; |
946 | oi->ip_created_trans = 0; | 946 | oi->ip_last_trans = 0; |
947 | oi->ip_last_trans = 0; | 947 | oi->ip_dir_start_lookup = 0; |
948 | oi->ip_dir_start_lookup = 0; | ||
949 | 948 | ||
950 | init_rwsem(&oi->ip_alloc_sem); | 949 | init_rwsem(&oi->ip_alloc_sem); |
951 | mutex_init(&oi->ip_io_mutex); | 950 | mutex_init(&oi->ip_io_mutex); |
952 | 951 | ||
953 | oi->ip_blkno = 0ULL; | 952 | oi->ip_blkno = 0ULL; |
954 | oi->ip_clusters = 0; | 953 | oi->ip_clusters = 0; |
955 | 954 | ||
956 | ocfs2_lock_res_init_once(&oi->ip_rw_lockres); | 955 | ocfs2_lock_res_init_once(&oi->ip_rw_lockres); |
957 | ocfs2_lock_res_init_once(&oi->ip_meta_lockres); | 956 | ocfs2_lock_res_init_once(&oi->ip_meta_lockres); |
958 | ocfs2_lock_res_init_once(&oi->ip_data_lockres); | 957 | ocfs2_lock_res_init_once(&oi->ip_data_lockres); |
959 | ocfs2_lock_res_init_once(&oi->ip_open_lockres); | 958 | ocfs2_lock_res_init_once(&oi->ip_open_lockres); |
960 | 959 | ||
961 | ocfs2_metadata_cache_init(&oi->vfs_inode); | 960 | ocfs2_metadata_cache_init(&oi->vfs_inode); |
962 | 961 | ||
963 | inode_init_once(&oi->vfs_inode); | 962 | inode_init_once(&oi->vfs_inode); |
964 | } | ||
965 | } | 963 | } |
966 | 964 | ||
967 | static int ocfs2_initialize_mem_caches(void) | 965 | static int ocfs2_initialize_mem_caches(void) |
diff --git a/fs/openpromfs/inode.c b/fs/openpromfs/inode.c index 731a90e9f0cd..e62397341c36 100644 --- a/fs/openpromfs/inode.c +++ b/fs/openpromfs/inode.c | |||
@@ -419,8 +419,7 @@ static void op_inode_init_once(void *data, struct kmem_cache * cachep, unsigned | |||
419 | { | 419 | { |
420 | struct op_inode_info *oi = (struct op_inode_info *) data; | 420 | struct op_inode_info *oi = (struct op_inode_info *) data; |
421 | 421 | ||
422 | if (flags & SLAB_CTOR_CONSTRUCTOR) | 422 | inode_init_once(&oi->vfs_inode); |
423 | inode_init_once(&oi->vfs_inode); | ||
424 | } | 423 | } |
425 | 424 | ||
426 | static int __init init_openprom_fs(void) | 425 | static int __init init_openprom_fs(void) |
diff --git a/fs/proc/inode.c b/fs/proc/inode.c index b8171907c83b..d5ce65c68d7b 100644 --- a/fs/proc/inode.c +++ b/fs/proc/inode.c | |||
@@ -109,8 +109,7 @@ static void init_once(void * foo, struct kmem_cache * cachep, unsigned long flag | |||
109 | { | 109 | { |
110 | struct proc_inode *ei = (struct proc_inode *) foo; | 110 | struct proc_inode *ei = (struct proc_inode *) foo; |
111 | 111 | ||
112 | if (flags & SLAB_CTOR_CONSTRUCTOR) | 112 | inode_init_once(&ei->vfs_inode); |
113 | inode_init_once(&ei->vfs_inode); | ||
114 | } | 113 | } |
115 | 114 | ||
116 | int __init proc_init_inodecache(void) | 115 | int __init proc_init_inodecache(void) |
diff --git a/fs/qnx4/inode.c b/fs/qnx4/inode.c index 75fc8498f2e2..8d256eb11813 100644 --- a/fs/qnx4/inode.c +++ b/fs/qnx4/inode.c | |||
@@ -536,8 +536,7 @@ static void init_once(void *foo, struct kmem_cache * cachep, | |||
536 | { | 536 | { |
537 | struct qnx4_inode_info *ei = (struct qnx4_inode_info *) foo; | 537 | struct qnx4_inode_info *ei = (struct qnx4_inode_info *) foo; |
538 | 538 | ||
539 | if (flags & SLAB_CTOR_CONSTRUCTOR) | 539 | inode_init_once(&ei->vfs_inode); |
540 | inode_init_once(&ei->vfs_inode); | ||
541 | } | 540 | } |
542 | 541 | ||
543 | static int init_inodecache(void) | 542 | static int init_inodecache(void) |
diff --git a/fs/reiserfs/super.c b/fs/reiserfs/super.c index c7762140c425..b4ac9119200e 100644 --- a/fs/reiserfs/super.c +++ b/fs/reiserfs/super.c | |||
@@ -511,14 +511,12 @@ static void init_once(void *foo, struct kmem_cache * cachep, unsigned long flags | |||
511 | { | 511 | { |
512 | struct reiserfs_inode_info *ei = (struct reiserfs_inode_info *)foo; | 512 | struct reiserfs_inode_info *ei = (struct reiserfs_inode_info *)foo; |
513 | 513 | ||
514 | if (flags & SLAB_CTOR_CONSTRUCTOR) { | 514 | INIT_LIST_HEAD(&ei->i_prealloc_list); |
515 | INIT_LIST_HEAD(&ei->i_prealloc_list); | 515 | inode_init_once(&ei->vfs_inode); |
516 | inode_init_once(&ei->vfs_inode); | ||
517 | #ifdef CONFIG_REISERFS_FS_POSIX_ACL | 516 | #ifdef CONFIG_REISERFS_FS_POSIX_ACL |
518 | ei->i_acl_access = NULL; | 517 | ei->i_acl_access = NULL; |
519 | ei->i_acl_default = NULL; | 518 | ei->i_acl_default = NULL; |
520 | #endif | 519 | #endif |
521 | } | ||
522 | } | 520 | } |
523 | 521 | ||
524 | static int init_inodecache(void) | 522 | static int init_inodecache(void) |
diff --git a/fs/romfs/inode.c b/fs/romfs/inode.c index 804285190271..2284e03342c6 100644 --- a/fs/romfs/inode.c +++ b/fs/romfs/inode.c | |||
@@ -566,12 +566,11 @@ static void romfs_destroy_inode(struct inode *inode) | |||
566 | kmem_cache_free(romfs_inode_cachep, ROMFS_I(inode)); | 566 | kmem_cache_free(romfs_inode_cachep, ROMFS_I(inode)); |
567 | } | 567 | } |
568 | 568 | ||
569 | static void init_once(void * foo, struct kmem_cache * cachep, unsigned long flags) | 569 | static void init_once(void *foo, struct kmem_cache *cachep, unsigned long flags) |
570 | { | 570 | { |
571 | struct romfs_inode_info *ei = (struct romfs_inode_info *) foo; | 571 | struct romfs_inode_info *ei = foo; |
572 | 572 | ||
573 | if (flags & SLAB_CTOR_CONSTRUCTOR) | 573 | inode_init_once(&ei->vfs_inode); |
574 | inode_init_once(&ei->vfs_inode); | ||
575 | } | 574 | } |
576 | 575 | ||
577 | static int init_inodecache(void) | 576 | static int init_inodecache(void) |
diff --git a/fs/smbfs/inode.c b/fs/smbfs/inode.c index 424a3ddf86dd..5c9243a23b9b 100644 --- a/fs/smbfs/inode.c +++ b/fs/smbfs/inode.c | |||
@@ -70,8 +70,7 @@ static void init_once(void * foo, struct kmem_cache * cachep, unsigned long flag | |||
70 | { | 70 | { |
71 | struct smb_inode_info *ei = (struct smb_inode_info *) foo; | 71 | struct smb_inode_info *ei = (struct smb_inode_info *) foo; |
72 | 72 | ||
73 | if (flags & SLAB_CTOR_CONSTRUCTOR) | 73 | inode_init_once(&ei->vfs_inode); |
74 | inode_init_once(&ei->vfs_inode); | ||
75 | } | 74 | } |
76 | 75 | ||
77 | static int init_inodecache(void) | 76 | static int init_inodecache(void) |
diff --git a/fs/sysv/inode.c b/fs/sysv/inode.c index 3152d7415606..564411693394 100644 --- a/fs/sysv/inode.c +++ b/fs/sysv/inode.c | |||
@@ -322,8 +322,7 @@ static void init_once(void *p, struct kmem_cache *cachep, unsigned long flags) | |||
322 | { | 322 | { |
323 | struct sysv_inode_info *si = (struct sysv_inode_info *)p; | 323 | struct sysv_inode_info *si = (struct sysv_inode_info *)p; |
324 | 324 | ||
325 | if (flags & SLAB_CTOR_CONSTRUCTOR) | 325 | inode_init_once(&si->vfs_inode); |
326 | inode_init_once(&si->vfs_inode); | ||
327 | } | 326 | } |
328 | 327 | ||
329 | const struct super_operations sysv_sops = { | 328 | const struct super_operations sysv_sops = { |
diff --git a/fs/udf/super.c b/fs/udf/super.c index 9b8644a06e53..3a743d854c17 100644 --- a/fs/udf/super.c +++ b/fs/udf/super.c | |||
@@ -134,10 +134,8 @@ static void init_once(void * foo, struct kmem_cache * cachep, unsigned long flag | |||
134 | { | 134 | { |
135 | struct udf_inode_info *ei = (struct udf_inode_info *) foo; | 135 | struct udf_inode_info *ei = (struct udf_inode_info *) foo; |
136 | 136 | ||
137 | if (flags & SLAB_CTOR_CONSTRUCTOR) { | 137 | ei->i_ext.i_data = NULL; |
138 | ei->i_ext.i_data = NULL; | 138 | inode_init_once(&ei->vfs_inode); |
139 | inode_init_once(&ei->vfs_inode); | ||
140 | } | ||
141 | } | 139 | } |
142 | 140 | ||
143 | static int init_inodecache(void) | 141 | static int init_inodecache(void) |
diff --git a/fs/ufs/super.c b/fs/ufs/super.c index be7c48c5f203..22ff6ed55ce9 100644 --- a/fs/ufs/super.c +++ b/fs/ufs/super.c | |||
@@ -1237,8 +1237,7 @@ static void init_once(void * foo, struct kmem_cache * cachep, unsigned long flag | |||
1237 | { | 1237 | { |
1238 | struct ufs_inode_info *ei = (struct ufs_inode_info *) foo; | 1238 | struct ufs_inode_info *ei = (struct ufs_inode_info *) foo; |
1239 | 1239 | ||
1240 | if (flags & SLAB_CTOR_CONSTRUCTOR) | 1240 | inode_init_once(&ei->vfs_inode); |
1241 | inode_init_once(&ei->vfs_inode); | ||
1242 | } | 1241 | } |
1243 | 1242 | ||
1244 | static int init_inodecache(void) | 1243 | static int init_inodecache(void) |
diff --git a/fs/xfs/linux-2.6/xfs_super.c b/fs/xfs/linux-2.6/xfs_super.c index 14e2cbe5a8d5..bf9a9d5909be 100644 --- a/fs/xfs/linux-2.6/xfs_super.c +++ b/fs/xfs/linux-2.6/xfs_super.c | |||
@@ -360,8 +360,7 @@ xfs_fs_inode_init_once( | |||
360 | kmem_zone_t *zonep, | 360 | kmem_zone_t *zonep, |
361 | unsigned long flags) | 361 | unsigned long flags) |
362 | { | 362 | { |
363 | if (flags & SLAB_CTOR_CONSTRUCTOR) | 363 | inode_init_once(vn_to_inode((bhv_vnode_t *)vnode)); |
364 | inode_init_once(vn_to_inode((bhv_vnode_t *)vnode)); | ||
365 | } | 364 | } |
366 | 365 | ||
367 | STATIC int | 366 | STATIC int |
diff --git a/include/linux/slab.h b/include/linux/slab.h index 5dbc0bae26e3..6fb2ae214152 100644 --- a/include/linux/slab.h +++ b/include/linux/slab.h | |||
@@ -32,9 +32,6 @@ typedef struct kmem_cache kmem_cache_t __deprecated; | |||
32 | #define SLAB_MEM_SPREAD 0x00100000UL /* Spread some memory over cpuset */ | 32 | #define SLAB_MEM_SPREAD 0x00100000UL /* Spread some memory over cpuset */ |
33 | #define SLAB_TRACE 0x00200000UL /* Trace allocations and frees */ | 33 | #define SLAB_TRACE 0x00200000UL /* Trace allocations and frees */ |
34 | 34 | ||
35 | /* Flags passed to a constructor functions */ | ||
36 | #define SLAB_CTOR_CONSTRUCTOR 0x001UL /* If not set, then deconstructor */ | ||
37 | |||
38 | /* | 35 | /* |
39 | * struct kmem_cache related prototypes | 36 | * struct kmem_cache related prototypes |
40 | */ | 37 | */ |
diff --git a/ipc/mqueue.c b/ipc/mqueue.c index fab5707cb5f7..a242c83d89d6 100644 --- a/ipc/mqueue.c +++ b/ipc/mqueue.c | |||
@@ -215,8 +215,7 @@ static void init_once(void *foo, struct kmem_cache * cachep, unsigned long flags | |||
215 | { | 215 | { |
216 | struct mqueue_inode_info *p = (struct mqueue_inode_info *) foo; | 216 | struct mqueue_inode_info *p = (struct mqueue_inode_info *) foo; |
217 | 217 | ||
218 | if (flags & SLAB_CTOR_CONSTRUCTOR) | 218 | inode_init_once(&p->vfs_inode); |
219 | inode_init_once(&p->vfs_inode); | ||
220 | } | 219 | } |
221 | 220 | ||
222 | static struct inode *mqueue_alloc_inode(struct super_block *sb) | 221 | static struct inode *mqueue_alloc_inode(struct super_block *sb) |
diff --git a/kernel/fork.c b/kernel/fork.c index 49530e40ea8b..87069cfc18a1 100644 --- a/kernel/fork.c +++ b/kernel/fork.c | |||
@@ -1427,10 +1427,8 @@ static void sighand_ctor(void *data, struct kmem_cache *cachep, | |||
1427 | { | 1427 | { |
1428 | struct sighand_struct *sighand = data; | 1428 | struct sighand_struct *sighand = data; |
1429 | 1429 | ||
1430 | if (flags & SLAB_CTOR_CONSTRUCTOR) { | 1430 | spin_lock_init(&sighand->siglock); |
1431 | spin_lock_init(&sighand->siglock); | 1431 | INIT_LIST_HEAD(&sighand->signalfd_list); |
1432 | INIT_LIST_HEAD(&sighand->signalfd_list); | ||
1433 | } | ||
1434 | } | 1432 | } |
1435 | 1433 | ||
1436 | void __init proc_caches_init(void) | 1434 | void __init proc_caches_init(void) |
@@ -162,12 +162,10 @@ void anon_vma_unlink(struct vm_area_struct *vma) | |||
162 | static void anon_vma_ctor(void *data, struct kmem_cache *cachep, | 162 | static void anon_vma_ctor(void *data, struct kmem_cache *cachep, |
163 | unsigned long flags) | 163 | unsigned long flags) |
164 | { | 164 | { |
165 | if (flags & SLAB_CTOR_CONSTRUCTOR) { | 165 | struct anon_vma *anon_vma = data; |
166 | struct anon_vma *anon_vma = data; | ||
167 | 166 | ||
168 | spin_lock_init(&anon_vma->lock); | 167 | spin_lock_init(&anon_vma->lock); |
169 | INIT_LIST_HEAD(&anon_vma->head); | 168 | INIT_LIST_HEAD(&anon_vma->head); |
170 | } | ||
171 | } | 169 | } |
172 | 170 | ||
173 | void __init anon_vma_init(void) | 171 | void __init anon_vma_init(void) |
diff --git a/mm/shmem.c b/mm/shmem.c index f01e8deed645..e537317bec4d 100644 --- a/mm/shmem.c +++ b/mm/shmem.c | |||
@@ -2358,13 +2358,11 @@ static void init_once(void *foo, struct kmem_cache *cachep, | |||
2358 | { | 2358 | { |
2359 | struct shmem_inode_info *p = (struct shmem_inode_info *) foo; | 2359 | struct shmem_inode_info *p = (struct shmem_inode_info *) foo; |
2360 | 2360 | ||
2361 | if (flags & SLAB_CTOR_CONSTRUCTOR) { | 2361 | inode_init_once(&p->vfs_inode); |
2362 | inode_init_once(&p->vfs_inode); | ||
2363 | #ifdef CONFIG_TMPFS_POSIX_ACL | 2362 | #ifdef CONFIG_TMPFS_POSIX_ACL |
2364 | p->i_acl = NULL; | 2363 | p->i_acl = NULL; |
2365 | p->i_default_acl = NULL; | 2364 | p->i_default_acl = NULL; |
2366 | #endif | 2365 | #endif |
2367 | } | ||
2368 | } | 2366 | } |
2369 | 2367 | ||
2370 | static int init_inodecache(void) | 2368 | static int init_inodecache(void) |
@@ -2610,7 +2610,7 @@ static inline kmem_bufctl_t *slab_bufctl(struct slab *slabp) | |||
2610 | } | 2610 | } |
2611 | 2611 | ||
2612 | static void cache_init_objs(struct kmem_cache *cachep, | 2612 | static void cache_init_objs(struct kmem_cache *cachep, |
2613 | struct slab *slabp, unsigned long ctor_flags) | 2613 | struct slab *slabp) |
2614 | { | 2614 | { |
2615 | int i; | 2615 | int i; |
2616 | 2616 | ||
@@ -2634,7 +2634,7 @@ static void cache_init_objs(struct kmem_cache *cachep, | |||
2634 | */ | 2634 | */ |
2635 | if (cachep->ctor && !(cachep->flags & SLAB_POISON)) | 2635 | if (cachep->ctor && !(cachep->flags & SLAB_POISON)) |
2636 | cachep->ctor(objp + obj_offset(cachep), cachep, | 2636 | cachep->ctor(objp + obj_offset(cachep), cachep, |
2637 | ctor_flags); | 2637 | 0); |
2638 | 2638 | ||
2639 | if (cachep->flags & SLAB_RED_ZONE) { | 2639 | if (cachep->flags & SLAB_RED_ZONE) { |
2640 | if (*dbg_redzone2(cachep, objp) != RED_INACTIVE) | 2640 | if (*dbg_redzone2(cachep, objp) != RED_INACTIVE) |
@@ -2650,7 +2650,7 @@ static void cache_init_objs(struct kmem_cache *cachep, | |||
2650 | cachep->buffer_size / PAGE_SIZE, 0); | 2650 | cachep->buffer_size / PAGE_SIZE, 0); |
2651 | #else | 2651 | #else |
2652 | if (cachep->ctor) | 2652 | if (cachep->ctor) |
2653 | cachep->ctor(objp, cachep, ctor_flags); | 2653 | cachep->ctor(objp, cachep, 0); |
2654 | #endif | 2654 | #endif |
2655 | slab_bufctl(slabp)[i] = i + 1; | 2655 | slab_bufctl(slabp)[i] = i + 1; |
2656 | } | 2656 | } |
@@ -2739,7 +2739,6 @@ static int cache_grow(struct kmem_cache *cachep, | |||
2739 | struct slab *slabp; | 2739 | struct slab *slabp; |
2740 | size_t offset; | 2740 | size_t offset; |
2741 | gfp_t local_flags; | 2741 | gfp_t local_flags; |
2742 | unsigned long ctor_flags; | ||
2743 | struct kmem_list3 *l3; | 2742 | struct kmem_list3 *l3; |
2744 | 2743 | ||
2745 | /* | 2744 | /* |
@@ -2748,7 +2747,6 @@ static int cache_grow(struct kmem_cache *cachep, | |||
2748 | */ | 2747 | */ |
2749 | BUG_ON(flags & ~(GFP_DMA | GFP_LEVEL_MASK)); | 2748 | BUG_ON(flags & ~(GFP_DMA | GFP_LEVEL_MASK)); |
2750 | 2749 | ||
2751 | ctor_flags = SLAB_CTOR_CONSTRUCTOR; | ||
2752 | local_flags = (flags & GFP_LEVEL_MASK); | 2750 | local_flags = (flags & GFP_LEVEL_MASK); |
2753 | /* Take the l3 list lock to change the colour_next on this node */ | 2751 | /* Take the l3 list lock to change the colour_next on this node */ |
2754 | check_irq_off(); | 2752 | check_irq_off(); |
@@ -2793,7 +2791,7 @@ static int cache_grow(struct kmem_cache *cachep, | |||
2793 | slabp->nodeid = nodeid; | 2791 | slabp->nodeid = nodeid; |
2794 | slab_map_pages(cachep, slabp, objp); | 2792 | slab_map_pages(cachep, slabp, objp); |
2795 | 2793 | ||
2796 | cache_init_objs(cachep, slabp, ctor_flags); | 2794 | cache_init_objs(cachep, slabp); |
2797 | 2795 | ||
2798 | if (local_flags & __GFP_WAIT) | 2796 | if (local_flags & __GFP_WAIT) |
2799 | local_irq_disable(); | 2797 | local_irq_disable(); |
@@ -3077,7 +3075,7 @@ static void *cache_alloc_debugcheck_after(struct kmem_cache *cachep, | |||
3077 | #endif | 3075 | #endif |
3078 | objp += obj_offset(cachep); | 3076 | objp += obj_offset(cachep); |
3079 | if (cachep->ctor && cachep->flags & SLAB_POISON) | 3077 | if (cachep->ctor && cachep->flags & SLAB_POISON) |
3080 | cachep->ctor(objp, cachep, SLAB_CTOR_CONSTRUCTOR); | 3078 | cachep->ctor(objp, cachep, 0); |
3081 | #if ARCH_SLAB_MINALIGN | 3079 | #if ARCH_SLAB_MINALIGN |
3082 | if ((u32)objp & (ARCH_SLAB_MINALIGN-1)) { | 3080 | if ((u32)objp & (ARCH_SLAB_MINALIGN-1)) { |
3083 | printk(KERN_ERR "0x%p: not aligned to ARCH_SLAB_MINALIGN=%d\n", | 3081 | printk(KERN_ERR "0x%p: not aligned to ARCH_SLAB_MINALIGN=%d\n", |
@@ -327,7 +327,7 @@ void *kmem_cache_alloc(struct kmem_cache *c, gfp_t flags) | |||
327 | b = (void *)__get_free_pages(flags, get_order(c->size)); | 327 | b = (void *)__get_free_pages(flags, get_order(c->size)); |
328 | 328 | ||
329 | if (c->ctor) | 329 | if (c->ctor) |
330 | c->ctor(b, c, SLAB_CTOR_CONSTRUCTOR); | 330 | c->ctor(b, c, 0); |
331 | 331 | ||
332 | return b; | 332 | return b; |
333 | } | 333 | } |
@@ -994,7 +994,7 @@ static void setup_object(struct kmem_cache *s, struct page *page, | |||
994 | } | 994 | } |
995 | 995 | ||
996 | if (unlikely(s->ctor)) | 996 | if (unlikely(s->ctor)) |
997 | s->ctor(object, s, SLAB_CTOR_CONSTRUCTOR); | 997 | s->ctor(object, s, 0); |
998 | } | 998 | } |
999 | 999 | ||
1000 | static struct page *new_slab(struct kmem_cache *s, gfp_t flags, int node) | 1000 | static struct page *new_slab(struct kmem_cache *s, gfp_t flags, int node) |
diff --git a/net/socket.c b/net/socket.c index 98a8f67abbfc..f4530196a70a 100644 --- a/net/socket.c +++ b/net/socket.c | |||
@@ -261,8 +261,7 @@ static void init_once(void *foo, struct kmem_cache *cachep, unsigned long flags) | |||
261 | { | 261 | { |
262 | struct socket_alloc *ei = (struct socket_alloc *)foo; | 262 | struct socket_alloc *ei = (struct socket_alloc *)foo; |
263 | 263 | ||
264 | if (flags & SLAB_CTOR_CONSTRUCTOR) | 264 | inode_init_once(&ei->vfs_inode); |
265 | inode_init_once(&ei->vfs_inode); | ||
266 | } | 265 | } |
267 | 266 | ||
268 | static int init_inodecache(void) | 267 | static int init_inodecache(void) |
diff --git a/net/sunrpc/rpc_pipe.c b/net/sunrpc/rpc_pipe.c index a2f1893bde53..5887457dc936 100644 --- a/net/sunrpc/rpc_pipe.c +++ b/net/sunrpc/rpc_pipe.c | |||
@@ -828,19 +828,17 @@ init_once(void * foo, struct kmem_cache * cachep, unsigned long flags) | |||
828 | { | 828 | { |
829 | struct rpc_inode *rpci = (struct rpc_inode *) foo; | 829 | struct rpc_inode *rpci = (struct rpc_inode *) foo; |
830 | 830 | ||
831 | if (flags & SLAB_CTOR_CONSTRUCTOR) { | 831 | inode_init_once(&rpci->vfs_inode); |
832 | inode_init_once(&rpci->vfs_inode); | 832 | rpci->private = NULL; |
833 | rpci->private = NULL; | 833 | rpci->nreaders = 0; |
834 | rpci->nreaders = 0; | 834 | rpci->nwriters = 0; |
835 | rpci->nwriters = 0; | 835 | INIT_LIST_HEAD(&rpci->in_upcall); |
836 | INIT_LIST_HEAD(&rpci->in_upcall); | 836 | INIT_LIST_HEAD(&rpci->pipe); |
837 | INIT_LIST_HEAD(&rpci->pipe); | 837 | rpci->pipelen = 0; |
838 | rpci->pipelen = 0; | 838 | init_waitqueue_head(&rpci->waitq); |
839 | init_waitqueue_head(&rpci->waitq); | 839 | INIT_DELAYED_WORK(&rpci->queue_timeout, |
840 | INIT_DELAYED_WORK(&rpci->queue_timeout, | 840 | rpc_timeout_upcall_queue); |
841 | rpc_timeout_upcall_queue); | 841 | rpci->ops = NULL; |
842 | rpci->ops = NULL; | ||
843 | } | ||
844 | } | 842 | } |
845 | 843 | ||
846 | int register_rpc_pipefs(void) | 844 | int register_rpc_pipefs(void) |