zfs/tests/runfiles
adilger f734301d22
linux: add basic fallocate(mode=0/2) compatibility
Implement semi-compatible functionality for mode=0 (preallocation)
and mode=FALLOC_FL_KEEP_SIZE (preallocation beyond EOF) for ZPL.

Since ZFS does COW and snapshots, preallocating blocks for a file
cannot guarantee that writes to the file will not run out of space.
Even if the first overwrite was guaranteed, it would not handle any
later overwrite of blocks due to COW, so strict compliance is futile.
Instead, make a best-effort check that at least enough free space is
currently available in the pool (with a bit of margin), then create
a sparse file of the requested size and continue on with life.

This does not handle all cases (e.g. several fallocate() calls before
writing into the files when the filesystem is nearly full), which
would require a more complex mechanism to be implemented, probably
based on a modified version of dmu_prealloc(), but is usable as-is.

A new module option zfs_fallocate_reserve_percent is used to control
the reserve margin for any single fallocate call.  By default, this
is 110% of the requested preallocation size, so an additional 10% of
available space is reserved for overhead to allow the application a
good chance of finishing the write when the fallocate() succeeds.
If the heuristics of this basic fallocate implementation are not
desirable, the old non-functional behavior of returning EOPNOTSUPP
for calls can be restored by setting zfs_fallocate_reserve_percent=0.

The parameter of zfs_statvfs() is changed to take an inode instead
of a dentry, since no dentry is available in zfs_fallocate_common().

A few tests from @behlendorf cover basic fallocate functionality.

Reviewed-by: Richard Laager <rlaager@wiktel.com>
Reviewed-by: Arshad Hussain <arshad.super@gmail.com>
Reviewed-by: Matthew Ahrens <mahrens@delphix.com>
Co-authored-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Andreas Dilger <adilger@dilger.ca>
Issue #326
Closes #10408
2020-06-18 11:22:11 -07:00
..
Makefile.am Add FreeBSD support to OpenZFS 2020-04-14 11:36:28 -07:00
common.run File incorrectly zeroed when receiving incremental stream that toggles -L 2020-06-09 10:41:01 -07:00
freebsd.run Don't delete freebsd.run in distclean 2020-04-15 09:21:40 -07:00
linux.run linux: add basic fallocate(mode=0/2) compatibility 2020-06-18 11:22:11 -07:00
longevity.run OpenZFS 9166 - zfs storage pool checkpoint 2018-06-26 10:07:42 -07:00
perf-regression.run OpenZFS 9184 - Add ZFS performance test for fixed blocksize random read/write IO 2018-07-02 13:46:06 -07:00
sunos.run ZTS: Add a failsafe callback to run after each test 2020-03-10 11:00:56 -07:00