[PATCH] imsm: fix checking completion of RAID10 resync

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

 



If one creates RAID10 with IMSM metadata the is_resync_complete
function returns '1' just when initial resync reaches 50%

IMSM version of the is_resync_complete function has been added
that handles the case of IMSM RAID10 correctly.


Signed-off-by: Pawel Baldysiak <pawel.baldysiak@xxxxxxxxx>
---
 super-intel.c |   20 ++++++++++++++++++--
 1 file changed, 18 insertions(+), 2 deletions(-)

diff --git a/super-intel.c b/super-intel.c
index 4df33f4..0371713 100644
--- a/super-intel.c
+++ b/super-intel.c
@@ -1021,6 +1021,22 @@ static int is_failed(struct imsm_disk *disk)
 	return (disk->status & FAILED_DISK) == FAILED_DISK;
 }
 
+/* IMSM version of is_resync_complete helper routine
+ * to determine resync completion
+ * since MaxSector is a moving target
+ */
+static int imsm_is_resync_complete(struct mdinfo *array)
+{
+	if (array->array.level != 10) {
+		if (array->resync_start >= array->component_size)
+			return 1;
+	} else {
+		if (array->resync_start >= 2*array->component_size)
+			return 1;
+	}
+	return 0;
+}
+
 /* try to determine how much space is reserved for metadata from
  * the last get_extents() entry on the smallest active disk,
  * otherwise fallback to the default
@@ -7119,12 +7135,12 @@ static int imsm_set_array_state(struct active_array *a, int consistent)
 		handle_missing(super, dev);
 
 	if (consistent == 2 &&
-	    (!is_resync_complete(&a->info) ||
+	    (!imsm_is_resync_complete(&a->info) ||
 	     map_state != IMSM_T_STATE_NORMAL ||
 	     dev->vol.migr_state))
 		consistent = 0;
 
-	if (is_resync_complete(&a->info)) {
+	if (imsm_is_resync_complete(&a->info)) {
 		/* complete intialization / resync,
 		 * recovery and interrupted recovery is completed in
 		 * ->set_disk

--
To unsubscribe from this list: send the line "unsubscribe linux-raid" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux RAID Wiki]     [ATA RAID]     [Linux SCSI Target Infrastructure]     [Linux Block]     [Linux IDE]     [Linux SCSI]     [Linux Hams]     [Device Mapper]     [Device Mapper Cryptographics]     [Kernel]     [Linux Admin]     [Linux Net]     [GFS]     [RPM]     [git]     [Yosemite Forum]


  Powered by Linux