From b79c897ea1531702c02b97d08ec1c49dfd36efd4 Mon Sep 17 00:00:00 2001 From: Alasdair Kergon Date: Thu, 10 Nov 2005 14:45:39 +0000 Subject: [PATCH] Extend allocation areas to avoid overflow with contiguous with other PVs. Another pvmove fix. --- WHATS_NEW | 1 + lib/metadata/lv_manip.c | 7 ++++++- lib/mirror/mirrored.c | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/WHATS_NEW b/WHATS_NEW index 402aa357e..a68f23b81 100644 --- a/WHATS_NEW +++ b/WHATS_NEW @@ -1,5 +1,6 @@ Version 2.02.00 - =================================== + Extend allocation areas to avoid overflow with contiguous with other PVs. Stop lvcreate attempting to wipe zero or error segments. Added new lvs table attributes. Separated out activation preload. diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c index 56ac57703..1170aca64 100644 --- a/lib/metadata/lv_manip.c +++ b/lib/metadata/lv_manip.c @@ -718,7 +718,7 @@ static int _find_parallel_space(struct alloc_handle *ah, alloc_policy_t alloc, already_found_one = 1; } - areas[ix + ix_offset -1] = pva; + areas[ix + ix_offset - 1] = pva; break; /* Next PV */ } @@ -811,6 +811,11 @@ static int _allocate(struct alloc_handle *ah, areas_size = ah->area_count + ah->log_count; } + /* Upper bound if none of the PVs in prev_lvseg is in pvms */ + /* FIXME Work size out properly */ + if (prev_lvseg) + areas_size += prev_lvseg->area_count; + /* Allocate an array of pv_areas to hold the largest space on each PV */ if (!(areas = dm_malloc(sizeof(*areas) * areas_size))) { log_err("Couldn't allocate areas array."); diff --git a/lib/mirror/mirrored.c b/lib/mirror/mirrored.c index c8c4d0b40..9782cc948 100644 --- a/lib/mirror/mirrored.c +++ b/lib/mirror/mirrored.c @@ -309,7 +309,7 @@ static int _add_target_line(struct dev_manager *dm, struct dm_pool *mem, } done: - return add_areas_line(dm, seg, node, start_area, seg->area_count); + return add_areas_line(dm, seg, node, start_area, area_count); } static int _target_present(void)