mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-25 03:37:45 +03:00
Make L2ARC tests more robust
Instead of relying on arbitrary timers after pool export/import or cache device off/online rely on arcstats. This makes the L2ARC tests more robust. Also cleanup some functions related to persistent L2ARC. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Reviewed-by: Adam Moss <c@yotes.com> Signed-off-by: George Amanakis <gamanakis@gmail.com> Closes #10983
This commit is contained in:
@@ -4173,6 +4173,45 @@ function get_arcstat # stat
|
||||
esac
|
||||
}
|
||||
|
||||
#
|
||||
# Wait for the specified arcstat to reach non-zero quiescence.
|
||||
# If echo is 1 echo the value after reaching quiescence, otherwise
|
||||
# if echo is 0 print the arcstat we are waiting on.
|
||||
#
|
||||
function arcstat_quiescence # stat echo
|
||||
{
|
||||
typeset stat=$1
|
||||
typeset echo=$2
|
||||
typeset do_once=true
|
||||
|
||||
if [[ $echo -eq 0 ]]; then
|
||||
echo "Waiting for arcstat $1 quiescence."
|
||||
fi
|
||||
|
||||
while $do_once || [ $stat1 -ne $stat2 ] || [ $stat2 -eq 0 ]; do
|
||||
typeset stat1=$(get_arcstat $stat)
|
||||
sleep 2
|
||||
typeset stat2=$(get_arcstat $stat)
|
||||
do_once=false
|
||||
done
|
||||
|
||||
if [[ $echo -eq 1 ]]; then
|
||||
echo $stat2
|
||||
fi
|
||||
}
|
||||
|
||||
function arcstat_quiescence_noecho # stat
|
||||
{
|
||||
typeset stat=$1
|
||||
arcstat_quiescence $stat 0
|
||||
}
|
||||
|
||||
function arcstat_quiescence_echo # stat
|
||||
{
|
||||
typeset stat=$1
|
||||
arcstat_quiescence $stat 1
|
||||
}
|
||||
|
||||
#
|
||||
# Given an array of pids, wait until all processes
|
||||
# have completed and check their return status.
|
||||
|
||||
Reference in New Issue
Block a user