]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
Teach --assemble --force to handle reshapes a little better.
authorNeilBrown <neilb@suse.de>
Mon, 21 Feb 2011 00:41:01 +0000 (11:41 +1100)
committerNeilBrown <neilb@suse.de>
Mon, 21 Feb 2011 00:41:01 +0000 (11:41 +1100)
When we force-assemble an array which is in the middle of a reshape,
we should repeat the reshape of any parts that aren't recorded in
the oldest superblock.

This is unlikely to make a significant difference, but could make
a small difference, and is safer.

Signed-off-by: NeilBrown <neilb@suse.de>
super0.c
super1.c

index ae3e8855193f9d6183776f346779b6d29ba5ef5c..b141b7461b1f37bc4d56c3e36a067c9b3672aaa3 100644 (file)
--- a/super0.c
+++ b/super0.c
@@ -491,6 +491,20 @@ static int update_super0(struct supertype *st, struct mdinfo *info,
                        sb->disks[d].state = info->disk.state | wonly;
                        rv = 1;
                }
+               if (info->reshape_active &&
+                   sb->minor_version > 90 && (sb->reshape_position+1) != 0 &&
+                   info->delta_disks >= 0 &&
+                   info->reshape_progress < sb->reshape_position) {
+                       sb->reshape_position = info->reshape_progress;
+                       rv = 1;
+               }
+               if (info->reshape_active &&
+                   sb->minor_version > 90 && (sb->reshape_position+1) != 0 &&
+                   info->delta_disks < 0 &&
+                   info->reshape_progress > sb->reshape_position) {
+                       sb->reshape_position = info->reshape_progress;
+                       rv = 1;
+               }
        }
        if (strcmp(update, "linear-grow-new") == 0) {
                memset(&sb->disks[info->disk.number], 0, sizeof(sb->disks[0]));
index 0eb03230a79fd4b8bf791f2b5057be5ee0db83be..e8f59c6a1132afaf4dfa90a9975d2f4cf2cba619 100644 (file)
--- a/super1.c
+++ b/super1.c
@@ -680,6 +680,20 @@ static int update_super1(struct supertype *st, struct mdinfo *info,
                        sb->dev_roles[d] = __cpu_to_le16(want);
                        rv = 1;
                }
+               if (info->reshape_active &&
+                   sb->feature_map & __le32_to_cpu(MD_FEATURE_RESHAPE_ACTIVE) &&
+                   info->delta_disks >= 0 &&
+                   info->reshape_progress < __le64_to_cpu(sb->reshape_position)) {
+                       sb->reshape_position = __cpu_to_le64(info->reshape_progress);
+                       rv = 1;
+               }
+               if (info->reshape_active &&
+                   sb->feature_map & __le32_to_cpu(MD_FEATURE_RESHAPE_ACTIVE) &&
+                   info->delta_disks < 0 &&
+                   info->reshape_progress > __le64_to_cpu(sb->reshape_position)) {
+                       sb->reshape_position = __cpu_to_le64(info->reshape_progress);
+                       rv = 1;
+               }
        }
        if (strcmp(update, "linear-grow-new") == 0) {
                unsigned int i;