mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
mirror: Fix log size calc when more than 1 extent.
Currently the code creates the log separately after allocating space for the data and as no data allocation is needed this second time, total_extents ends up holding zero so use new_extents directly instead.
This commit is contained in:
parent
16780f6faa
commit
8096f2224c
@ -1,5 +1,6 @@
|
||||
Version 2.02.134 -
|
||||
====================================
|
||||
Pass correct data size to mirror log calc so log can be bigger than 1 extent.
|
||||
|
||||
Version 2.02.133 - 30th October 2015
|
||||
====================================
|
||||
|
@ -1579,7 +1579,7 @@ struct alloc_handle {
|
||||
* Returns log device size in extents, algorithm from kernel code
|
||||
*/
|
||||
#define BYTE_SHIFT 3
|
||||
static uint32_t mirror_log_extents(uint32_t region_size, uint32_t pe_size, uint32_t area_len)
|
||||
static uint32_t _mirror_log_extents(uint32_t region_size, uint32_t pe_size, uint32_t area_len)
|
||||
{
|
||||
size_t area_size, bitset_size, log_size, region_count;
|
||||
|
||||
@ -3281,12 +3281,15 @@ static struct alloc_handle *_alloc_init(struct cmd_context *cmd,
|
||||
} else {
|
||||
ah->log_area_count = metadata_area_count;
|
||||
ah->log_len = !metadata_area_count ? 0 :
|
||||
mirror_log_extents(ah->region_size, extent_size,
|
||||
(existing_extents + total_extents) / ah->area_multiple);
|
||||
_mirror_log_extents(ah->region_size, extent_size,
|
||||
(existing_extents + new_extents) / ah->area_multiple);
|
||||
}
|
||||
|
||||
log_debug("Adjusted allocation request to %" PRIu32 " logical extents. Existing size %" PRIu32 ". New size %" PRIu32 ".",
|
||||
total_extents, existing_extents, total_extents + existing_extents);
|
||||
if (ah->log_len)
|
||||
log_debug("Mirror log of %" PRIu32 " extents of size %" PRIu32 "sectors needed for region size %" PRIu32 ".",
|
||||
ah->log_len, extent_size, ah->region_size);
|
||||
|
||||
if (mirrors || stripes)
|
||||
total_extents += existing_extents;
|
||||
|
Loading…
Reference in New Issue
Block a user