Commit 91bdae7c authored by Brian Gerst's avatar Brian Gerst Committed by Linus Torvalds

[PATCH] Use mempool_alloc/free_slab

Convert fs/bio.c and fs/jfs/jfs_metapage.c to use the mempool_alloc_slab
and mempool_free_slab helper functions.
parent 7bdcfe31
...@@ -52,16 +52,6 @@ static struct biovec_pool bvec_array[BIOVEC_NR_POOLS] = { ...@@ -52,16 +52,6 @@ static struct biovec_pool bvec_array[BIOVEC_NR_POOLS] = {
}; };
#undef BV #undef BV
static void *slab_pool_alloc(int gfp_mask, void *data)
{
return kmem_cache_alloc(data, gfp_mask);
}
static void slab_pool_free(void *ptr, void *data)
{
kmem_cache_free(data, ptr);
}
static inline struct bio_vec *bvec_alloc(int gfp_mask, int nr, unsigned long *idx) static inline struct bio_vec *bvec_alloc(int gfp_mask, int nr, unsigned long *idx)
{ {
struct biovec_pool *bp; struct biovec_pool *bp;
...@@ -749,8 +739,8 @@ static void __init biovec_init_pools(void) ...@@ -749,8 +739,8 @@ static void __init biovec_init_pools(void)
if (i >= scale) if (i >= scale)
pool_entries >>= 1; pool_entries >>= 1;
bp->pool = mempool_create(pool_entries, slab_pool_alloc, bp->pool = mempool_create(pool_entries, mempool_alloc_slab,
slab_pool_free, bp->slab); mempool_free_slab, bp->slab);
if (!bp->pool) if (!bp->pool)
panic("biovec: can't init mempool\n"); panic("biovec: can't init mempool\n");
...@@ -766,7 +756,7 @@ static int __init init_bio(void) ...@@ -766,7 +756,7 @@ static int __init init_bio(void)
SLAB_HWCACHE_ALIGN, NULL, NULL); SLAB_HWCACHE_ALIGN, NULL, NULL);
if (!bio_slab) if (!bio_slab)
panic("bio: can't create slab cache\n"); panic("bio: can't create slab cache\n");
bio_pool = mempool_create(BIO_POOL_SIZE, slab_pool_alloc, slab_pool_free, bio_slab); bio_pool = mempool_create(BIO_POOL_SIZE, mempool_alloc_slab, mempool_free_slab, bio_slab);
if (!bio_pool) if (!bio_pool)
panic("bio: can't create mempool\n"); panic("bio: can't create mempool\n");
......
...@@ -120,15 +120,6 @@ static inline void free_metapage(struct metapage *mp) ...@@ -120,15 +120,6 @@ static inline void free_metapage(struct metapage *mp)
mempool_free(mp, metapage_mempool); mempool_free(mp, metapage_mempool);
} }
static void *mp_mempool_alloc(int gfp_mask, void *pool_data)
{
return kmem_cache_alloc(metapage_cache, gfp_mask);
}
static void mp_mempool_free(void *element, void *pool_data)
{
return kmem_cache_free(metapage_cache, element);
}
int __init metapage_init(void) int __init metapage_init(void)
{ {
/* /*
...@@ -139,8 +130,8 @@ int __init metapage_init(void) ...@@ -139,8 +130,8 @@ int __init metapage_init(void)
if (metapage_cache == NULL) if (metapage_cache == NULL)
return -ENOMEM; return -ENOMEM;
metapage_mempool = mempool_create(METAPOOL_MIN_PAGES, mp_mempool_alloc, metapage_mempool = mempool_create(METAPOOL_MIN_PAGES, mempool_alloc_slab,
mp_mempool_free, NULL); mempool_free_slab, metapage_cache);
if (metapage_mempool == NULL) { if (metapage_mempool == NULL) {
kmem_cache_destroy(metapage_cache); kmem_cache_destroy(metapage_cache);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment