summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorLOLi <[email protected]>2017-09-12 20:33:22 +0200
committerBrian Behlendorf <[email protected]>2017-09-12 11:33:22 -0700
commitded8f06a3cfee60b3a8ea5309e9c4d0e567ed3b5 (patch)
tree542c4084ec40c6dbdc531dd47dc9d33299a23a73 /tests
parentd9549cba9640cd3b09d76b8cbd54387728b7be24 (diff)
Relax (ref)reservation constraints on ZVOLs
This change allow (ref)reservation to be set larger than the current ZVOL size: this is safe as we normally set refreservation > volsize at ZVOL creation time when we account for metadata. Reviewed-by: Brian Behlendorf <[email protected]> Reviewed-by: George Melikov <[email protected]> Reviewed by: Richard Elling <[email protected]> Reviewed by: Matthew Ahrens <[email protected]> Signed-off-by: loli10K <[email protected]> Closes #2468 Closes #6610
Diffstat (limited to 'tests')
-rwxr-xr-xtests/zfs-tests/tests/functional/refreserv/refreserv_005_pos.ksh26
-rwxr-xr-xtests/zfs-tests/tests/functional/reservation/reservation_002_pos.sh10
-rwxr-xr-xtests/zfs-tests/tests/functional/reservation/reservation_014_pos.sh25
3 files changed, 24 insertions, 37 deletions
diff --git a/tests/zfs-tests/tests/functional/refreserv/refreserv_005_pos.ksh b/tests/zfs-tests/tests/functional/refreserv/refreserv_005_pos.ksh
index a43dd8432..8c044eca5 100755
--- a/tests/zfs-tests/tests/functional/refreserv/refreserv_005_pos.ksh
+++ b/tests/zfs-tests/tests/functional/refreserv/refreserv_005_pos.ksh
@@ -33,13 +33,12 @@
#
# DESCRIPTION:
-# Volume refreservation is limited by volsize
+# Volume (ref)reservation is not limited by volsize
#
# STRATEGY:
# 1. Create volume on filesystem
# 2. Setting quota for parent filesystem
-# 3. Verify volume refreservation is only limited by volsize
-# 4. Verify volume refreservation can be changed when volsize changed
+# 3. Verify volume (ref)reservation is not limited by volsize
#
verify_runnable "global"
@@ -51,21 +50,24 @@ function cleanup
log_must zfs set mountpoint=$TESTDIR $TESTPOOL/$TESTFS
}
-log_assert "Volume refreservation is limited by volsize"
+log_assert "Volume (ref)reservation is not limited by volsize"
log_onexit cleanup
-fs=$TESTPOOL/$TESTFS; vol=$fs/vol
+fs=$TESTPOOL/$TESTFS
+vol=$fs/vol
log_must zfs create -V 10M $vol
+refreserv=`get_prop refreservation $vol`
+fudge=1
# Verify the parent filesystem does not affect volume
log_must zfs set quota=25M $fs
+log_must zfs set reservation=10M $vol
log_must zfs set refreservation=10M $vol
-avail=$(get_prop mountpoint $vol)
-log_mustnot zfs set refreservation=$avail $vol
-# Verify it is affected by volsize
-log_must zfs set volsize=15M $vol
-log_must zfs set refreservation=15M $vol
-log_mustnot zfs set refreservation=16M $vol
+# Verify it is not affected by volsize
+log_must zfs set reservation=$(($refreserv + $fudge)) $vol
+log_must zfs set reservation=$(($refreserv - $fudge)) $vol
+log_must zfs set refreservation=$(($refreserv + $fudge)) $vol
+log_must zfs set refreservation=$(($refreserv - $fudge)) $vol
-log_pass "Volume refreservation is limited by volsize"
+log_pass "Volume (ref)reservation is not limited by volsize"
diff --git a/tests/zfs-tests/tests/functional/reservation/reservation_002_pos.sh b/tests/zfs-tests/tests/functional/reservation/reservation_002_pos.sh
index f96010802..202393d4d 100755
--- a/tests/zfs-tests/tests/functional/reservation/reservation_002_pos.sh
+++ b/tests/zfs-tests/tests/functional/reservation/reservation_002_pos.sh
@@ -84,17 +84,9 @@ fi
for obj in $TESTPOOL/$TESTFS $OBJ_LIST ; do
- space_avail=`get_prop available $TESTPOOL`
+ space_avail=`get_prop available $obj`
resv_size_set=`expr $space_avail + $RESV_DELTA`
- #
- # For regular (non-sparse) volumes the upper limit is determined
- # not by the space available in the pool but rather by the size
- # of the volume itself.
- #
- [[ $obj == $TESTPOOL/$TESTVOL ]] && \
- ((resv_size_set = vol_set_size + RESV_DELTA))
-
log_must zero_reservation $obj
log_mustnot zfs set reservation=$resv_size_set $obj
diff --git a/tests/zfs-tests/tests/functional/reservation/reservation_014_pos.sh b/tests/zfs-tests/tests/functional/reservation/reservation_014_pos.sh
index d307917b5..e8bd91d00 100755
--- a/tests/zfs-tests/tests/functional/reservation/reservation_014_pos.sh
+++ b/tests/zfs-tests/tests/functional/reservation/reservation_014_pos.sh
@@ -79,30 +79,23 @@ fi
for obj in $TESTPOOL/$TESTFS $OBJ_LIST ; do
- space_avail=`get_prop available $TESTPOOL`
+ space_avail=`get_prop available $obj`
((quota_set_size = space_avail / 3))
#
- # A regular (non-sparse) volume's size is effectively
- # its quota so only need to explicitly set quotas for
- # filesystems and datasets.
+ # Volumes do not support quota so only need to explicitly
+ # set quotas for filesystems.
#
- # A volumes size is effectively its quota. The maximum
- # reservation value that can be set on a volume is
- # determined by the size of the volume or the amount of
- # space in the pool, whichever is smaller.
+ # The maximum reservation value that can be set on a volume
+ # is determined by the quota set on its parent filesystems or
+ # the amount of space in the pool, whichever is smaller.
#
if [[ $obj == $TESTPOOL/$TESTFS ]]; then
log_must zfs set quota=$quota_set_size $obj
((resv_set_size = quota_set_size + RESV_SIZE))
-
- elif [[ $obj == $TESTPOOL/$TESTVOL2 ]] ; then
-
- ((resv_set_size = sparse_vol_set_size + RESV_SIZE))
-
- elif [[ $obj == $TESTPOOL/$TESTVOL ]] ; then
-
- ((resv_set_size = vol_set_size + RESV_SIZE))
+ elif [[ $obj == $TESTPOOL/$TESTVOL || $obj == $TESTPOOL/$TESTVOL2 ]]
+ then
+ resv_set_size=`expr $space_avail + $RESV_DELTA`
fi
orig_quota=`get_prop quota $obj`