-static int init_super0(struct supertype *st, void **sbp, mdu_array_info_t *info, char *ignored_name)
+static int init_super0(struct supertype *st, void **sbp, mdu_array_info_t *info, unsigned long long size, char *ignored_name)
{
mdp_super_t *sb = malloc(MD_SB_BYTES + sizeof(bitmap_super_t));
int spares;
sb->set_uuid0 = random();
sb->ctime = time(0);
sb->level = info->level;
+ if (size != info->size)
+ return 0;
sb->size = info->size;
sb->nr_disks = info->nr_disks;
sb->raid_disks = info->raid_disks;
dsize = ((unsigned long long)size)<<9;
}
- if (dsize < MD_RESERVED_SECTORS*2)
+ if (dsize < MD_RESERVED_SECTORS*2*512)
return 2;
offset = MD_NEW_SIZE_SECTORS(dsize>>9);