stable-2.02 - tests: use delayzero_dev
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=8ad7c344cd06e14f40b...
Commit: 8ad7c344cd06e14f40bd66a98315db68665cd79e
Parent: 5ac48c0655c9b0da6846dca30e1250f9a1f78f70
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Sep 4 18:05:01 2020 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Oct 16 17:07:58 2020 +0200
tests: use delayzero_dev
Speed-up a bit the first synchronization with just 50ms write delay,
but later set also delay on read to slowdown lvextend.
FIXME: there are still things to look at:
0 229376 raid raid1 2 AA 229376/229376 idle 0 0
0 229376 raid raid1 2 AA 0/229376 frozen 0 0 -
0 262144 raid raid1 2 AA 229376/262144 repair 0 0 -
0 262144 raid raid1 2 AA 229376/262144 repair 0 0 -
0 262144 raid raid1 2 AA 245888/262144 repair 0 0 -
---
test/shell/lvextend-raid.sh | 23 ++++++++++++++++++++---
1 file changed, 20 insertions(+), 3 deletions(-)
diff --git a/test/shell/lvextend-raid.sh b/test/shell/lvextend-raid.sh
index 471097e45..04e9adf87 100644
--- a/test/shell/lvextend-raid.sh
+++ b/test/shell/lvextend-raid.sh
@@ -21,7 +21,7 @@ v1_15_0=0
aux have_raid 1 15 0 && v1_15_0=1
# Use smallest regionsize to save VG space
-regionsize=`getconf PAGESIZE` # in bytes
+regionsize=$(getconf PAGESIZE) # in bytes
let pageregions=regionsize*8 # number of regions per MD bitmap page
# in KiB
@@ -35,7 +35,14 @@ aux prepare_pvs 2 $(($lvsz + 3 * $lvext))
get_devs
vgcreate -s 4k $vg ${DEVICES[@]}
-aux delay_dev "$dev1" 0 150
+# Keep $dev1 & $dev2 always open via small active LVs.
+# This trick avoids race on system with scanning udev service
+# when device is 'in-use' and we cleared _rimage & _rmeta.
+lvcreate -l1 $vg "$dev1"
+lvcreate -l1 $vg "$dev2"
+
+sector=$(( $(get first_extent_sector "$dev2") + 2048 ))
+aux delayzero_dev "$dev2" 0 50 "${sector}:"
# Create raid1 LV consuming 1 MD bitmap page
lvcreate --yes --type raid1 --regionsize ${regionsize}K -L$(($lvsz-$lvext))M -n $lv1 $vg
@@ -45,10 +52,17 @@ aux wait_for_sync $vg $lv1
check lv_field $vg/$lv1 sync_percent "100.00"
check lv_field $vg/$lv1 region_size "4.00k"
+# to slow down extension - slowdown readings
+aux delayzero_dev "$dev1" 50 0 "${sector}:"
+
+dmsetup table
+dmsetup info -c
+dmsetup status
# Extend so that full MD bitmap page is consumed
-lvextend -y -L+${lvext}M $vg/$lv1
+lvextend -vvvv -y -L+${lvext}M $vg/$lv1
not check lv_field $vg/$lv1 sync_percent "100.00"
check lv_field $vg/$lv1 size "$(($lvsz)).00m" $vg/$lv1
+lvs -a $vg
aux wait_for_sync $vg $lv1
check lv_field $vg/$lv1 sync_percent "100.00"
@@ -64,4 +78,7 @@ aux wait_for_sync $vg $lv1
check lv_field $vg/$lv1 sync_percent "100.00"
check lv_field $vg/$lv1 size "$(($lvsz+$lvext)).00m" $vg/$lv1
+aux enable_dev "$dev1"
+aux enable_dev "$dev2"
+
vgremove -ff $vg
2 years, 7 months
stable-2.02 - tests: add aux delayzero_dev support
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=5ac48c0655c9b0da684...
Commit: 5ac48c0655c9b0da6846dca30e1250f9a1f78f70
Parent: 8744d97c7b974a1ad990a0b7e61fa496a9500a52
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Sep 4 13:50:05 2020 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Oct 16 17:07:58 2020 +0200
tests: add aux delayzero_dev support
Just like we have 'writeerror_dev' supporting creation of device
which 'readable' segment and segments where write will fail we
have now support for delay zero mappings.
This is useful if we want to 'fake' large writing areas where we do
not really care about the actual 'disk' content - since we test
operation logic and it doesn't matter we read and write zeroes.
With combination with 'delay' target we can create specific mappings
and avoid using large memory areas of ramdisk.
---
test/lib/aux.sh | 31 +++++++++++++++++++++++++++++++
1 file changed, 31 insertions(+)
diff --git a/test/lib/aux.sh b/test/lib/aux.sh
index 7a8d054e9..3c39151ae 100644
--- a/test/lib/aux.sh
+++ b/test/lib/aux.sh
@@ -565,6 +565,7 @@ teardown() {
unset LVM_LOG_FILE_EPOCH
test ! -f ERR_DEV || should dmsetup remove $(cat ERR_DEV_NAME)
+ test ! -f ZERO_DEV || should dmsetup remove $(cat ZERO_DEV_NAME)
if test -f TESTNAME ; then
@@ -957,6 +958,11 @@ common_dev_() {
}
shift 2
;;
+ delayzero)
+ shift 2
+ # zero delay is just equivalent to 'zero_dev'
+ test "$read_ms" -eq 0 && test "$write_ms" -eq 0 && tgtype="zero"
+ ;;
# error|zero target does not take read_ms & write_ms only offset list
esac
@@ -989,6 +995,8 @@ common_dev_() {
echo "$from $len delay $pvdev $(( pos + offset )) $read_ms $pvdev $(( pos + offset )) $write_ms" ;;
writeerror)
echo "$from $len delay $pvdev $(( pos + offset )) 0 $(cat ERR_DEV) 0 0" ;;
+ delayzero)
+ echo "$from $len delay $(cat ZERO_DEV) 0 $read_ms $(cat ZERO_DEV) 0 $write_ms" ;;
error|zero)
echo "$from $len $tgtype" ;;
esac
@@ -1151,6 +1159,29 @@ writeerror_dev() {
common_dev_ writeerror "$@"
}
+#
+# Convert device to device with sections of delayed zero read and writes.
+# For this 'delay' dev will use extra new TEST-zerodev (huge zero target)
+# and reroutes reads and writes
+# i.e. delayzero_dev "$dev1" 8:32
+delayzero_dev() {
+ local name=${PREFIX}-zerodev
+
+ if test ! -e ZERO_DEV; then
+ # delay target is used for error mapping
+ if test ! -f HAVE_DM_DELAY ; then
+ target_at_least dm-delay 1 1 0 || return 0
+ touch HAVE_DM_DELAY
+ fi
+ dmsetup create -u "TEST-$name" "$name" --table "0 4611686018427387904 zero"
+ # Take major:minor of our error device
+ echo "$name" > ZERO_DEV_NAME
+ dmsetup info -c --noheadings -o major,minor "$name" > ZERO_DEV
+ fi
+
+ common_dev_ delayzero "$@"
+}
+
#
# Convert existing device to a device with zero segments
# Takes the list of pairs of zero segment from:len
2 years, 7 months
stable-2.02 - alloc: improve estimation of sufficient_pes_free
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=8744d97c7b974a1ad99...
Commit: 8744d97c7b974a1ad990a0b7e61fa496a9500a52
Parent: 6b1f67da0699d408477b6cdd79cdd34f8b4b98cd
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Sep 11 20:57:20 2020 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Oct 16 17:07:58 2020 +0200
alloc: improve estimation of sufficient_pes_free
Metadata size was calculated correctly only for raids.
Fixes problem for crash during lvcreate when thin-pool was created
on a VG where remaining free space had the size to only fit a single
metadata LV and not also its _pmspare.
Lvcreate crashed with this assert message:
lvcreate: metadata/pv_map.c:198: consume_pv_area: Assertion `to_go <= pva->count' failed.
Aborted (core dumped)
TODO: there is probably to large overload of several alloc_handle
variables.
Reported-by: Wu Guanghao<wuguanghao3(a)huawei.com>
Reported-by: Zhiqiang Liu <liuzhiqiang26(a)huawei.com>
---
WHATS_NEW | 1 +
lib/metadata/lv_manip.c | 6 +++---
2 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index c902ccde5..125e094ee 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.188 -
==================================
+ Improve estimation of needed extents when creating thin-pool.
Use extra 1% when resizing thin-pool metadata LV with --use-policy.
Enhance --use-policy percentage rounding.
Switch code base to use flexible array syntax.
diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c
index 74b2afa96..cbd4798ac 100644
--- a/lib/metadata/lv_manip.c
+++ b/lib/metadata/lv_manip.c
@@ -1698,12 +1698,12 @@ static int _sufficient_pes_free(struct alloc_handle *ah, struct dm_list *pvms,
{
uint32_t area_extents_needed = (extents_still_needed - allocated) * ah->area_count / ah->area_multiple;
uint32_t parity_extents_needed = (extents_still_needed - allocated) * ah->parity_count / ah->area_multiple;
- uint32_t metadata_extents_needed = ah->alloc_and_split_meta ? 0 : ah->metadata_area_count * RAID_METADATA_AREA_LEN; /* One each */
- uint32_t total_extents_needed = area_extents_needed + parity_extents_needed + metadata_extents_needed;
+ uint32_t metadata_extents_needed = ah->alloc_and_split_meta ? 0 : ah->metadata_area_count * RAID_METADATA_AREA_LEN + ah->log_len; /* One each */
+ uint64_t total_extents_needed = (uint64_t)area_extents_needed + parity_extents_needed + metadata_extents_needed;
uint32_t free_pes = pv_maps_size(pvms);
if (total_extents_needed > free_pes) {
- log_error("Insufficient free space: %" PRIu32 " extents needed,"
+ log_error("Insufficient free space: %" PRIu64 " extents needed,"
" but only %" PRIu32 " available",
total_extents_needed, free_pes);
return 0;
2 years, 7 months
stable-2.02 - thin: compensate metadata size by extra percent
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=6b1f67da0699d408477...
Commit: 6b1f67da0699d408477b6cdd79cdd34f8b4b98cd
Parent: e5066339a5c61c5d5e8cd365071526cdd07ec04c
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Sep 11 13:31:55 2020 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Oct 16 17:07:58 2020 +0200
thin: compensate metadata size by extra percent
When using --use-policy for automatic extension of thin-pool,
the extension of thin-pool's metadata itself can actually take
some extra space.
Since I'm not aware of exact compensation formula, add just
1% extra to calculated amount and hope it fits.
Wanted target is to always have usable thin-pool that fits
bellow pool_metadata_min_threshold().
---
WHATS_NEW | 1 +
lib/metadata/lv_manip.c | 4 +++-
2 files changed, 4 insertions(+), 1 deletion(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 86c0274b3..c902ccde5 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.188 -
==================================
+ Use extra 1% when resizing thin-pool metadata LV with --use-policy.
Enhance --use-policy percentage rounding.
Switch code base to use flexible array syntax.
Preserve uint32_t for seqno handling.
diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c
index affce9433..74b2afa96 100644
--- a/lib/metadata/lv_manip.c
+++ b/lib/metadata/lv_manip.c
@@ -4724,7 +4724,9 @@ static int _lvresize_adjust_policy(const struct logical_volume *lv,
min_threshold = pool_metadata_min_threshold(first_seg(lv)) / DM_PERCENT_1;
*meta_amount = _adjust_amount(percent, (min_threshold < policy_threshold) ?
min_threshold : policy_threshold, policy_amount);
-
+ if (*meta_amount)
+ /* Compensate possible extra space consumption by kernel on resize */
+ (*meta_amount)++;
if (!lv_thin_pool_percent(lv, 0, &percent))
return_0;
} else {
2 years, 7 months
stable-2.02 - cleanup: comment typo
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=e5066339a5c61c5d5e8...
Commit: e5066339a5c61c5d5e8cd365071526cdd07ec04c
Parent: 5190e16c30dcf3ed76a756ff0a5e54342f477abd
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Thu Sep 10 22:38:13 2020 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Oct 16 17:07:58 2020 +0200
cleanup: comment typo
---
lib/metadata/thin_manip.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/metadata/thin_manip.c b/lib/metadata/thin_manip.c
index 3aab29708..02a97d588 100644
--- a/lib/metadata/thin_manip.c
+++ b/lib/metadata/thin_manip.c
@@ -224,7 +224,7 @@ int thin_pool_feature_supported(const struct logical_volume *lv, int feature)
int pool_metadata_min_threshold(const struct lv_segment *pool_seg)
{
/*
- * Hardcoded minimal requirment for thin pool target.
+ * Hardcoded minimal requirement for thin pool target.
*
* In the metadata LV there should be minimum from either 4MiB of free space
* or at least 25% of free space, which applies when the size of thin pool's
2 years, 7 months
stable-2.02 - lvextend: improve percentage estimation
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=5190e16c30dcf3ed76a...
Commit: 5190e16c30dcf3ed76a756ff0a5e54342f477abd
Parent: 68f94a2dd38da38d705051b055caf231ad6fb100
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Thu Sep 10 22:38:34 2020 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Oct 16 17:07:58 2020 +0200
lvextend: improve percentage estimation
Correcting rounding rules for percentage evaluation.
Validate supported range of percentage.
(although ranges are already validated earlier on code path)
---
WHATS_NEW | 1 +
lib/metadata/lv_manip.c | 5 +++--
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 32dcd5f34..86c0274b3 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.188 -
==================================
+ Enhance --use-policy percentage rounding.
Switch code base to use flexible array syntax.
Preserve uint32_t for seqno handling.
Switch from mmap to plain read when loading regular files.
diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c
index 945f5cb60..affce9433 100644
--- a/lib/metadata/lv_manip.c
+++ b/lib/metadata/lv_manip.c
@@ -4652,7 +4652,7 @@ static int _fsadm_cmd(enum fsadm_cmd_e fcmd,
static uint32_t _adjust_amount(dm_percent_t percent, int policy_threshold, int policy_amount)
{
- if (!(DM_PERCENT_0 < percent && percent <= DM_PERCENT_100) ||
+ if (!((50 * DM_PERCENT_1) < percent && percent <= DM_PERCENT_100) ||
percent <= (policy_threshold * DM_PERCENT_1))
return 0; /* nothing to do */
/*
@@ -4660,7 +4660,8 @@ static uint32_t _adjust_amount(dm_percent_t percent, int policy_threshold, int p
* Keep using DM_PERCENT_1 units for better precision.
* Round-up to needed percentage value
*/
- percent = (percent / policy_threshold + (DM_PERCENT_1 - 1) / 100) / (DM_PERCENT_1 / 100) - 100;
+ policy_threshold *= (DM_PERCENT_1 / 100);
+ percent = (percent + policy_threshold - 1) / policy_threshold - 100;
/* Use it if current policy amount is smaller */
return (policy_amount < percent) ? (uint32_t) percent : (uint32_t) policy_amount;
2 years, 7 months
stable-2.02 - man: correctly use configured directories
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=68f94a2dd38da38d705...
Commit: 68f94a2dd38da38d705051b055caf231ad6fb100
Parent: 6d2fc49e9957308e6c770c2a84f3a34b9b416d2b
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Wed Sep 9 13:22:37 2020 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Oct 16 17:07:58 2020 +0200
man: correctly use configured directories
---
man/lvmdump.8_main | 4 ++--
man/lvmlockd.8_main | 2 +-
man/lvmthin.7_main | 6 +++---
3 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/man/lvmdump.8_main b/man/lvmdump.8_main
index ec3dbb2ea..c42f80917 100644
--- a/man/lvmdump.8_main
+++ b/man/lvmdump.8_main
@@ -26,7 +26,7 @@ The content of the tarball is as follows:
.br
- recent entries from /var/log/messages (containing system messages)
.br
-- complete lvm configuration and cache (content of /etc/lvm)
+- complete lvm configuration and cache (content of #DEFAULT_SYS_DIR#)
.br
- list of device nodes present under /dev
.br
@@ -102,7 +102,7 @@ database content (the output of 'udevadm info --export-db' command).
\fBLVM_BINARY\fP
The LVM2 binary to use.
Defaults to "lvm".
-Sometimes you might need to set this to "/sbin/lvm.static", for example.
+Sometimes you might need to set this to "#LVM_PATH#/lvm.static", for example.
.TP
\fBDMSETUP_BINARY\fP
The dmsetup binary to use.
diff --git a/man/lvmlockd.8_main b/man/lvmlockd.8_main
index b917d9381..80c23b7ea 100644
--- a/man/lvmlockd.8_main
+++ b/man/lvmlockd.8_main
@@ -110,7 +110,7 @@ use_lvmlockd = 1
.br
Assign each host a unique host_id in the range 1-2000 by setting
.br
-/etc/lvm/lvmlocal.conf local/host_id
+#DEFAULT_SYS_DIR#/lvmlocal.conf local/host_id
.SS 3. start lvmlockd
diff --git a/man/lvmthin.7_main b/man/lvmthin.7_main
index 27bad5731..5a2ccc440 100644
--- a/man/lvmthin.7_main
+++ b/man/lvmthin.7_main
@@ -902,7 +902,7 @@ To change these values globally, edit
To change these values on a per-VG or per-LV basis, attach a "profile" to
the VG or LV. A profile is a collection of config settings, saved in a
local text file (using the lvm.conf format). lvm looks for profiles in
-the profile_dir directory, e.g. /etc/lvm/profile/. Once attached to a VG
+the profile_dir directory, e.g. #DEFAULT_SYS_DIR#/profile/. Once attached to a VG
or LV, lvm will process the VG or LV using the settings from the attached
profile. A profile is named and referenced by its file name.
@@ -930,9 +930,9 @@ Extend the LV using the profile settings:
.br
.nf
# lvmconfig config/profile_dir
-profile_dir="/etc/lvm/profile"
+profile_dir="#DEFAULT_SYS_DIR#/profile"
-# cat /etc/lvm/profile/pool0extend.profile
+# cat #DEFAULT_SYS_DIR#/profile/pool0extend.profile
activation {
thin_pool_autoextend_threshold=50
thin_pool_autoextend_percent=10
2 years, 7 months
stable-2.02 - lv_manip: add synchronization points
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=6d2fc49e9957308e6c7...
Commit: 6d2fc49e9957308e6c770c2a84f3a34b9b416d2b
Parent: d063ea27b46f2c3e2575a55576ea15e5957657c6
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Tue Sep 8 15:20:50 2020 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Oct 16 17:07:58 2020 +0200
lv_manip: add synchronization points
---
lib/metadata/lv_manip.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c
index 97bab5256..945f5cb60 100644
--- a/lib/metadata/lv_manip.c
+++ b/lib/metadata/lv_manip.c
@@ -7322,6 +7322,9 @@ out:
r = 0; /* Continue deactivating as many as possible. */
}
+ if (!sync_local_dev_names(vg->cmd))
+ log_debug("Failed to sync local device names after deactivation of wiped volumes.");
+
return r;
}
2 years, 7 months
stable-2.02 - lvconvert: flip return value of _raid_split_image_conversion
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=d063ea27b46f2c3e257...
Commit: d063ea27b46f2c3e2575a55576ea15e5957657c6
Parent: 0bd9eb80c9037da729891ab1bee4d6026ac4a5ac
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Sep 4 20:55:02 2020 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Oct 16 17:07:58 2020 +0200
lvconvert: flip return value of _raid_split_image_conversion
Use '0' for error and '1' as success.
Also drop INTERNAL_ERROR from path - as this error
is ATM used for invalid devices.
(i.e. test lvconvert-raid1-split-trackchanges.sh)
---
tools/lvconvert.c | 30 +++++++++++++++---------------
1 file changed, 15 insertions(+), 15 deletions(-)
diff --git a/tools/lvconvert.c b/tools/lvconvert.c
index 014163f49..4da9655e8 100644
--- a/tools/lvconvert.c
+++ b/tools/lvconvert.c
@@ -1179,7 +1179,7 @@ static int _raid_split_image_conversion(struct logical_volume *lv)
if (lv_is_raid_with_tracking(lv)) {
log_error("Conversion of tracking raid1 LV %s is not supported.",
display_lvname(lv));
- return 1;
+ return 0;
}
if (lv_is_raid_image(lv) &&
@@ -1187,19 +1187,19 @@ static int _raid_split_image_conversion(struct logical_volume *lv)
(void) dm_strncpy(raidlv_name, lv->name, s - lv->name);
if (!(tmp_lv = find_lv(lv->vg, raidlv_name))) {
- log_error(INTERNAL_ERROR "Failed to find RaidLV of RAID subvolume %s.",
+ log_error("Failed to find RaidLV of RAID subvolume %s.",
display_lvname(lv));
- return 1;
+ return 0;
}
if (lv_is_raid_with_tracking(tmp_lv)) {
log_error("Conversion of tracked raid1 subvolume %s is not supported.",
display_lvname(lv));
- return 1;
+ return 0;
}
}
- return 0;
+ return 1;
}
/*
@@ -1217,8 +1217,8 @@ static int _lvconvert_mirrors(struct cmd_context *cmd,
uint32_t new_mimage_count = 0;
uint32_t new_log_count = 0;
- if (_raid_split_image_conversion(lv))
- return 0;
+ if (!_raid_split_image_conversion(lv))
+ return_0;
if ((lp->corelog || lp->mirrorlog) && *lp->type_str && strcmp(lp->type_str, SEG_TYPE_NAME_MIRROR)) {
log_error("--corelog and --mirrorlog are only compatible with mirror devices.");
@@ -1337,8 +1337,8 @@ static int _lvconvert_raid(struct logical_volume *lv, struct lvconvert_params *l
struct cmd_context *cmd = lv->vg->cmd;
struct lv_segment *seg = first_seg(lv);
- if (_raid_split_image_conversion(lv))
- return 0;
+ if (!_raid_split_image_conversion(lv))
+ return_0;
if (_linear_type_requested(lp->type_str)) {
if (arg_is_set(cmd, mirrors_ARG) && (arg_uint_value(cmd, mirrors_ARG, 0) != 0)) {
@@ -2633,8 +2633,8 @@ static int _lvconvert_to_thin_with_external(struct cmd_context *cmd,
.virtual_extents = lv->le_count,
};
- if (_raid_split_image_conversion(lv))
- return 0;
+ if (!_raid_split_image_conversion(lv))
+ return_0;
if (lv == thinpool_lv) {
log_error("Can't use same LV %s for thin pool and thin volume.",
@@ -2945,8 +2945,8 @@ static int _lvconvert_to_pool(struct cmd_context *cmd,
struct id lockd_meta_id;
const char *str_seg_type = to_cachepool ? SEG_TYPE_NAME_CACHE_POOL : SEG_TYPE_NAME_THIN_POOL;
- if (_raid_split_image_conversion(lv))
- return 0;
+ if (!_raid_split_image_conversion(lv))
+ return_0;
if (lv_is_thin_pool(lv) || lv_is_cache_pool(lv)) {
log_error(INTERNAL_ERROR "LV %s is already a pool.", display_lvname(lv));
@@ -3399,8 +3399,8 @@ static int _lvconvert_to_cache_vol(struct cmd_context *cmd,
struct dm_config_tree *policy_settings = NULL;
int r = 0;
- if (_raid_split_image_conversion(lv))
- return 0;
+ if (!_raid_split_image_conversion(lv))
+ return_0;
/* If LV is inactive here, ensure it's not active elsewhere. */
if (!lockd_lv(cmd, lv, "ex", 0))
2 years, 7 months
stable-2.02 - cleanup: better expressing passing key arg to _hash
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=0bd9eb80c9037da7298...
Commit: 0bd9eb80c9037da729891ab1bee4d6026ac4a5ac
Parent: f0c281f9a94dead2e32737f69f5e42a757433900
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Sat Aug 29 22:37:17 2020 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Oct 16 16:02:06 2020 +0200
cleanup: better expressing passing key arg to _hash
---
libdm/datastruct/hash.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/libdm/datastruct/hash.c b/libdm/datastruct/hash.c
index 992f4fad9..3e4adfdc0 100644
--- a/libdm/datastruct/hash.c
+++ b/libdm/datastruct/hash.c
@@ -57,26 +57,27 @@ static unsigned char _nums[] = {
209
};
-static struct dm_hash_node *_create_node(const char *str, unsigned len)
+static struct dm_hash_node *_create_node(const void *key, unsigned len)
{
struct dm_hash_node *n = dm_malloc(sizeof(*n) + len);
if (n) {
- memcpy(n->key, str, len);
+ memcpy(n->key, key, len);
n->keylen = len;
}
return n;
}
-static unsigned long _hash(const char *str, unsigned len)
+static unsigned long _hash(const void *key, unsigned len)
{
+ const unsigned char *str = key;
unsigned long h = 0, g;
unsigned i;
for (i = 0; i < len; i++) {
h <<= 4;
- h += _nums[(unsigned char) *str++];
+ h += _nums[*str++];
g = h & ((unsigned long) 0xf << 16u);
if (g) {
h ^= g >> 16u;
2 years, 7 months