ZTS: Make do_vol_test() more deterministic (#16379)
- Explicitly disable compression since mkfile uses a zero buffer. - Explicitly sync file systems instead of waiting for timeout. Signed-off-by: Alexander Motin <mav@FreeBSD.org> Sponsored by: iXsystems, Inc. Reviewed-by: George Melikov <mail@gmelikov.ru> Reviewed-by: Tony Hutter <hutter2@llnl.gov>
This commit is contained in:
parent
a1be921673
commit
82f281ad99
|
@ -84,7 +84,8 @@ function do_vol_test
|
||||||
vol=$TESTPOOL/$TESTVOL1
|
vol=$TESTPOOL/$TESTVOL1
|
||||||
vol_b_path=$ZVOL_DEVDIR/$TESTPOOL/$TESTVOL1
|
vol_b_path=$ZVOL_DEVDIR/$TESTPOOL/$TESTVOL1
|
||||||
|
|
||||||
log_must zfs create -V $VOLSIZE -o copies=$copies $vol
|
log_must zfs create -V $VOLSIZE -o compression=off -o copies=$copies \
|
||||||
|
$vol
|
||||||
log_must zfs set refreservation=none $vol
|
log_must zfs set refreservation=none $vol
|
||||||
block_device_wait $vol_b_path
|
block_device_wait $vol_b_path
|
||||||
|
|
||||||
|
@ -116,31 +117,30 @@ function do_vol_test
|
||||||
else
|
else
|
||||||
log_must zpool create $TESTPOOL1 $vol_b_path
|
log_must zpool create $TESTPOOL1 $vol_b_path
|
||||||
fi
|
fi
|
||||||
log_must zfs create $TESTPOOL1/$TESTFS1
|
log_must zfs create -o compression=off $TESTPOOL1/$TESTFS1
|
||||||
|
sync_pool $TESTPOOL1
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
log_unsupported "$type test not implemented"
|
log_unsupported "$type test not implemented"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
((nfilesize = copies * ${FILESIZE%m}))
|
sync_pool $TESTPOOL
|
||||||
pre_used=$(get_prop used $vol)
|
pre_used=$(get_prop used $vol)
|
||||||
((target_size = pre_used + nfilesize))
|
|
||||||
|
|
||||||
if [[ $type == "zfs" ]]; then
|
if [[ $type == "zfs" ]]; then
|
||||||
log_must mkfile $FILESIZE /$TESTPOOL1/$TESTFS1/$FILE
|
log_must mkfile $FILESIZE /$TESTPOOL1/$TESTFS1/$FILE
|
||||||
|
sync_pool $TESTPOOL1
|
||||||
else
|
else
|
||||||
log_must mkfile $FILESIZE $mntp/$FILE
|
log_must mkfile $FILESIZE $mntp/$FILE
|
||||||
|
log_must sync
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
sync_pool $TESTPOOL
|
||||||
post_used=$(get_prop used $vol)
|
post_used=$(get_prop used $vol)
|
||||||
((retries = 0))
|
|
||||||
while ((post_used < target_size && retries++ < 42)); do
|
|
||||||
sleep 1
|
|
||||||
post_used=$(get_prop used $vol)
|
|
||||||
done
|
|
||||||
|
|
||||||
((used = post_used - pre_used))
|
((used = post_used - pre_used))
|
||||||
|
((nfilesize = copies * ${FILESIZE%m}))
|
||||||
if ((used < nfilesize)); then
|
if ((used < nfilesize)); then
|
||||||
log_fail "The space is not charged correctly while setting" \
|
log_fail "The space is not charged correctly while setting" \
|
||||||
"copies as $copies ($used < $nfilesize)" \
|
"copies as $copies ($used < $nfilesize)" \
|
||||||
|
|
Loading…
Reference in New Issue