X-Git-Url: http://git.ipfire.org/?a=blobdiff_plain;ds=sidebyside;f=super0.c;h=9f78b9452dec9e04792760500310769a0b277258;hb=672ca1b7272c69ea3055aeb746a77b8408e5f3ed;hp=3f02ed403435bcaf4c5196e931539627c7ba8495;hpb=8320878543bb5e49b5acb24fa919ff11be485c61;p=thirdparty%2Fmdadm.git diff --git a/super0.c b/super0.c index 3f02ed40..9f78b945 100644 --- a/super0.c +++ b/super0.c @@ -1,7 +1,7 @@ /* * mdadm - manage Linux "md" devices aka RAID arrays. * - * Copyright (C) 2001-2006 Neil Brown + * Copyright (C) 2001-2009 Neil Brown * * * This program is free software; you can redistribute it and/or modify @@ -19,12 +19,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * Author: Neil Brown - * Email: - * Paper: Neil Brown - * School of Computer Science and Engineering - * The University of New South Wales - * Sydney, 2052 - * Australia + * Email: */ #define HAVE_STDINT_H 1 @@ -90,6 +85,7 @@ static void examine_super0(struct supertype *st, char *homehost) mdp_super_t *sb = st->sb; time_t atime; int d; + int delta_extra = 0; char *c; printf(" Magic : %08x\n", sb->md_magic); @@ -140,10 +136,9 @@ static void examine_super0(struct supertype *st, char *homehost) printf(" Reshape pos'n : %llu%s\n", (unsigned long long)sb->reshape_position/2, human_size((long long)sb->reshape_position<<9)); if (sb->delta_disks) { printf(" Delta Devices : %d", sb->delta_disks); - if (sb->delta_disks) - printf(" (%d->%d)\n", sb->raid_disks-sb->delta_disks, sb->raid_disks); - else - printf(" (%d->%d)\n", sb->raid_disks, sb->raid_disks+sb->delta_disks); + printf(" (%d->%d)\n", sb->raid_disks-sb->delta_disks, sb->raid_disks); + if (((int)sb->delta_disks) < 0) + delta_extra = - sb->delta_disks; } if (sb->new_level != sb->level) { c = map_num(pers, sb->new_level); @@ -154,6 +149,10 @@ static void examine_super0(struct supertype *st, char *homehost) c = map_num(r5layout, sb->new_layout); printf(" New Layout : %s\n", c?c:"-unknown-"); } + if (sb->level == 6) { + c = map_num(r6layout, sb->new_layout); + printf(" New Layout : %s\n", c?c:"-unknown-"); + } if (sb->level == 10) { printf(" New Layout : near=%d, %s=%d\n", sb->new_layout&255, @@ -187,6 +186,10 @@ static void examine_super0(struct supertype *st, char *homehost) c = map_num(r5layout, sb->layout); printf(" Layout : %s\n", c?c:"-unknown-"); } + if (sb->level == 6) { + c = map_num(r6layout, sb->layout); + printf(" Layout : %s\n", c?c:"-unknown-"); + } if (sb->level == 10) { printf(" Layout :"); print_r10_layout(sb->layout); @@ -207,7 +210,7 @@ static void examine_super0(struct supertype *st, char *homehost) } printf("\n"); printf(" Number Major Minor RaidDevice State\n"); - for (d= -1; d<(signed int)(sb->raid_disks+sb->spare_disks); d++) { + for (d= -1; d<(signed int)(sb->raid_disks+delta_extra + sb->spare_disks); d++) { mdp_disk_t *dp; char *dv; char nb[5]; @@ -310,9 +313,13 @@ static int match_home0(struct supertype *st, char *homehost) { mdp_super_t *sb = st->sb; char buf[20]; - char *hash = sha1_buffer(homehost, - strlen(homehost), - buf); + char *hash; + + if (!homehost) + return 0; + hash = sha1_buffer(homehost, + strlen(homehost), + buf); return (memcmp(&sb->set_uuid2, hash, 8)==0); } @@ -372,6 +379,8 @@ static void getinfo_super0(struct supertype *st, struct mdinfo *info) info->delta_disks = sb->delta_disks; info->new_layout = sb->new_layout; info->new_chunk = sb->new_chunk; + if (info->delta_disks < 0) + info->array.raid_disks -= info->delta_disks; } else info->reshape_active = 0; @@ -469,7 +478,14 @@ static int update_super0(struct supertype *st, struct mdinfo *info, if (strcmp(update, "assemble")==0) { int d = info->disk.number; int wonly = sb->disks[d].state & (1<disks[d].state & ~(1<minor_version >= 91) + /* During reshape we don't insist on everything + * being marked 'sync' + */ + add = (1<disks[d].state & ~mask) | add) != info->disk.state) { sb->disks[d].state = info->disk.state | wonly; rv = 1;