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>
This commit is contained in:
parent
63c12c89d4
commit
c4b26c643d
5
Grow.c
5
Grow.c
|
@ -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
|
||||
|
|
8
super1.c
8
super1.c
|
@ -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) {
|
||||
|
|
Loading…
Reference in New Issue