c=map_num(pers, sb->level);
printf(" Raid Level : %s\n", c?c:"-unknown-");
if ((int)sb->level > 0) {
- int ddsks=0;
+ int ddsks = 0, ddsks_denom = 1;
printf(" Used Dev Size : %d%s\n", sb->size,
human_size((long long)sb->size<<10));
switch(sb->level) {
case 4:
case 5: ddsks = sb->raid_disks-1; break;
case 6: ddsks = sb->raid_disks-2; break;
- case 10: ddsks = sb->raid_disks / (sb->layout&255) / ((sb->layout>>8)&255);
+ case 10: ddsks = sb->raid_disks;
+ ddsks_denom = (sb->layout&255) * ((sb->layout>>8)&255);
+ }
+ if (ddsks) {
+ long long asize = sb->size;
+ asize = (asize << 10) * ddsks / ddsks_denom;
+ printf(" Array Size : %llu%s\n",
+ asize >> 10, human_size(asize));
}
- if (ddsks)
- printf(" Array Size : %llu%s\n", (unsigned long long)ddsks * sb->size,
- human_size(ddsks*(long long)sb->size<<10));
}
printf(" Raid Devices : %d\n", sb->raid_disks);
printf(" Total Devices : %d\n", sb->nr_disks);
info->array.state = sb->state;
info->component_size = sb->size*2;
+ if (sb->state & (1<<MD_SB_BITMAP_PRESENT))
+ info->bitmap_offset = 8;
+
info->disk.state = sb->this_disk.state;
info->disk.major = sb->this_disk.major;
info->disk.minor = sb->this_disk.minor;
} else
info->reshape_active = 0;
+ info->recovery_blocked = info->reshape_active;
+
sprintf(info->name, "%d", sb->md_minor);
/* work_disks is calculated rather than read directly */
for (i=0; i < MD_SB_DISKS; i++)
sb->state &= ~(1<<MD_SB_BITMAP_PRESENT);
} else if (strcmp(update, "_reshape_progress")==0)
sb->reshape_position = info->reshape_progress;
+ else if (strcmp(update, "writemostly")==0)
+ sb->state |= (1<<MD_DISK_WRITEMOSTLY);
+ else if (strcmp(update, "readwrite")==0)
+ sb->state &= ~(1<<MD_DISK_WRITEMOSTLY);
else
rv = -1;
dk->minor = dinfo->minor;
dk->raid_disk = dinfo->raid_disk;
dk->state = dinfo->state;
+ /* In case our source disk was writemostly, don't copy that bit */
+ dk->state &= ~(1<<MD_DISK_WRITEMOSTLY);
sb->this_disk = sb->disks[dinfo->number];
sb->sb_csum = calc_sb0_csum(sb);
static struct supertype *match_metadata_desc0(char *arg)
{
- struct supertype *st = malloc(sizeof(*st));
- if (!st) return st;
+ struct supertype *st = calloc(1, sizeof(*st));
+ if (!st)
+ return st;
- memset(st, 0, sizeof(*st));
st->container_dev = NoMdDev;
st->ss = &super0;
st->info = NULL;
int rv = 0;
int towrite, n;
- char abuf[4096+4096];
- char *buf = (char*)(((long)(abuf+4096))&~4095L);
+ void *buf;
if (!get_dev_size(fd, NULL, &dsize))
return 1;
-
if (dsize < MD_RESERVED_SECTORS*512)
return -1;
if (lseek64(fd, offset + 4096, 0)< 0LL)
return 3;
+ if (posix_memalign(&buf, 4096, 4096))
+ return -ENOMEM;
+
memset(buf, 0xff, 4096);
memcpy(buf, ((char*)sb)+MD_SB_BYTES, sizeof(bitmap_super_t));
towrite = 60*1024;
if (towrite)
rv = -2;
+ free(buf);
return rv;
}
MD_SB_DISKS);
return 0;
}
- if (size >= tbmax * 1024*1024*1024*2ULL) {
+ if (size >= tbmax * 2ULL*1024*1024*1024) {
if (verbose)
fprintf(stderr, Name ": 0.90 metadata supports at most "
"%d terabytes per device\n", tbmax);