From: Jonathan Brassow <[email-masked]>

This patch adds extra information to the mirror status output, so that
it can be determined which device(s) have failed.  An 'A' for alive and
'D' for dead are printed in the status line for each mirror device.  This
allows userspace to properly reconfigure the mirror set.

[FIXME: Add comment showing how output looks]

Signed-off-by: Jonathan Brassow <[email-masked]>
Signed-off-by: Alasdair G Kergon <[email-masked]>

---
 drivers/md/dm-raid1.c |   13 +++++++++----
 1 files changed, 9 insertions(+), 4 deletions(-)

Index: linux-2.6.24-rc8/drivers/md/dm-raid1.c
===================================================================
--- linux-2.6.24-rc8.orig/drivers/md/dm-raid1.c	2008-01-24 16:57:23.000000000 +0000
+++ linux-2.6.24-rc8/drivers/md/dm-raid1.c	2008-01-24 16:57:25.000000000 +0000
@@ -1525,17 +1525,22 @@ static int mirror_status(struct dm_targe
 {
 	unsigned int m, sz = 0;
 	struct mirror_set *ms = (struct mirror_set *) ti->private;
+	char buffer[ms->nr_mirrors + 1];
 
 	switch (type) {
 	case STATUSTYPE_INFO:
 		DMEMIT("%d ", ms->nr_mirrors);
-		for (m = 0; m < ms->nr_mirrors; m++)
+		for (m = 0; m < ms->nr_mirrors; m++) {
 			DMEMIT("%s ", ms->mirror[m].dev->name);
+			buffer[m] = atomic_read(&(ms->mirror[m].error_count)) ?
+				'D' : 'A';
+		}
+		buffer[m] = '\0';
 
-		DMEMIT("%llu/%llu 0 ",
+		DMEMIT("%llu/%llu 1 %s ",
 			(unsigned long long)ms->rh.log->type->
 				get_sync_count(ms->rh.log),
-			(unsigned long long)ms->nr_regions);
+		       (unsigned long long)ms->nr_regions, buffer);
 
 		sz += ms->rh.log->type->status(ms->rh.log, type, result+sz, maxlen-sz);
 
@@ -1558,7 +1563,7 @@ static int mirror_status(struct dm_targe
 
 static struct target_type mirror_target = {
 	.name	 = "mirror",
-	.version = {1, 0, 3},
+	.version = {1, 0, 20},
 	.module	 = THIS_MODULE,
 	.ctr	 = mirror_ctr,
 	.dtr	 = mirror_dtr,