1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

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.
This commit is contained in:
Jonathan Earl Brassow 2011-09-13 18:11:38 +00:00
parent d954a7f991
commit 2d8a2f35c7

View File

@ -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;