mirror_zfs/module/spl
Etienne Dechamps bbdc6ae495 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
2012-10-04 16:22:07 -07:00
..
Makefile.in Add script for builtin module building. 2012-07-26 15:13:09 -07:00
spl-atomic.c Linux 2.6.39 compat, DEFINE_SPINLOCK() 2011-04-20 12:01:11 -07:00
spl-condvar.c Debug cv_destroy() with mutex held 2012-09-10 10:23:26 -07:00
spl-cred.c Add crgetfsuid()/crgetfsgid() helpers 2011-03-22 12:18:44 -07:00
spl-debug.c Wrap trace_set_debug_header in trace_[get|put]_tcd 2012-08-23 10:01:20 -07:00
spl-err.c Add --enable-debug-log configure option 2012-02-02 11:27:54 -08:00
spl-generic.c Determine the hostid on demand. 2012-07-26 15:14:02 -07:00
spl-kmem.c Add KMC_NOEMERGENCY slab flag 2012-09-07 14:27:03 -07:00
spl-kobj.c Remove VN_HOLD/VN_RELE/VOP_PUTPAGE 2011-01-12 11:38:05 -08:00
spl-kstat.c Add basic dynamic kstat support 2012-02-02 11:28:00 -08:00
spl-mutex.c Fix undefined reference on spl_mutex_spin_max(). 2012-07-26 14:54:53 -07:00
spl-proc.c Emergency slab objects 2012-08-27 12:00:42 -07:00
spl-rwlock.c Public Release Prep 2010-05-17 15:18:00 -07:00
spl-taskq.c Remove TQ_SLEEP -> KM_SLEEP mapping 2012-09-12 11:41:42 -07:00
spl-thread.c Switch KM_SLEEP to KM_PUSHPAGE 2012-09-12 12:27:09 -07:00
spl-time.c Minor 32-bit fix cast to hrtime_t before the mutliply. 2010-05-23 09:51:17 -07:00
spl-tsd.c Suppress task_hash_table_init() large allocation warning 2012-08-30 21:02:52 -07:00
spl-vnode.c Add interface for file hole punching. 2012-10-04 16:22:07 -07:00
spl-xdr.c Prefix all SPL debug macros with 'S' 2010-07-20 13:30:40 -07:00
spl-zlib.c Set KMC_NOEMERGENCY for zlib workspaces 2012-09-07 14:36:26 -07:00