mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-22 10:37:35 +03:00
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
This commit is contained in:
committed by
Brian Behlendorf
parent
4f68d7878f
commit
223df0161f
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user