summaryrefslogtreecommitdiffstats
path: root/super0.c
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.de>2013-05-23 07:48:48 +0200
committerNeilBrown <neilb@suse.de>2013-05-28 08:44:23 +0200
commit199f1a1fadcd0fb5efba656ad92a44c51f8cc8ea (patch)
tree5f85a1db5fb927b5a33643c621ff64f60ffb4c3f /super0.c
parentAssemble: --update=metadata converts v0.90 to v1.0 (diff)
downloadmdadm-199f1a1fadcd0fb5efba656ad92a44c51f8cc8ea.tar.xz
mdadm-199f1a1fadcd0fb5efba656ad92a44c51f8cc8ea.zip
Assemble: allow --update=revert-reshape
This will cause a reshape to start going backwards.
Diffstat (limited to 'super0.c')
-rw-r--r--super0.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/super0.c b/super0.c
index 01c31c27..e4bbe3e1 100644
--- a/super0.c
+++ b/super0.c
@@ -645,6 +645,28 @@ static int update_super0(struct supertype *st, struct mdinfo *info,
uuid_from_super0(st, info->uuid);
st->other = super1_make_v0(st, info, st->sb);
}
+ } else if (strcmp(update, "revert-reshape") == 0) {
+ rv = -2;
+ if (sb->minor_version <= 90)
+ pr_err("No active reshape to revert on %s\n",
+ devname);
+ else if (sb->delta_disks == 0)
+ pr_err("%s: Can on revert reshape which changes number of devices\n",
+ devname);
+ else {
+ int tmp;
+ rv = 0;
+ sb->raid_disks -= sb->delta_disks;
+ sb->delta_disks = -sb->delta_disks;
+
+ tmp = sb->new_layout;
+ sb->new_layout = sb->layout;
+ sb->layout = tmp;
+
+ tmp = sb->new_chunk;
+ sb->new_chunk = sb->chunk_size;
+ sb->chunk_size = tmp;
+ }
} else if (strcmp(update, "no-bitmap") == 0) {
sb->state &= ~(1<<MD_SB_BITMAP_PRESENT);
} else if (strcmp(update, "_reshape_progress")==0)