1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-01-03 05:18:29 +03:00

cleanup: explicit prohibition for virtual segs

Internal _alloc_init() is only called from allocate_extents(),
which already does prevent usage of virtual segments.

So mark as internal error early and do not process it any further.
This commit is contained in:
Zdenek Kabelac 2016-01-06 13:54:15 +01:00
parent 4310dfd4e1
commit 2567d03e95

View File

@ -3128,19 +3128,20 @@ static struct alloc_handle *_alloc_init(struct cmd_context *cmd,
uint32_t s, area_count, alloc_count, parity_count, total_extents;
size_t size = 0;
if (segtype_is_virtual(segtype)) {
log_error(INTERNAL_ERROR "_alloc_init called for virtual segment.");
return NULL;
}
/* FIXME Caller should ensure this */
if (mirrors && !stripes)
stripes = 1;
if (segtype_is_virtual(segtype))
area_count = 0;
else if (mirrors > 1)
area_count = mirrors * stripes;
else
area_count = stripes;
if (!segtype_is_virtual(segtype) &&
!(area_count + metadata_area_count)) {
if (!(area_count + metadata_area_count)) {
log_error(INTERNAL_ERROR "_alloc_init called for non-virtual segment with no disk space.");
return NULL;
}
@ -3186,10 +3187,6 @@ static struct alloc_handle *_alloc_init(struct cmd_context *cmd,
ah->cmd = cmd;
ah->mem = mem;
if (segtype_is_virtual(segtype))
return ah;
ah->area_count = area_count;
ah->parity_count = parity_count;
ah->region_size = region_size;