aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md/dm-raid1.c
diff options
context:
space:
mode:
authorMatthew Dobson <colpatch@us.ibm.com>2006-03-26 04:37:47 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2006-03-26 11:56:59 -0500
commit0eaae62abaa1ad1f231932b6cdd9fb1b91df6651 (patch)
treecda02cffff075a8b542ddcea4fa0ff0064130502 /drivers/md/dm-raid1.c
parent53184082b070dfb077218828fdf839826102ed96 (diff)
[PATCH] mempool: use common mempool kmalloc allocator
This patch changes several mempool users, all of which are basically just wrappers around kmalloc(), to use the common mempool_kmalloc/kfree, rather than their own wrapper function, removing a bunch of duplicated code. 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>
Diffstat (limited to 'drivers/md/dm-raid1.c')
-rw-r--r--drivers/md/dm-raid1.c14
1 files changed, 2 insertions, 12 deletions
diff --git a/drivers/md/dm-raid1.c b/drivers/md/dm-raid1.c
index 6cfa8d435d55..4e90f231fbfb 100644
--- a/drivers/md/dm-raid1.c
+++ b/drivers/md/dm-raid1.c
@@ -122,16 +122,6 @@ static inline sector_t region_to_sector(struct region_hash *rh, region_t region)
122/* FIXME move this */ 122/* FIXME move this */
123static void queue_bio(struct mirror_set *ms, struct bio *bio, int rw); 123static void queue_bio(struct mirror_set *ms, struct bio *bio, int rw);
124 124
125static void *region_alloc(gfp_t gfp_mask, void *pool_data)
126{
127 return kmalloc(sizeof(struct region), gfp_mask);
128}
129
130static void region_free(void *element, void *pool_data)
131{
132 kfree(element);
133}
134
135#define MIN_REGIONS 64 125#define MIN_REGIONS 64
136#define MAX_RECOVERY 1 126#define MAX_RECOVERY 1
137static int rh_init(struct region_hash *rh, struct mirror_set *ms, 127static int rh_init(struct region_hash *rh, struct mirror_set *ms,
@@ -173,8 +163,8 @@ static int rh_init(struct region_hash *rh, struct mirror_set *ms,
173 INIT_LIST_HEAD(&rh->quiesced_regions); 163 INIT_LIST_HEAD(&rh->quiesced_regions);
174 INIT_LIST_HEAD(&rh->recovered_regions); 164 INIT_LIST_HEAD(&rh->recovered_regions);
175 165
176 rh->region_pool = mempool_create(MIN_REGIONS, region_alloc, 166 rh->region_pool = mempool_create_kmalloc_pool(MIN_REGIONS,
177 region_free, NULL); 167 sizeof(struct region));
178 if (!rh->region_pool) { 168 if (!rh->region_pool) {
179 vfree(rh->buckets); 169 vfree(rh->buckets);
180 rh->buckets = NULL; 170 rh->buckets = NULL;