Monitor: do not move partitions to external container

Arrays on partitions are not supported for external metadata
so do not take such spare from native array.

Signed-off-by: Anna Czarnowska <anna.czarnowska@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
This commit is contained in:
Czarnowska, Anna 2011-02-01 10:40:56 +11:00 committed by NeilBrown
parent 1dfaa38015
commit bfd76b9309
3 changed files with 18 additions and 0 deletions

View File

@ -765,6 +765,10 @@ static dev_t choose_spare(struct state *from, struct state *to,
struct dev_policy *pol;
unsigned long long dev_size;
if (to->metadata->ss->external &&
test_partition_from_id(from->devid[d]))
continue;
if (min_size &&
dev_size_from_id(from->devid[d], &dev_size) &&
dev_size < min_size)

View File

@ -1120,6 +1120,7 @@ extern int ask(char *mesg);
extern unsigned long long get_component_size(int fd);
extern void remove_partitions(int fd);
extern int test_partition(int fd);
extern int test_partition_from_id(dev_t id);
extern unsigned long long calc_array_size(int level, int raid_disks, int layout,
int chunksize, unsigned long long devsize);
extern int flush_metadata_updates(struct supertype *st);

13
util.c
View File

@ -295,6 +295,19 @@ int test_partition(int fd)
return 1;
}
int test_partition_from_id(dev_t id)
{
char buf[20];
int fd, rv;
sprintf(buf, "%d:%d", major(id), minor(id));
fd = dev_open(buf, O_RDONLY);
if (fd < 0)
return -1;
rv = test_partition(fd);
close(fd);
return rv;
}
int enough(int level, int raid_disks, int layout, int clean,
char *avail, int avail_disks)