[2.6.22-rc1-mm1 PATCH 5/10] dm-raid1-report-fault-status.patch

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



 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.

Index: linux-2.6.22-rc1-mm1/drivers/md/dm-raid1.c
===================================================================
--- linux-2.6.22-rc1-mm1.orig/drivers/md/dm-raid1.c
+++ 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);
 


--
dm-devel mailing list
dm-devel@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/dm-devel

[Index of Archives]     [DM Crypt]     [Fedora Desktop]     [ATA RAID]     [Fedora Marketing]     [Fedora Packaging]     [Fedora SELinux]     [Yosemite Discussion]     [KDE Users]     [Fedora Docs]

  Powered by Linux