diff options
author | Neil Brown <neilb@suse.de> | 2003-10-29 00:20:01 +0100 |
---|---|---|
committer | Neil Brown <neilb@suse.de> | 2003-10-29 00:20:01 +0100 |
commit | feb716e9c3568a45b8815bf2c59e417d30635f89 (patch) | |
tree | 0f8e3d3ad2ba688cf70c7655e86566a5fa27e753 /Assemble.c | |
parent | mdadm-1.3.0 (diff) | |
download | mdadm-feb716e9c3568a45b8815bf2c59e417d30635f89.tar.xz mdadm-feb716e9c3568a45b8815bf2c59e417d30635f89.zip |
mdadm-1.4.0mdadm-1.4.0
Diffstat (limited to 'Assemble.c')
-rw-r--r-- | Assemble.c | 27 |
1 files changed, 27 insertions, 0 deletions
@@ -292,6 +292,33 @@ int Assemble(char *mddev, int mdfd, fprintf(stderr, Name ": updating superblock of %s with minor number %d\n", devname, super.md_minor); } + if (strcmp(update, "summaries") == 0) { + /* set nr_disks, active_disks, working_disks, + * failed_disks, spare_disks based on disks[] + * array in superblock. + * Also make sure extra slots aren't 'failed' + */ + super.nr_disks = super.active_disks = + super.working_disks = super.failed_disks = + super.spare_disks = 0; + for (i=0; i < MD_SB_DISKS ; i++) + if (super.disks[i].major || + super.disks[i].minor) { + int state = super.disks[i].state; + if (state & (1<<MD_DISK_REMOVED)) + continue; + super.nr_disks++; + if (state & (1<<MD_DISK_ACTIVE)) + super.active_disks++; + if (state & (1<<MD_DISK_FAULTY)) + super.failed_disks++; + else + super.working_disks++; + if (state == 0) + super.spare_disks++; + } else if (i >= super.raid_disks && super.disks[i].number == 0) + super.disks[i].state = 0; + } super.sb_csum = calc_sb_csum(&super); dfd = open(devname, O_RDWR, 0); if (dfd < 0) |