Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=333eb8667e73439c71dc3…
Commit: 333eb8667e73439c71dc351a02612c1c7601e8ec
Parent: 6d1c983122bc2a17bbfbac234f9a73ee9c27f161
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Sun Jul 8 23:24:58 2018 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Mon Jul 9 00:23:35 2018 +0200
tests: check how thin-pool allocation works
Check allocation of thin-pool works on 2PVs, when one is so full,
that even metadata do not fit there (as they need at least 2M,
while 99% of 63MB fills >62MB)
---
test/shell/lvcreate-thin.sh | 11 +++++++++++
1 files changed, 11 insertions(+), 0 deletions(-)
diff --git a/test/shell/lvcreate-thin.sh b/test/shell/lvcreate-thin.sh
index 8e04c9e..9ca7f11 100644
--- a/test/shell/lvcreate-thin.sh
+++ b/test/shell/lvcreate-thin.sh
@@ -199,6 +199,17 @@ check vg_field $vg lv_count 6
lvremove -ff $vg
check vg_field $vg lv_count 0
+
+# Check how allocator works with 2PVs where one is nearly full
+lvcreate -l99%PV $vg "$dev1"
+lvs -a $vg
+# Check when separate metadata is required, allocation needs to fail
+fail lvcreate -L10 -T --poolmetadataspare n --config 'allocation/thin_pool_metadata_require_separate_pvs=1' $vg
+# Check when data and metadata may share the same PV, it shall pass
+lvcreate -L10 -T --poolmetadataspare n --config 'allocation/thin_pool_metadata_require_separate_pvs=0' $vg
+lvremove -f $vg
+
+
# Fail cases
# Too small pool size (1 extent 64KB) for given chunk size
not lvcreate --chunksize 256 -l1 -T $vg/pool1
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=b697aa96466b6a5f479df…
Commit: b697aa96466b6a5f479df41a213fc1fd583dc743
Parent: c96400b6c7b8ba5124c045a2ae9475e3224ec284
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Sun Jul 8 18:34:38 2018 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Mon Jul 9 00:19:30 2018 +0200
allocator: fix thin-pool allocation
When allocating thin-pool with more then 1 device - try to
allocate 'metadataLV' with reuse of log-type allocation for mirror LV.
It should be naturally place on other device then 'dataLV'.
However due to somewhat hard to follow allocation logic code,
it's been rejected allocation in cases where there was not
enough space for data or metadata on single PV, thus to successed,
usage of segments was mandatory.
While user may use:
allocation/thin_pool_metadata_require_separate_pvs=1
to enforce separe meta and data LV - on default settings, this is not
enable thus segment allocation is meant to work.
NOTE:
As already said - the original intention of this whole 'if()' is unclear,
so try to split this test into multiple more simple tests that are more readable.
TODO: more validation.
---
lib/metadata/lv_manip.c | 10 ++++++----
1 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c
index a382e27..b315a87 100644
--- a/lib/metadata/lv_manip.c
+++ b/lib/metadata/lv_manip.c
@@ -2966,12 +2966,14 @@ static int _find_some_parallel_space(struct alloc_handle *ah,
(*(alloc_state->areas + alloc_state->num_positional_areas + ix - 1 -
too_small_for_log_count)).used < ah->log_len)
too_small_for_log_count++;
- ix_log_offset = alloc_state->num_positional_areas + ix - too_small_for_log_count - ah->log_area_count;
+ if (ah->mirror_logs_separate && (too_small_for_log_count >= devices_needed))
+ return 1;
+ if ((alloc_state->num_positional_areas + ix) < (too_small_for_log_count + ah->log_area_count))
+ return 1;
+ ix_log_offset = alloc_state->num_positional_areas + ix - (too_small_for_log_count + ah->log_area_count);
}
- if (ix + alloc_state->num_positional_areas < devices_needed +
- (alloc_state->log_area_count_still_needed ? alloc_state->log_area_count_still_needed +
- too_small_for_log_count : 0))
+ if (ix + alloc_state->num_positional_areas < devices_needed)
return 1;
/*