[md PATCH 09/24] md/bitmap: move storage allocation from bitmap_load to bitmap_create.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



We should allocate memory for the storage-bitmap at create-time, not
load time.

Signed-off-by: NeilBrown <neilb@xxxxxxx>
---

 drivers/md/bitmap.c |   11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/drivers/md/bitmap.c b/drivers/md/bitmap.c
index 0819ec2..79dafff 100644
--- a/drivers/md/bitmap.c
+++ b/drivers/md/bitmap.c
@@ -1030,11 +1030,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)
@@ -1781,6 +1776,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));
 


--
To unsubscribe from this list: send the line "unsubscribe linux-raid" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux RAID Wiki]     [ATA RAID]     [Linux SCSI Target Infrastructure]     [Linux Block]     [Linux IDE]     [Linux SCSI]     [Linux Hams]     [Device Mapper]     [Device Mapper Cryptographics]     [Kernel]     [Linux Admin]     [Linux Net]     [GFS]     [RPM]     [git]     [Yosemite Forum]


  Powered by Linux