[PATCH] imsm: correct num_data_stripes in metadata map for migration

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

 



When migrating an array from R0 to R10 num_data_stripes in metadata map
will not be updated. Update it to allow correct migration process.
Changes in R10 to R0 migration for clarity of code.

Signed-off-by: Roman Sobanski <roman.sobanski@xxxxxxxxx>
---
 super-intel.c | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/super-intel.c b/super-intel.c
index 520abf5d..cd606368 100644
--- a/super-intel.c
+++ b/super-intel.c
@@ -9532,12 +9532,6 @@ static int apply_takeover_update(struct imsm_update_takeover *u,
 	if (u->direction == R10_TO_R0) {
 		unsigned long long num_data_stripes;
 
-		map->num_domains = 1;
-		num_data_stripes = imsm_dev_size(dev) / 2;
-		num_data_stripes /= map->blocks_per_strip;
-		num_data_stripes /= map->num_domains;
-		set_num_data_stripes(map, num_data_stripes);
-
 		/* Number of failed disks must be half of initial disk number */
 		if (imsm_count_failed(super, dev, MAP_0) !=
 				(map->num_members / 2))
@@ -9563,10 +9557,15 @@ static int apply_takeover_update(struct imsm_update_takeover *u,
 		map->num_domains = 1;
 		map->raid_level = 0;
 		map->failed_disk_num = -1;
+		num_data_stripes = imsm_dev_size(dev) / 2;
+		num_data_stripes /= map->blocks_per_strip;
+		set_num_data_stripes(map, num_data_stripes);
 	}
 
 	if (u->direction == R0_TO_R10) {
 		void **space;
+		unsigned long long num_data_stripes;
+
 		/* update slots in current disk list */
 		for (dm = super->disks; dm; dm = dm->next) {
 			if (dm->index >= 0)
@@ -9604,6 +9603,11 @@ static int apply_takeover_update(struct imsm_update_takeover *u,
 		map->map_state = IMSM_T_STATE_DEGRADED;
 		map->num_domains = 2;
 		map->raid_level = 1;
+		num_data_stripes = imsm_dev_size(dev) / 2;
+		num_data_stripes /= map->blocks_per_strip;
+		num_data_stripes /= map->num_domains;
+		set_num_data_stripes(map, num_data_stripes);
+
 		/* replace dev<->dev_new */
 		dv->dev = dev_new;
 	}
-- 
2.13.6

--
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