dcavalca / rpms / mdadm

Forked from rpms/mdadm 3 years ago
Clone

Blame SOURCES/mdadm-3.2.6-Fix-is_resync_complete-for-RAID10.patch

fc6001
From 71d68ff62f945254240575cd836f5f2a09ced5d2 Mon Sep 17 00:00:00 2001
fc6001
From: NeilBrown <neilb@suse.de>
fc6001
Date: Wed, 31 Jul 2013 09:18:57 +1000
fc6001
Subject: [PATCH] Fix is_resync_complete for RAID10
fc6001
fc6001
For RAID10, 'sync' numbers go up to the array size rather than the
fc6001
component size.  is_resync_complete() needs to allow for this.
fc6001
fc6001
Reported-by: Pawel Baldysiak <pawel.baldysiak@intel.com>
fc6001
Signed-off-by: NeilBrown <neilb@suse.de>
fc6001
---
fc6001
 mdmon.h | 20 +++++++++++++++++---
fc6001
 1 file changed, 17 insertions(+), 3 deletions(-)
fc6001
fc6001
diff --git a/mdmon.h b/mdmon.h
fc6001
index 60fda38..5a8e120 100644
fc6001
--- a/mdmon.h
fc6001
+++ b/mdmon.h
fc6001
@@ -91,8 +91,22 @@ extern int monitor_loop_cnt;
fc6001
  */
fc6001
 static inline int is_resync_complete(struct mdinfo *array)
fc6001
 {
fc6001
-	if (array->resync_start >= array->component_size)
fc6001
-		return 1;
fc6001
-	return 0;
fc6001
+	unsigned long long sync_size = 0;
fc6001
+	int ncopies, l;
fc6001
+	switch(array->array.level) {
fc6001
+	case 1:
fc6001
+	case 4:
fc6001
+	case 5:
fc6001
+	case 6:
fc6001
+		sync_size = array->component_size;
fc6001
+		break;
fc6001
+	case 10:
fc6001
+		l = array->array.layout;
fc6001
+		ncopies = (l & 0xff) * ((l >> 8) && 0xff);
fc6001
+		sync_size = array->component_size * array->array.raid_disks;
fc6001
+		sync_size /= ncopies;
fc6001
+		break;
fc6001
+	}
fc6001
+	return array->resync_start >= sync_size;
fc6001
 }
fc6001