mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-22 10:37:35 +03:00
ZTS: Enable punch-hole tests on FreeBSD
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Reviewed-by: Alexander Motin <mav@FreeBSD.org> Reviewed-by: Ryan Moeller <ryan@iXsystems.com> Signed-off-by: Ka Ho Ng <khng@FreeBSD.org> Sponsored-by: The FreeBSD Foundation Closes #12458
This commit is contained in:
@@ -27,6 +27,7 @@
|
||||
# Copyright (c) 2017, Lawrence Livermore National Security LLC.
|
||||
# Copyright (c) 2017, Datto Inc. All rights reserved.
|
||||
# Copyright (c) 2017, Open-E Inc. All rights reserved.
|
||||
# Copyright (c) 2021, The FreeBSD Foundation.
|
||||
# Use is subject to license terms.
|
||||
#
|
||||
|
||||
@@ -4218,6 +4219,25 @@ function get_arcstat # stat
|
||||
esac
|
||||
}
|
||||
|
||||
function punch_hole # offset length file
|
||||
{
|
||||
typeset offset=$1
|
||||
typeset length=$2
|
||||
typeset file=$3
|
||||
|
||||
case $(uname) in
|
||||
FreeBSD)
|
||||
truncate -d -o $offset -l $length "$file"
|
||||
;;
|
||||
Linux)
|
||||
fallocate --punch-hole --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
|
||||
|
||||
Reference in New Issue
Block a user