]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
md/bitmap: move storage allocation from bitmap_load to bitmap_create.
authorNeilBrown <neilb@suse.de>
Tue, 24 Apr 2012 00:57:55 +0000 (10:57 +1000)
committerNeilBrown <neilb@suse.de>
Tue, 24 Apr 2012 00:57:55 +0000 (10:57 +1000)
We should allocate memory for the storage-bitmap at create-time, not
load time.

Signed-off-by: NeilBrown <neilb@suse.de>
drivers/md/bitmap.c

index e9d2a4d48eefe8fd1ddb47bd4a0227ed3282ab36..6e11d6e9336d857e6879e872f6e15529e0cf90aa 100644 (file)
@@ -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)
@@ -1783,6 +1778,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));