2 # This file and its contents are supplied under the terms of the
3 # Common Development and Distribution License ("CDDL"), version 1.0.
4 # You may only use this file in accordance with the terms of version
7 # A full copy of the text of the CDDL should have accompanied this
8 # source. A copy of the CDDL is also available via the Internet at
9 # http://www.illumos.org/license/CDDL.
13 # Copyright (c) 2012, 2016 by Delphix. All rights reserved.
16 . $STF_SUITE/include/math.shlib
18 export TESTVOL="testvol.nopwrite"
22 function verify_nopwrite
31 for i in origin snap clone; do
32 for j in used refer usedbychildren written; do
33 typeset ${i}_$j=$(get_prop $j $(eval echo \$$i))
38 # If we are dealing with a volume, deduct the refreserv from the used
39 # value to prevent real failures from being masked by the unexpected
40 # extra space. Also, volumes use more space for metadata, so adjust the
41 # percentages to be more forgiving.
43 if [[ "$(get_prop type $origin)" = "volume" ]]; then
44 typeset rr=$(get_prop refreserv $origin)
45 ((origin_used -= rr ))
50 # These values should differ greatly with nopwrite.
51 within_percent $origin_used $clone_used $low && return 1
52 within_percent $origin_refer $origin_usedbychildren $low && return 1
53 within_percent $snap_written $clone_written $low && return 1
55 # These values should be nearly the same with nopwrite.
56 within_percent $origin_used $clone_refer $high || return 1
57 within_percent $origin_used $snap_refer $high || return 1
60 # The comparisons below should pass regardless of nopwrite. They're
63 typeset deadlist=$(zdb -Pddd $clone | awk '/Deadlist:/ {print $2}')
64 within_percent $deadlist $clone_written $high || return 1
65 within_percent $snap_refer $snap_written $high || return 1