libext2fs: use ZERO_RANGE before PUNCH_HOLE in unix_zeroout
In unix_zeroout() for files, we should try a ZERO_RANGE before we try
PUNCH_HOLE because the former will not cause us to lose preallocated
blocks. Since block devices have supported fallocate for a few years
now, refactor the fallocate calls into a helper and call it from either
case.
Reported-by: Andreas Dilger <adilger@dilger.ca>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Andreas Dilger <adilger@dilger.ca>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>