From f9c25f1d2af73f9494589afab42e07aa9ca2f740 Mon Sep 17 00:00:00 2001 From: Neil Brown Date: Tue, 22 Nov 2005 03:37:14 +0000 Subject: Support bitmaps with raid10 And a couple of other little things Signed-off-by: Neil Brown --- Create.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'Create.c') diff --git a/Create.c b/Create.c index 148ab0e..0fd38a5 100644 --- a/Create.c +++ b/Create.c @@ -69,6 +69,7 @@ int Create(struct supertype *st, char *mddev, int mdfd, int vers; int rv; int bitmap_fd; + unsigned long long bitmapsize; mdu_array_info_t array; int major = BITMAP_MAJOR_HI; @@ -322,6 +323,17 @@ int Create(struct supertype *st, char *mddev, int mdfd, else array.state = 0; /* not clean, but no errors */ + if (level == 10) { + /* for raid10, the bitmap size is the capacity of the array, + * which is array.size * raid_disks / ncopies; + * .. but convert to sectors. + */ + int ncopies = (layout>>8) * (layout & 255); + bitmapsize = (unsigned long long)array.size * raiddisks / ncopies * 2; + printf("bms=%llu as=%d rd=%d nc=%d\n", bitmapsize, array.size, raiddisks, ncopies); + } else + bitmapsize = (unsigned long long)array.size * 2; + /* There is lots of redundancy in these disk counts, * raid_disks is the most meaningful value * it describes the geometry of the array @@ -365,7 +377,7 @@ int Create(struct supertype *st, char *mddev, int mdfd, return 1; } if (!st->ss->add_internal_bitmap(st, super, bitmap_chunk, delay, write_behind, - &array.size, 1, major)) { + bitmapsize, 1, major)) { fprintf(stderr, Name ": Given bitmap chunk size not supported.\n"); return 1; } @@ -397,7 +409,7 @@ int Create(struct supertype *st, char *mddev, int mdfd, st->ss->uuid_from_super(uuid, super); if (CreateBitmap(bitmap_file, force, (char*)uuid, bitmap_chunk, delay, write_behind, - array.size*2ULL /* FIXME wrong for raid10 */, + bitmapsize, major)) { return 1; } -- cgit