Skip to content

Commit

Permalink
Slab API: remove useless ctor parameter and reorder parameters
Browse files Browse the repository at this point in the history
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

[[email protected]: coupla fixes]
Signed-off-by: Christoph Lameter <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
Christoph Lameter authored and Linus Torvalds committed Oct 17, 2007
1 parent b811c20 commit 4ba9b9d
Show file tree
Hide file tree
Showing 67 changed files with 83 additions and 99 deletions.
2 changes: 1 addition & 1 deletion arch/arm/plat-s3c24xx/dma.c
Original file line number Diff line number Diff line change
Expand Up @@ -1272,7 +1272,7 @@ struct sysdev_class dma_sysclass = {

/* kmem cache implementation */

static void s3c2410_dma_cache_ctor(void *p, struct kmem_cache *c, unsigned long f)
static void s3c2410_dma_cache_ctor(struct kmem_cache *c, void *p)
{
memset(p, 0, sizeof(struct s3c2410_dma_buf));
}
Expand Down
2 changes: 1 addition & 1 deletion arch/powerpc/kernel/rtas_flash.c
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ static ssize_t rtas_flash_read(struct file *file, char __user *buf,
}

/* constructor for flash_block_cache */
void rtas_block_ctor(void *ptr, struct kmem_cache *cache, unsigned long flags)
void rtas_block_ctor(struct kmem_cache *cache, void *ptr)
{
memset(ptr, 0, RTAS_BLK_SIZE);
}
Expand Down
2 changes: 1 addition & 1 deletion arch/powerpc/mm/hugetlbpage.c
Original file line number Diff line number Diff line change
Expand Up @@ -526,7 +526,7 @@ int hash_huge_page(struct mm_struct *mm, unsigned long access,
return err;
}

static void zero_ctor(void *addr, struct kmem_cache *cache, unsigned long flags)
static void zero_ctor(struct kmem_cache *cache, void *addr)
{
memset(addr, 0, kmem_cache_size(cache));
}
Expand Down
2 changes: 1 addition & 1 deletion arch/powerpc/mm/init_64.c
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ static int __init setup_kcore(void)
module_init(setup_kcore);
#endif

static void zero_ctor(void *addr, struct kmem_cache *cache, unsigned long flags)
static void zero_ctor(struct kmem_cache *cache, void *addr)
{
memset(addr, 0, kmem_cache_size(cache));
}
Expand Down
2 changes: 1 addition & 1 deletion arch/powerpc/platforms/cell/spufs/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ spufs_destroy_inode(struct inode *inode)
}

static void
spufs_init_once(void *p, struct kmem_cache * cachep, unsigned long flags)
spufs_init_once(struct kmem_cache *cachep, void *p)
{
struct spufs_inode_info *ei = p;

Expand Down
3 changes: 1 addition & 2 deletions arch/sh/mm/pmb.c
Original file line number Diff line number Diff line change
Expand Up @@ -292,8 +292,7 @@ void pmb_unmap(unsigned long addr)
} while (pmbe);
}

static void pmb_cache_ctor(void *pmb, struct kmem_cache *cachep,
unsigned long flags)
static void pmb_cache_ctor(struct kmem_cache *cachep, void *pmb)
{
struct pmb_entry *pmbe = pmb;

Expand Down
2 changes: 1 addition & 1 deletion arch/x86/mm/pgtable_32.c
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ struct page *pte_alloc_one(struct mm_struct *mm, unsigned long address)
return pte;
}

void pmd_ctor(void *pmd, struct kmem_cache *cache, unsigned long flags)
void pmd_ctor(struct kmem_cache *cache, void *pmd)
{
memset(pmd, 0, PTRS_PER_PMD*sizeof(pmd_t));
}
Expand Down
3 changes: 1 addition & 2 deletions drivers/mtd/ubi/eba.c
Original file line number Diff line number Diff line change
Expand Up @@ -933,8 +933,7 @@ int ubi_eba_atomic_leb_change(struct ubi_device *ubi, int vol_id, int lnum,
* @cache: the lock tree entry slab cache
* @flags: constructor flags
*/
static void ltree_entry_ctor(void *obj, struct kmem_cache *cache,
unsigned long flags)
static void ltree_entry_ctor(struct kmem_cache *cache, void *obj)
{
struct ltree_entry *le = obj;

Expand Down
4 changes: 2 additions & 2 deletions drivers/usb/mon/mon_text.c
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ struct mon_reader_text {

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

static void mon_text_ctor(void *, struct kmem_cache *, unsigned long);
static void mon_text_ctor(struct kmem_cache *, void *);

struct mon_text_ptr {
int cnt, limit;
Expand Down Expand Up @@ -720,7 +720,7 @@ void mon_text_del(struct mon_bus *mbus)
/*
* Slab interface: constructor.
*/
static void mon_text_ctor(void *mem, struct kmem_cache *slab, unsigned long sflags)
static void mon_text_ctor(struct kmem_cache *slab, void *mem)
{
/*
* Nothing to initialize. No, really!
Expand Down
2 changes: 1 addition & 1 deletion fs/adfs/super.c
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ static void adfs_destroy_inode(struct inode *inode)
kmem_cache_free(adfs_inode_cachep, ADFS_I(inode));
}

static void init_once(void * foo, struct kmem_cache * cachep, unsigned long flags)
static void init_once(struct kmem_cache *cachep, void *foo)
{
struct adfs_inode_info *ei = (struct adfs_inode_info *) foo;

Expand Down
2 changes: 1 addition & 1 deletion fs/affs/super.c
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ static void affs_destroy_inode(struct inode *inode)
kmem_cache_free(affs_inode_cachep, AFFS_I(inode));
}

static void init_once(void * foo, struct kmem_cache * cachep, unsigned long flags)
static void init_once(struct kmem_cache *cachep, void *foo)
{
struct affs_inode_info *ei = (struct affs_inode_info *) foo;

Expand Down
6 changes: 2 additions & 4 deletions fs/afs/super.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@

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

static void afs_i_init_once(void *foo, struct kmem_cache *cachep,
unsigned long flags);
static void afs_i_init_once(struct kmem_cache *cachep, void *foo);
static int afs_get_sb(struct file_system_type *fs_type,
int flags, const char *dev_name,
void *data, struct vfsmount *mnt);
Expand Down Expand Up @@ -446,8 +445,7 @@ static void afs_put_super(struct super_block *sb)
/*
* initialise an inode cache slab element prior to any use
*/
static void afs_i_init_once(void *_vnode, struct kmem_cache *cachep,
unsigned long flags)
static void afs_i_init_once(struct kmem_cache *cachep, void *_vnode)
{
struct afs_vnode *vnode = _vnode;

Expand Down
2 changes: 1 addition & 1 deletion fs/befs/linuxvfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ befs_destroy_inode(struct inode *inode)
kmem_cache_free(befs_inode_cachep, BEFS_I(inode));
}

static void init_once(void * foo, struct kmem_cache * cachep, unsigned long flags)
static void init_once(struct kmem_cache *cachep, void *foo)
{
struct befs_inode_info *bi = (struct befs_inode_info *) foo;

Expand Down
2 changes: 1 addition & 1 deletion fs/bfs/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ static void bfs_destroy_inode(struct inode *inode)
kmem_cache_free(bfs_inode_cachep, BFS_I(inode));
}

static void init_once(void * foo, struct kmem_cache * cachep, unsigned long flags)
static void init_once(struct kmem_cache *cachep, void *foo)
{
struct bfs_inode_info *bi = foo;

Expand Down
2 changes: 1 addition & 1 deletion fs/block_dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,7 @@ static void bdev_destroy_inode(struct inode *inode)
kmem_cache_free(bdev_cachep, bdi);
}

static void init_once(void * foo, struct kmem_cache * cachep, unsigned long flags)
static void init_once(struct kmem_cache * cachep, void *foo)
{
struct bdev_inode *ei = (struct bdev_inode *) foo;
struct block_device *bdev = &ei->bdev;
Expand Down
2 changes: 1 addition & 1 deletion fs/cifs/cifsfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -704,7 +704,7 @@ const struct file_operations cifs_dir_ops = {
};

static void
cifs_init_once(void *inode, struct kmem_cache *cachep, unsigned long flags)
cifs_init_once(struct kmem_cache *cachep, void *inode)
{
struct cifsInodeInfo *cifsi = inode;

Expand Down
2 changes: 1 addition & 1 deletion fs/coda/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ static void coda_destroy_inode(struct inode *inode)
kmem_cache_free(coda_inode_cachep, ITOC(inode));
}

static void init_once(void * foo, struct kmem_cache * cachep, unsigned long flags)
static void init_once(struct kmem_cache * cachep, void *foo)
{
struct coda_inode_info *ei = (struct coda_inode_info *) foo;

Expand Down
4 changes: 2 additions & 2 deletions fs/ecryptfs/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -611,7 +611,7 @@ static struct file_system_type ecryptfs_fs_type = {
* Initializes the ecryptfs_inode_info_cache when it is created
*/
static void
inode_info_init_once(void *vptr, struct kmem_cache *cachep, unsigned long flags)
inode_info_init_once(struct kmem_cache *cachep, void *vptr)
{
struct ecryptfs_inode_info *ei = (struct ecryptfs_inode_info *)vptr;

Expand All @@ -622,7 +622,7 @@ static struct ecryptfs_cache_info {
struct kmem_cache **cache;
const char *name;
size_t size;
void (*ctor)(void*, struct kmem_cache *, unsigned long);
void (*ctor)(struct kmem_cache *cache, void *obj);
} ecryptfs_cache_infos[] = {
{
.cache = &ecryptfs_auth_tok_list_item_cache,
Expand Down
2 changes: 1 addition & 1 deletion fs/efs/super.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ static void efs_destroy_inode(struct inode *inode)
kmem_cache_free(efs_inode_cachep, INODE_INFO(inode));
}

static void init_once(void * foo, struct kmem_cache * cachep, unsigned long flags)
static void init_once(struct kmem_cache *cachep, void *foo)
{
struct efs_inode_info *ei = (struct efs_inode_info *) foo;

Expand Down
2 changes: 1 addition & 1 deletion fs/ext2/super.c
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ static void ext2_destroy_inode(struct inode *inode)
kmem_cache_free(ext2_inode_cachep, EXT2_I(inode));
}

static void init_once(void * foo, struct kmem_cache * cachep, unsigned long flags)
static void init_once(struct kmem_cache * cachep, void *foo)
{
struct ext2_inode_info *ei = (struct ext2_inode_info *) foo;

Expand Down
2 changes: 1 addition & 1 deletion fs/ext3/super.c
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,7 @@ static void ext3_destroy_inode(struct inode *inode)
kmem_cache_free(ext3_inode_cachep, EXT3_I(inode));
}

static void init_once(void * foo, struct kmem_cache * cachep, unsigned long flags)
static void init_once(struct kmem_cache * cachep, void *foo)
{
struct ext3_inode_info *ei = (struct ext3_inode_info *) foo;

Expand Down
2 changes: 1 addition & 1 deletion fs/ext4/super.c
Original file line number Diff line number Diff line change
Expand Up @@ -523,7 +523,7 @@ static void ext4_destroy_inode(struct inode *inode)
kmem_cache_free(ext4_inode_cachep, EXT4_I(inode));
}

static void init_once(void * foo, struct kmem_cache * cachep, unsigned long flags)
static void init_once(struct kmem_cache *cachep, void *foo)
{
struct ext4_inode_info *ei = (struct ext4_inode_info *) foo;

Expand Down
2 changes: 1 addition & 1 deletion fs/fat/cache.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ static inline int fat_max_cache(struct inode *inode)

static struct kmem_cache *fat_cache_cachep;

static void init_once(void *foo, struct kmem_cache *cachep, unsigned long flags)
static void init_once(struct kmem_cache *cachep, void *foo)
{
struct fat_cache *cache = (struct fat_cache *)foo;

Expand Down
2 changes: 1 addition & 1 deletion fs/fat/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -501,7 +501,7 @@ static void fat_destroy_inode(struct inode *inode)
kmem_cache_free(fat_inode_cachep, MSDOS_I(inode));
}

static void init_once(void * foo, struct kmem_cache * cachep, unsigned long flags)
static void init_once(struct kmem_cache *cachep, void *foo)
{
struct msdos_inode_info *ei = (struct msdos_inode_info *)foo;

Expand Down
3 changes: 1 addition & 2 deletions fs/fuse/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -692,8 +692,7 @@ static inline void unregister_fuseblk(void)
static decl_subsys(fuse, NULL, NULL);
static decl_subsys(connections, NULL, NULL);

static void fuse_inode_init_once(void *foo, struct kmem_cache *cachep,
unsigned long flags)
static void fuse_inode_init_once(struct kmem_cache *cachep, void *foo)
{
struct inode * inode = foo;

Expand Down
4 changes: 2 additions & 2 deletions fs/gfs2/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
#include "util.h"
#include "glock.h"

static void gfs2_init_inode_once(void *foo, struct kmem_cache *cachep, unsigned long flags)
static void gfs2_init_inode_once(struct kmem_cache *cachep, void *foo)
{
struct gfs2_inode *ip = foo;

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

static void gfs2_init_glock_once(void *foo, struct kmem_cache *cachep, unsigned long flags)
static void gfs2_init_glock_once(struct kmem_cache *cachep, void *foo)
{
struct gfs2_glock *gl = foo;

Expand Down
2 changes: 1 addition & 1 deletion fs/hfs/super.c
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,7 @@ static struct file_system_type hfs_fs_type = {
.fs_flags = FS_REQUIRES_DEV,
};

static void hfs_init_once(void *p, struct kmem_cache *cachep, unsigned long flags)
static void hfs_init_once(struct kmem_cache *cachep, void *p)
{
struct hfs_inode_info *i = p;

Expand Down
2 changes: 1 addition & 1 deletion fs/hfsplus/super.c
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,7 @@ static struct file_system_type hfsplus_fs_type = {
.fs_flags = FS_REQUIRES_DEV,
};

static void hfsplus_init_once(void *p, struct kmem_cache *cachep, unsigned long flags)
static void hfsplus_init_once(struct kmem_cache *cachep, void *p)
{
struct hfsplus_inode_info *i = p;

Expand Down
2 changes: 1 addition & 1 deletion fs/hpfs/super.c
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ static void hpfs_destroy_inode(struct inode *inode)
kmem_cache_free(hpfs_inode_cachep, hpfs_i(inode));
}

static void init_once(void * foo, struct kmem_cache * cachep, unsigned long flags)
static void init_once(struct kmem_cache *cachep, void *foo)
{
struct hpfs_inode_info *ei = (struct hpfs_inode_info *) foo;

Expand Down
2 changes: 1 addition & 1 deletion fs/hugetlbfs/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -697,7 +697,7 @@ static const struct address_space_operations hugetlbfs_aops = {
};


static void init_once(void *foo, struct kmem_cache *cachep, unsigned long flags)
static void init_once(struct kmem_cache *cachep, void *foo)
{
struct hugetlbfs_inode_info *ei = (struct hugetlbfs_inode_info *)foo;

Expand Down
2 changes: 1 addition & 1 deletion fs/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ void inode_init_once(struct inode *inode)

EXPORT_SYMBOL(inode_init_once);

static void init_once(void * foo, struct kmem_cache * cachep, unsigned long flags)
static void init_once(struct kmem_cache * cachep, void *foo)
{
struct inode * inode = (struct inode *) foo;

Expand Down
2 changes: 1 addition & 1 deletion fs/isofs/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ static void isofs_destroy_inode(struct inode *inode)
kmem_cache_free(isofs_inode_cachep, ISOFS_I(inode));
}

static void init_once(void *foo, struct kmem_cache *cachep, unsigned long flags)
static void init_once(struct kmem_cache *cachep, void *foo)
{
struct iso_inode_info *ei = foo;

Expand Down
2 changes: 1 addition & 1 deletion fs/jffs2/super.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ static void jffs2_destroy_inode(struct inode *inode)
kmem_cache_free(jffs2_inode_cachep, JFFS2_INODE_INFO(inode));
}

static void jffs2_i_init_once(void * foo, struct kmem_cache * cachep, unsigned long flags)
static void jffs2_i_init_once(struct kmem_cache *cachep, void *foo)
{
struct jffs2_inode_info *ei = (struct jffs2_inode_info *) foo;

Expand Down
2 changes: 1 addition & 1 deletion fs/jfs/jfs_metapage.c
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ static inline void remove_metapage(struct page *page, struct metapage *mp)

#endif

static void init_once(void *foo, struct kmem_cache *cachep, unsigned long flags)
static void init_once(struct kmem_cache *cachep, void *foo)
{
struct metapage *mp = (struct metapage *)foo;

Expand Down
2 changes: 1 addition & 1 deletion fs/jfs/super.c
Original file line number Diff line number Diff line change
Expand Up @@ -750,7 +750,7 @@ static struct file_system_type jfs_fs_type = {
.fs_flags = FS_REQUIRES_DEV,
};

static void init_once(void *foo, struct kmem_cache * cachep, unsigned long flags)
static void init_once(struct kmem_cache *cachep, void *foo)
{
struct jfs_inode_info *jfs_ip = (struct jfs_inode_info *) foo;

Expand Down
2 changes: 1 addition & 1 deletion fs/locks.c
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ EXPORT_SYMBOL(locks_init_lock);
* Initialises the fields of the file lock which are invariant for
* free file_locks.
*/
static void init_once(void *foo, struct kmem_cache *cache, unsigned long flags)
static void init_once(struct kmem_cache *cache, void *foo)
{
struct file_lock *lock = (struct file_lock *) foo;

Expand Down
2 changes: 1 addition & 1 deletion fs/minix/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ static void minix_destroy_inode(struct inode *inode)
kmem_cache_free(minix_inode_cachep, minix_i(inode));
}

static void init_once(void * foo, struct kmem_cache * cachep, unsigned long flags)
static void init_once(struct kmem_cache * cachep, void *foo)
{
struct minix_inode_info *ei = (struct minix_inode_info *) foo;

Expand Down
2 changes: 1 addition & 1 deletion fs/ncpfs/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ static void ncp_destroy_inode(struct inode *inode)
kmem_cache_free(ncp_inode_cachep, NCP_FINFO(inode));
}

static void init_once(void * foo, struct kmem_cache * cachep, unsigned long flags)
static void init_once(struct kmem_cache *cachep, void *foo)
{
struct ncp_inode_info *ei = (struct ncp_inode_info *) foo;

Expand Down
2 changes: 1 addition & 1 deletion fs/nfs/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -1154,7 +1154,7 @@ static inline void nfs4_init_once(struct nfs_inode *nfsi)
#endif
}

static void init_once(void * foo, struct kmem_cache * cachep, unsigned long flags)
static void init_once(struct kmem_cache * cachep, void *foo)
{
struct nfs_inode *nfsi = (struct nfs_inode *) foo;

Expand Down
Loading

0 comments on commit 4ba9b9d

Please sign in to comment.