Skip to contentSkip to conversation

dm-raid1-report-fault-status.patch

PATCH In review Jonathan Brassow 1 participant 1 message May 21, 2007 Device mapper

lore
Share & tools
lore
#0 lore raw

PATCH 5/10 dm-raid1-report-fault-status.patch

brassow

This patch adds extra information to the mirror status output, so that it can be determined which device(s) have failed. This allows userspace to properly reconfigure the mirror set.

drivers/md/dm-raid1.c +8 -3
Index: linux-2.6.22-rc1-mm1/drivers/md/dm-raid1.c
===================================================================
@@ -1485,17 +1485,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);