aboutsummaryrefslogtreecommitdiffstats
path: root/tests/zfs-tests/include/libtest.shlib
diff options
context:
space:
mode:
authorRich Ercolani <[email protected]>2022-04-20 19:07:03 -0400
committerGitHub <[email protected]>2022-04-20 16:07:03 -0700
commitb657f2c59220dba92607aa253ed2a6a1f6d9bec8 (patch)
tree01a70499df274d78be4e699a38cd9b78ffb77bd9 /tests/zfs-tests/include/libtest.shlib
parent9209ea69bc03e7e9f678b2294da7a0317b5c9c5b (diff)
Corrected oversight in ZERO_RANGE behavior
It turns out, no, in fact, ZERO_RANGE and PUNCH_HOLE do have differing semantics in some ways - in particular, one requires KEEP_SIZE, and the other does not. Also added a zero-range test to catch this, corrected a flaw that made the punch-hole test succeed vacuously, and a typo in file_write. Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Rich Ercolani <[email protected]> Closes #13329 Closes #13338
Diffstat (limited to 'tests/zfs-tests/include/libtest.shlib')
-rw-r--r--tests/zfs-tests/include/libtest.shlib16
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/zfs-tests/include/libtest.shlib b/tests/zfs-tests/include/libtest.shlib
index b24ba6cb6..175adfc62 100644
--- a/tests/zfs-tests/include/libtest.shlib
+++ b/tests/zfs-tests/include/libtest.shlib
@@ -3602,6 +3602,22 @@ function punch_hole # offset length file
esac
}
+function zero_range # offset length file
+{
+ typeset offset=$1
+ typeset length=$2
+ typeset file=$3
+
+ case "$UNAME" in
+ Linux)
+ fallocate --zero-range --offset $offset --length $length "$file"
+ ;;
+ *)
+ false
+ ;;
+ esac
+}
+
#
# Wait for the specified arcstat to reach non-zero quiescence.
# If echo is 1 echo the value after reaching quiescence, otherwise