diff options
author | NeilBrown <neilb@suse.de> | 2013-05-21 16:32:00 +1000 |
---|---|---|
committer | NeilBrown <neilb@suse.de> | 2013-05-22 12:26:19 +1000 |
commit | c4b26c643dd8dd4e897288345dad7ecbe318e243 (patch) | |
tree | 14ae89b8e83975eceeb4f68c60594f5f5f9a0479 | |
parent | 63c12c89d4bed2cfbf9d263b968563741bb37d2c (diff) |
Grow: allow metadata to indicate that changing data_offset not supported.
If space_after and space_before are zero (the default) then assume that
metadata doesn't support changing data_offset.
Signed-off-by: NeilBrown <neilb@suse.de>
-rw-r--r-- | Grow.c | 5 | ||||
-rw-r--r-- | super1.c | 8 |
2 files changed, 13 insertions, 0 deletions
@@ -2179,6 +2179,11 @@ static int set_new_data_offset(struct mdinfo *sra, struct supertype *st, st2->ss->getinfo_super(st2, &info2, NULL); st2->ss->free_super(st2); free(st2); + if (info2.space_before == 0 && + info2.space_after == 0) { + /* Metadata doesn't support data_offset changes */ + return 1; + } if (delta_disks < 0) { /* Don't need any space as array is shrinking * just move data_offset up by min @@ -953,6 +953,14 @@ static void getinfo_super1(struct supertype *st, struct mdinfo *info, char *map) info->space_before = 0; info->space_after = misc->device_size - data_size - info->data_offset; } + if (info->space_before == 0 && info->space_after == 0) { + /* It will look like we don't support data_offset changes, + * be we do - it's just that there is no room. + * A change that reduced the number of devices should + * still be allowed, so set the otherwise useless value of '1' + */ + info->space_after = 1; + } info->disk.raid_disk = -1; switch(role) { |