]> git.proxmox.com Git - mirror_spl.git/commit - config/spl-build.m4
Add interface for file hole punching.
authorEtienne Dechamps <etienne.dechamps@ovh.net>
Mon, 3 Sep 2012 12:56:26 +0000 (14:56 +0200)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Thu, 4 Oct 2012 23:22:07 +0000 (16:22 -0700)
commitbbdc6ae49518a4be7230ab673370e9231e2f72e7
treef1e0522a75b9272b1da8a6f5382e0a3b9fbdffe4
parenta6c6839a88b7dc344f3cd8e875a01802b34645cd
Add interface for file hole punching.

This adds an interface to "punch holes" (deallocate space) in VFS
files. The interface is identical to the Solaris VOP_SPACE interface.
This interface is necessary for TRIM support on file vdevs.

This is implemented using Linux fallocate(FALLOC_FL_PUNCH_HOLE), which
was introduced in 2.6.38. For a brief time before 2.6.38 this was done
using the truncate_range inode operation, which was quickly deprecated.
This patch only supports FALLOC_FL_PUNCH_HOLE.

This adds support for the truncate_range() inode operation to
VOP_SPACE() for file hole punching. This API is deprecated and removed
in 3.5, so it's only useful for old kernels.

On tmpfs, the truncate_range() inode operation translates to
shmem_truncate_range(). Unfortunately, this function expects the end
offset to be inclusive and aligned to the end of a page. If it is not,
the kernel will stop with a BUG_ON().

This patch fixes the issue by adapting to the constraints set forth by
shmem_truncate_range().

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #168
config/spl-build.m4
include/sys/vnode.h
module/spl/spl-vnode.c