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:
parent
4310dfd4e1
commit
2567d03e95
@ -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;
|
uint32_t s, area_count, alloc_count, parity_count, total_extents;
|
||||||
size_t size = 0;
|
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 */
|
/* FIXME Caller should ensure this */
|
||||||
if (mirrors && !stripes)
|
if (mirrors && !stripes)
|
||||||
stripes = 1;
|
stripes = 1;
|
||||||
|
|
||||||
if (segtype_is_virtual(segtype))
|
|
||||||
area_count = 0;
|
|
||||||
else if (mirrors > 1)
|
else if (mirrors > 1)
|
||||||
area_count = mirrors * stripes;
|
area_count = mirrors * stripes;
|
||||||
else
|
else
|
||||||
area_count = stripes;
|
area_count = stripes;
|
||||||
|
|
||||||
if (!segtype_is_virtual(segtype) &&
|
if (!(area_count + metadata_area_count)) {
|
||||||
!(area_count + metadata_area_count)) {
|
|
||||||
log_error(INTERNAL_ERROR "_alloc_init called for non-virtual segment with no disk space.");
|
log_error(INTERNAL_ERROR "_alloc_init called for non-virtual segment with no disk space.");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -3186,10 +3187,6 @@ static struct alloc_handle *_alloc_init(struct cmd_context *cmd,
|
|||||||
|
|
||||||
ah->cmd = cmd;
|
ah->cmd = cmd;
|
||||||
ah->mem = mem;
|
ah->mem = mem;
|
||||||
|
|
||||||
if (segtype_is_virtual(segtype))
|
|
||||||
return ah;
|
|
||||||
|
|
||||||
ah->area_count = area_count;
|
ah->area_count = area_count;
|
||||||
ah->parity_count = parity_count;
|
ah->parity_count = parity_count;
|
||||||
ah->region_size = region_size;
|
ah->region_size = region_size;
|
||||||
|
Loading…
Reference in New Issue
Block a user