[PATCH] imsm:FIX: change arrays reshape order (v2)

From
Adam Kwolek <hidden>
Date
2011-01-31 10:20:46
Reshape is started from second array, so it causes imsm incompatibility
and problems during second array start.

Reshape should be started in arrays metadata order.

v2: added function to obtain intel_dev

Signed-off-by: Adam Kwolek <redacted>
---

 super-intel.c |   18 +++++++++++++++++-
 1 files changed, 17 insertions(+), 1 deletions(-)
diff --git a/super-intel.c b/super-intel.c
index 48336b2..3e163ec 100644
--- a/super-intel.c
+++ b/super-intel.c
@@ -641,6 +641,18 @@ static struct imsm_dev *get_imsm_dev(struct intel_super *super, __u8 index)
 	return NULL;
 }
 
+static struct intel_dev *get_intel_dev(struct intel_super *super, __u8 index)
+{
+	struct intel_dev *dv;
+
+	if (index >= super->anchor->num_raid_devs)
+		return NULL;
+	for (dv = super->devlist; dv; dv = dv->next)
+		if (dv->index == index)
+			return dv;
+	return NULL;
+}
+
 /*
  * for second_map:
  *  == 0 get first map
@@ -5852,6 +5864,7 @@ static int apply_reshape_container_disks_update(struct imsm_update_reshape *u,
 	int devices_to_reshape = 1;
 	struct imsm_super *mpb = super->anchor;
 	int ret_val = 0;
+	unsigned int dev_id;
 
 	dprintf("imsm: imsm_process_update() for update_reshape\n");
 
@@ -5881,11 +5894,14 @@ static int apply_reshape_container_disks_update(struct imsm_update_reshape *u,
 		" mpb->num_raid_devs = %i\n", mpb->num_raid_devs);
 	/* manage changes in volume
 	 */
-	for (id = super->devlist ; id; id = id->next) {
+	for (dev_id = 0; dev_id < mpb->num_raid_devs; dev_id++) {
 		void **sp = *space_list;
 		struct imsm_dev *newdev;
 		struct imsm_map *newmap, *oldmap;
 
+		id = get_intel_dev(super, dev_id);
+		if (id == NULL)
+			break;
 		if (!sp)
 			continue;
 		*space_list = *sp;
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help