diff options
author | Tim Chase <[email protected]> | 2014-08-20 17:35:13 -0500 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2014-09-08 13:52:25 -0700 |
commit | 223df0161fad50f53a8fa5ffeea8cc4f8137d522 (patch) | |
tree | 4cb1ed2d880ab2c5c745e407267f2d6433213106 /include | |
parent | 4f68d7878fbed9e225022a1d435cfb7177234110 (diff) |
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 <[email protected]>
Signed-off-by: Tim Chase <[email protected]>
Closes #2619
Diffstat (limited to 'include')
-rw-r--r-- | include/sys/zpl.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/include/sys/zpl.h b/include/sys/zpl.h index eb0e9f057..2d82d1ada 100644 --- a/include/sys/zpl.h +++ b/include/sys/zpl.h @@ -52,8 +52,10 @@ extern ssize_t zpl_read_common(struct inode *ip, const char *buf, extern ssize_t zpl_write_common(struct inode *ip, const char *buf, size_t len, loff_t *ppos, uio_seg_t segment, int flags, cred_t *cr); +#if defined(HAVE_FILE_FALLOCATE) || defined(HAVE_INODE_FALLOCATE) extern long zpl_fallocate_common(struct inode *ip, int mode, loff_t offset, loff_t len); +#endif /* defined(HAVE_FILE_FALLOCATE) || defined(HAVE_INODE_FALLOCATE) */ extern const struct address_space_operations zpl_address_space_operations; extern const struct file_operations zpl_file_operations; |