X-Git-Url: http://git.ipfire.org/?p=thirdparty%2Fmdadm.git;a=blobdiff_plain;f=super-intel.c;h=24827d0b20261f865167e7dd62b5d457aea48564;hp=d7383fbdfe1ce55c5e86780ede47a61de3f84fe2;hb=af99d9ca67a4dc898e7be1d4a947800deec93c83;hpb=3b435195fc34ba447c8ca8fa2f90cd6d5ad88cdb diff --git a/super-intel.c b/super-intel.c index d7383fbd..24827d0b 100644 --- a/super-intel.c +++ b/super-intel.c @@ -768,17 +768,16 @@ static void brief_examine_super_imsm(struct supertype *st, int verbose) getinfo_super_imsm(st, &info); fname_from_uuid(st, &info, nbuf, ':'); - printf("ARRAY metadata=imsm auto=md UUID=%s\n", nbuf + 5); for (i = 0; i < super->anchor->num_raid_devs; i++) { struct imsm_dev *dev = get_imsm_dev(super, i); super->current_vol = i; getinfo_super_imsm(st, &info); fname_from_uuid(st, &info, nbuf1, ':'); - printf("ARRAY /dev/md/%.16s container=%s\n" - " member=%d auto=mdp UUID=%s\n", + printf("ARRAY /dev/md/%.16s container=%s member=%d UUID=%s\n", dev->volume, nbuf + 5, i, nbuf1 + 5); } + printf("ARRAY metadata=imsm UUID=%s\n", nbuf + 5); } static void export_examine_super_imsm(struct supertype *st) @@ -2168,8 +2167,10 @@ static int load_super_imsm_all(struct supertype *st, int fd, void **sbp, if (st->subarray[0]) { if (atoi(st->subarray) <= super->anchor->num_raid_devs) super->current_vol = atoi(st->subarray); - else + else { + free_imsm(super); return 1; + } } *sbp = super; @@ -2194,8 +2195,6 @@ static int load_super_imsm(struct supertype *st, int fd, char *devname) if (load_super_imsm_all(st, fd, &st->sb, devname, 1) == 0) return 0; #endif - if (st->subarray[0]) - return 1; /* FIXME */ super = alloc_super(0); if (!super) { @@ -2216,6 +2215,15 @@ static int load_super_imsm(struct supertype *st, int fd, char *devname) return rv; } + if (st->subarray[0]) { + if (atoi(st->subarray) <= super->anchor->num_raid_devs) + super->current_vol = atoi(st->subarray); + else { + free_imsm(super); + return 1; + } + } + st->sb = super; if (st->ss == NULL) { st->ss = &super_imsm; @@ -2405,13 +2413,16 @@ static int init_super_imsm_volume(struct supertype *st, mdu_array_info_t *info, "in a raid1 volume\n"); return 0; } + + map->raid_level = info->level; if (info->level == 10) { map->raid_level = 1; map->num_domains = info->raid_disks / 2; - } else { - map->raid_level = info->level; + } else if (info->level == 1) + map->num_domains = info->raid_disks; + else map->num_domains = 1; - } + num_data_stripes = info_to_num_data_stripes(info, map->num_domains); map->num_data_stripes = __cpu_to_le32(num_data_stripes); @@ -3627,7 +3638,7 @@ static int mark_failure(struct imsm_dev *dev, struct imsm_disk *disk, int idx) disk->status |= FAILED_DISK; set_imsm_ord_tbl_ent(map, slot, idx | IMSM_ORD_REBUILD); - if (map->failed_disk_num == ~0) + if (~map->failed_disk_num == 0) map->failed_disk_num = slot; return 1; }