Skip to content

Commit c9de42e

Browse files
committed
ZTS: refreserv/refreserv_raidz improvements
Several small changes intended to make this test reliable. - Leave the default compression enabled for the pool and switch to using /dev/urandom as the data source. Functionally this shouldn't impact the test but it's preferable to test with the pool defaults when possible. - Verify the device is created and removed as required. Switch to a unique volume name for a more clarity in the logs. - Use the ZVOL_DEVDIR to specify the device path. - Speed up the test by creating the pool with an ashift=12 and testing 4K, 8K, 128K volblocksizes. Reviewed-by: Alexander Motin <alexander.motin@TrueNAS.com> Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov> Closes openzfs#17725
1 parent 41c6eaa commit c9de42e

File tree

1 file changed

+16
-30
lines changed

1 file changed

+16
-30
lines changed

tests/zfs-tests/tests/functional/refreserv/refreserv_raidz.ksh

Lines changed: 16 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,15 @@
1717

1818
. $STF_SUITE/include/libtest.shlib
1919
. $STF_SUITE/tests/functional/refreserv/refreserv.cfg
20+
. $STF_SUITE/tests/functional/zvol/zvol_misc/zvol_misc_common.kshlib
2021

2122
#
2223
# DESCRIPTION:
2324
# raidz refreservation=auto accounts for extra parity and skip blocks
2425
#
2526
# STRATEGY:
2627
# 1. Create a pool with a single raidz vdev
27-
# 2. For each block size [512b, 1k, 128k] or [4k, 8k, 128k]
28+
# 2. For each block size [4k, 8k, 128k]
2829
# - create a volume
2930
# - fully overwrite it
3031
# - verify that referenced is less than or equal to reservation
@@ -38,6 +39,7 @@
3839
# 1. This test will use up to 14 disks but can cover the key concepts with
3940
# 5 disks.
4041
# 2. If the disks are a mixture of 4Kn and 512n/512e, failures are likely.
42+
# Therefore, when creating the pool we specify 4Kn sectors.
4143
#
4244

4345
verify_runnable "global"
@@ -60,29 +62,10 @@ log_onexit cleanup
6062

6163
poolexists "$TESTPOOL" && log_must_busy zpool destroy "$TESTPOOL"
6264

63-
# Testing tiny block sizes on ashift=12 pools causes so much size inflation
64-
# that small test disks may fill before creating small volumes. However,
65-
# testing 512b and 1K blocks on ashift=9 pools is an ok approximation for
66-
# testing the problems that arise from 4K and 8K blocks on ashift=12 pools.
67-
if is_freebsd; then
68-
bps=$(diskinfo -v ${alldisks[0]} | awk '/sectorsize/ { print $1 }')
69-
elif is_linux; then
70-
bps=$(lsblk -nrdo min-io /dev/${alldisks[0]})
71-
fi
72-
log_must test "$bps" -eq 512 -o "$bps" -eq 4096
73-
case "$bps" in
74-
512)
75-
allshifts=(9 10 17)
76-
maxpct=151
77-
;;
78-
4096)
79-
allshifts=(12 13 17)
80-
maxpct=110
81-
;;
82-
*)
83-
log_fail "bytes/sector: $bps != (512|4096)"
84-
;;
85-
esac
65+
ashift=12
66+
allshifts=(12 13 17)
67+
maxpct=110
68+
8669
log_note "Testing in ashift=${allshifts[0]} mode"
8770

8871
# This loop handles all iterations of steps 1 through 4 described in strategy
@@ -99,18 +82,21 @@ for parity in 1 2 3; do
9982
continue
10083
fi
10184

102-
log_must zpool create -O compression=off "$TESTPOOL" "$raid" "${disks[@]}"
85+
log_must zpool create -o ashift=$ashift "$TESTPOOL" "$raid" "${disks[@]}"
10386

10487
for bits in "${allshifts[@]}"; do
10588
vbs=$((1 << bits))
10689
log_note "Testing $raid-$ndisks volblocksize=$vbs"
10790

108-
vol=$TESTPOOL/$TESTVOL
91+
vol=$TESTPOOL/$TESTVOL-$vbs
92+
zdev=$ZVOL_DEVDIR/$vol
10993
log_must zfs create -V ${volsize}m \
11094
-o volblocksize=$vbs "$vol"
111-
block_device_wait "/dev/zvol/$vol"
112-
log_must dd if=/dev/zero of=/dev/zvol/$vol \
113-
bs=1024k count=$volsize
95+
block_device_wait $zdev
96+
blockdev_exists $zdev
97+
98+
log_must timeout 120 dd if=/dev/urandom of=$zdev \
99+
bs=1024k count=$volsize status=progress
114100
sync_pool $TESTPOOL
115101

116102
ref=$(zfs get -Hpo value referenced "$vol")
@@ -126,7 +112,7 @@ for parity in 1 2 3; do
126112
log_must test "$deltapct" -le $maxpct
127113

128114
log_must_busy zfs destroy "$vol"
129-
block_device_wait
115+
blockdev_missing $zdev
130116
done
131117

132118
log_must_busy zpool destroy "$TESTPOOL"

0 commit comments

Comments
 (0)