Commit bc9891a8 authored by NeilBrown's avatar NeilBrown

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: default avatarNeilBrown <neilb@suse.de>
parent d1244cb0
...@@ -1032,11 +1032,6 @@ static int bitmap_init_from_disk(struct bitmap *bitmap, sector_t start) ...@@ -1032,11 +1032,6 @@ static int bitmap_init_from_disk(struct bitmap *bitmap, sector_t start)
goto err; goto err;
} }
ret = bitmap_storage_alloc(&bitmap->storage, bitmap->chunks,
!bitmap->mddev->bitmap_info.external);
if (ret)
goto err;
oldindex = ~0L; oldindex = ~0L;
offset = 0; offset = 0;
if (!bitmap->mddev->bitmap_info.external) if (!bitmap->mddev->bitmap_info.external)
...@@ -1782,6 +1777,12 @@ int bitmap_create(struct mddev *mddev) ...@@ -1782,6 +1777,12 @@ int bitmap_create(struct mddev *mddev)
if (!bitmap->bp) if (!bitmap->bp)
goto error; 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", printk(KERN_INFO "created bitmap (%lu pages) for device %s\n",
pages, bmname(bitmap)); pages, bmname(bitmap));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment