]> git.proxmox.com Git - mirror_zfs.git/commit
Implement fallocate FALLOC_FL_PUNCH_HOLE
authorTim Chase <tim@chase2k.com>
Wed, 20 Aug 2014 22:35:13 +0000 (17:35 -0500)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Mon, 8 Sep 2014 20:52:25 +0000 (13:52 -0700)
commit223df0161fad50f53a8fa5ffeea8cc4f8137d522
tree4cb1ed2d880ab2c5c745e407267f2d6433213106
parent4f68d7878fbed9e225022a1d435cfb7177234110
Implement fallocate FALLOC_FL_PUNCH_HOLE

Add support for the FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE mode of
fallocate(2).  Mimic the behavior of other native file systems such as
ext4 in cases where the file might be extended. If the offset is beyond
the end of the file, return success without changing the file. If the
extent of the punched hole would extend the file, only the existing tail
of the file is punched.

Add the zfs_zero_partial_page() function, modeled after update_page(),
to handle zeroing partial pages in a hole-punching operation.  It must
be used under a range lock for the requested region in order that the
ARC and page cache stay in sync.

Move the existing page cache truncation via truncate_setsize() into
zfs_freesp() for better source structure compatibility with upstream code.

Add page cache truncation to zfs_freesp() and zfs_free_range() to handle
hole punching.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Tim Chase <tim@chase2k.com>
Closes #2619
include/sys/zpl.h
module/zfs/zfs_vnops.c
module/zfs/zfs_znode.c
module/zfs/zpl_file.c