diff options
author | NeilBrown <neilb@suse.de> | 2012-05-21 23:55:12 -0400 |
---|---|---|
committer | NeilBrown <neilb@suse.de> | 2012-05-21 23:55:12 -0400 |
commit | bc9891a8853842a19c33dda0ba02fbacf7da067f (patch) | |
tree | 6561027b0a61521b24786266855cba0e4dc730a1 /drivers/md/bitmap.c | |
parent | d1244cb062750bdb2298ca2565239d3d8cbd91a8 (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/bitmap.c')
-rw-r--r-- | drivers/md/bitmap.c | 11 |
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) | |||
1032 | goto err; | 1032 | goto err; |
1033 | } | 1033 | } |
1034 | 1034 | ||
1035 | ret = bitmap_storage_alloc(&bitmap->storage, bitmap->chunks, | ||
1036 | !bitmap->mddev->bitmap_info.external); | ||
1037 | if (ret) | ||
1038 | goto err; | ||
1039 | |||
1040 | oldindex = ~0L; | 1035 | oldindex = ~0L; |
1041 | offset = 0; | 1036 | offset = 0; |
1042 | if (!bitmap->mddev->bitmap_info.external) | 1037 | if (!bitmap->mddev->bitmap_info.external) |
@@ -1782,6 +1777,12 @@ int bitmap_create(struct mddev *mddev) | |||
1782 | if (!bitmap->bp) | 1777 | if (!bitmap->bp) |
1783 | goto error; | 1778 | goto error; |
1784 | 1779 | ||
1780 | if (file || mddev->bitmap_info.offset) { | ||
1781 | err = bitmap_storage_alloc(&bitmap->storage, bitmap->chunks, | ||
1782 | !mddev->bitmap_info.external); | ||
1783 | if (err) | ||
1784 | goto error; | ||
1785 | } | ||
1785 | printk(KERN_INFO "created bitmap (%lu pages) for device %s\n", | 1786 | printk(KERN_INFO "created bitmap (%lu pages) for device %s\n", |
1786 | pages, bmname(bitmap)); | 1787 | pages, bmname(bitmap)); |
1787 | 1788 | ||