diff options
author | Joe Perches <joe@perches.com> | 2011-08-02 07:32:02 -0400 |
---|---|---|
committer | Alasdair G Kergon <agk@redhat.com> | 2011-08-02 07:32:02 -0400 |
commit | e29e65aacbd9e628378084905cbcf62a9fa4a8cc (patch) | |
tree | 279e6e87d60da82c082833205c996d7046b1a46d /drivers | |
parent | 6c9b27ab08aaf46426515b8b858ad9c60731c7a1 (diff) |
dm: use vzalloc
Use vzalloc() instead of vmalloc()+memset().
Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Alasdair G Kergon <agk@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/md/dm-log.c | 3 | ||||
-rw-r--r-- | drivers/md/dm-snap-persistent.c | 3 | ||||
-rw-r--r-- | drivers/md/dm-table.c | 4 |
3 files changed, 3 insertions, 7 deletions
diff --git a/drivers/md/dm-log.c b/drivers/md/dm-log.c index 306ce123d6b4..3b52bb72bd1f 100644 --- a/drivers/md/dm-log.c +++ b/drivers/md/dm-log.c | |||
@@ -492,7 +492,7 @@ static int create_log_context(struct dm_dirty_log *log, struct dm_target *ti, | |||
492 | memset(lc->sync_bits, (sync == NOSYNC) ? -1 : 0, bitset_size); | 492 | memset(lc->sync_bits, (sync == NOSYNC) ? -1 : 0, bitset_size); |
493 | lc->sync_count = (sync == NOSYNC) ? region_count : 0; | 493 | lc->sync_count = (sync == NOSYNC) ? region_count : 0; |
494 | 494 | ||
495 | lc->recovering_bits = vmalloc(bitset_size); | 495 | lc->recovering_bits = vzalloc(bitset_size); |
496 | if (!lc->recovering_bits) { | 496 | if (!lc->recovering_bits) { |
497 | DMWARN("couldn't allocate sync bitset"); | 497 | DMWARN("couldn't allocate sync bitset"); |
498 | vfree(lc->sync_bits); | 498 | vfree(lc->sync_bits); |
@@ -504,7 +504,6 @@ static int create_log_context(struct dm_dirty_log *log, struct dm_target *ti, | |||
504 | kfree(lc); | 504 | kfree(lc); |
505 | return -ENOMEM; | 505 | return -ENOMEM; |
506 | } | 506 | } |
507 | memset(lc->recovering_bits, 0, bitset_size); | ||
508 | lc->sync_search = 0; | 507 | lc->sync_search = 0; |
509 | log->context = lc; | 508 | log->context = lc; |
510 | 509 | ||
diff --git a/drivers/md/dm-snap-persistent.c b/drivers/md/dm-snap-persistent.c index 39becbec4dfe..1a0acb8abdf6 100644 --- a/drivers/md/dm-snap-persistent.c +++ b/drivers/md/dm-snap-persistent.c | |||
@@ -174,10 +174,9 @@ static int alloc_area(struct pstore *ps) | |||
174 | if (!ps->area) | 174 | if (!ps->area) |
175 | goto err_area; | 175 | goto err_area; |
176 | 176 | ||
177 | ps->zero_area = vmalloc(len); | 177 | ps->zero_area = vzalloc(len); |
178 | if (!ps->zero_area) | 178 | if (!ps->zero_area) |
179 | goto err_zero_area; | 179 | goto err_zero_area; |
180 | memset(ps->zero_area, 0, len); | ||
181 | 180 | ||
182 | ps->header_area = vmalloc(len); | 181 | ps->header_area = vmalloc(len); |
183 | if (!ps->header_area) | 182 | if (!ps->header_area) |
diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c index 3909fa259f55..8dc67555e736 100644 --- a/drivers/md/dm-table.c +++ b/drivers/md/dm-table.c | |||
@@ -153,9 +153,7 @@ void *dm_vcalloc(unsigned long nmemb, unsigned long elem_size) | |||
153 | return NULL; | 153 | return NULL; |
154 | 154 | ||
155 | size = nmemb * elem_size; | 155 | size = nmemb * elem_size; |
156 | addr = vmalloc(size); | 156 | addr = vzalloc(size); |
157 | if (addr) | ||
158 | memset(addr, 0, size); | ||
159 | 157 | ||
160 | return addr; | 158 | return addr; |
161 | } | 159 | } |