mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2024-12-26 19:19:32 +03:00
OpenZFS 7036 - zvol_swap_004_pos test failed
Authored by: Igor Kozhukhov <ikozhukhov@gmail.com> Reviewed by: - John Kennedy <john.kennedy@delphix.com> Approved by: - Dan McDonald <danmcd@omniti.com> Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Ported-by: George Melikov <mail@gmelikov.ru> OpenZFS-issue: https://www.illumos.org/issues/7036 OpenZFS-commit: https://github.com/openzfs/openzfs/commit/3f85b2a Closes #5783
This commit is contained in:
parent
37bb2fc7dc
commit
0dc8347c30
@ -30,26 +30,29 @@
|
|||||||
#
|
#
|
||||||
|
|
||||||
. $STF_SUITE/include/libtest.shlib
|
. $STF_SUITE/include/libtest.shlib
|
||||||
|
. $STF_SUITE/tests/functional/zvol/zvol_common.shlib
|
||||||
|
|
||||||
#
|
#
|
||||||
# DESCRIPTION:
|
# DESCRIPTION:
|
||||||
# When a swap zvol is added it is resized to be equal to 1/4 c_max,
|
# When a swap zvol is added its volsize does not change.
|
||||||
# capped between 2G and 16G.
|
|
||||||
#
|
#
|
||||||
# STRATEGY:
|
# STRATEGY:
|
||||||
# 1. Determine what 1/4 arc_c_max is.
|
# 1. Determine what 1/4 arc_c_max is.
|
||||||
# 2. Create a zvols in a variety of sizes.
|
# 2. Create a zvols in a variety of sizes.
|
||||||
# 3. Add them as swap, and verify the volsize is resized correctly.
|
# 3. Add them as swap, and verify the volsize is not changed.
|
||||||
#
|
#
|
||||||
|
|
||||||
verify_runnable "global"
|
verify_runnable "global"
|
||||||
|
|
||||||
|
function cleanup
|
||||||
|
{
|
||||||
|
is_swap_inuse $swapname && log_must $SWAP -d $swapname
|
||||||
|
datasetexists $vol && log_must $ZFS destroy $vol
|
||||||
|
}
|
||||||
|
|
||||||
log_assert "For an added swap zvol, (2G <= volsize <= 16G)"
|
log_assert "For an added swap zvol, (2G <= volsize <= 16G)"
|
||||||
|
|
||||||
typeset -i min max mem
|
log_onexit cleanup
|
||||||
((mem = $($KSTAT -p ::arcstats:c_max | $AWK '{print $2}') / 4))
|
|
||||||
((min = 2 * 1024 * 1024 * 1024))
|
|
||||||
((max = 16 * 1024 * 1024 * 1024))
|
|
||||||
|
|
||||||
for vbs in 512 1024 2048 4096 8192 16384 32768 65536 131072; do
|
for vbs in 512 1024 2048 4096 8192 16384 32768 65536 131072; do
|
||||||
for multiplier in 1 32 16384 131072; do
|
for multiplier in 1 32 16384 131072; do
|
||||||
@ -61,19 +64,8 @@ for vbs in 512 1024 2048 4096 8192 16384 32768 65536 131072; do
|
|||||||
log_must $ZFS create -s -b $vbs -V $volsize $vol
|
log_must $ZFS create -s -b $vbs -V $volsize $vol
|
||||||
log_must $SWAP -a $swapname
|
log_must $SWAP -a $swapname
|
||||||
|
|
||||||
if ((mem <= min)); then # volsize should be 2G
|
|
||||||
new_volsize=$(get_prop volsize $vol)
|
new_volsize=$(get_prop volsize $vol)
|
||||||
((new_volsize == min)) || log_fail \
|
[[ $volsize -eq $new_volsize ]] || log_fail "$volsize $new_volsize"
|
||||||
"Unexpected volsize: $new_volsize"
|
|
||||||
elif ((mem >= max)); then # volsize should be 16G
|
|
||||||
new_volsize=$(get_prop volsize $vol)
|
|
||||||
((new_volsize == max)) || log_fail \
|
|
||||||
"Unexpected volsize: $new_volsize"
|
|
||||||
else # volsize should be 'mem'
|
|
||||||
new_volsize=$(get_prop volsize $vol)
|
|
||||||
((new_volsize == mem)) || log_fail \
|
|
||||||
"Unexpected volsize: $new_volsize"
|
|
||||||
fi
|
|
||||||
|
|
||||||
log_must $SWAP -d $swapname
|
log_must $SWAP -d $swapname
|
||||||
log_must $ZFS destroy $vol
|
log_must $ZFS destroy $vol
|
||||||
|
Loading…
Reference in New Issue
Block a user