From: Darrick J. Wong Date: Tue, 28 Aug 2018 23:38:00 +0000 (-0700) Subject: libext2fs: use ZERO_RANGE before PUNCH_HOLE in unix_zeroout X-Git-Tag: v1.45.0~44 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=3f6a9786d749e40952c233e6d1d324045d67416c;hp=3f6a9786d749e40952c233e6d1d324045d67416c;p=tools%2Fe2fsprogs.git 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 Signed-off-by: Darrick J. Wong Reviewed-by: Andreas Dilger Signed-off-by: Theodore Ts'o ---