Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 140152
b: refs/heads/master
c: 95f8fac
h: refs/heads/master
v: v3
  • Loading branch information
Mikulas Patocka authored and Alasdair G Kergon committed Apr 2, 2009
1 parent 5548fac commit 98ef6ba
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 5 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: a920f6b3accc77d9dddbc98a7426be23ee479625
refs/heads/master: 95f8fac8dc6139fedfb87746e0c8fda9b803cb46
25 changes: 21 additions & 4 deletions trunk/drivers/md/dm-raid1.c
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,8 @@ struct dm_raid1_read_record {
struct dm_bio_details details;
};

static struct kmem_cache *_dm_raid1_read_record_cache;

/*
* Every mirror should look like this one.
*/
Expand Down Expand Up @@ -764,9 +766,9 @@ static struct mirror_set *alloc_context(unsigned int nr_mirrors,
atomic_set(&ms->suspend, 0);
atomic_set(&ms->default_mirror, DEFAULT_MIRROR);

len = sizeof(struct dm_raid1_read_record);
ms->read_record_pool = mempool_create_kmalloc_pool(MIN_READ_RECORDS,
len);
ms->read_record_pool = mempool_create_slab_pool(MIN_READ_RECORDS,
_dm_raid1_read_record_cache);

if (!ms->read_record_pool) {
ti->error = "Error creating mirror read_record_pool";
kfree(ms);
Expand Down Expand Up @@ -1279,16 +1281,31 @@ static int __init dm_mirror_init(void)
{
int r;

_dm_raid1_read_record_cache = KMEM_CACHE(dm_raid1_read_record, 0);
if (!_dm_raid1_read_record_cache) {
DMERR("Can't allocate dm_raid1_read_record cache");
r = -ENOMEM;
goto bad_cache;
}

r = dm_register_target(&mirror_target);
if (r < 0)
if (r < 0) {
DMERR("Failed to register mirror target");
goto bad_target;
}

return 0;

bad_target:
kmem_cache_destroy(_dm_raid1_read_record_cache);
bad_cache:
return r;
}

static void __exit dm_mirror_exit(void)
{
dm_unregister_target(&mirror_target);
kmem_cache_destroy(_dm_raid1_read_record_cache);
}

/* Module hooks */
Expand Down

0 comments on commit 98ef6ba

Please sign in to comment.