zfsonlinux/spl — pull request #168 by dechamps (2012-09-03 13:45:15+00:00)
Title: 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 (see zfsonlinux/zfs#924).

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`.

@behlendorf: like the previous patch, you can either wait for ZFS TRIM support to be finished or you can merge this now. Your call.