summaryrefslogtreecommitdiffstats
path: root/Assemble.c
diff options
context:
space:
mode:
authorNeil Brown <neilb@suse.de>2003-10-29 00:20:01 +0100
committerNeil Brown <neilb@suse.de>2003-10-29 00:20:01 +0100
commitfeb716e9c3568a45b8815bf2c59e417d30635f89 (patch)
tree0f8e3d3ad2ba688cf70c7655e86566a5fa27e753 /Assemble.c
parentmdadm-1.3.0 (diff)
downloadmdadm-feb716e9c3568a45b8815bf2c59e417d30635f89.tar.xz
mdadm-feb716e9c3568a45b8815bf2c59e417d30635f89.zip
mdadm-1.4.0mdadm-1.4.0
Diffstat (limited to 'Assemble.c')
-rw-r--r--Assemble.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/Assemble.c b/Assemble.c
index cddb76fa..794b00d4 100644
--- a/Assemble.c
+++ b/Assemble.c
@@ -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)