From 2d8a2f35c77fdeef1dbe0ef791db8530d07826eb Mon Sep 17 00:00:00 2001 From: Jonathan Earl Brassow Date: Tue, 13 Sep 2011 18:11:38 +0000 Subject: [PATCH] Better fix for bug 737125 - unable to create mirror on 1K extent size VG WHATS_NEW entry: Fix log size calculation when only a log is being added to a mirror. The original fix pass the mirror LV to allocate_extents (rather than passing NULL) so that _alloc_init could correctly determine the necessary size of the mirror log. In the previous check-in, I noted: In order to get a decent value computed, we need to pass in the 'lv' argument to allocate_extents. This would normally imply a desire for cling/contiguous allocation to the given LV, but since we are not allocating any parallel extents and only log extents, it works fine. However, passing in the LV did have unintended consequences on the placement of the log. The better solution is to pass in the number of extext that are in the mirror LV instead of the LV itself. This will not cause the allocator to reserve that number of extents, because 'stripes' and 'mirrors' are specified as 0. Thus, 'extents' is used to calculate the size of the log, but won't affect how much is allocated. --- lib/metadata/mirror.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/metadata/mirror.c b/lib/metadata/mirror.c index fd863df4f..d0cfb7d82 100644 --- a/lib/metadata/mirror.c +++ b/lib/metadata/mirror.c @@ -1966,9 +1966,10 @@ int add_mirror_log(struct cmd_context *cmd, struct logical_volume *lv, } /* allocate destination extents */ - ah = allocate_extents(lv->vg, lv, segtype, - 0, 0, log_count - old_log_count, region_size, 0, - allocatable_pvs, alloc, parallel_areas); + ah = allocate_extents(lv->vg, NULL, segtype, + 0, 0, log_count - old_log_count, region_size, + lv->le_count, allocatable_pvs, + alloc, parallel_areas); if (!ah) { log_error("Unable to allocate extents for mirror log."); return 0;