[PATCH] mempool: use mempool_create_slab_pool()
Modify well over a dozen mempool users to call mempool_create_slab_pool() rather than calling mempool_create() with extra arguments, saving about 30 lines of code and increasing readability. Signed-off-by: Matthew Dobson <colpatch@us.ibm.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
This commit is contained in:
committed by
Linus Torvalds
parent
fec433aaaa
commit
93d2341c75
7
fs/bio.c
7
fs/bio.c
@@ -1141,8 +1141,7 @@ static int biovec_create_pools(struct bio_set *bs, int pool_entries, int scale)
|
||||
if (i >= scale)
|
||||
pool_entries >>= 1;
|
||||
|
||||
*bvp = mempool_create(pool_entries, mempool_alloc_slab,
|
||||
mempool_free_slab, bp->slab);
|
||||
*bvp = mempool_create_slab_pool(pool_entries, bp->slab);
|
||||
if (!*bvp)
|
||||
return -ENOMEM;
|
||||
}
|
||||
@@ -1179,9 +1178,7 @@ struct bio_set *bioset_create(int bio_pool_size, int bvec_pool_size, int scale)
|
||||
if (!bs)
|
||||
return NULL;
|
||||
|
||||
bs->bio_pool = mempool_create(bio_pool_size, mempool_alloc_slab,
|
||||
mempool_free_slab, bio_slab);
|
||||
|
||||
bs->bio_pool = mempool_create_slab_pool(bio_pool_size, bio_slab);
|
||||
if (!bs->bio_pool)
|
||||
goto bad;
|
||||
|
||||
|
@@ -738,10 +738,8 @@ cifs_init_request_bufs(void)
|
||||
cERROR(1,("cifs_min_rcv set to maximum (64)"));
|
||||
}
|
||||
|
||||
cifs_req_poolp = mempool_create(cifs_min_rcv,
|
||||
mempool_alloc_slab,
|
||||
mempool_free_slab,
|
||||
cifs_req_cachep);
|
||||
cifs_req_poolp = mempool_create_slab_pool(cifs_min_rcv,
|
||||
cifs_req_cachep);
|
||||
|
||||
if(cifs_req_poolp == NULL) {
|
||||
kmem_cache_destroy(cifs_req_cachep);
|
||||
@@ -771,10 +769,8 @@ cifs_init_request_bufs(void)
|
||||
cFYI(1,("cifs_min_small set to maximum (256)"));
|
||||
}
|
||||
|
||||
cifs_sm_req_poolp = mempool_create(cifs_min_small,
|
||||
mempool_alloc_slab,
|
||||
mempool_free_slab,
|
||||
cifs_sm_req_cachep);
|
||||
cifs_sm_req_poolp = mempool_create_slab_pool(cifs_min_small,
|
||||
cifs_sm_req_cachep);
|
||||
|
||||
if(cifs_sm_req_poolp == NULL) {
|
||||
mempool_destroy(cifs_req_poolp);
|
||||
@@ -808,10 +804,8 @@ cifs_init_mids(void)
|
||||
if (cifs_mid_cachep == NULL)
|
||||
return -ENOMEM;
|
||||
|
||||
cifs_mid_poolp = mempool_create(3 /* a reasonable min simultan opers */,
|
||||
mempool_alloc_slab,
|
||||
mempool_free_slab,
|
||||
cifs_mid_cachep);
|
||||
/* 3 is a reasonable minimum number of simultaneous operations */
|
||||
cifs_mid_poolp = mempool_create_slab_pool(3, cifs_mid_cachep);
|
||||
if(cifs_mid_poolp == NULL) {
|
||||
kmem_cache_destroy(cifs_mid_cachep);
|
||||
return -ENOMEM;
|
||||
|
@@ -220,8 +220,8 @@ int __init metapage_init(void)
|
||||
if (metapage_cache == NULL)
|
||||
return -ENOMEM;
|
||||
|
||||
metapage_mempool = mempool_create(METAPOOL_MIN_PAGES, mempool_alloc_slab,
|
||||
mempool_free_slab, metapage_cache);
|
||||
metapage_mempool = mempool_create_slab_pool(METAPOOL_MIN_PAGES,
|
||||
metapage_cache);
|
||||
|
||||
if (metapage_mempool == NULL) {
|
||||
kmem_cache_destroy(metapage_cache);
|
||||
|
@@ -663,10 +663,8 @@ int nfs_init_readpagecache(void)
|
||||
if (nfs_rdata_cachep == NULL)
|
||||
return -ENOMEM;
|
||||
|
||||
nfs_rdata_mempool = mempool_create(MIN_POOL_READ,
|
||||
mempool_alloc_slab,
|
||||
mempool_free_slab,
|
||||
nfs_rdata_cachep);
|
||||
nfs_rdata_mempool = mempool_create_slab_pool(MIN_POOL_READ,
|
||||
nfs_rdata_cachep);
|
||||
if (nfs_rdata_mempool == NULL)
|
||||
return -ENOMEM;
|
||||
|
||||
|
@@ -1521,17 +1521,13 @@ int nfs_init_writepagecache(void)
|
||||
if (nfs_wdata_cachep == NULL)
|
||||
return -ENOMEM;
|
||||
|
||||
nfs_wdata_mempool = mempool_create(MIN_POOL_WRITE,
|
||||
mempool_alloc_slab,
|
||||
mempool_free_slab,
|
||||
nfs_wdata_cachep);
|
||||
nfs_wdata_mempool = mempool_create_slab_pool(MIN_POOL_WRITE,
|
||||
nfs_wdata_cachep);
|
||||
if (nfs_wdata_mempool == NULL)
|
||||
return -ENOMEM;
|
||||
|
||||
nfs_commit_mempool = mempool_create(MIN_POOL_COMMIT,
|
||||
mempool_alloc_slab,
|
||||
mempool_free_slab,
|
||||
nfs_wdata_cachep);
|
||||
nfs_commit_mempool = mempool_create_slab_pool(MIN_POOL_COMMIT,
|
||||
nfs_wdata_cachep);
|
||||
if (nfs_commit_mempool == NULL)
|
||||
return -ENOMEM;
|
||||
|
||||
|
@@ -375,9 +375,8 @@ xfs_init_zones(void)
|
||||
if (!xfs_ioend_zone)
|
||||
goto out_destroy_vnode_zone;
|
||||
|
||||
xfs_ioend_pool = mempool_create(4 * MAX_BUF_PER_PAGE,
|
||||
mempool_alloc_slab, mempool_free_slab,
|
||||
xfs_ioend_zone);
|
||||
xfs_ioend_pool = mempool_create_slab_pool(4 * MAX_BUF_PER_PAGE,
|
||||
xfs_ioend_zone);
|
||||
if (!xfs_ioend_pool)
|
||||
goto out_free_ioend_zone;
|
||||
return 0;
|
||||
|
Reference in New Issue
Block a user