[dm-devel] [2.6.22-rc4-mm2 PATCH 5/11] dm-raid1-report-fault-status.patch

Jonathan Brassow jbrassow at redhat.com
Thu Jun 21 18:04:24 UTC 2007


Minor change to header.

Suggestion was made to update the version number with this patch.  I
have a version-bump patch at the end of this series.

 brassow

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.

Index: linux-2.6.22-rc4-mm2/drivers/md/dm-raid1.c
===================================================================
--- linux-2.6.22-rc4-mm2.orig/drivers/md/dm-raid1.c
+++ linux-2.6.22-rc4-mm2/drivers/md/dm-raid1.c
@@ -1482,17 +1482,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);
 





More information about the dm-devel mailing list