summaryrefslogtreecommitdiff
path: root/drivers/md
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.de>2012-05-22 13:55:12 +1000
committerNeilBrown <neilb@suse.de>2012-05-22 13:55:12 +1000
commitbc9891a8853842a19c33dda0ba02fbacf7da067f (patch)
tree6561027b0a61521b24786266855cba0e4dc730a1 /drivers/md
parentd1244cb062750bdb2298ca2565239d3d8cbd91a8 (diff)
md/bitmap: move storage allocation from bitmap_load to bitmap_create.
We should allocate memory for the storage-bitmap at create-time, not load time. Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'drivers/md')
-rw-r--r--drivers/md/bitmap.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/drivers/md/bitmap.c b/drivers/md/bitmap.c
index 4ac60ed66c49..1a93ed1fb8df 100644
--- a/drivers/md/bitmap.c
+++ b/drivers/md/bitmap.c
@@ -1032,11 +1032,6 @@ static int bitmap_init_from_disk(struct bitmap *bitmap, sector_t start)
goto err;
}
- ret = bitmap_storage_alloc(&bitmap->storage, bitmap->chunks,
- !bitmap->mddev->bitmap_info.external);
- if (ret)
- goto err;
-
oldindex = ~0L;
offset = 0;
if (!bitmap->mddev->bitmap_info.external)
@@ -1782,6 +1777,12 @@ int bitmap_create(struct mddev *mddev)
if (!bitmap->bp)
goto error;
+ if (file || mddev->bitmap_info.offset) {
+ err = bitmap_storage_alloc(&bitmap->storage, bitmap->chunks,
+ !mddev->bitmap_info.external);
+ if (err)
+ goto error;
+ }
printk(KERN_INFO "created bitmap (%lu pages) for device %s\n",
pages, bmname(bitmap));