[PATCH 1/6] imsm: Update metadata for second array
am 13.01.2011 15:50:10 von adam.kwolekWhen second array reshape is about to start external metadata should be updated
by mdmon in imsm_set_array_state().
for this purposes imsm_progress_container_reshape() is reused.
Signed-off-by: Adam Kwolek
---
super-intel.c | 35 ++++++++++++++++++++++++++++++++---
1 files changed, 32 insertions(+), 3 deletions(-)
diff --git a/super-intel.c b/super-intel.c
index cb2b51b..4cbb070 100644
--- a/super-intel.c
+++ b/super-intel.c
@@ -4863,7 +4863,9 @@ static void handle_missing(struct intel_super *super, struct imsm_dev *dev)
static void imsm_set_disk(struct active_array *a, int n, int state);
-static void imsm_progress_container_reshape(struct intel_super *super)
+static void imsm_progress_container_reshape(struct intel_super *super,
+ struct imsm_dev *dev_in,
+ int disk_count)
{
/* if no device has a migr_state, but some device has a
* different number of members than the previous device, start
@@ -4871,7 +4873,7 @@ static void imsm_progress_container_reshape(struct intel_super *super)
* previous.
*/
struct imsm_super *mpb = super->anchor;
- int prev_disks = -1;
+ int prev_disks = disk_count;
int i;
for (i = 0; i < mpb->num_raid_devs; i++) {
@@ -4884,6 +4886,10 @@ static void imsm_progress_container_reshape(struct intel_super *super)
if (dev->vol.migr_state)
return;
+ if (((dev_in != NULL) && disk_count > 0) &&
+ (dev_in != dev))
+ continue;
+
if (prev_disks == -1)
prev_disks = map->num_members;
if (prev_disks == map->num_members)
@@ -4999,7 +5005,9 @@ static int imsm_set_array_state(struct active_array *a, int consistent)
* array size
*/
super->updates_pending++;
- imsm_progress_container_reshape(super);
+ imsm_progress_container_reshape(super,
+ NULL,
+ -1);
}
}
}
@@ -5072,6 +5080,27 @@ static int imsm_set_array_state(struct active_array *a, int consistent)
for (mdi = a->info.devs; mdi; mdi = mdi->next)
imsm_set_disk(a, mdi->disk.raid_disk, mdi->curr_state);
+ } else if (dev->vol.migr_state == 0) {
+ /* check here if this is container action
+ * and next metadata should be prepared
+ */
+ struct imsm_map *map = get_imsm_map(dev, 0);
+ struct dl *dl = NULL;
+ int disks_count = 0;
+
+ /* check if this array should be reshaped
+ */
+ for (dl = super->disks; dl; dl = dl->next)
+ if (dl->index >= 0)
+ disks_count++;
+ if (disks_count > map->num_members) {
+ /* manage changes in volume
+ */
+ imsm_progress_container_reshape(super,
+ dev,
+ disks_count);
+ super->updates_pending++;
+ }
}
return consistent;
--
To unsubscribe from this list: send the line "unsubscribe linux-raid" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html