diff options
author | Zdenek Kabelac <zkabelac@redhat.com> | 2016-01-06 13:54:15 +0100 |
---|---|---|
committer | Zdenek Kabelac <zkabelac@redhat.com> | 2016-01-14 11:34:05 +0100 |
commit | 2567d03e95bb4e46cd845c2ae8b518ec4989b939 (patch) | |
tree | f294cb675c8b71d63dfe2b833e90478496b92a52 | |
parent | 4310dfd4e141bb83320148d245f3ab2cae778f6e (diff) | |
download | lvm2-2567d03e95bb4e46cd845c2ae8b518ec4989b939.tar.gz |
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.
-rw-r--r-- | lib/metadata/lv_manip.c | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c index 1396b867a..68978010a 100644 --- a/lib/metadata/lv_manip.c +++ b/lib/metadata/lv_manip.c @@ -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; |