Skip to content

Commit a35afb8

Browse files
Christoph LameterLinus Torvalds
authored andcommitted
Remove SLAB_CTOR_CONSTRUCTOR
SLAB_CTOR_CONSTRUCTOR is always specified. No point in checking it. Signed-off-by: Christoph Lameter <clameter@sgi.com> Cc: David Howells <dhowells@redhat.com> Cc: Jens Axboe <jens.axboe@oracle.com> Cc: Steven French <sfrench@us.ibm.com> Cc: Michael Halcrow <mhalcrow@us.ibm.com> Cc: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp> Cc: Miklos Szeredi <miklos@szeredi.hu> Cc: Steven Whitehouse <swhiteho@redhat.com> Cc: Roman Zippel <zippel@linux-m68k.org> Cc: David Woodhouse <dwmw2@infradead.org> Cc: Dave Kleikamp <shaggy@austin.ibm.com> Cc: Trond Myklebust <trond.myklebust@fys.uio.no> Cc: "J. Bruce Fields" <bfields@fieldses.org> Cc: Anton Altaparmakov <aia21@cantab.net> Cc: Mark Fasheh <mark.fasheh@oracle.com> Cc: Paul Mackerras <paulus@samba.org> Cc: Christoph Hellwig <hch@lst.de> Cc: Jan Kara <jack@ucw.cz> Cc: David Chinner <dgc@sgi.com> Cc: "David S. Miller" <davem@davemloft.net> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent 5577bd8 commit a35afb8

56 files changed

Lines changed: 178 additions & 277 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎arch/powerpc/platforms/cell/spufs/inode.c‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,7 @@ spufs_init_once(void *p, struct kmem_cache * cachep, unsigned long flags)
7171
{
7272
struct spufs_inode_info *ei = p;
7373

74-
if (flags & SLAB_CTOR_CONSTRUCTOR) {
75-
inode_init_once(&ei->vfs_inode);
76-
}
74+
inode_init_once(&ei->vfs_inode);
7775
}
7876

7977
static struct inode *

‎drivers/mtd/ubi/eba.c‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -940,9 +940,6 @@ static void ltree_entry_ctor(void *obj, struct kmem_cache *cache,
940940
{
941941
struct ltree_entry *le = obj;
942942

943-
if (flags & SLAB_CTOR_CONSTRUCTOR)
944-
return;
945-
946943
le->users = 0;
947944
init_rwsem(&le->mutex);
948945
}

‎fs/adfs/super.c‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -232,8 +232,7 @@ static void init_once(void * foo, struct kmem_cache * cachep, unsigned long flag
232232
{
233233
struct adfs_inode_info *ei = (struct adfs_inode_info *) foo;
234234

235-
if (flags & SLAB_CTOR_CONSTRUCTOR)
236-
inode_init_once(&ei->vfs_inode);
235+
inode_init_once(&ei->vfs_inode);
237236
}
238237

239238
static int init_inodecache(void)

‎fs/affs/super.c‎

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -87,11 +87,9 @@ static void init_once(void * foo, struct kmem_cache * cachep, unsigned long flag
8787
{
8888
struct affs_inode_info *ei = (struct affs_inode_info *) foo;
8989

90-
if (flags & SLAB_CTOR_CONSTRUCTOR) {
91-
init_MUTEX(&ei->i_link_lock);
92-
init_MUTEX(&ei->i_ext_lock);
93-
inode_init_once(&ei->vfs_inode);
94-
}
90+
init_MUTEX(&ei->i_link_lock);
91+
init_MUTEX(&ei->i_ext_lock);
92+
inode_init_once(&ei->vfs_inode);
9593
}
9694

9795
static int init_inodecache(void)

‎fs/afs/super.c‎

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -451,17 +451,15 @@ static void afs_i_init_once(void *_vnode, struct kmem_cache *cachep,
451451
{
452452
struct afs_vnode *vnode = _vnode;
453453

454-
if (flags & SLAB_CTOR_CONSTRUCTOR) {
455-
memset(vnode, 0, sizeof(*vnode));
456-
inode_init_once(&vnode->vfs_inode);
457-
init_waitqueue_head(&vnode->update_waitq);
458-
mutex_init(&vnode->permits_lock);
459-
mutex_init(&vnode->validate_lock);
460-
spin_lock_init(&vnode->writeback_lock);
461-
spin_lock_init(&vnode->lock);
462-
INIT_LIST_HEAD(&vnode->writebacks);
463-
INIT_WORK(&vnode->cb_broken_work, afs_broken_callback_work);
464-
}
454+
memset(vnode, 0, sizeof(*vnode));
455+
inode_init_once(&vnode->vfs_inode);
456+
init_waitqueue_head(&vnode->update_waitq);
457+
mutex_init(&vnode->permits_lock);
458+
mutex_init(&vnode->validate_lock);
459+
spin_lock_init(&vnode->writeback_lock);
460+
spin_lock_init(&vnode->lock);
461+
INIT_LIST_HEAD(&vnode->writebacks);
462+
INIT_WORK(&vnode->cb_broken_work, afs_broken_callback_work);
465463
}
466464

467465
/*

‎fs/befs/linuxvfs.c‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -292,10 +292,8 @@ befs_destroy_inode(struct inode *inode)
292292
static void init_once(void * foo, struct kmem_cache * cachep, unsigned long flags)
293293
{
294294
struct befs_inode_info *bi = (struct befs_inode_info *) foo;
295-
296-
if (flags & SLAB_CTOR_CONSTRUCTOR) {
297-
inode_init_once(&bi->vfs_inode);
298-
}
295+
296+
inode_init_once(&bi->vfs_inode);
299297
}
300298

301299
static void

‎fs/bfs/inode.c‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -248,8 +248,7 @@ static void init_once(void * foo, struct kmem_cache * cachep, unsigned long flag
248248
{
249249
struct bfs_inode_info *bi = foo;
250250

251-
if (flags & SLAB_CTOR_CONSTRUCTOR)
252-
inode_init_once(&bi->vfs_inode);
251+
inode_init_once(&bi->vfs_inode);
253252
}
254253

255254
static int init_inodecache(void)

‎fs/block_dev.c‎

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -458,17 +458,15 @@ static void init_once(void * foo, struct kmem_cache * cachep, unsigned long flag
458458
struct bdev_inode *ei = (struct bdev_inode *) foo;
459459
struct block_device *bdev = &ei->bdev;
460460

461-
if (flags & SLAB_CTOR_CONSTRUCTOR) {
462-
memset(bdev, 0, sizeof(*bdev));
463-
mutex_init(&bdev->bd_mutex);
464-
sema_init(&bdev->bd_mount_sem, 1);
465-
INIT_LIST_HEAD(&bdev->bd_inodes);
466-
INIT_LIST_HEAD(&bdev->bd_list);
461+
memset(bdev, 0, sizeof(*bdev));
462+
mutex_init(&bdev->bd_mutex);
463+
sema_init(&bdev->bd_mount_sem, 1);
464+
INIT_LIST_HEAD(&bdev->bd_inodes);
465+
INIT_LIST_HEAD(&bdev->bd_list);
467466
#ifdef CONFIG_SYSFS
468-
INIT_LIST_HEAD(&bdev->bd_holder_list);
467+
INIT_LIST_HEAD(&bdev->bd_holder_list);
469468
#endif
470-
inode_init_once(&ei->vfs_inode);
471-
}
469+
inode_init_once(&ei->vfs_inode);
472470
}
473471

474472
static inline void __bd_forget(struct inode *inode)

‎fs/buffer.c‎

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2898,8 +2898,9 @@ static void recalc_bh_state(void)
28982898

28992899
struct buffer_head *alloc_buffer_head(gfp_t gfp_flags)
29002900
{
2901-
struct buffer_head *ret = kmem_cache_alloc(bh_cachep, gfp_flags);
2901+
struct buffer_head *ret = kmem_cache_zalloc(bh_cachep, gfp_flags);
29022902
if (ret) {
2903+
INIT_LIST_HEAD(&ret->b_assoc_buffers);
29032904
get_cpu_var(bh_accounting).nr++;
29042905
recalc_bh_state();
29052906
put_cpu_var(bh_accounting);
@@ -2918,17 +2919,6 @@ void free_buffer_head(struct buffer_head *bh)
29182919
}
29192920
EXPORT_SYMBOL(free_buffer_head);
29202921

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-
29322922
static void buffer_exit_cpu(int cpu)
29332923
{
29342924
int i;
@@ -2955,12 +2945,8 @@ void __init buffer_init(void)
29552945
{
29562946
int nrpages;
29572947

2958-
bh_cachep = kmem_cache_create("buffer_head",
2959-
sizeof(struct buffer_head), 0,
2960-
(SLAB_RECLAIM_ACCOUNT|SLAB_PANIC|
2961-
SLAB_MEM_SPREAD),
2962-
init_buffer_head,
2963-
NULL);
2948+
bh_cachep = KMEM_CACHE(buffer_head,
2949+
SLAB_RECLAIM_ACCOUNT|SLAB_PANIC|SLAB_MEM_SPREAD);
29642950

29652951
/*
29662952
* Limit the bh occupancy to 10% of ZONE_NORMAL

‎fs/cifs/cifsfs.c‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -701,10 +701,8 @@ cifs_init_once(void *inode, struct kmem_cache * cachep, unsigned long flags)
701701
{
702702
struct cifsInodeInfo *cifsi = inode;
703703

704-
if (flags & SLAB_CTOR_CONSTRUCTOR) {
705-
inode_init_once(&cifsi->vfs_inode);
706-
INIT_LIST_HEAD(&cifsi->lockList);
707-
}
704+
inode_init_once(&cifsi->vfs_inode);
705+
INIT_LIST_HEAD(&cifsi->lockList);
708706
}
709707

710708
static int

0 commit comments

Comments
 (0)