# which SEEK_DATA support exists.
seek_data_capable_()
{
+ # Check that SEEK_HOLE support is enabled
+ # Note APFS was seen to not create sparse files < 16MiB
+ if ! truncate -s16M file.sparse_; then
+ warn_ "can't create a sparse file: assuming not SEEK_DATA capable"
+ return 1
+ fi
+ if ! cp --debug --reflink=never file.sparse_ file.sparse_.cp \
+ | grep SEEK_HOLE; then
+ return 1
+ fi
+
+ # Check that SEEK_HOLE is supported on the passed file
{ python3 < /dev/null && PYTHON_=python3; } ||
{ python < /dev/null && PYTHON_=python; }
touch sparse_chk
seek_data_capable_ sparse_chk \
- || skip_ "this file system lacks SEEK_DATA support"
+ || skip_ "insufficient SEEK_DATA support"
# Exercise the code that handles a file ending in a hole.
printf x > k || framework_failure_
if seek_data_capable_ sparse_chk && ! df -t ext3 . >/dev/null; then
: # Current partition has working extents. Good!
else
- skip_ "current file system has insufficient SEEK_DATA support"
+ skip_ "insufficient SEEK_DATA support"
# It's not; we need to create one, hence we need root access.
require_root_
touch sparse_chk || framework_failure_
seek_data_capable_ sparse_chk ||
- skip_ 'this file system lacks SEEK_DATA support'
+ skip_ 'insufficient SEEK_DATA support'
fallocate --help >/dev/null || skip_ 'The fallocate utility is required'
touch falloc.test || framework_failure_
# between the creation of the file and the use of SEEK_DATA,
# for it to determine it's an empty file (return ENXIO).
seek_data_capable_ f ||
- skip_ "this file system lacks appropriate SEEK_DATA support"
+ skip_ "insufficient SEEK_DATA support"
# Nothing can read that many bytes in so little time.
timeout 10 cp --reflink=never f f2 || fail=1