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

tests: use DIRECT io for zeroing whenver we can

Performance with direct I/O here is noticable better,
so use it instead of buffered write whenever we can.
This commit is contained in:
Zdenek Kabelac 2020-09-19 23:25:11 +02:00
parent 531a475afc
commit f2878a801c
15 changed files with 97 additions and 127 deletions

View File

@ -46,10 +46,17 @@ vgremove -ff $vg
trap 'cleanup_mounted_and_teardown' EXIT trap 'cleanup_mounted_and_teardown' EXIT
dd if=/dev/zero of=loopa bs=$((1024*1024)) count=64 2> /dev/null # Currently (5.9-rc5 hits 'blkdev_issue_discard()' kernel WARNING)
dd if=/dev/zero of=loopb bs=$((1024*1024)) count=64 2> /dev/null #truncate -s 64M loopa
dd if=/dev/zero of=loopc bs=$((1024*1024)) count=64 2> /dev/null #truncate -s 64M loopb
dd if=/dev/zero of=loopd bs=$((1024*1024)) count=64 2> /dev/null #truncate -s 64M loopc
#truncate -s 64M loopd
dd if=/dev/zero of=loopa bs=1M count=64 oflag=sync
dd if=/dev/zero of=loopb bs=1M count=64 oflag=sync
dd if=/dev/zero of=loopc bs=1M count=64 oflag=sync
dd if=/dev/zero of=loopd bs=1M count=64 oflag=sync
LOOP1=$(losetup -f loopa --show) LOOP1=$(losetup -f loopa --show)
LOOP2=$(losetup -f loopb --show) LOOP2=$(losetup -f loopb --show)
LOOP3=$(losetup -f loopc --sector-size 4096 --show) LOOP3=$(losetup -f loopc --sector-size 4096 --show)

View File

@ -37,11 +37,11 @@ dd if=/dev/urandom of=randC bs=512K count=4
_prepare_vg() { _prepare_vg() {
# zero devs so we are sure to find the correct file data # zero devs so we are sure to find the correct file data
# on the underlying devs when corrupting it # on the underlying devs when corrupting it
dd if=/dev/zero of="$dev1" bs=1M || true dd if=/dev/zero of="$dev1" bs=1M oflag=direct || true
dd if=/dev/zero of="$dev2" bs=1M || true dd if=/dev/zero of="$dev2" bs=1M oflag=direct || true
dd if=/dev/zero of="$dev3" bs=1M || true dd if=/dev/zero of="$dev3" bs=1M oflag=direct || true
dd if=/dev/zero of="$dev4" bs=1M || true dd if=/dev/zero of="$dev4" bs=1M oflag=direct || true
dd if=/dev/zero of="$dev5" bs=1M || true dd if=/dev/zero of="$dev5" bs=1M oflag=direct || true
vgcreate $SHARED $vg "$dev1" "$dev2" "$dev3" "$dev4" "$dev5" vgcreate $SHARED $vg "$dev1" "$dev2" "$dev3" "$dev4" "$dev5"
pvs pvs
} }

View File

@ -32,9 +32,9 @@ lvcreate -H -L14 -n $lv1 --cachemode writeback --cachesettings migration_thresho
for i in $(seq 1 10) ; do for i in $(seq 1 10) ; do
echo 3 >/proc/sys/vm/drop_caches echo 3 >/proc/sys/vm/drop_caches
dd if=/dev/zero of="$DM_DEV_DIR/$vg/$lv1" bs=64K count=20 conv=fdatasync || true dd if=/dev/zero of="$DM_DEV_DIR/$vg/$lv1" bs=64K count=20 oflag=direct || true
echo 3 >/proc/sys/vm/drop_caches echo 3 >/proc/sys/vm/drop_caches
dd if="$DM_DEV_DIR/$vg/$lv1" of=/dev/null bs=64K count=20 || true dd if="$DM_DEV_DIR/$vg/$lv1" of=/dev/null bs=64K count=20 oflag=direct || true
done done
lvs -o+cache_dirty_blocks,cache_read_hits,cache_read_misses,cache_write_hits,cache_write_misses $vg/$lv1 lvs -o+cache_dirty_blocks,cache_read_hits,cache_read_misses,cache_write_hits,cache_write_misses $vg/$lv1

View File

@ -49,7 +49,7 @@ lvcreate -V10G $vg/pool3 -n $lv1
lvcreate -V2G $vg/pool3 -n $lv2 lvcreate -V2G $vg/pool3 -n $lv2
dd if=/dev/zero of="$DM_DEV_DIR/$vg/$lv1" bs=512b count=1 conv=fdatasync dd if=/dev/zero of="$DM_DEV_DIR/$vg/$lv1" bs=512b count=1 conv=fdatasync
# ...excercise write speed to 'zero' device ;) # ...excercise write speed to 'zero' device ;)
dd if=/dev/zero of="$DM_DEV_DIR/$vg/$lv2" bs=64K count=32767 conv=fdatasync dd if=/dev/zero of="$DM_DEV_DIR/$vg/$lv2" bs=64K count=32767 oflag=direct
lvs -a $vg lvs -a $vg
# Check the percentage is not shown as 0.00 # Check the percentage is not shown as 0.00
check lv_field $vg/$lv1 data_percent "0.01" check lv_field $vg/$lv1 data_percent "0.01"

View File

@ -27,9 +27,9 @@ get_devs
# is needed. # is needed.
# #
dd if=/dev/zero of="$dev1" || true dd if=/dev/zero of="$dev1" bs=1M count=1 oflag=direct
dd if=/dev/zero of="$dev2" || true dd if=/dev/zero of="$dev2" bs=1M count=1 oflag=direct
dd if=/dev/zero of="$dev3" || true dd if=/dev/zero of="$dev3" bs=1M count=1 oflag=direct
vgcreate $SHARED $vg "$dev1" "$dev2" "$dev3" vgcreate $SHARED $vg "$dev1" "$dev2" "$dev3"
@ -74,5 +74,3 @@ pvs "$dev3"
vgchange -an $vg vgchange -an $vg
vgremove -ff $vg vgremove -ff $vg

View File

@ -17,11 +17,11 @@ SIZE_MB=80
aux prepare_devs 4 $SIZE_MB aux prepare_devs 4 $SIZE_MB
get_devs get_devs
dd if=/dev/zero of="$dev1" bs=1M count=2 conv=fdatasync dd if=/dev/zero of="$dev1" bs=1M count=2 oflag=direct
dd if=/dev/zero of="$dev2" bs=1M count=2 conv=fdatasync dd if=/dev/zero of="$dev2" bs=1M count=2 oflag=direct
# clear entire dev to cover mda2 # clear entire dev to cover mda2
dd if=/dev/zero of="$dev3" bs=1M count=$SIZE_MB conv=fdatasync dd if=/dev/zero of="$dev3" bs=1M count=$SIZE_MB oflag=direct
dd if=/dev/zero of="$dev4" bs=1M count=2 conv=fdatasync dd if=/dev/zero of="$dev4" bs=1M count=2 oflag=direct
pvcreate "$dev1" pvcreate "$dev1"
pvcreate "$dev2" pvcreate "$dev2"
@ -136,10 +136,10 @@ vgremove -ff $vg
# clear entire dev to cover mda2 # clear entire dev to cover mda2
dd if=/dev/zero of="$dev1" bs=1M count=$SIZE_MB conv=fdatasync dd if=/dev/zero of="$dev1" bs=1M count=$SIZE_MB oflag=direct
dd if=/dev/zero of="$dev2" bs=1M count=32 conv=fdatasync dd if=/dev/zero of="$dev2" bs=1M count=32 oflag=direct
dd if=/dev/zero of="$dev3" bs=1M count=32 conv=fdatasync dd if=/dev/zero of="$dev3" bs=1M count=32 oflag=direct
dd if=/dev/zero of="$dev4" bs=1M count=32 conv=fdatasync dd if=/dev/zero of="$dev4" bs=1M count=32 oflag=direct
pvcreate --pvmetadatacopies 2 --metadatasize 32M "$dev1" pvcreate --pvmetadatacopies 2 --metadatasize 32M "$dev1"
@ -160,7 +160,7 @@ dd if="$dev1" of=dev1dd bs=1M count=34
# Clear the header so that we force metadata_search to use # Clear the header so that we force metadata_search to use
# the settings instead of getting the mda_size/mda_offset # the settings instead of getting the mda_size/mda_offset
# from the headers. # from the headers.
dd if=/dev/zero of="$dev1" bs=4K count=1 dd if=/dev/zero of="$dev1" bs=4K count=1 oflag=direct
# Warning: these checks are based on copying specific numbers # Warning: these checks are based on copying specific numbers
# seen when running these commands, but these numbers could # seen when running these commands, but these numbers could
@ -192,6 +192,6 @@ grep "seqno 477" m1b
grep "seqno 478" m1b grep "seqno 478" m1b
grep "seqno 500" m2 grep "seqno 500" m2
dd if=dev1dd of="$dev1" bs=4K count=1 dd if=dev1dd of="$dev1" bs=4K count=1 oflag=direct
vgremove -ff $vg vgremove -ff $vg

View File

@ -12,13 +12,33 @@
. lib/inittest . lib/inittest
aux prepare_devs 2 SIZE=34
_prepare_vg() {
rm -f meta debug.log_DEBUG*
for i in "$@" ; do
dd if=/dev/zero of="$i" bs=1M count=1 oflag=direct
done
vgcreate $vg "$@"
}
_clear_devs() {
rm -f meta debug.log_DEBUG*
for i in "$@" ; do
dd if=/dev/zero of="$i" bs=1M count=$SIZE oflag=direct
done
}
_prepare_vg_with_copy() {
_clear_devs "$@"
vgcreate --pvmetadatacopies 2 $vg "$@"
}
aux prepare_devs 2 $SIZE
get_devs get_devs
# One PV, one mda, pv_header zeroed # One PV, one mda, pv_header zeroed
rm meta || true _prepare_vg "$dev1"
dd if=/dev/zero of="$dev1" || true
vgcreate $vg "$dev1"
dd if=/dev/zero of="$dev1" bs=512 count=2 dd if=/dev/zero of="$dev1" bs=512 count=2
pvck --dump headers "$dev1" || true pvck --dump headers "$dev1" || true
pvck --dump metadata_search --settings seqno=1 -f meta "$dev1" || true pvck --dump metadata_search --settings seqno=1 -f meta "$dev1" || true
@ -28,9 +48,7 @@ vgs $vg
lvcreate -l1 -an $vg lvcreate -l1 -an $vg
# One PV, one mda, mda_header zeroed # One PV, one mda, mda_header zeroed
rm meta || true _prepare_vg "$dev1"
dd if=/dev/zero of="$dev1" || true
vgcreate $vg "$dev1"
dd if=/dev/zero of="$dev1" bs=512 count=1 seek=8 dd if=/dev/zero of="$dev1" bs=512 count=1 seek=8
pvck --dump headers "$dev1" || true pvck --dump headers "$dev1" || true
pvck --dump metadata_search --settings seqno=1 -f meta "$dev1" || true pvck --dump metadata_search --settings seqno=1 -f meta "$dev1" || true
@ -40,9 +58,7 @@ vgs $vg
lvcreate -l1 -an $vg lvcreate -l1 -an $vg
# One PV, one mda, pv_header and mda_header zeroed # One PV, one mda, pv_header and mda_header zeroed
rm meta || true _prepare_vg "$dev1"
dd if=/dev/zero of="$dev1" || true
vgcreate $vg "$dev1"
dd if=/dev/zero of="$dev1" bs=512 count=2 dd if=/dev/zero of="$dev1" bs=512 count=2
dd if=/dev/zero of="$dev1" bs=512 count=1 seek=8 dd if=/dev/zero of="$dev1" bs=512 count=1 seek=8
pvck --dump headers "$dev1" || true pvck --dump headers "$dev1" || true
@ -53,9 +69,7 @@ vgs $vg
lvcreate -l1 -an $vg lvcreate -l1 -an $vg
# One PV, one mda, metadata zeroed, use backup # One PV, one mda, metadata zeroed, use backup
rm meta || true _prepare_vg "$dev1"
dd if=/dev/zero of="$dev1" || true
vgcreate $vg "$dev1"
vgcfgbackup vgcfgbackup
dd if=/dev/zero of="$dev1" bs=512 count=2 seek=9 dd if=/dev/zero of="$dev1" bs=512 count=2 seek=9
pvck --dump headers "$dev1" || true pvck --dump headers "$dev1" || true
@ -67,9 +81,7 @@ vgs $vg
lvcreate -l1 -an $vg lvcreate -l1 -an $vg
# One PV, one mda, mda_header and metadata zeroed, use backup # One PV, one mda, mda_header and metadata zeroed, use backup
rm meta || true _prepare_vg "$dev1"
dd if=/dev/zero of="$dev1" || true
vgcreate $vg "$dev1"
vgcfgbackup vgcfgbackup
dd if=/dev/zero of="$dev1" bs=512 count=3 seek=8 dd if=/dev/zero of="$dev1" bs=512 count=3 seek=8
pvck --dump headers "$dev1" || true pvck --dump headers "$dev1" || true
@ -81,9 +93,7 @@ vgs $vg
lvcreate -l1 -an $vg lvcreate -l1 -an $vg
# One PV, one mda, pv_header, mda_header and metadata zeroed, use backup # One PV, one mda, pv_header, mda_header and metadata zeroed, use backup
rm meta || true _prepare_vg "$dev1"
dd if=/dev/zero of="$dev1" || true
vgcreate $vg "$dev1"
vgcfgbackup vgcfgbackup
dd if=/dev/zero of="$dev1" bs=512 count=2 dd if=/dev/zero of="$dev1" bs=512 count=2
dd if=/dev/zero of="$dev1" bs=512 count=3 seek=8 dd if=/dev/zero of="$dev1" bs=512 count=3 seek=8
@ -96,9 +106,7 @@ vgs $vg
lvcreate -l1 -an $vg lvcreate -l1 -an $vg
# One PV, two mdas, pv_header zeroed # One PV, two mdas, pv_header zeroed
rm meta || true _prepare_vg_with_copy "$dev1"
dd if=/dev/zero of="$dev1" || true
vgcreate --pvmetadatacopies 2 $vg "$dev1"
dd if=/dev/zero of="$dev1" bs=512 count=2 dd if=/dev/zero of="$dev1" bs=512 count=2
pvck --dump headers "$dev1" || true pvck --dump headers "$dev1" || true
pvck --dump metadata_search --settings seqno=1 -f meta "$dev1" || true pvck --dump metadata_search --settings seqno=1 -f meta "$dev1" || true
@ -108,9 +116,7 @@ vgs $vg
lvcreate -l1 -an $vg lvcreate -l1 -an $vg
# One PV, two mdas, mda_header1 zeroed # One PV, two mdas, mda_header1 zeroed
rm meta || true _prepare_vg_with_copy "$dev1"
dd if=/dev/zero of="$dev1" || true
vgcreate --pvmetadatacopies 2 $vg "$dev1"
pvck --dump headers "$dev1" || true pvck --dump headers "$dev1" || true
dd if=/dev/zero of="$dev1" bs=512 count=1 seek=8 dd if=/dev/zero of="$dev1" bs=512 count=1 seek=8
pvck --dump headers "$dev1" || true pvck --dump headers "$dev1" || true
@ -125,9 +131,7 @@ vgs $vg
lvcreate -l1 -an $vg lvcreate -l1 -an $vg
# One PV, two mdas, pv_header and mda_header1 zeroed # One PV, two mdas, pv_header and mda_header1 zeroed
rm meta || true _prepare_vg_with_copy "$dev1"
dd if=/dev/zero of="$dev1" || true
vgcreate --pvmetadatacopies 2 $vg "$dev1"
pvck --dump headers "$dev1" || true pvck --dump headers "$dev1" || true
dd if=/dev/zero of="$dev1" bs=512 count=2 dd if=/dev/zero of="$dev1" bs=512 count=2
dd if=/dev/zero of="$dev1" bs=512 count=1 seek=8 dd if=/dev/zero of="$dev1" bs=512 count=1 seek=8
@ -143,9 +147,7 @@ vgs $vg
lvcreate -l1 -an $vg lvcreate -l1 -an $vg
# One PV, two mdas, metadata1 zeroed, use mda2 # One PV, two mdas, metadata1 zeroed, use mda2
rm meta || true _prepare_vg_with_copy "$dev1"
dd if=/dev/zero of="$dev1" || true
vgcreate --pvmetadatacopies 2 $vg "$dev1"
pvck --dump headers "$dev1" || true pvck --dump headers "$dev1" || true
dd if=/dev/zero of="$dev1" bs=512 count=2 seek=9 dd if=/dev/zero of="$dev1" bs=512 count=2 seek=9
pvck --dump headers "$dev1" || true pvck --dump headers "$dev1" || true
@ -157,9 +159,7 @@ vgs $vg
lvcreate -l1 -an $vg lvcreate -l1 -an $vg
# One PV, two mdas, mda_header1 and metadata1 zeroed, use mda2 # One PV, two mdas, mda_header1 and metadata1 zeroed, use mda2
rm meta || true _prepare_vg_with_copy "$dev1"
dd if=/dev/zero of="$dev1" || true
vgcreate --pvmetadatacopies 2 $vg "$dev1"
pvck --dump headers "$dev1" || true pvck --dump headers "$dev1" || true
dd if=/dev/zero of="$dev1" bs=512 count=3 seek=8 dd if=/dev/zero of="$dev1" bs=512 count=3 seek=8
pvck --dump headers "$dev1" || true pvck --dump headers "$dev1" || true
@ -171,9 +171,7 @@ vgs $vg
lvcreate -l1 -an $vg lvcreate -l1 -an $vg
# One PV, two mdas, pv_header, mda_header1 and metadata1 zeroed, use mda2 # One PV, two mdas, pv_header, mda_header1 and metadata1 zeroed, use mda2
rm meta || true _prepare_vg_with_copy "$dev1"
dd if=/dev/zero of="$dev1" || true
vgcreate --pvmetadatacopies 2 $vg "$dev1"
pvck --dump headers "$dev1" || true pvck --dump headers "$dev1" || true
dd if=/dev/zero of="$dev1" bs=512 count=2 dd if=/dev/zero of="$dev1" bs=512 count=2
dd if=/dev/zero of="$dev1" bs=512 count=3 seek=8 dd if=/dev/zero of="$dev1" bs=512 count=3 seek=8
@ -190,9 +188,7 @@ lvcreate -l1 -an $vg
# One PV, two mdas, pv_header, both mda_header, and both metadata zeroed, use backup # One PV, two mdas, pv_header, both mda_header, and both metadata zeroed, use backup
# only writes mda1 since there's no evidence that mda2 existed # only writes mda1 since there's no evidence that mda2 existed
rm meta || true _prepare_vg_with_copy "$dev1"
dd if=/dev/zero of="$dev1" || true
vgcreate --pvmetadatacopies 2 $vg "$dev1"
pvck --dump headers "$dev1" || true pvck --dump headers "$dev1" || true
vgcfgbackup vgcfgbackup
dd if=/dev/zero of="$dev1" bs=512 count=2 dd if=/dev/zero of="$dev1" bs=512 count=2
@ -210,9 +206,7 @@ lvcreate -l1 -an $vg
# One PV, two mdas, pv_header, both mda_header, and both metadata zeroed, use backup # One PV, two mdas, pv_header, both mda_header, and both metadata zeroed, use backup
# writes mda1 and also mda2 because of the mda2 settings passed to repair # writes mda1 and also mda2 because of the mda2 settings passed to repair
rm meta || true _prepare_vg_with_copy "$dev1"
dd if=/dev/zero of="$dev1" || true
vgcreate --pvmetadatacopies 2 $vg "$dev1"
pvck --dump headers "$dev1" || true pvck --dump headers "$dev1" || true
vgcfgbackup vgcfgbackup
dd if=/dev/zero of="$dev1" bs=512 count=2 dd if=/dev/zero of="$dev1" bs=512 count=2
@ -229,10 +223,7 @@ vgs $vg
lvcreate -l1 -an $vg lvcreate -l1 -an $vg
# Two PV, one mda each, pv_header and mda_header zeroed on each # Two PV, one mda each, pv_header and mda_header zeroed on each
rm meta || true _prepare_vg "$dev1" "$dev2"
dd if=/dev/zero of="$dev1" || true
dd if=/dev/zero of="$dev2" || true
vgcreate $vg "$dev1" "$dev2"
dd if=/dev/zero of="$dev1" bs=512 count=2 dd if=/dev/zero of="$dev1" bs=512 count=2
dd if=/dev/zero of="$dev2" bs=512 count=2 dd if=/dev/zero of="$dev2" bs=512 count=2
dd if=/dev/zero of="$dev1" bs=512 count=1 seek=8 dd if=/dev/zero of="$dev1" bs=512 count=1 seek=8
@ -248,10 +239,7 @@ vgs $vg
lvcreate -l1 -an $vg lvcreate -l1 -an $vg
# Two PV, one mda each, metadata zeroed on each, use backup # Two PV, one mda each, metadata zeroed on each, use backup
rm meta || true _prepare_vg "$dev1" "$dev2"
dd if=/dev/zero of="$dev1" || true
dd if=/dev/zero of="$dev2" || true
vgcreate $vg "$dev1" "$dev2"
vgcfgbackup vgcfgbackup
dd if=/dev/zero of="$dev1" bs=512 count=2 seek=9 dd if=/dev/zero of="$dev1" bs=512 count=2 seek=9
dd if=/dev/zero of="$dev2" bs=512 count=2 seek=9 dd if=/dev/zero of="$dev2" bs=512 count=2 seek=9
@ -265,10 +253,7 @@ vgs $vg
lvcreate -l1 -an $vg lvcreate -l1 -an $vg
# Two PV, one mda each, pv_header, mda_header and metadata zeroed on each, use backup # Two PV, one mda each, pv_header, mda_header and metadata zeroed on each, use backup
rm meta || true _prepare_vg "$dev1" "$dev2"
dd if=/dev/zero of="$dev1" || true
dd if=/dev/zero of="$dev2" || true
vgcreate $vg "$dev1" "$dev2"
vgcfgbackup vgcfgbackup
dd if=/dev/zero of="$dev1" bs=512 count=2 dd if=/dev/zero of="$dev1" bs=512 count=2
dd if=/dev/zero of="$dev2" bs=512 count=2 dd if=/dev/zero of="$dev2" bs=512 count=2
@ -284,10 +269,7 @@ vgs $vg
lvcreate -l1 -an $vg lvcreate -l1 -an $vg
# Two PV, one mda each, pv_header and mda_header zeroed on first # Two PV, one mda each, pv_header and mda_header zeroed on first
rm meta || true _prepare_vg "$dev1" "$dev2"
dd if=/dev/zero of="$dev1" || true
dd if=/dev/zero of="$dev2" || true
vgcreate $vg "$dev1" "$dev2"
dd if=/dev/zero of="$dev1" bs=512 count=2 dd if=/dev/zero of="$dev1" bs=512 count=2
dd if=/dev/zero of="$dev1" bs=512 count=1 seek=8 dd if=/dev/zero of="$dev1" bs=512 count=1 seek=8
pvck --dump headers "$dev1" || true pvck --dump headers "$dev1" || true
@ -299,10 +281,7 @@ vgs $vg
lvcreate -l1 -an $vg lvcreate -l1 -an $vg
# Two PV, one mda each, metadata zeroed on first # Two PV, one mda each, metadata zeroed on first
rm meta || true _prepare_vg "$dev1" "$dev2"
dd if=/dev/zero of="$dev1" || true
dd if=/dev/zero of="$dev2" || true
vgcreate $vg "$dev1" "$dev2"
dd if=/dev/zero of="$dev1" bs=512 count=2 seek=9 dd if=/dev/zero of="$dev1" bs=512 count=2 seek=9
pvck --dump headers "$dev1" || true pvck --dump headers "$dev1" || true
pvck --dump headers "$dev2" || true pvck --dump headers "$dev2" || true
@ -313,10 +292,7 @@ vgs $vg
lvcreate -l1 -an $vg lvcreate -l1 -an $vg
# Two PV, one mda each, pv_header, mda_header and metadata zeroed on first # Two PV, one mda each, pv_header, mda_header and metadata zeroed on first
rm meta || true _prepare_vg "$dev1" "$dev2"
dd if=/dev/zero of="$dev1" || true
dd if=/dev/zero of="$dev2" || true
vgcreate $vg "$dev1" "$dev2"
dd if=/dev/zero of="$dev1" bs=512 count=2 dd if=/dev/zero of="$dev1" bs=512 count=2
dd if=/dev/zero of="$dev1" bs=512 count=3 seek=8 dd if=/dev/zero of="$dev1" bs=512 count=3 seek=8
pvck --dump headers "$dev1" || true pvck --dump headers "$dev1" || true
@ -328,9 +304,7 @@ vgs $vg
lvcreate -l1 -an $vg lvcreate -l1 -an $vg
# Two PV, one mda on first, no mda on second, zero header on first # Two PV, one mda on first, no mda on second, zero header on first
rm meta || true _clear_devs "$dev1" "$dev2"
dd if=/dev/zero of="$dev1" || true
dd if=/dev/zero of="$dev2" || true
pvcreate "$dev1" pvcreate "$dev1"
pvcreate --pvmetadatacopies 0 "$dev2" pvcreate --pvmetadatacopies 0 "$dev2"
vgcreate $vg "$dev1" "$dev2" vgcreate $vg "$dev1" "$dev2"
@ -344,9 +318,7 @@ vgs $vg
lvcreate -l1 -an $vg lvcreate -l1 -an $vg
# Two PV, one mda on first, no mda on second, zero headers on both # Two PV, one mda on first, no mda on second, zero headers on both
rm meta || true _clear_devs "$dev1" "$dev2"
dd if=/dev/zero of="$dev1" || true
dd if=/dev/zero of="$dev2" || true
pvcreate "$dev1" pvcreate "$dev1"
pvcreate --pvmetadatacopies 0 "$dev2" pvcreate --pvmetadatacopies 0 "$dev2"
vgcreate $vg "$dev1" "$dev2" vgcreate $vg "$dev1" "$dev2"
@ -363,9 +335,7 @@ vgs $vg
lvcreate -l1 -an $vg lvcreate -l1 -an $vg
# Two PV, one mda on first, no mda on second, zero all on first # Two PV, one mda on first, no mda on second, zero all on first
rm meta || true _clear_devs "$dev1" "$dev2"
dd if=/dev/zero of="$dev1" || true
dd if=/dev/zero of="$dev2" || true
pvcreate "$dev1" pvcreate "$dev1"
pvcreate --pvmetadatacopies 0 "$dev2" pvcreate --pvmetadatacopies 0 "$dev2"
vgcreate $vg "$dev1" "$dev2" vgcreate $vg "$dev1" "$dev2"
@ -382,9 +352,7 @@ vgs $vg
lvcreate -l1 -an $vg lvcreate -l1 -an $vg
# Two PV, two mda on each, pv_header and mda_header1 zeroed on both # Two PV, two mda on each, pv_header and mda_header1 zeroed on both
rm meta || true _clear_devs "$dev1" "$dev2"
dd if=/dev/zero of="$dev1" || true
dd if=/dev/zero of="$dev2" || true
pvcreate --pvmetadatacopies 2 "$dev1" pvcreate --pvmetadatacopies 2 "$dev1"
pvcreate --pvmetadatacopies 2 "$dev2" pvcreate --pvmetadatacopies 2 "$dev2"
vgcreate $vg "$dev1" "$dev2" vgcreate $vg "$dev1" "$dev2"
@ -407,9 +375,7 @@ lvcreate -l1 -an $vg
# Two PV, one mda each, pv_header and mda_header zeroed on each, # Two PV, one mda each, pv_header and mda_header zeroed on each,
# non-standard data_offset/mda_size on first # non-standard data_offset/mda_size on first
rm meta || true _clear_devs "$dev1" "$dev2"
dd if=/dev/zero of="$dev1" || true
dd if=/dev/zero of="$dev2" || true
pvcreate --metadatasize 2048k --dataalignment 128k "$dev1" pvcreate --metadatasize 2048k --dataalignment 128k "$dev1"
pvcreate "$dev2" pvcreate "$dev2"
vgcreate $vg "$dev1" "$dev2" vgcreate $vg "$dev1" "$dev2"
@ -431,9 +397,7 @@ vgs $vg
lvcreate -l1 -an $vg lvcreate -l1 -an $vg
# One PV, one mda, pv_header zeroed, unmatching dev name requires specified uuid # One PV, one mda, pv_header zeroed, unmatching dev name requires specified uuid
rm meta || true _clear_devs "$dev1" "$dev2"
dd if=/dev/zero of="$dev1" || true
dd if=/dev/zero of="$dev2" || true
vgcreate $vg "$dev1" vgcreate $vg "$dev1"
pvck --dump headers "$dev1" || true pvck --dump headers "$dev1" || true
UUID1=`pvck --dump headers "$dev1" | grep pv_header.pv_uuid | awk '{print $2}'` UUID1=`pvck --dump headers "$dev1" | grep pv_header.pv_uuid | awk '{print $2}'`
@ -450,3 +414,4 @@ pvck --dump headers "$dev1" || true
vgs $vg vgs $vg
lvcreate -l1 -an $vg lvcreate -l1 -an $vg
vgremove -f $vg

View File

@ -181,7 +181,7 @@ grep "Not enough space available for metadata area with index 1 on PV $dev1" err
rm -f "$backupfile" rm -f "$backupfile"
# pvcreate wipes swap signature when forced # pvcreate wipes swap signature when forced
dd if=/dev/zero of="$dev1" bs=1024 count=64 dd if=/dev/zero of="$dev1" bs=64k count=1 oflag=direct
mkswap "$dev1" mkswap "$dev1"
blkid -c /dev/null "$dev1" | grep "swap" blkid -c /dev/null "$dev1" | grep "swap"
pvcreate -f "$dev1" pvcreate -f "$dev1"

View File

@ -152,11 +152,11 @@ if aux target_at_least dm-snapshot 1 10 0; then
# Before 1.10.0, the snap percent included metadata size. # Before 1.10.0, the snap percent included metadata size.
sel lv 'snap_percent=0' snap sel lv 'snap_percent=0' snap
fi fi
dd if=/dev/zero of="$DM_DEV_DIR/$vg3/snap" bs=1M count=1 conv=fdatasync dd if=/dev/zero of="$DM_DEV_DIR/$vg3/snap" bs=1M count=1 oflag=direct
sel lv 'snap_percent<50' snap sel lv 'snap_percent<50' snap
sel lv 'snap_percent>50' sel lv 'snap_percent>50'
# overflow snapshot -> invalidated, but still showing 100% # overflow snapshot -> invalidated, but still showing 100%
not dd if=/dev/zero of="$DM_DEV_DIR/$vg3/snap" bs=1M count=4 conv=fdatasync not dd if=/dev/zero of="$DM_DEV_DIR/$vg3/snap" bs=1M count=4 oflag=direct
sel lv 'snap_percent=100' snap sel lv 'snap_percent=100' snap
# % char is accepted as suffix for percent values # % char is accepted as suffix for percent values
sel lv 'snap_percent=100%' snap sel lv 'snap_percent=100%' snap

View File

@ -27,7 +27,7 @@ lvcreate -aey -L1 -n $lv1 $vg
# Snapshot should be large enough to handle any writes # Snapshot should be large enough to handle any writes
lvcreate -L2 -s $vg/$lv1 -n $lv2 lvcreate -L2 -s $vg/$lv1 -n $lv2
dd if=/dev/zero of="$DM_DEV_DIR/$vg/$lv2" bs=1M count=1 conv=fdatasync dd if=/dev/zero of="$DM_DEV_DIR/$vg/$lv2" bs=1M count=1 oflag=direct
# Snapshot must not be 'I'nvalid here # Snapshot must not be 'I'nvalid here
check lv_attr_bit state $vg/$lv2 "a" check lv_attr_bit state $vg/$lv2 "a"

View File

@ -23,7 +23,7 @@ aux prepare_vg 2
lvcreate -T -L1 -V1 -n $lv1 $vg/pool "$dev1" lvcreate -T -L1 -V1 -n $lv1 $vg/pool "$dev1"
lvcreate -s -n $lv2 -L2 $vg/$lv1 "$dev2" lvcreate -s -n $lv2 -L2 $vg/$lv1 "$dev2"
dd if=/dev/zero of="$DM_DEV_DIR/$vg/$lv2" bs=1M count=1 conv=fdatasync dd if=/dev/zero of="$DM_DEV_DIR/$vg/$lv2" bs=1M count=1 oflag=direct
# Initiate background merge # Initiate background merge
lvconvert -b --merge $vg/$lv2 lvconvert -b --merge $vg/$lv2

View File

@ -44,19 +44,19 @@ aux prepare_vg
lvcreate -L8 -V8 -T $vg/pool -n $lv1 lvcreate -L8 -V8 -T $vg/pool -n $lv1
dd if=/dev/zero of="$DM_DEV_DIR/$vg/$lv1" bs=256K count=26 dd if=/dev/zero of="$DM_DEV_DIR/$vg/$lv1" bs=256K count=26 oflag=direct
test "$(percent_)" -gt 80 test "$(percent_)" -gt 80
# Give it some time to dmeventd to log WARNING # Give it some time to dmeventd to log WARNING
wait_warn_ 1 wait_warn_ 1
dd if=/dev/zero of="$DM_DEV_DIR/$vg/$lv1" bs=256K count=30 dd if=/dev/zero of="$DM_DEV_DIR/$vg/$lv1" bs=256K count=30 oflag=direct
test "$(percent_)" -gt 90 test "$(percent_)" -gt 90
# Give it some time to dmeventd to log WARNING # Give it some time to dmeventd to log WARNING
wait_warn_ 2 wait_warn_ 2
dd if=/dev/zero of="$DM_DEV_DIR/$vg/$lv1" bs=1M count=8 dd if=/dev/zero of="$DM_DEV_DIR/$vg/$lv1" bs=1M count=8 oflag=direct
test "$(percent_)" -eq 100 test "$(percent_)" -eq 100
wait_warn_ 3 wait_warn_ 3
@ -71,7 +71,7 @@ sleep 11
# below 'WARNED' threshold. # below 'WARNED' threshold.
dd if=/dev/zero of="$DM_DEV_DIR/$vg/$lv1" bs=256K count=30 dd if=/dev/zero of="$DM_DEV_DIR/$vg/$lv1" bs=256K count=30 oflag=direct
test "$(percent_)" -gt 90 test "$(percent_)" -gt 90
lvs -a $vg lvs -a $vg

View File

@ -47,7 +47,7 @@ lvchange -an $vg
# Overfill data area # Overfill data area
lvchange -ay $vg lvchange -ay $vg
dd if=/dev/zero of="$DM_DEV_DIR/mapper/$vg-$lv2" bs=1M count=2 dd if=/dev/zero of="$DM_DEV_DIR/mapper/$vg-$lv2" bs=1M count=2 oflag=direct
check lv_attr_bit health $vg/pool "D" check lv_attr_bit health $vg/pool "D"
# TODO use spaces ?? # TODO use spaces ??
check lv_field $vg/pool lv_health_status "out_of_data" check lv_field $vg/pool lv_health_status "out_of_data"
@ -78,7 +78,7 @@ lvchange -ay $vg
lvchange -ay $vg/$lv2 lvchange -ay $vg/$lv2
# Provisiong and last free bits in metadata # Provisiong and last free bits in metadata
dd if=/dev/zero of="$DM_DEV_DIR/mapper/$vg-$lv2" bs=32K count=1 dd if=/dev/zero of="$DM_DEV_DIR/mapper/$vg-$lv2" bs=32K count=1 oflag=direct
check lv_attr_bit health $vg/pool "M" check lv_attr_bit health $vg/pool "M"
# TODO - use spaces ?? # TODO - use spaces ??

View File

@ -34,7 +34,7 @@ for i in $(seq 1 5)
do do
lvcreate --errorwhenfull y -Zn -T -L4M -V4M $vg/pool_${i} -n $lv${i} lvcreate --errorwhenfull y -Zn -T -L4M -V4M $vg/pool_${i} -n $lv${i}
# Fill thin-pool to some capacity >50% # Fill thin-pool to some capacity >50%
dd if=/dev/zero of="$DM_DEV_DIR/$vg/$lv${i}" bs=256K count=9 conv=fdatasync dd if=/dev/zero of="$DM_DEV_DIR/$vg/$lv${i}" bs=256K count=9 oflag=direct
done done
lvs -a $vg lvs -a $vg
@ -63,7 +63,7 @@ do
DIFF=$(( END - START )) DIFF=$(( END - START ))
test "$DIFF" -lt 8 || die "Creation of thin pool took more then 8 second! ($DIFF seconds)" test "$DIFF" -lt 8 || die "Creation of thin pool took more then 8 second! ($DIFF seconds)"
# Fill thin-pool to some capacity >50% # Fill thin-pool to some capacity >50%
dd if=/dev/zero of="$DM_DEV_DIR/$vg/$lv${i}" bs=256K count=9 conv=fdatasync dd if=/dev/zero of="$DM_DEV_DIR/$vg/$lv${i}" bs=256K count=9 oflag=direct
done done
vgremove -f $vg vgremove -f $vg

View File

@ -22,11 +22,11 @@ aux prepare_devs 3 8
vgcreate $SHARED "$vg" "$dev1" "$dev2" vgcreate $SHARED "$vg" "$dev1" "$dev2"
lvcreate -l100%FREE -n $lv $vg lvcreate -l100%FREE -n $lv $vg
dd if="$dev1" of="$dev3" bs=1M dd if="$dev1" of="$dev3" bs=1M oflag=direct
pvs --config "devices/global_filter = [ \"a|$dev2|\", \"a|$dev3|\", \"r|.*|\" ]" 2>err pvs --config "devices/global_filter = [ \"a|$dev2|\", \"a|$dev3|\", \"r|.*|\" ]" 2>err
grep "WARNING: Device mismatch detected for $vg/$lv which is accessing $dev1 instead of $dev3" err grep "WARNING: Device mismatch detected for $vg/$lv which is accessing $dev1 instead of $dev3" err
dd if=/dev/zero of="$dev3" bs=1M count=8 dd if=/dev/zero of="$dev3" bs=1M count=8 oflag=direct
lvremove -ff $vg lvremove -ff $vg
# Also test if sub LVs with suffixes are correctly processed. # Also test if sub LVs with suffixes are correctly processed.