aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md/bitmap.c
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.de>2006-01-06 03:20:32 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2006-01-06 11:34:05 -0500
commit9ffae0cf3ea02f75d163922accfd3e592d87adde (patch)
tree4974727e9f36e1b618b68d2789644ee3a0d7a371 /drivers/md/bitmap.c
parent2d1f3b5d1b2cd11a162eb29645df749ec0036413 (diff)
[PATCH] md: convert md to use kzalloc throughout
Replace multiple kmalloc/memset pairs with kzalloc calls. Signed-off-by: Neil Brown <neilb@suse.de> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/md/bitmap.c')
-rw-r--r--drivers/md/bitmap.c11
1 files changed, 3 insertions, 8 deletions
diff --git a/drivers/md/bitmap.c b/drivers/md/bitmap.c
index fc05d1205aa0..c3faa6a43de1 100644
--- a/drivers/md/bitmap.c
+++ b/drivers/md/bitmap.c
@@ -887,12 +887,10 @@ static int bitmap_init_from_disk(struct bitmap *bitmap, sector_t start)
887 if (!bitmap->filemap) 887 if (!bitmap->filemap)
888 goto out; 888 goto out;
889 889
890 bitmap->filemap_attr = kmalloc(sizeof(long) * num_pages, GFP_KERNEL); 890 bitmap->filemap_attr = kzalloc(sizeof(long) * num_pages, GFP_KERNEL);
891 if (!bitmap->filemap_attr) 891 if (!bitmap->filemap_attr)
892 goto out; 892 goto out;
893 893
894 memset(bitmap->filemap_attr, 0, sizeof(long) * num_pages);
895
896 oldindex = ~0L; 894 oldindex = ~0L;
897 895
898 for (i = 0; i < chunks; i++) { 896 for (i = 0; i < chunks; i++) {
@@ -1557,12 +1555,10 @@ int bitmap_create(mddev_t *mddev)
1557 1555
1558 BUG_ON(file && mddev->bitmap_offset); 1556 BUG_ON(file && mddev->bitmap_offset);
1559 1557
1560 bitmap = kmalloc(sizeof(*bitmap), GFP_KERNEL); 1558 bitmap = kzalloc(sizeof(*bitmap), GFP_KERNEL);
1561 if (!bitmap) 1559 if (!bitmap)
1562 return -ENOMEM; 1560 return -ENOMEM;
1563 1561
1564 memset(bitmap, 0, sizeof(*bitmap));
1565
1566 spin_lock_init(&bitmap->lock); 1562 spin_lock_init(&bitmap->lock);
1567 bitmap->mddev = mddev; 1563 bitmap->mddev = mddev;
1568 1564
@@ -1603,12 +1599,11 @@ int bitmap_create(mddev_t *mddev)
1603#ifdef INJECT_FATAL_FAULT_1 1599#ifdef INJECT_FATAL_FAULT_1
1604 bitmap->bp = NULL; 1600 bitmap->bp = NULL;
1605#else 1601#else
1606 bitmap->bp = kmalloc(pages * sizeof(*bitmap->bp), GFP_KERNEL); 1602 bitmap->bp = kzalloc(pages * sizeof(*bitmap->bp), GFP_KERNEL);
1607#endif 1603#endif
1608 err = -ENOMEM; 1604 err = -ENOMEM;
1609 if (!bitmap->bp) 1605 if (!bitmap->bp)
1610 goto error; 1606 goto error;
1611 memset(bitmap->bp, 0, pages * sizeof(*bitmap->bp));
1612 1607
1613 bitmap->flags |= BITMAP_ACTIVE; 1608 bitmap->flags |= BITMAP_ACTIVE;
1614 1609