printf(" Creation Time : %.24s\n", ctime(&atime));
c=map_num(pers, sb->level);
printf(" Raid Level : %s\n", c?c:"-unknown-");
- if ((int)sb->level >= 0) {
+ if ((int)sb->level > 0) {
int ddsks=0;
printf(" Used Dev Size : %d%s\n", sb->size,
human_size((long long)sb->size<<10));
/* work_disks is calculated rather than read directly */
for (i=0; i < MD_SB_DISKS; i++)
if ((sb->disks[i].state & (1<<MD_DISK_SYNC)) &&
- (sb->disks[i].raid_disk < info->array.raid_disks) &&
+ (sb->disks[i].raid_disk < (unsigned)info->array.raid_disks) &&
(sb->disks[i].state & (1<<MD_DISK_ACTIVE)) &&
!(sb->disks[i].state & (1<<MD_DISK_FAULTY)))
working ++;
char *devname, int verbose,
int uuid_set, char *homehost)
{
- /* NOTE: for 'assemble' and 'force' we need to return non-zero if any change was made.
- * For others, the return value is ignored.
+ /* NOTE: for 'assemble' and 'force' we need to return non-zero
+ * if any change was made. For others, the return value is
+ * ignored.
*/
int rv = 0;
mdp_super_t *sb = st->sb;
devname, info->array.md_minor);
}
if (strcmp(update, "summaries") == 0) {
- int i;
+ unsigned int i;
/* set nr_disks, active_disks, working_disks,
* failed_disks, spare_disks based on disks[]
* array in superblock.
*/
add = (1<<MD_DISK_SYNC);
if (((sb->disks[d].state & ~mask) | add)
- != info->disk.state) {
+ != (unsigned)info->disk.state) {
sb->disks[d].state = info->disk.state | wonly;
rv = 1;
}
+ if (info->reshape_active &&
+ sb->minor_version > 90 && (sb->reshape_position+1) != 0 &&
+ info->delta_disks >= 0 &&
+ info->reshape_progress < sb->reshape_position) {
+ sb->reshape_position = info->reshape_progress;
+ rv = 1;
+ }
+ if (info->reshape_active &&
+ sb->minor_version > 90 && (sb->reshape_position+1) != 0 &&
+ info->delta_disks < 0 &&
+ info->reshape_progress > sb->reshape_position) {
+ sb->reshape_position = info->reshape_progress;
+ rv = 1;
+ }
}
if (strcmp(update, "linear-grow-new") == 0) {
memset(&sb->disks[info->disk.number], 0, sizeof(sb->disks[0]));
bm = (struct bitmap_super_s*)(sb+1);
uuid_from_super0(st, (int*)bm->uuid);
}
+ } else if (strcmp(update, "no-bitmap") == 0) {
+ sb->state &= ~(1<<MD_SB_BITMAP_PRESENT);
}
if (strcmp(update, "_reshape_progress")==0)
sb->reshape_position = info->reshape_progress;
sb->gvalid_words = 0; /* ignored */
sb->ctime = time(0);
sb->level = info->level;
- if (size != info->size)
+ if (size != (unsigned long long)info->size)
return 0;
sb->size = info->size;
sb->nr_disks = info->nr_disks;
while (arg[0] == '0' && arg[1] == '0')
arg++;
if (strcmp(arg, "0") == 0 ||
- strcmp(arg, "0.90") == 0
+#ifdef DEFAULT_OLD_METADATA /* ifndef in super1.c */
+ strcmp(arg, "default") == 0 ||
+#endif /* DEFAULT_OLD_METADATA */
+ strcmp(arg, "0.90") == 0 ||
+ strcmp(arg, "") == 0 /* no metadata - i.e. non_persistent */
)
return st;
* size is in sectors, chunk is in bytes !!!
*/
unsigned long long bits;
- unsigned long long max_bits = 60*1024*8;
+ unsigned long long max_bits = (60*1024 - sizeof(bitmap_super_t))*8;
unsigned long long min_chunk;
int chunk = *chunkp;
mdp_super_t *sb = st->sb;
chunk = min_chunk;
if (chunk < 64*1024*1024)
chunk = 64*1024*1024;
- } else if (chunk < min_chunk)
+ } else if ((unsigned long long)chunk < min_chunk)
return 0; /* chunk size too small */
sb->state |= (1<<MD_SB_BITMAP_PRESENT);
memset(buf, 0xff, 4096);
memcpy(buf, ((char*)sb)+MD_SB_BYTES, sizeof(bitmap_super_t));
- towrite = 64*1024;
+ towrite = 60*1024;
while (towrite > 0) {
n = towrite;
if (n > 4096)