Grow: increase raid_disks before adding specific spares.

When we add spared that have been targeted at a specific slot,
we need raid_disks to be bigger than the slot number.
But currently we don't increase raid_disks until after we add
these spares.

So introduce an early increase of raid_disks to allow the spares
to be added.

Signed-off-by: NeilBrown <neilb@suse.de>
This commit is contained in:
NeilBrown 2011-03-22 14:52:36 +11:00
parent 38376c2e51
commit 0d5ac3c6ef
1 changed files with 9 additions and 0 deletions

9
Grow.c
View File

@ -1786,6 +1786,15 @@ static int reshape_array(char *container, int fd, char *devname,
if (info2) {
sysfs_init(info2, fd, st->devnum);
/* When increasing number of devices, we need to set
* new raid_disks before adding these, or they might
* be rejected.
*/
if (reshape.backup_blocks &&
reshape.after.data_disks > reshape.before.data_disks)
subarray_set_num(container, info2, "raid_disks",
reshape.after.data_disks +
reshape.parity);
for (d = info2->devs; d; d = d->next) {
if (d->disk.state == 0 &&
d->disk.raid_disk >= 0) {