NeilBrown: Detail: list containers before members.

Martin F. Krafft madduck at alioth.debian.org
Tue Oct 27 19:21:38 UTC 2009


Module: mdadm
Branch: master
Commit: 8f1b2bbbb9cab959ecab0c474dc81afdc7b6dffd
URL:    http://git.debian.org/?p=pkg-mdadm/mdadm.git;a=commit;h=8f1b2bbbb9cab959ecab0c474dc81afdc7b6dffd

Author: NeilBrown <neilb at suse.de>
Date:   Mon Oct 19 17:00:52 2009 +1100

Detail: list containers before members.

To allow "--assemble --scan" to have a chance, list
containers before members in --detail --scan output.

Signed-off-by: NeilBrown <neilb at suse.de>

---

 mdadm.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/mdadm.c b/mdadm.c
index df48117..4651e73 100644
--- a/mdadm.c
+++ b/mdadm.c
@@ -1263,11 +1263,18 @@ int main(int argc, char *argv[])
 					struct mdstat_ent *ms = mdstat_read(0, 1);
 					struct mdstat_ent *e;
 					struct map_ent *map = NULL;
+					int members;
 					int v = verbose>1?0:verbose+1;
 
+					for (members = 0; members <= 1; members++) {
 					for (e=ms ; e ; e=e->next) {
 						char *name;
 						struct map_ent *me;
+						int member = e->metadata_version &&
+							strncmp(e->metadata_version,
+								"external:/", 10) == 0;
+						if (members != member)
+							continue;
 						me = map_by_devnum(&map, e->devnum);
 						if (me && me->path
 						    && strcmp(me->path, "/unknown") != 0)
@@ -1288,6 +1295,7 @@ int main(int argc, char *argv[])
 							rv |= WaitClean(name, -1, v);
 						put_md_name(name);
 					}
+					}
 					free_mdstat(ms);
 				} else	if (devmode == 'S' && scan) {
 					/* apply --stop to all devices in /proc/mdstat */




More information about the pkg-mdadm-commits mailing list