]> git.ipfire.org Git - thirdparty/util-linux.git/commit
fallocate: fix --dig-holes at end of files
authorGero Treuner <gero@70t.de>
Thu, 10 Sep 2020 19:43:03 +0000 (21:43 +0200)
committerKarel Zak <kzak@redhat.com>
Mon, 14 Sep 2020 10:03:50 +0000 (12:03 +0200)
commit23fcac045711da524682c0f23ea8f5ba4d15ad15
tree0a09604f5b9a1450300710ad7b94552a3749f042
parent93b23ce42068ec03e253421bf8e156b5d960c158
fallocate: fix --dig-holes at end of files

I discovered that making a file sparse with "fallocate -d filename"
fails on the last block of a file, because - usually being partial -
the system call only zeroes that part instead of deallocating the
block. See man fallocate(2) - section "Deallocating file space".

The expected call is punching the whole block beyond eof, which
doesn't change the file length because of flag FALLOC_FL_KEEP_SIZE.

Signed-off-by: Karel Zak <kzak@redhat.com>
sys-utils/fallocate.c