FIX: Get spares from external metadata

For external metadata cases, information about number of spares cannot
be get via ioctl GET_ARRAY_INFO for particular array
(as info variable is initialized by). In md this information is present
in container object not array one.
This causes need to get spare disks number from external metadata.

This information is required for reshape_array() function to decide
if spare disks number satisfy operation requirements.

Signed-off-by: Adam Kwolek <adam.kwolek@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
This commit is contained in:
Adam Kwolek 2011-02-14 11:06:31 +11:00 committed by NeilBrown
parent 41784c88f3
commit 08f9e34bb5
1 changed files with 13 additions and 0 deletions

13
Grow.c
View File

@ -1573,6 +1573,19 @@ int Grow_reshape(char *devname, int fd, int quiet, char *backup_file,
force, backup_file, quiet);
frozen = 0;
} else {
/* get spare devices from external metadata
*/
if (st->ss->external) {
struct mdinfo *info2;
info2 = st->ss->container_content(st, subarray);
if (info2) {
info.array.spare_disks =
info2->array.spare_disks;
sysfs_free(info2);
}
}
/* Impose these changes on a single array. First
* check that the metadata is OK with the change. */