Skip to content

Commit 4ba9b9d

Browse files
Christoph LameterLinus Torvalds
Christoph Lameter
authored and
Linus Torvalds
committed
Slab API: remove useless ctor parameter and reorder parameters
Slab constructors currently have a flags parameter that is never used. And the order of the arguments is opposite to other slab functions. The object pointer is placed before the kmem_cache pointer. Convert ctor(void *object, struct kmem_cache *s, unsigned long flags) to ctor(struct kmem_cache *s, void *object) throughout the kernel [akpm@linux-foundation.org: coupla fixes] Signed-off-by: Christoph Lameter <clameter@sgi.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent b811c20 commit 4ba9b9d

File tree

67 files changed

+83
-99
lines changed

Some content is hidden

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

67 files changed

+83
-99
lines changed

arch/arm/plat-s3c24xx/dma.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -1272,7 +1272,7 @@ struct sysdev_class dma_sysclass = {
12721272

12731273
/* kmem cache implementation */
12741274

1275-
static void s3c2410_dma_cache_ctor(void *p, struct kmem_cache *c, unsigned long f)
1275+
static void s3c2410_dma_cache_ctor(struct kmem_cache *c, void *p)
12761276
{
12771277
memset(p, 0, sizeof(struct s3c2410_dma_buf));
12781278
}

arch/powerpc/kernel/rtas_flash.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ static ssize_t rtas_flash_read(struct file *file, char __user *buf,
286286
}
287287

288288
/* constructor for flash_block_cache */
289-
void rtas_block_ctor(void *ptr, struct kmem_cache *cache, unsigned long flags)
289+
void rtas_block_ctor(struct kmem_cache *cache, void *ptr)
290290
{
291291
memset(ptr, 0, RTAS_BLK_SIZE);
292292
}

arch/powerpc/mm/hugetlbpage.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -526,7 +526,7 @@ int hash_huge_page(struct mm_struct *mm, unsigned long access,
526526
return err;
527527
}
528528

529-
static void zero_ctor(void *addr, struct kmem_cache *cache, unsigned long flags)
529+
static void zero_ctor(struct kmem_cache *cache, void *addr)
530530
{
531531
memset(addr, 0, kmem_cache_size(cache));
532532
}

arch/powerpc/mm/init_64.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ static int __init setup_kcore(void)
142142
module_init(setup_kcore);
143143
#endif
144144

145-
static void zero_ctor(void *addr, struct kmem_cache *cache, unsigned long flags)
145+
static void zero_ctor(struct kmem_cache *cache, void *addr)
146146
{
147147
memset(addr, 0, kmem_cache_size(cache));
148148
}

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ spufs_destroy_inode(struct inode *inode)
6868
}
6969

7070
static void
71-
spufs_init_once(void *p, struct kmem_cache * cachep, unsigned long flags)
71+
spufs_init_once(struct kmem_cache *cachep, void *p)
7272
{
7373
struct spufs_inode_info *ei = p;
7474

arch/sh/mm/pmb.c

+1-2
Original file line numberDiff line numberDiff line change
@@ -292,8 +292,7 @@ void pmb_unmap(unsigned long addr)
292292
} while (pmbe);
293293
}
294294

295-
static void pmb_cache_ctor(void *pmb, struct kmem_cache *cachep,
296-
unsigned long flags)
295+
static void pmb_cache_ctor(struct kmem_cache *cachep, void *pmb)
297296
{
298297
struct pmb_entry *pmbe = pmb;
299298

arch/x86/mm/pgtable_32.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ struct page *pte_alloc_one(struct mm_struct *mm, unsigned long address)
193193
return pte;
194194
}
195195

196-
void pmd_ctor(void *pmd, struct kmem_cache *cache, unsigned long flags)
196+
void pmd_ctor(struct kmem_cache *cache, void *pmd)
197197
{
198198
memset(pmd, 0, PTRS_PER_PMD*sizeof(pmd_t));
199199
}

drivers/mtd/ubi/eba.c

+1-2
Original file line numberDiff line numberDiff line change
@@ -933,8 +933,7 @@ int ubi_eba_atomic_leb_change(struct ubi_device *ubi, int vol_id, int lnum,
933933
* @cache: the lock tree entry slab cache
934934
* @flags: constructor flags
935935
*/
936-
static void ltree_entry_ctor(void *obj, struct kmem_cache *cache,
937-
unsigned long flags)
936+
static void ltree_entry_ctor(struct kmem_cache *cache, void *obj)
938937
{
939938
struct ltree_entry *le = obj;
940939

drivers/usb/mon/mon_text.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ struct mon_reader_text {
8787

8888
static struct dentry *mon_dir; /* Usually /sys/kernel/debug/usbmon */
8989

90-
static void mon_text_ctor(void *, struct kmem_cache *, unsigned long);
90+
static void mon_text_ctor(struct kmem_cache *, void *);
9191

9292
struct mon_text_ptr {
9393
int cnt, limit;
@@ -720,7 +720,7 @@ void mon_text_del(struct mon_bus *mbus)
720720
/*
721721
* Slab interface: constructor.
722722
*/
723-
static void mon_text_ctor(void *mem, struct kmem_cache *slab, unsigned long sflags)
723+
static void mon_text_ctor(struct kmem_cache *slab, void *mem)
724724
{
725725
/*
726726
* Nothing to initialize. No, really!

fs/adfs/super.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ static void adfs_destroy_inode(struct inode *inode)
228228
kmem_cache_free(adfs_inode_cachep, ADFS_I(inode));
229229
}
230230

231-
static void init_once(void * foo, struct kmem_cache * cachep, unsigned long flags)
231+
static void init_once(struct kmem_cache *cachep, void *foo)
232232
{
233233
struct adfs_inode_info *ei = (struct adfs_inode_info *) foo;
234234

fs/affs/super.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ static void affs_destroy_inode(struct inode *inode)
8484
kmem_cache_free(affs_inode_cachep, AFFS_I(inode));
8585
}
8686

87-
static void init_once(void * foo, struct kmem_cache * cachep, unsigned long flags)
87+
static void init_once(struct kmem_cache *cachep, void *foo)
8888
{
8989
struct affs_inode_info *ei = (struct affs_inode_info *) foo;
9090

fs/afs/super.c

+2-4
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,7 @@
2727

2828
#define AFS_FS_MAGIC 0x6B414653 /* 'kAFS' */
2929

30-
static void afs_i_init_once(void *foo, struct kmem_cache *cachep,
31-
unsigned long flags);
30+
static void afs_i_init_once(struct kmem_cache *cachep, void *foo);
3231
static int afs_get_sb(struct file_system_type *fs_type,
3332
int flags, const char *dev_name,
3433
void *data, struct vfsmount *mnt);
@@ -446,8 +445,7 @@ static void afs_put_super(struct super_block *sb)
446445
/*
447446
* initialise an inode cache slab element prior to any use
448447
*/
449-
static void afs_i_init_once(void *_vnode, struct kmem_cache *cachep,
450-
unsigned long flags)
448+
static void afs_i_init_once(struct kmem_cache *cachep, void *_vnode)
451449
{
452450
struct afs_vnode *vnode = _vnode;
453451

fs/befs/linuxvfs.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ befs_destroy_inode(struct inode *inode)
289289
kmem_cache_free(befs_inode_cachep, BEFS_I(inode));
290290
}
291291

292-
static void init_once(void * foo, struct kmem_cache * cachep, unsigned long flags)
292+
static void init_once(struct kmem_cache *cachep, void *foo)
293293
{
294294
struct befs_inode_info *bi = (struct befs_inode_info *) foo;
295295

fs/bfs/inode.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ static void bfs_destroy_inode(struct inode *inode)
244244
kmem_cache_free(bfs_inode_cachep, BFS_I(inode));
245245
}
246246

247-
static void init_once(void * foo, struct kmem_cache * cachep, unsigned long flags)
247+
static void init_once(struct kmem_cache *cachep, void *foo)
248248
{
249249
struct bfs_inode_info *bi = foo;
250250

fs/block_dev.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -465,7 +465,7 @@ static void bdev_destroy_inode(struct inode *inode)
465465
kmem_cache_free(bdev_cachep, bdi);
466466
}
467467

468-
static void init_once(void * foo, struct kmem_cache * cachep, unsigned long flags)
468+
static void init_once(struct kmem_cache * cachep, void *foo)
469469
{
470470
struct bdev_inode *ei = (struct bdev_inode *) foo;
471471
struct block_device *bdev = &ei->bdev;

fs/cifs/cifsfs.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -704,7 +704,7 @@ const struct file_operations cifs_dir_ops = {
704704
};
705705

706706
static void
707-
cifs_init_once(void *inode, struct kmem_cache *cachep, unsigned long flags)
707+
cifs_init_once(struct kmem_cache *cachep, void *inode)
708708
{
709709
struct cifsInodeInfo *cifsi = inode;
710710

fs/coda/inode.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ static void coda_destroy_inode(struct inode *inode)
5858
kmem_cache_free(coda_inode_cachep, ITOC(inode));
5959
}
6060

61-
static void init_once(void * foo, struct kmem_cache * cachep, unsigned long flags)
61+
static void init_once(struct kmem_cache * cachep, void *foo)
6262
{
6363
struct coda_inode_info *ei = (struct coda_inode_info *) foo;
6464

fs/ecryptfs/main.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -611,7 +611,7 @@ static struct file_system_type ecryptfs_fs_type = {
611611
* Initializes the ecryptfs_inode_info_cache when it is created
612612
*/
613613
static void
614-
inode_info_init_once(void *vptr, struct kmem_cache *cachep, unsigned long flags)
614+
inode_info_init_once(struct kmem_cache *cachep, void *vptr)
615615
{
616616
struct ecryptfs_inode_info *ei = (struct ecryptfs_inode_info *)vptr;
617617

@@ -622,7 +622,7 @@ static struct ecryptfs_cache_info {
622622
struct kmem_cache **cache;
623623
const char *name;
624624
size_t size;
625-
void (*ctor)(void*, struct kmem_cache *, unsigned long);
625+
void (*ctor)(struct kmem_cache *cache, void *obj);
626626
} ecryptfs_cache_infos[] = {
627627
{
628628
.cache = &ecryptfs_auth_tok_list_item_cache,

fs/efs/super.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ static void efs_destroy_inode(struct inode *inode)
6969
kmem_cache_free(efs_inode_cachep, INODE_INFO(inode));
7070
}
7171

72-
static void init_once(void * foo, struct kmem_cache * cachep, unsigned long flags)
72+
static void init_once(struct kmem_cache *cachep, void *foo)
7373
{
7474
struct efs_inode_info *ei = (struct efs_inode_info *) foo;
7575

fs/ext2/super.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ static void ext2_destroy_inode(struct inode *inode)
157157
kmem_cache_free(ext2_inode_cachep, EXT2_I(inode));
158158
}
159159

160-
static void init_once(void * foo, struct kmem_cache * cachep, unsigned long flags)
160+
static void init_once(struct kmem_cache * cachep, void *foo)
161161
{
162162
struct ext2_inode_info *ei = (struct ext2_inode_info *) foo;
163163

fs/ext3/super.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -472,7 +472,7 @@ static void ext3_destroy_inode(struct inode *inode)
472472
kmem_cache_free(ext3_inode_cachep, EXT3_I(inode));
473473
}
474474

475-
static void init_once(void * foo, struct kmem_cache * cachep, unsigned long flags)
475+
static void init_once(struct kmem_cache * cachep, void *foo)
476476
{
477477
struct ext3_inode_info *ei = (struct ext3_inode_info *) foo;
478478

fs/ext4/super.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -523,7 +523,7 @@ static void ext4_destroy_inode(struct inode *inode)
523523
kmem_cache_free(ext4_inode_cachep, EXT4_I(inode));
524524
}
525525

526-
static void init_once(void * foo, struct kmem_cache * cachep, unsigned long flags)
526+
static void init_once(struct kmem_cache *cachep, void *foo)
527527
{
528528
struct ext4_inode_info *ei = (struct ext4_inode_info *) foo;
529529

fs/fat/cache.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ static inline int fat_max_cache(struct inode *inode)
3636

3737
static struct kmem_cache *fat_cache_cachep;
3838

39-
static void init_once(void *foo, struct kmem_cache *cachep, unsigned long flags)
39+
static void init_once(struct kmem_cache *cachep, void *foo)
4040
{
4141
struct fat_cache *cache = (struct fat_cache *)foo;
4242

fs/fat/inode.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -501,7 +501,7 @@ static void fat_destroy_inode(struct inode *inode)
501501
kmem_cache_free(fat_inode_cachep, MSDOS_I(inode));
502502
}
503503

504-
static void init_once(void * foo, struct kmem_cache * cachep, unsigned long flags)
504+
static void init_once(struct kmem_cache *cachep, void *foo)
505505
{
506506
struct msdos_inode_info *ei = (struct msdos_inode_info *)foo;
507507

fs/fuse/inode.c

+1-2
Original file line numberDiff line numberDiff line change
@@ -692,8 +692,7 @@ static inline void unregister_fuseblk(void)
692692
static decl_subsys(fuse, NULL, NULL);
693693
static decl_subsys(connections, NULL, NULL);
694694

695-
static void fuse_inode_init_once(void *foo, struct kmem_cache *cachep,
696-
unsigned long flags)
695+
static void fuse_inode_init_once(struct kmem_cache *cachep, void *foo)
697696
{
698697
struct inode * inode = foo;
699698

fs/gfs2/main.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
#include "util.h"
2525
#include "glock.h"
2626

27-
static void gfs2_init_inode_once(void *foo, struct kmem_cache *cachep, unsigned long flags)
27+
static void gfs2_init_inode_once(struct kmem_cache *cachep, void *foo)
2828
{
2929
struct gfs2_inode *ip = foo;
3030

@@ -34,7 +34,7 @@ static void gfs2_init_inode_once(void *foo, struct kmem_cache *cachep, unsigned
3434
memset(ip->i_cache, 0, sizeof(ip->i_cache));
3535
}
3636

37-
static void gfs2_init_glock_once(void *foo, struct kmem_cache *cachep, unsigned long flags)
37+
static void gfs2_init_glock_once(struct kmem_cache *cachep, void *foo)
3838
{
3939
struct gfs2_glock *gl = foo;
4040

fs/hfs/super.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -430,7 +430,7 @@ static struct file_system_type hfs_fs_type = {
430430
.fs_flags = FS_REQUIRES_DEV,
431431
};
432432

433-
static void hfs_init_once(void *p, struct kmem_cache *cachep, unsigned long flags)
433+
static void hfs_init_once(struct kmem_cache *cachep, void *p)
434434
{
435435
struct hfs_inode_info *i = p;
436436

fs/hfsplus/super.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -466,7 +466,7 @@ static struct file_system_type hfsplus_fs_type = {
466466
.fs_flags = FS_REQUIRES_DEV,
467467
};
468468

469-
static void hfsplus_init_once(void *p, struct kmem_cache *cachep, unsigned long flags)
469+
static void hfsplus_init_once(struct kmem_cache *cachep, void *p)
470470
{
471471
struct hfsplus_inode_info *i = p;
472472

fs/hpfs/super.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ static void hpfs_destroy_inode(struct inode *inode)
173173
kmem_cache_free(hpfs_inode_cachep, hpfs_i(inode));
174174
}
175175

176-
static void init_once(void * foo, struct kmem_cache * cachep, unsigned long flags)
176+
static void init_once(struct kmem_cache *cachep, void *foo)
177177
{
178178
struct hpfs_inode_info *ei = (struct hpfs_inode_info *) foo;
179179

fs/hugetlbfs/inode.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -697,7 +697,7 @@ static const struct address_space_operations hugetlbfs_aops = {
697697
};
698698

699699

700-
static void init_once(void *foo, struct kmem_cache *cachep, unsigned long flags)
700+
static void init_once(struct kmem_cache *cachep, void *foo)
701701
{
702702
struct hugetlbfs_inode_info *ei = (struct hugetlbfs_inode_info *)foo;
703703

fs/inode.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ void inode_init_once(struct inode *inode)
215215

216216
EXPORT_SYMBOL(inode_init_once);
217217

218-
static void init_once(void * foo, struct kmem_cache * cachep, unsigned long flags)
218+
static void init_once(struct kmem_cache * cachep, void *foo)
219219
{
220220
struct inode * inode = (struct inode *) foo;
221221

fs/isofs/inode.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ static void isofs_destroy_inode(struct inode *inode)
7373
kmem_cache_free(isofs_inode_cachep, ISOFS_I(inode));
7474
}
7575

76-
static void init_once(void *foo, struct kmem_cache *cachep, unsigned long flags)
76+
static void init_once(struct kmem_cache *cachep, void *foo)
7777
{
7878
struct iso_inode_info *ei = foo;
7979

fs/jffs2/super.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ static void jffs2_destroy_inode(struct inode *inode)
4343
kmem_cache_free(jffs2_inode_cachep, JFFS2_INODE_INFO(inode));
4444
}
4545

46-
static void jffs2_i_init_once(void * foo, struct kmem_cache * cachep, unsigned long flags)
46+
static void jffs2_i_init_once(struct kmem_cache *cachep, void *foo)
4747
{
4848
struct jffs2_inode_info *ei = (struct jffs2_inode_info *) foo;
4949

fs/jfs/jfs_metapage.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ static inline void remove_metapage(struct page *page, struct metapage *mp)
180180

181181
#endif
182182

183-
static void init_once(void *foo, struct kmem_cache *cachep, unsigned long flags)
183+
static void init_once(struct kmem_cache *cachep, void *foo)
184184
{
185185
struct metapage *mp = (struct metapage *)foo;
186186

fs/jfs/super.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -750,7 +750,7 @@ static struct file_system_type jfs_fs_type = {
750750
.fs_flags = FS_REQUIRES_DEV,
751751
};
752752

753-
static void init_once(void *foo, struct kmem_cache * cachep, unsigned long flags)
753+
static void init_once(struct kmem_cache *cachep, void *foo)
754754
{
755755
struct jfs_inode_info *jfs_ip = (struct jfs_inode_info *) foo;
756756

fs/locks.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ EXPORT_SYMBOL(locks_init_lock);
199199
* Initialises the fields of the file lock which are invariant for
200200
* free file_locks.
201201
*/
202-
static void init_once(void *foo, struct kmem_cache *cache, unsigned long flags)
202+
static void init_once(struct kmem_cache *cache, void *foo)
203203
{
204204
struct file_lock *lock = (struct file_lock *) foo;
205205

fs/minix/inode.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ static void minix_destroy_inode(struct inode *inode)
6969
kmem_cache_free(minix_inode_cachep, minix_i(inode));
7070
}
7171

72-
static void init_once(void * foo, struct kmem_cache * cachep, unsigned long flags)
72+
static void init_once(struct kmem_cache * cachep, void *foo)
7373
{
7474
struct minix_inode_info *ei = (struct minix_inode_info *) foo;
7575

fs/ncpfs/inode.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ static void ncp_destroy_inode(struct inode *inode)
5656
kmem_cache_free(ncp_inode_cachep, NCP_FINFO(inode));
5757
}
5858

59-
static void init_once(void * foo, struct kmem_cache * cachep, unsigned long flags)
59+
static void init_once(struct kmem_cache *cachep, void *foo)
6060
{
6161
struct ncp_inode_info *ei = (struct ncp_inode_info *) foo;
6262

fs/nfs/inode.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -1154,7 +1154,7 @@ static inline void nfs4_init_once(struct nfs_inode *nfsi)
11541154
#endif
11551155
}
11561156

1157-
static void init_once(void * foo, struct kmem_cache * cachep, unsigned long flags)
1157+
static void init_once(struct kmem_cache * cachep, void *foo)
11581158
{
11591159
struct nfs_inode *nfsi = (struct nfs_inode *) foo;
11601160

0 commit comments

Comments
 (0)