diff options
author | NeilBrown <neilb@suse.de> | 2010-11-22 10:58:07 +0100 |
---|---|---|
committer | NeilBrown <neilb@suse.de> | 2010-11-22 10:58:07 +0100 |
commit | ca750d9830cca2454cd6c8d1679dfb9b62f57281 (patch) | |
tree | 0ad412141626375dbcc4f5462039fd8ffe998f92 /Monitor.c | |
parent | Monitor: include containers in scan mode (diff) | |
download | mdadm-ca750d9830cca2454cd6c8d1679dfb9b62f57281.tar.xz mdadm-ca750d9830cca2454cd6c8d1679dfb9b62f57281.zip |
Monitor: track metadata type or parent/container of arrays.
For subarrays, record the devid of the parent.
For others arrays, record the metadata type.
This will be used in a subsequent patch to link related arrays
together and allow spare migration between containers.
Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to '')
-rw-r--r-- | Monitor.c | 26 |
1 files changed, 26 insertions, 0 deletions
@@ -97,6 +97,10 @@ int Monitor(struct mddev_dev *devlist, int devstate[MaxDisks]; unsigned devid[MaxDisks]; int percent; + int parent_dev; /* For subarray, devnum of parent. + * For others, NoMdDev + */ + struct supertype *metadata; struct state *next; } *statelist = NULL; int finished = 0; @@ -391,6 +395,17 @@ int Monitor(struct mddev_dev *devlist, } else info[i].major = info[i].minor = 0; } + + if (strncmp(mse->metadata_version, "external:", 9) == 0 && + is_subarray(mse->metadata_version+9)) + st->parent_dev = + devname2devnum(mse->metadata_version+10); + else + st->parent_dev = NoMdDev; + if (st->metadata == NULL && + st->parent_dev == NoMdDev) + st->metadata = super_by_fd(fd, NULL); + close(fd); for (i=0; i<MaxDisks; i++) { @@ -472,6 +487,10 @@ int Monitor(struct mddev_dev *devlist, if (fd >=0) close(fd); put_md_name(st->devname); free(st->devname); + if (st->metadata) { + st->metadata->ss->free_super(st->metadata); + free(st->metadata); + } free(st); continue; } @@ -483,6 +502,13 @@ int Monitor(struct mddev_dev *devlist, st->percent = -2; st->spare_group = NULL; st->expected_spares = -1; + if (strncmp(mse->metadata_version, "external:", 9) == 0 && + is_subarray(mse->metadata_version+9)) + st->parent_dev = + devname2devnum(mse->metadata_version+10); + else + st->parent_dev = NoMdDev; + st->metadata = NULL; statelist = st; if (test) alert("TestMessage", st->devname, NULL, mailaddr, mailfrom, alert_cmd, dosyslog); |