aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEtienne Dechamps <etienne.dechamps@ovh.net>2011-09-02 07:42:07 +0000
committerBrian Behlendorf <behlendorf1@llnl.gov>2012-02-10 00:19:32 +0000
commitcb2d19010d8fbcf6c22585cd8763fad3ba7db724 (patch)
treeb4fe64638a19856107953dc1a814c2e3f787c989
parentaec69371a6a2e94534809c5e9ba22e7b0e276937 (diff)
downloadsrc-cb2d19010d8fbcf6c22585cd8763fad3ba7db724.tar.gz
src-cb2d19010d8fbcf6c22585cd8763fad3ba7db724.zip
-rw-r--r--Makefile.in1
-rw-r--r--cmd/Makefile.in1
-rw-r--r--cmd/mount_zfs/Makefile.in1
-rw-r--r--cmd/sas_switch_id/Makefile.in1
-rw-r--r--cmd/zdb/Makefile.in1
-rw-r--r--cmd/zfs/Makefile.in1
-rw-r--r--cmd/zinject/Makefile.in1
-rw-r--r--cmd/zpios/Makefile.in1
-rw-r--r--cmd/zpool/Makefile.in1
-rw-r--r--cmd/zpool_id/Makefile.in1
-rw-r--r--cmd/zpool_layout/Makefile.in1
-rw-r--r--cmd/ztest/Makefile.in1
-rw-r--r--cmd/zvol_id/Makefile.in1
-rw-r--r--config/kernel-fallocate.m448
-rw-r--r--config/kernel.m41
-rwxr-xr-xconfigure276
-rw-r--r--dracut/90zfs/Makefile.in1
-rw-r--r--dracut/Makefile.in1
-rw-r--r--etc/Makefile.in1
-rw-r--r--etc/init.d/Makefile.in1
-rw-r--r--etc/zfs/Makefile.in1
-rw-r--r--include/Makefile.in1
-rw-r--r--include/linux/Makefile.in1
-rw-r--r--include/sys/Makefile.in1
-rw-r--r--include/sys/fm/Makefile.in1
-rw-r--r--include/sys/fm/fs/Makefile.in1
-rw-r--r--include/sys/fs/Makefile.in1
-rw-r--r--include/sys/zpl.h3
-rw-r--r--lib/Makefile.in1
-rw-r--r--lib/libavl/Makefile.in1
-rw-r--r--lib/libefi/Makefile.in1
-rw-r--r--lib/libnvpair/Makefile.in1
-rw-r--r--lib/libshare/Makefile.in1
-rw-r--r--lib/libspl/Makefile.in1
-rw-r--r--lib/libspl/asm-generic/Makefile.in1
-rw-r--r--lib/libspl/asm-i386/Makefile.in1
-rw-r--r--lib/libspl/asm-x86_64/Makefile.in1
-rw-r--r--lib/libspl/include/Makefile.in1
-rw-r--r--lib/libspl/include/ia32/Makefile.in1
-rw-r--r--lib/libspl/include/ia32/sys/Makefile.in1
-rw-r--r--lib/libspl/include/rpc/Makefile.in1
-rw-r--r--lib/libspl/include/sys/Makefile.in1
-rw-r--r--lib/libspl/include/sys/dktp/Makefile.in1
-rw-r--r--lib/libspl/include/sys/sysevent/Makefile.in1
-rw-r--r--lib/libspl/include/util/Makefile.in1
-rw-r--r--lib/libunicode/Makefile.in1
-rw-r--r--lib/libuutil/Makefile.in1
-rw-r--r--lib/libzfs/Makefile.in1
-rw-r--r--lib/libzpool/Makefile.in1
-rw-r--r--man/Makefile.in1
-rw-r--r--man/man8/Makefile.in1
-rw-r--r--module/zfs/zpl_file.c47
-rw-r--r--module/zfs/zpl_inode.c12
-rw-r--r--scripts/Makefile.in1
-rw-r--r--scripts/zpios-profile/Makefile.in1
-rw-r--r--scripts/zpios-test/Makefile.in1
-rw-r--r--scripts/zpool-config/Makefile.in1
-rw-r--r--scripts/zpool-layout/Makefile.in1
-rw-r--r--udev/Makefile.in1
-rw-r--r--udev/rules.d/Makefile.in1
-rw-r--r--zfs_config.h.in6
61 files changed, 447 insertions, 0 deletions
diff --git a/Makefile.in b/Makefile.in
index 37b0db77130c..64deb2369ac6 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -86,6 +86,7 @@ am__aclocal_m4_deps = \
$(top_srcdir)/config/kernel-check-disk-size-change.m4 \
$(top_srcdir)/config/kernel-d-obtain-alias.m4 \
$(top_srcdir)/config/kernel-evict-inode.m4 \
+ $(top_srcdir)/config/kernel-fallocate.m4 \
$(top_srcdir)/config/kernel-fmode-t.m4 \
$(top_srcdir)/config/kernel-fsync.m4 \
$(top_srcdir)/config/kernel-get-disk-ro.m4 \
diff --git a/cmd/Makefile.in b/cmd/Makefile.in
index a0fdde92c4cb..4a38f36fc4a4 100644
--- a/cmd/Makefile.in
+++ b/cmd/Makefile.in
@@ -63,6 +63,7 @@ am__aclocal_m4_deps = \
$(top_srcdir)/config/kernel-check-disk-size-change.m4 \
$(top_srcdir)/config/kernel-d-obtain-alias.m4 \
$(top_srcdir)/config/kernel-evict-inode.m4 \
+ $(top_srcdir)/config/kernel-fallocate.m4 \
$(top_srcdir)/config/kernel-fmode-t.m4 \
$(top_srcdir)/config/kernel-fsync.m4 \
$(top_srcdir)/config/kernel-get-disk-ro.m4 \
diff --git a/cmd/mount_zfs/Makefile.in b/cmd/mount_zfs/Makefile.in
index 350c67dd4c29..273e20542983 100644
--- a/cmd/mount_zfs/Makefile.in
+++ b/cmd/mount_zfs/Makefile.in
@@ -66,6 +66,7 @@ am__aclocal_m4_deps = \
$(top_srcdir)/config/kernel-check-disk-size-change.m4 \
$(top_srcdir)/config/kernel-d-obtain-alias.m4 \
$(top_srcdir)/config/kernel-evict-inode.m4 \
+ $(top_srcdir)/config/kernel-fallocate.m4 \
$(top_srcdir)/config/kernel-fmode-t.m4 \
$(top_srcdir)/config/kernel-fsync.m4 \
$(top_srcdir)/config/kernel-get-disk-ro.m4 \
diff --git a/cmd/sas_switch_id/Makefile.in b/cmd/sas_switch_id/Makefile.in
index 94e3a63e63b3..73a22c4ef4b0 100644
--- a/cmd/sas_switch_id/Makefile.in
+++ b/cmd/sas_switch_id/Makefile.in
@@ -65,6 +65,7 @@ am__aclocal_m4_deps = \
$(top_srcdir)/config/kernel-check-disk-size-change.m4 \
$(top_srcdir)/config/kernel-d-obtain-alias.m4 \
$(top_srcdir)/config/kernel-evict-inode.m4 \
+ $(top_srcdir)/config/kernel-fallocate.m4 \
$(top_srcdir)/config/kernel-fmode-t.m4 \
$(top_srcdir)/config/kernel-fsync.m4 \
$(top_srcdir)/config/kernel-get-disk-ro.m4 \
diff --git a/cmd/zdb/Makefile.in b/cmd/zdb/Makefile.in
index fa0b8c76222a..5ce100dd0e48 100644
--- a/cmd/zdb/Makefile.in
+++ b/cmd/zdb/Makefile.in
@@ -66,6 +66,7 @@ am__aclocal_m4_deps = \
$(top_srcdir)/config/kernel-check-disk-size-change.m4 \
$(top_srcdir)/config/kernel-d-obtain-alias.m4 \
$(top_srcdir)/config/kernel-evict-inode.m4 \
+ $(top_srcdir)/config/kernel-fallocate.m4 \
$(top_srcdir)/config/kernel-fmode-t.m4 \
$(top_srcdir)/config/kernel-fsync.m4 \
$(top_srcdir)/config/kernel-get-disk-ro.m4 \
diff --git a/cmd/zfs/Makefile.in b/cmd/zfs/Makefile.in
index ccf9924bd3c7..81f778a5e4ef 100644
--- a/cmd/zfs/Makefile.in
+++ b/cmd/zfs/Makefile.in
@@ -66,6 +66,7 @@ am__aclocal_m4_deps = \
$(top_srcdir)/config/kernel-check-disk-size-change.m4 \
$(top_srcdir)/config/kernel-d-obtain-alias.m4 \
$(top_srcdir)/config/kernel-evict-inode.m4 \
+ $(top_srcdir)/config/kernel-fallocate.m4 \
$(top_srcdir)/config/kernel-fmode-t.m4 \
$(top_srcdir)/config/kernel-fsync.m4 \
$(top_srcdir)/config/kernel-get-disk-ro.m4 \
diff --git a/cmd/zinject/Makefile.in b/cmd/zinject/Makefile.in
index eb3f28d0fdb7..644c0b2a3652 100644
--- a/cmd/zinject/Makefile.in
+++ b/cmd/zinject/Makefile.in
@@ -66,6 +66,7 @@ am__aclocal_m4_deps = \
$(top_srcdir)/config/kernel-check-disk-size-change.m4 \
$(top_srcdir)/config/kernel-d-obtain-alias.m4 \
$(top_srcdir)/config/kernel-evict-inode.m4 \
+ $(top_srcdir)/config/kernel-fallocate.m4 \
$(top_srcdir)/config/kernel-fmode-t.m4 \
$(top_srcdir)/config/kernel-fsync.m4 \
$(top_srcdir)/config/kernel-get-disk-ro.m4 \
diff --git a/cmd/zpios/Makefile.in b/cmd/zpios/Makefile.in
index c9811af105e1..e270f3744d1f 100644
--- a/cmd/zpios/Makefile.in
+++ b/cmd/zpios/Makefile.in
@@ -66,6 +66,7 @@ am__aclocal_m4_deps = \
$(top_srcdir)/config/kernel-check-disk-size-change.m4 \
$(top_srcdir)/config/kernel-d-obtain-alias.m4 \
$(top_srcdir)/config/kernel-evict-inode.m4 \
+ $(top_srcdir)/config/kernel-fallocate.m4 \
$(top_srcdir)/config/kernel-fmode-t.m4 \
$(top_srcdir)/config/kernel-fsync.m4 \
$(top_srcdir)/config/kernel-get-disk-ro.m4 \
diff --git a/cmd/zpool/Makefile.in b/cmd/zpool/Makefile.in
index 60a97aa2acf6..81620379a6d5 100644
--- a/cmd/zpool/Makefile.in
+++ b/cmd/zpool/Makefile.in
@@ -66,6 +66,7 @@ am__aclocal_m4_deps = \
$(top_srcdir)/config/kernel-check-disk-size-change.m4 \
$(top_srcdir)/config/kernel-d-obtain-alias.m4 \
$(top_srcdir)/config/kernel-evict-inode.m4 \
+ $(top_srcdir)/config/kernel-fallocate.m4 \
$(top_srcdir)/config/kernel-fmode-t.m4 \
$(top_srcdir)/config/kernel-fsync.m4 \
$(top_srcdir)/config/kernel-get-disk-ro.m4 \
diff --git a/cmd/zpool_id/Makefile.in b/cmd/zpool_id/Makefile.in
index e53c87c4f437..578fdbbc6e18 100644
--- a/cmd/zpool_id/Makefile.in
+++ b/cmd/zpool_id/Makefile.in
@@ -65,6 +65,7 @@ am__aclocal_m4_deps = \
$(top_srcdir)/config/kernel-check-disk-size-change.m4 \
$(top_srcdir)/config/kernel-d-obtain-alias.m4 \
$(top_srcdir)/config/kernel-evict-inode.m4 \
+ $(top_srcdir)/config/kernel-fallocate.m4 \
$(top_srcdir)/config/kernel-fmode-t.m4 \
$(top_srcdir)/config/kernel-fsync.m4 \
$(top_srcdir)/config/kernel-get-disk-ro.m4 \
diff --git a/cmd/zpool_layout/Makefile.in b/cmd/zpool_layout/Makefile.in
index 20658364b4f9..b89e9e8e8b9b 100644
--- a/cmd/zpool_layout/Makefile.in
+++ b/cmd/zpool_layout/Makefile.in
@@ -65,6 +65,7 @@ am__aclocal_m4_deps = \
$(top_srcdir)/config/kernel-check-disk-size-change.m4 \
$(top_srcdir)/config/kernel-d-obtain-alias.m4 \
$(top_srcdir)/config/kernel-evict-inode.m4 \
+ $(top_srcdir)/config/kernel-fallocate.m4 \
$(top_srcdir)/config/kernel-fmode-t.m4 \
$(top_srcdir)/config/kernel-fsync.m4 \
$(top_srcdir)/config/kernel-get-disk-ro.m4 \
diff --git a/cmd/ztest/Makefile.in b/cmd/ztest/Makefile.in
index e95f55cb49ef..70532fbef451 100644
--- a/cmd/ztest/Makefile.in
+++ b/cmd/ztest/Makefile.in
@@ -66,6 +66,7 @@ am__aclocal_m4_deps = \
$(top_srcdir)/config/kernel-check-disk-size-change.m4 \
$(top_srcdir)/config/kernel-d-obtain-alias.m4 \
$(top_srcdir)/config/kernel-evict-inode.m4 \
+ $(top_srcdir)/config/kernel-fallocate.m4 \
$(top_srcdir)/config/kernel-fmode-t.m4 \
$(top_srcdir)/config/kernel-fsync.m4 \
$(top_srcdir)/config/kernel-get-disk-ro.m4 \
diff --git a/cmd/zvol_id/Makefile.in b/cmd/zvol_id/Makefile.in
index 39862677ff34..6bacf9944af2 100644
--- a/cmd/zvol_id/Makefile.in
+++ b/cmd/zvol_id/Makefile.in
@@ -66,6 +66,7 @@ am__aclocal_m4_deps = \
$(top_srcdir)/config/kernel-check-disk-size-change.m4 \
$(top_srcdir)/config/kernel-d-obtain-alias.m4 \
$(top_srcdir)/config/kernel-evict-inode.m4 \
+ $(top_srcdir)/config/kernel-fallocate.m4 \
$(top_srcdir)/config/kernel-fmode-t.m4 \
$(top_srcdir)/config/kernel-fsync.m4 \
$(top_srcdir)/config/kernel-get-disk-ro.m4 \
diff --git a/config/kernel-fallocate.m4 b/config/kernel-fallocate.m4
new file mode 100644
index 000000000000..d551276c77fe
--- /dev/null
+++ b/config/kernel-fallocate.m4
@@ -0,0 +1,48 @@
+dnl #
+dnl # Linux 2.6.38 - 3.x API
+dnl #
+AC_DEFUN([ZFS_AC_KERNEL_FILE_FALLOCATE], [
+ AC_MSG_CHECKING([whether fops->fallocate() exists])
+ ZFS_LINUX_TRY_COMPILE([
+ #include <linux/fs.h>
+ ],[
+ long (*fallocate) (struct file *, int, loff_t, loff_t) = NULL;
+ struct file_operations fops __attribute__ ((unused)) = {
+ .fallocate = fallocate,
+ };
+ ],[
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(HAVE_FILE_FALLOCATE, 1, [fops->fallocate() exists])
+ ],[
+ AC_MSG_RESULT(no)
+ ])
+])
+
+dnl #
+dnl # Linux 2.6.x - 2.6.37 API
+dnl #
+AC_DEFUN([ZFS_AC_KERNEL_INODE_FALLOCATE], [
+ AC_MSG_CHECKING([whether iops->fallocate() exists])
+ ZFS_LINUX_TRY_COMPILE([
+ #include <linux/fs.h>
+ ],[
+ long (*fallocate) (struct inode *, int, loff_t, loff_t) = NULL;
+ struct inode_operations fops __attribute__ ((unused)) = {
+ .fallocate = fallocate,
+ };
+ ],[
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(HAVE_INODE_FALLOCATE, 1, [fops->fallocate() exists])
+ ],[
+ AC_MSG_RESULT(no)
+ ])
+])
+
+dnl #
+dnl # The fallocate callback was moved from the inode_operations
+dnl # structure to the file_operations structure.
+dnl #
+AC_DEFUN([ZFS_AC_KERNEL_FALLOCATE], [
+ ZFS_AC_KERNEL_FILE_FALLOCATE
+ ZFS_AC_KERNEL_INODE_FALLOCATE
+])
diff --git a/config/kernel.m4 b/config/kernel.m4
index b4645570099d..c41cdf694b8b 100644
--- a/config/kernel.m4
+++ b/config/kernel.m4
@@ -43,6 +43,7 @@ AC_DEFUN([ZFS_AC_CONFIG_KERNEL], [
ZFS_AC_KERNEL_EVICT_INODE
ZFS_AC_KERNEL_NR_CACHED_OBJECTS
ZFS_AC_KERNEL_FREE_CACHED_OBJECTS
+ ZFS_AC_KERNEL_FALLOCATE
ZFS_AC_KERNEL_INSERT_INODE_LOCKED
ZFS_AC_KERNEL_D_OBTAIN_ALIAS
ZFS_AC_KERNEL_CHECK_DISK_SIZE_CHANGE
diff --git a/configure b/configure
index 40ab1d293195..4288ca658f26 100755
--- a/configure
+++ b/configure
@@ -15469,6 +15469,144 @@ fi
+
+ { $as_echo "$as_me:$LINENO: checking whether fops->fallocate() exists" >&5
+$as_echo_n "checking whether fops->fallocate() exists... " >&6; }
+
+
+cat confdefs.h - <<_ACEOF >conftest.c
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+
+ #include <linux/fs.h>
+
+int
+main (void)
+{
+
+ long (*fallocate) (struct file *, int, loff_t, loff_t) = NULL;
+ struct file_operations fops __attribute__ ((unused)) = {
+ .fallocate = fallocate,
+ };
+
+ ;
+ return 0;
+}
+
+_ACEOF
+
+
+ rm -Rf build && mkdir -p build
+ echo "obj-m := conftest.o" >build/Makefile
+ if { ac_try='cp conftest.c build && make modules -C $LINUX_OBJ EXTRA_CFLAGS="-Werror-implicit-function-declaration $EXTRA_KCFLAGS" $ARCH_UM M=$PWD/build'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } >/dev/null && { ac_try='test -s build/conftest.o'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+
+ { $as_echo "$as_me:$LINENO: result: yes" >&5
+$as_echo "yes" >&6; }
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_FILE_FALLOCATE 1
+_ACEOF
+
+
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
+
+
+
+fi
+
+ rm -Rf build
+
+
+
+
+ { $as_echo "$as_me:$LINENO: checking whether iops->fallocate() exists" >&5
+$as_echo_n "checking whether iops->fallocate() exists... " >&6; }
+
+
+cat confdefs.h - <<_ACEOF >conftest.c
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+
+ #include <linux/fs.h>
+
+int
+main (void)
+{
+
+ long (*fallocate) (struct inode *, int, loff_t, loff_t) = NULL;
+ struct inode_operations fops __attribute__ ((unused)) = {
+ .fallocate = fallocate,
+ };
+
+ ;
+ return 0;
+}
+
+_ACEOF
+
+
+ rm -Rf build && mkdir -p build
+ echo "obj-m := conftest.o" >build/Makefile
+ if { ac_try='cp conftest.c build && make modules -C $LINUX_OBJ EXTRA_CFLAGS="-Werror-implicit-function-declaration $EXTRA_KCFLAGS" $ARCH_UM M=$PWD/build'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } >/dev/null && { ac_try='test -s build/conftest.o'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+
+ { $as_echo "$as_me:$LINENO: result: yes" >&5
+$as_echo "yes" >&6; }
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_INODE_FALLOCATE 1
+_ACEOF
+
+
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
+
+
+
+fi
+
+ rm -Rf build
+
+
+
+
+
{ $as_echo "$as_me:$LINENO: checking whether symbol insert_inode_locked is exported" >&5
$as_echo_n "checking whether symbol insert_inode_locked is exported... " >&6; }
grep -q -E '[[:space:]]insert_inode_locked[[:space:]]' \
@@ -21149,6 +21287,144 @@ fi
+
+ { $as_echo "$as_me:$LINENO: checking whether fops->fallocate() exists" >&5
+$as_echo_n "checking whether fops->fallocate() exists... " >&6; }
+
+
+cat confdefs.h - <<_ACEOF >conftest.c
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+
+ #include <linux/fs.h>
+
+int
+main (void)
+{
+
+ long (*fallocate) (struct file *, int, loff_t, loff_t) = NULL;
+ struct file_operations fops __attribute__ ((unused)) = {
+ .fallocate = fallocate,
+ };
+
+ ;
+ return 0;
+}
+
+_ACEOF
+
+
+ rm -Rf build && mkdir -p build
+ echo "obj-m := conftest.o" >build/Makefile
+ if { ac_try='cp conftest.c build && make modules -C $LINUX_OBJ EXTRA_CFLAGS="-Werror-implicit-function-declaration $EXTRA_KCFLAGS" $ARCH_UM M=$PWD/build'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } >/dev/null && { ac_try='test -s build/conftest.o'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+
+ { $as_echo "$as_me:$LINENO: result: yes" >&5
+$as_echo "yes" >&6; }
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_FILE_FALLOCATE 1
+_ACEOF
+
+
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
+
+
+
+fi
+
+ rm -Rf build
+
+
+
+
+ { $as_echo "$as_me:$LINENO: checking whether iops->fallocate() exists" >&5
+$as_echo_n "checking whether iops->fallocate() exists... " >&6; }
+
+
+cat confdefs.h - <<_ACEOF >conftest.c
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+
+ #include <linux/fs.h>
+
+int
+main (void)
+{
+
+ long (*fallocate) (struct inode *, int, loff_t, loff_t) = NULL;
+ struct inode_operations fops __attribute__ ((unused)) = {
+ .fallocate = fallocate,
+ };
+
+ ;
+ return 0;
+}
+
+_ACEOF
+
+
+ rm -Rf build && mkdir -p build
+ echo "obj-m := conftest.o" >build/Makefile
+ if { ac_try='cp conftest.c build && make modules -C $LINUX_OBJ EXTRA_CFLAGS="-Werror-implicit-function-declaration $EXTRA_KCFLAGS" $ARCH_UM M=$PWD/build'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } >/dev/null && { ac_try='test -s build/conftest.o'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+
+ { $as_echo "$as_me:$LINENO: result: yes" >&5
+$as_echo "yes" >&6; }
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_INODE_FALLOCATE 1
+_ACEOF
+
+
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
+
+
+
+fi
+
+ rm -Rf build
+
+
+
+
+
{ $as_echo "$as_me:$LINENO: checking whether symbol insert_inode_locked is exported" >&5
$as_echo_n "checking whether symbol insert_inode_locked is exported... " >&6; }
grep -q -E '[[:space:]]insert_inode_locked[[:space:]]' \
diff --git a/dracut/90zfs/Makefile.in b/dracut/90zfs/Makefile.in
index b7c3be689e4c..f574205dd95c 100644
--- a/dracut/90zfs/Makefile.in
+++ b/dracut/90zfs/Makefile.in
@@ -64,6 +64,7 @@ am__aclocal_m4_deps = \
$(top_srcdir)/config/kernel-check-disk-size-change.m4 \
$(top_srcdir)/config/kernel-d-obtain-alias.m4 \
$(top_srcdir)/config/kernel-evict-inode.m4 \
+ $(top_srcdir)/config/kernel-fallocate.m4 \
$(top_srcdir)/config/kernel-fmode-t.m4 \
$(top_srcdir)/config/kernel-fsync.m4 \
$(top_srcdir)/config/kernel-get-disk-ro.m4 \
diff --git a/dracut/Makefile.in b/dracut/Makefile.in
index d92a983f8fb0..a9f8be2053dd 100644
--- a/dracut/Makefile.in
+++ b/dracut/Makefile.in
@@ -63,6 +63,7 @@ am__aclocal_m4_deps = \
$(top_srcdir)/config/kernel-check-disk-size-change.m4 \
$(top_srcdir)/config/kernel-d-obtain-alias.m4 \
$(top_srcdir)/config/kernel-evict-inode.m4 \
+ $(top_srcdir)/config/kernel-fallocate.m4 \
$(top_srcdir)/config/kernel-fmode-t.m4 \
$(top_srcdir)/config/kernel-fsync.m4 \
$(top_srcdir)/config/kernel-get-disk-ro.m4 \
diff --git a/etc/Makefile.in b/etc/Makefile.in
index b5e53a43775b..2cb43ca3c9f8 100644
--- a/etc/Makefile.in
+++ b/etc/Makefile.in
@@ -63,6 +63,7 @@ am__aclocal_m4_deps = \
$(top_srcdir)/config/kernel-check-disk-size-change.m4 \
$(top_srcdir)/config/kernel-d-obtain-alias.m4 \
$(top_srcdir)/config/kernel-evict-inode.m4 \
+ $(top_srcdir)/config/kernel-fallocate.m4 \
$(top_srcdir)/config/kernel-fmode-t.m4 \
$(top_srcdir)/config/kernel-fsync.m4 \
$(top_srcdir)/config/kernel-get-disk-ro.m4 \
diff --git a/etc/init.d/Makefile.in b/etc/init.d/Makefile.in
index 0106a50684db..73f07f4b6e54 100644
--- a/etc/init.d/Makefile.in
+++ b/etc/init.d/Makefile.in
@@ -64,6 +64,7 @@ am__aclocal_m4_deps = \
$(top_srcdir)/config/kernel-check-disk-size-change.m4 \
$(top_srcdir)/config/kernel-d-obtain-alias.m4 \
$(top_srcdir)/config/kernel-evict-inode.m4 \
+ $(top_srcdir)/config/kernel-fallocate.m4 \
$(top_srcdir)/config/kernel-fmode-t.m4 \
$(top_srcdir)/config/kernel-fsync.m4 \
$(top_srcdir)/config/kernel-get-disk-ro.m4 \
diff --git a/etc/zfs/Makefile.in b/etc/zfs/Makefile.in
index e0bc342969cd..8024d3095c38 100644
--- a/etc/zfs/Makefile.in
+++ b/etc/zfs/Makefile.in
@@ -64,6 +64,7 @@ am__aclocal_m4_deps = \
$(top_srcdir)/config/kernel-check-disk-size-change.m4 \
$(top_srcdir)/config/kernel-d-obtain-alias.m4 \
$(top_srcdir)/config/kernel-evict-inode.m4 \
+ $(top_srcdir)/config/kernel-fallocate.m4 \
$(top_srcdir)/config/kernel-fmode-t.m4 \
$(top_srcdir)/config/kernel-fsync.m4 \
$(top_srcdir)/config/kernel-get-disk-ro.m4 \
diff --git a/include/Makefile.in b/include/Makefile.in
index d4bb07ce6ea7..d7423a3c7774 100644
--- a/include/Makefile.in
+++ b/include/Makefile.in
@@ -65,6 +65,7 @@ am__aclocal_m4_deps = \
$(top_srcdir)/config/kernel-check-disk-size-change.m4 \
$(top_srcdir)/config/kernel-d-obtain-alias.m4 \
$(top_srcdir)/config/kernel-evict-inode.m4 \
+ $(top_srcdir)/config/kernel-fallocate.m4 \
$(top_srcdir)/config/kernel-fmode-t.m4 \
$(top_srcdir)/config/kernel-fsync.m4 \
$(top_srcdir)/config/kernel-get-disk-ro.m4 \
diff --git a/include/linux/Makefile.in b/include/linux/Makefile.in
index e88c69215c74..d18e5dd9c692 100644
--- a/include/linux/Makefile.in
+++ b/include/linux/Makefile.in
@@ -65,6 +65,7 @@ am__aclocal_m4_deps = \
$(top_srcdir)/config/kernel-check-disk-size-change.m4 \
$(top_srcdir)/config/kernel-d-obtain-alias.m4 \
$(top_srcdir)/config/kernel-evict-inode.m4 \
+ $(top_srcdir)/config/kernel-fallocate.m4 \
$(top_srcdir)/config/kernel-fmode-t.m4 \
$(top_srcdir)/config/kernel-fsync.m4 \
$(top_srcdir)/config/kernel-get-disk-ro.m4 \
diff --git a/include/sys/Makefile.in b/include/sys/Makefile.in
index 3903cefdc57e..06c20479b8e1 100644
--- a/include/sys/Makefile.in
+++ b/include/sys/Makefile.in
@@ -65,6 +65,7 @@ am__aclocal_m4_deps = \
$(top_srcdir)/config/kernel-check-disk-size-change.m4 \
$(top_srcdir)/config/kernel-d-obtain-alias.m4 \
$(top_srcdir)/config/kernel-evict-inode.m4 \
+ $(top_srcdir)/config/kernel-fallocate.m4 \
$(top_srcdir)/config/kernel-fmode-t.m4 \
$(top_srcdir)/config/kernel-fsync.m4 \
$(top_srcdir)/config/kernel-get-disk-ro.m4 \
diff --git a/include/sys/fm/Makefile.in b/include/sys/fm/Makefile.in
index 46255c8e6622..245995ddaac5 100644
--- a/include/sys/fm/Makefile.in
+++ b/include/sys/fm/Makefile.in
@@ -65,6 +65,7 @@ am__aclocal_m4_deps = \
$(top_srcdir)/config/kernel-check-disk-size-change.m4 \
$(top_srcdir)/config/kernel-d-obtain-alias.m4 \
$(top_srcdir)/config/kernel-evict-inode.m4 \
+ $(top_srcdir)/config/kernel-fallocate.m4 \
$(top_srcdir)/config/kernel-fmode-t.m4 \
$(top_srcdir)/config/kernel-fsync.m4 \
$(top_srcdir)/config/kernel-get-disk-ro.m4 \
diff --git a/include/sys/fm/fs/Makefile.in b/include/sys/fm/fs/Makefile.in
index 5dd6f48820fd..10dcd83e9144 100644
--- a/include/sys/fm/fs/Makefile.in
+++ b/include/sys/fm/fs/Makefile.in
@@ -65,6 +65,7 @@ am__aclocal_m4_deps = \
$(top_srcdir)/config/kernel-check-disk-size-change.m4 \
$(top_srcdir)/config/kernel-d-obtain-alias.m4 \
$(top_srcdir)/config/kernel-evict-inode.m4 \
+ $(top_srcdir)/config/kernel-fallocate.m4 \
$(top_srcdir)/config/kernel-fmode-t.m4 \
$(top_srcdir)/config/kernel-fsync.m4 \
$(top_srcdir)/config/kernel-get-disk-ro.m4 \
diff --git a/include/sys/fs/Makefile.in b/include/sys/fs/Makefile.in
index 550b106bb810..ee2f168216e6 100644
--- a/include/sys/fs/Makefile.in
+++ b/include/sys/fs/Makefile.in
@@ -65,6 +65,7 @@ am__aclocal_m4_deps = \
$(top_srcdir)/config/kernel-check-disk-size-change.m4 \
$(top_srcdir)/config/kernel-d-obtain-alias.m4 \
$(top_srcdir)/config/kernel-evict-inode.m4 \
+ $(top_srcdir)/config/kernel-fallocate.m4 \
$(top_srcdir)/config/kernel-fmode-t.m4 \
$(top_srcdir)/config/kernel-fsync.m4 \
$(top_srcdir)/config/kernel-get-disk-ro.m4 \
diff --git a/include/sys/zpl.h b/include/sys/zpl.h
index 2195ec9a3d98..cfc86794e78a 100644
--- a/include/sys/zpl.h
+++ b/include/sys/zpl.h
@@ -30,6 +30,7 @@
#include <linux/xattr_compat.h>
#include <linux/exportfs.h>
#include <linux/writeback.h>
+#include <linux/falloc.h>
/* zpl_inode.c */
extern const struct inode_operations zpl_inode_operations;
@@ -42,6 +43,8 @@ extern ssize_t zpl_read_common(struct inode *ip, const char *buf,
size_t len, loff_t pos, uio_seg_t segment, int flags, cred_t *cr);
extern ssize_t zpl_write_common(struct inode *ip, const char *buf,
size_t len, loff_t pos, uio_seg_t segment, int flags, cred_t *cr);
+extern long zpl_fallocate_common(struct inode *ip, int mode,
+ loff_t offset, loff_t len);
extern const struct address_space_operations zpl_address_space_operations;
extern const struct file_operations zpl_file_operations;
diff --git a/lib/Makefile.in b/lib/Makefile.in
index f68acbe71633..43bdf0dc226a 100644
--- a/lib/Makefile.in
+++ b/lib/Makefile.in
@@ -63,6 +63,7 @@ am__aclocal_m4_deps = \
$(top_srcdir)/config/kernel-check-disk-size-change.m4 \
$(top_srcdir)/config/kernel-d-obtain-alias.m4 \
$(top_srcdir)/config/kernel-evict-inode.m4 \
+ $(top_srcdir)/config/kernel-fallocate.m4 \
$(top_srcdir)/config/kernel-fmode-t.m4 \
$(top_srcdir)/config/kernel-fsync.m4 \
$(top_srcdir)/config/kernel-get-disk-ro.m4 \
diff --git a/lib/libavl/Makefile.in b/lib/libavl/Makefile.in
index c87bbb323c5a..d909fa66aa6d 100644
--- a/lib/libavl/Makefile.in
+++ b/lib/libavl/Makefile.in
@@ -65,6 +65,7 @@ am__aclocal_m4_deps = \
$(top_srcdir)/config/kernel-check-disk-size-change.m4 \
$(top_srcdir)/config/kernel-d-obtain-alias.m4 \
$(top_srcdir)/config/kernel-evict-inode.m4 \
+ $(top_srcdir)/config/kernel-fallocate.m4 \
$(top_srcdir)/config/kernel-fmode-t.m4 \
$(top_srcdir)/config/kernel-fsync.m4 \
$(top_srcdir)/config/kernel-get-disk-ro.m4 \
diff --git a/lib/libefi/Makefile.in b/lib/libefi/Makefile.in
index 3fcb93de8858..a0595ce5dac6 100644
--- a/lib/libefi/Makefile.in
+++ b/lib/libefi/Makefile.in
@@ -65,6 +65,7 @@ am__aclocal_m4_deps = \
$(top_srcdir)/config/kernel-check-disk-size-change.m4 \
$(top_srcdir)/config/kernel-d-obtain-alias.m4 \
$(top_srcdir)/config/kernel-evict-inode.m4 \
+ $(top_srcdir)/config/kernel-fallocate.m4 \
$(top_srcdir)/config/kernel-fmode-t.m4 \
$(top_srcdir)/config/kernel-fsync.m4 \
$(top_srcdir)/config/kernel-get-disk-ro.m4 \
diff --git a/lib/libnvpair/Makefile.in b/lib/libnvpair/Makefile.in
index cbfff617ab36..533d962356c1 100644
--- a/lib/libnvpair/Makefile.in
+++ b/lib/libnvpair/Makefile.in
@@ -65,6 +65,7 @@ am__aclocal_m4_deps = \
$(top_srcdir)/config/kernel-check-disk-size-change.m4 \
$(top_srcdir)/config/kernel-d-obtain-alias.m4 \
$(top_srcdir)/config/kernel-evict-inode.m4 \
+ $(top_srcdir)/config/kernel-fallocate.m4 \
$(top_srcdir)/config/kernel-fmode-t.m4 \
$(top_srcdir)/config/kernel-fsync.m4 \
$(top_srcdir)/config/kernel-get-disk-ro.m4 \
diff --git a/lib/libshare/Makefile.in b/lib/libshare/Makefile.in
index 8951784ad256..8390ce835dbb 100644
--- a/lib/libshare/Makefile.in
+++ b/lib/libshare/Makefile.in
@@ -65,6 +65,7 @@ am__aclocal_m4_deps = \
$(top_srcdir)/config/kernel-check-disk-size-change.m4 \
$(top_srcdir)/config/kernel-d-obtain-alias.m4 \
$(top_srcdir)/config/kernel-evict-inode.m4 \
+ $(top_srcdir)/config/kernel-fallocate.m4 \
$(top_srcdir)/config/kernel-fmode-t.m4 \
$(top_srcdir)/config/kernel-fsync.m4 \
$(top_srcdir)/config/kernel-get-disk-ro.m4 \
diff --git a/lib/libspl/Makefile.in b/lib/libspl/Makefile.in
index b77af2300f43..541f72b9d175 100644
--- a/lib/libspl/Makefile.in
+++ b/lib/libspl/Makefile.in
@@ -65,6 +65,7 @@ am__aclocal_m4_deps = \
$(top_srcdir)/config/kernel-check-disk-size-change.m4 \
$(top_srcdir)/config/kernel-d-obtain-alias.m4 \
$(top_srcdir)/config/kernel-evict-inode.m4 \
+ $(top_srcdir)/config/kernel-fallocate.m4 \
$(top_srcdir)/config/kernel-fmode-t.m4 \
$(top_srcdir)/config/kernel-fsync.m4 \
$(top_srcdir)/config/kernel-get-disk-ro.m4 \
diff --git a/lib/libspl/asm-generic/Makefile.in b/lib/libspl/asm-generic/Makefile.in
index 7fb66ef7c081..974f489adb82 100644
--- a/lib/libspl/asm-generic/Makefile.in
+++ b/lib/libspl/asm-generic/Makefile.in
@@ -64,6 +64,7 @@ am__aclocal_m4_deps = \
$(top_srcdir)/config/kernel-check-disk-size-change.m4 \
$(top_srcdir)/config/kernel-d-obtain-alias.m4 \
$(top_srcdir)/config/kernel-evict-inode.m4 \
+ $(top_srcdir)/config/kernel-fallocate.m4 \
$(top_srcdir)/config/kernel-fmode-t.m4 \
$(top_srcdir)/config/kernel-fsync.m4 \
$(top_srcdir)/config/kernel-get-disk-ro.m4 \
diff --git a/lib/libspl/asm-i386/Makefile.in b/lib/libspl/asm-i386/Makefile.in
index bf418b90ef86..f84cd39d976b 100644
--- a/lib/libspl/asm-i386/Makefile.in
+++ b/lib/libspl/asm-i386/Makefile.in
@@ -65,6 +65,7 @@ am__aclocal_m4_deps = \
$(top_srcdir)/config/kernel-check-disk-size-change.m4 \
$(top_srcdir)/config/kernel-d-obtain-alias.m4 \
$(top_srcdir)/config/kernel-evict-inode.m4 \
+ $(top_srcdir)/config/kernel-fallocate.m4 \
$(top_srcdir)/config/kernel-fmode-t.m4 \
$(top_srcdir)/config/kernel-fsync.m4 \
$(top_srcdir)/config/kernel-get-disk-ro.m4 \
diff --git a/lib/libspl/asm-x86_64/Makefile.in b/lib/libspl/asm-x86_64/Makefile.in
index 2d6f74644786..23c4b2917f71 100644
--- a/lib/libspl/asm-x86_64/Makefile.in
+++ b/lib/libspl/asm-x86_64/Makefile.in
@@ -65,6 +65,7 @@ am__aclocal_m4_deps = \
$(top_srcdir)/config/kernel-check-disk-size-change.m4 \
$(top_srcdir)/config/kernel-d-obtain-alias.m4 \
$(top_srcdir)/config/kernel-evict-inode.m4 \
+ $(top_srcdir)/config/kernel-fallocate.m4 \
$(top_srcdir)/config/kernel-fmode-t.m4 \
$(top_srcdir)/config/kernel-fsync.m4 \
$(top_srcdir)/config/kernel-get-disk-ro.m4 \
diff --git a/lib/libspl/include/Makefile.in b/lib/libspl/include/Makefile.in
index 9c693d43f273..043f0fe1e48e 100644
--- a/lib/libspl/include/Makefile.in
+++ b/lib/libspl/include/Makefile.in
@@ -65,6 +65,7 @@ am__aclocal_m4_deps = \
$(top_srcdir)/config/kernel-check-disk-size-change.m4 \
$(top_srcdir)/config/kernel-d-obtain-alias.m4 \
$(top_srcdir)/config/kernel-evict-inode.m4 \
+ $(top_srcdir)/config/kernel-fallocate.m4 \
$(top_srcdir)/config/kernel-fmode-t.m4 \
$(top_srcdir)/config/kernel-fsync.m4 \
$(top_srcdir)/config/kernel-get-disk-ro.m4 \
diff --git a/lib/libspl/include/ia32/Makefile.in b/lib/libspl/include/ia32/Makefile.in
index 789214e5f569..dad5d8561339 100644
--- a/lib/libspl/include/ia32/Makefile.in
+++ b/lib/libspl/include/ia32/Makefile.in
@@ -63,6 +63,7 @@ am__aclocal_m4_deps = \
$(top_srcdir)/config/kernel-check-disk-size-change.m4 \
$(top_srcdir)/config/kernel-d-obtain-alias.m4 \
$(top_srcdir)/config/kernel-evict-inode.m4 \
+ $(top_srcdir)/config/kernel-fallocate.m4 \
$(top_srcdir)/config/kernel-fmode-t.m4 \
$(top_srcdir)/config/kernel-fsync.m4 \
$(top_srcdir)/config/kernel-get-disk-ro.m4 \
diff --git a/lib/libspl/include/ia32/sys/Makefile.in b/lib/libspl/include/ia32/sys/Makefile.in
index 058f143a5246..d7ea24fff9e3 100644
--- a/lib/libspl/include/ia32/sys/Makefile.in
+++ b/lib/libspl/include/ia32/sys/Makefile.in
@@ -65,6 +65,7 @@ am__aclocal_m4_deps = \
$(top_srcdir)/config/kernel-check-disk-size-change.m4 \
$(top_srcdir)/config/kernel-d-obtain-alias.m4 \
$(top_srcdir)/config/kernel-evict-inode.m4 \
+ $(top_srcdir)/config/kernel-fallocate.m4 \
$(top_srcdir)/config/kernel-fmode-t.m4 \
$(top_srcdir)/config/kernel-fsync.m4 \
$(top_srcdir)/config/kernel-get-disk-ro.m4 \
diff --git a/lib/libspl/include/rpc/Makefile.in b/lib/libspl/include/rpc/Makefile.in
index 840100f75e7c..3a0b3a1aff51 100644
--- a/lib/libspl/include/rpc/Makefile.in
+++ b/lib/libspl/include/rpc/Makefile.in
@@ -65,6 +65,7 @@ am__aclocal_m4_deps = \
$(top_srcdir)/config/kernel-check-disk-size-change.m4 \
$(top_srcdir)/config/kernel-d-obtain-alias.m4 \
$(top_srcdir)/config/kernel-evict-inode.m4 \
+ $(top_srcdir)/config/kernel-fallocate.m4 \
$(top_srcdir)/config/kernel-fmode-t.m4 \
$(top_srcdir)/config/kernel-fsync.m4 \
$(top_srcdir)/config/kernel-get-disk-ro.m4 \
diff --git a/lib/libspl/include/sys/Makefile.in b/lib/libspl/include/sys/Makefile.in
index 81d011e1a7eb..b8663bdd2ef6 100644
--- a/lib/libspl/include/sys/Makefile.in
+++ b/lib/libspl/include/sys/Makefile.in
@@ -65,6 +65,7 @@ am__aclocal_m4_deps = \
$(top_srcdir)/config/kernel-check-disk-size-change.m4 \
$(top_srcdir)/config/kernel-d-obtain-alias.m4 \
$(top_srcdir)/config/kernel-evict-inode.m4 \
+ $(top_srcdir)/config/kernel-fallocate.m4 \
$(top_srcdir)/config/kernel-fmode-t.m4 \
$(top_srcdir)/config/kernel-fsync.m4 \
$(top_srcdir)/config/kernel-get-disk-ro.m4 \
diff --git a/lib/libspl/include/sys/dktp/Makefile.in b/lib/libspl/include/sys/dktp/Makefile.in
index 1107586e40f2..e5c353795518 100644
--- a/lib/libspl/include/sys/dktp/Makefile.in
+++ b/lib/libspl/include/sys/dktp/Makefile.in
@@ -65,6 +65,7 @@ am__aclocal_m4_deps = \
$(top_srcdir)/config/kernel-check-disk-size-change.m4 \
$(top_srcdir)/config/kernel-d-obtain-alias.m4 \
$(top_srcdir)/config/kernel-evict-inode.m4 \
+ $(top_srcdir)/config/kernel-fallocate.m4 \
$(top_srcdir)/config/kernel-fmode-t.m4 \
$(top_srcdir)/config/kernel-fsync.m4 \
$(top_srcdir)/config/kernel-get-disk-ro.m4 \
diff --git a/lib/libspl/include/sys/sysevent/Makefile.in b/lib/libspl/include/sys/sysevent/Makefile.in
index 065f9dc0e5a1..edb36b071035 100644
--- a/lib/libspl/include/sys/sysevent/Makefile.in
+++ b/lib/libspl/include/sys/sysevent/Makefile.in
@@ -65,6 +65,7 @@ am__aclocal_m4_deps = \
$(top_srcdir)/config/kernel-check-disk-size-change.m4 \
$(top_srcdir)/config/kernel-d-obtain-alias.m4 \
$(top_srcdir)/config/kernel-evict-inode.m4 \
+ $(top_srcdir)/config/kernel-fallocate.m4 \
$(top_srcdir)/config/kernel-fmode-t.m4 \
$(top_srcdir)/config/kernel-fsync.m4 \
$(top_srcdir)/config/kernel-get-disk-ro.m4 \
diff --git a/lib/libspl/include/util/Makefile.in b/lib/libspl/include/util/Makefile.in
index 62db1c83f999..301fde58799d 100644
--- a/lib/libspl/include/util/Makefile.in
+++ b/lib/libspl/include/util/Makefile.in
@@ -65,6 +65,7 @@ am__aclocal_m4_deps = \
$(top_srcdir)/config/kernel-check-disk-size-change.m4 \
$(top_srcdir)/config/kernel-d-obtain-alias.m4 \
$(top_srcdir)/config/kernel-evict-inode.m4 \
+ $(top_srcdir)/config/kernel-fallocate.m4 \
$(top_srcdir)/config/kernel-fmode-t.m4 \
$(top_srcdir)/config/kernel-fsync.m4 \
$(top_srcdir)/config/kernel-get-disk-ro.m4 \
diff --git a/lib/libunicode/Makefile.in b/lib/libunicode/Makefile.in
index ae6626bae256..3e3cb2df1057 100644
--- a/lib/libunicode/Makefile.in
+++ b/lib/libunicode/Makefile.in
@@ -65,6 +65,7 @@ am__aclocal_m4_deps = \
$(top_srcdir)/config/kernel-check-disk-size-change.m4 \
$(top_srcdir)/config/kernel-d-obtain-alias.m4 \
$(top_srcdir)/config/kernel-evict-inode.m4 \
+ $(top_srcdir)/config/kernel-fallocate.m4 \
$(top_srcdir)/config/kernel-fmode-t.m4 \
$(top_srcdir)/config/kernel-fsync.m4 \
$(top_srcdir)/config/kernel-get-disk-ro.m4 \
diff --git a/lib/libuutil/Makefile.in b/lib/libuutil/Makefile.in
index 6870365be3e3..1fb5e573dbeb 100644
--- a/lib/libuutil/Makefile.in
+++ b/lib/libuutil/Makefile.in
@@ -65,6 +65,7 @@ am__aclocal_m4_deps = \
$(top_srcdir)/config/kernel-check-disk-size-change.m4 \
$(top_srcdir)/config/kernel-d-obtain-alias.m4 \
$(top_srcdir)/config/kernel-evict-inode.m4 \
+ $(top_srcdir)/config/kernel-fallocate.m4 \
$(top_srcdir)/config/kernel-fmode-t.m4 \
$(top_srcdir)/config/kernel-fsync.m4 \
$(top_srcdir)/config/kernel-get-disk-ro.m4 \
diff --git a/lib/libzfs/Makefile.in b/lib/libzfs/Makefile.in
index c62a360dfd64..9ba47ca73aca 100644
--- a/lib/libzfs/Makefile.in
+++ b/lib/libzfs/Makefile.in
@@ -65,6 +65,7 @@ am__aclocal_m4_deps = \
$(top_srcdir)/config/kernel-check-disk-size-change.m4 \
$(top_srcdir)/config/kernel-d-obtain-alias.m4 \
$(top_srcdir)/config/kernel-evict-inode.m4 \
+ $(top_srcdir)/config/kernel-fallocate.m4 \
$(top_srcdir)/config/kernel-fmode-t.m4 \
$(top_srcdir)/config/kernel-fsync.m4 \
$(top_srcdir)/config/kernel-get-disk-ro.m4 \
diff --git a/lib/libzpool/Makefile.in b/lib/libzpool/Makefile.in
index 39ec39311849..fc071e22a89e 100644
--- a/lib/libzpool/Makefile.in
+++ b/lib/libzpool/Makefile.in
@@ -65,6 +65,7 @@ am__aclocal_m4_deps = \
$(top_srcdir)/config/kernel-check-disk-size-change.m4 \
$(top_srcdir)/config/kernel-d-obtain-alias.m4 \
$(top_srcdir)/config/kernel-evict-inode.m4 \
+ $(top_srcdir)/config/kernel-fallocate.m4 \
$(top_srcdir)/config/kernel-fmode-t.m4 \
$(top_srcdir)/config/kernel-fsync.m4 \
$(top_srcdir)/config/kernel-get-disk-ro.m4 \
diff --git a/man/Makefile.in b/man/Makefile.in
index f428397b86d5..8e98be3d16ad 100644
--- a/man/Makefile.in
+++ b/man/Makefile.in
@@ -63,6 +63,7 @@ am__aclocal_m4_deps = \
$(top_srcdir)/config/kernel-check-disk-size-change.m4 \
$(top_srcdir)/config/kernel-d-obtain-alias.m4 \
$(top_srcdir)/config/kernel-evict-inode.m4 \
+ $(top_srcdir)/config/kernel-fallocate.m4 \
$(top_srcdir)/config/kernel-fmode-t.m4 \
$(top_srcdir)/config/kernel-fsync.m4 \
$(top_srcdir)/config/kernel-get-disk-ro.m4 \
diff --git a/man/man8/Makefile.in b/man/man8/Makefile.in
index 4a12e10966e2..12524ffcce65 100644
--- a/man/man8/Makefile.in
+++ b/man/man8/Makefile.in
@@ -63,6 +63,7 @@ am__aclocal_m4_deps = \
$(top_srcdir)/config/kernel-check-disk-size-change.m4 \
$(top_srcdir)/config/kernel-d-obtain-alias.m4 \
$(top_srcdir)/config/kernel-evict-inode.m4 \
+ $(top_srcdir)/config/kernel-fallocate.m4 \
$(top_srcdir)/config/kernel-fmode-t.m4 \
$(top_srcdir)/config/kernel-fsync.m4 \
$(top_srcdir)/config/kernel-get-disk-ro.m4 \
diff --git a/module/zfs/zpl_file.c b/module/zfs/zpl_file.c
index 0ef2c1558f0b..5ac41c9d24e9 100644
--- a/module/zfs/zpl_file.c
+++ b/module/zfs/zpl_file.c
@@ -394,6 +394,50 @@ zpl_writepage(struct page *pp, struct writeback_control *wbc)
return zpl_putpage(pp, wbc, pp->mapping);
}
+/*
+ * The only flag combination which matches the behavior of zfs_space()
+ * is FALLOC_FL_PUNCH_HOLE. This flag was introduced in the 2.6.38 kernel.
+ */
+long
+zpl_fallocate_common(struct inode *ip, int mode, loff_t offset, loff_t len)
+{
+ cred_t *cr = CRED();
+ int error = -EOPNOTSUPP;
+
+ if (mode & FALLOC_FL_KEEP_SIZE)
+ return (-EOPNOTSUPP);
+
+ crhold(cr);
+
+#ifdef FALLOC_FL_PUNCH_HOLE
+ if (mode & FALLOC_FL_PUNCH_HOLE) {
+ flock64_t bf;
+
+ bf.l_type = F_WRLCK;
+ bf.l_whence = 0;
+ bf.l_start = offset;
+ bf.l_len = len;
+ bf.l_pid = 0;
+
+ error = -zfs_space(ip, F_FREESP, &bf, FWRITE, offset, cr);
+ }
+#endif /* FALLOC_FL_PUNCH_HOLE */
+
+ crfree(cr);
+
+ ASSERT3S(error, <=, 0);
+ return (error);
+}
+
+#ifdef HAVE_FILE_FALLOCATE
+static long
+zpl_fallocate(struct file *filp, int mode, loff_t offset, loff_t len)
+{
+ return zpl_fallocate_common(filp->f_path.dentry->d_inode,
+ mode, offset, len);
+}
+#endif /* HAVE_FILE_FALLOCATE */
+
const struct address_space_operations zpl_address_space_operations = {
.readpages = zpl_readpages,
.readpage = zpl_readpage,
@@ -410,6 +454,9 @@ const struct file_operations zpl_file_operations = {
.readdir = zpl_readdir,
.mmap = zpl_mmap,
.fsync = zpl_fsync,
+#ifdef HAVE_FILE_FALLOCATE
+ .fallocate = zpl_fallocate,
+#endif /* HAVE_FILE_FALLOCATE */
};
const struct file_operations zpl_dir_file_operations = {
diff --git a/module/zfs/zpl_inode.c b/module/zfs/zpl_inode.c
index 2d197a488072..9b5533755985 100644
--- a/module/zfs/zpl_inode.c
+++ b/module/zfs/zpl_inode.c
@@ -342,6 +342,15 @@ zpl_truncate_range(struct inode* ip, loff_t start, loff_t end)
crfree(cr);
}
+#ifdef HAVE_INODE_FALLOCATE
+static long
+zpl_fallocate(struct inode *ip, int mode, loff_t offset, loff_t len)
+{
+ return zpl_fallocate_common(ip, mode, offset, len);
+}
+#endif /* HAVE_INODE_FALLOCATE */
+
+
const struct inode_operations zpl_inode_operations = {
.create = zpl_create,
.link = zpl_link,
@@ -358,6 +367,9 @@ const struct inode_operations zpl_inode_operations = {
.removexattr = generic_removexattr,
.listxattr = zpl_xattr_list,
.truncate_range = zpl_truncate_range,
+#ifdef HAVE_INODE_FALLOCATE
+ .fallocate = zpl_fallocate,
+#endif /* HAVE_INODE_FALLOCATE */
};
const struct inode_operations zpl_dir_inode_operations = {
diff --git a/scripts/Makefile.in b/scripts/Makefile.in
index f09668560dae..f8316f960f42 100644
--- a/scripts/Makefile.in
+++ b/scripts/Makefile.in
@@ -64,6 +64,7 @@ am__aclocal_m4_deps = \
$(top_srcdir)/config/kernel-check-disk-size-change.m4 \
$(top_srcdir)/config/kernel-d-obtain-alias.m4 \
$(top_srcdir)/config/kernel-evict-inode.m4 \
+ $(top_srcdir)/config/kernel-fallocate.m4 \
$(top_srcdir)/config/kernel-fmode-t.m4 \
$(top_srcdir)/config/kernel-fsync.m4 \
$(top_srcdir)/config/kernel-get-disk-ro.m4 \
diff --git a/scripts/zpios-profile/Makefile.in b/scripts/zpios-profile/Makefile.in
index e50a0a4aff0e..0264aa45d3bb 100644
--- a/scripts/zpios-profile/Makefile.in
+++ b/scripts/zpios-profile/Makefile.in
@@ -64,6 +64,7 @@ am__aclocal_m4_deps = \
$(top_srcdir)/config/kernel-check-disk-size-change.m4 \
$(top_srcdir)/config/kernel-d-obtain-alias.m4 \
$(top_srcdir)/config/kernel-evict-inode.m4 \
+ $(top_srcdir)/config/kernel-fallocate.m4 \
$(top_srcdir)/config/kernel-fmode-t.m4 \
$(top_srcdir)/config/kernel-fsync.m4 \
$(top_srcdir)/config/kernel-get-disk-ro.m4 \
diff --git a/scripts/zpios-test/Makefile.in b/scripts/zpios-test/Makefile.in
index 46e7e086021f..b5d5d25697cc 100644
--- a/scripts/zpios-test/Makefile.in
+++ b/scripts/zpios-test/Makefile.in
@@ -64,6 +64,7 @@ am__aclocal_m4_deps = \
$(top_srcdir)/config/kernel-check-disk-size-change.m4 \
$(top_srcdir)/config/kernel-d-obtain-alias.m4 \
$(top_srcdir)/config/kernel-evict-inode.m4 \
+ $(top_srcdir)/config/kernel-fallocate.m4 \
$(top_srcdir)/config/kernel-fmode-t.m4 \
$(top_srcdir)/config/kernel-fsync.m4 \
$(top_srcdir)/config/kernel-get-disk-ro.m4 \
diff --git a/scripts/zpool-config/Makefile.in b/scripts/zpool-config/Makefile.in
index 33ceab9a1d60..73c32494d352 100644
--- a/scripts/zpool-config/Makefile.in
+++ b/scripts/zpool-config/Makefile.in
@@ -64,6 +64,7 @@ am__aclocal_m4_deps = \
$(top_srcdir)/config/kernel-check-disk-size-change.m4 \
$(top_srcdir)/config/kernel-d-obtain-alias.m4 \
$(top_srcdir)/config/kernel-evict-inode.m4 \
+ $(top_srcdir)/config/kernel-fallocate.m4 \
$(top_srcdir)/config/kernel-fmode-t.m4 \
$(top_srcdir)/config/kernel-fsync.m4 \
$(top_srcdir)/config/kernel-get-disk-ro.m4 \
diff --git a/scripts/zpool-layout/Makefile.in b/scripts/zpool-layout/Makefile.in
index 6e45dbbc396c..70545c4c7fcf 100644
--- a/scripts/zpool-layout/Makefile.in
+++ b/scripts/zpool-layout/Makefile.in
@@ -64,6 +64,7 @@ am__aclocal_m4_deps = \
$(top_srcdir)/config/kernel-check-disk-size-change.m4 \
$(top_srcdir)/config/kernel-d-obtain-alias.m4 \
$(top_srcdir)/config/kernel-evict-inode.m4 \
+ $(top_srcdir)/config/kernel-fallocate.m4 \
$(top_srcdir)/config/kernel-fmode-t.m4 \
$(top_srcdir)/config/kernel-fsync.m4 \
$(top_srcdir)/config/kernel-get-disk-ro.m4 \
diff --git a/udev/Makefile.in b/udev/Makefile.in
index 7fbdbc105813..018d0a72e203 100644
--- a/udev/Makefile.in
+++ b/udev/Makefile.in
@@ -63,6 +63,7 @@ am__aclocal_m4_deps = \
$(top_srcdir)/config/kernel-check-disk-size-change.m4 \
$(top_srcdir)/config/kernel-d-obtain-alias.m4 \
$(top_srcdir)/config/kernel-evict-inode.m4 \
+ $(top_srcdir)/config/kernel-fallocate.m4 \
$(top_srcdir)/config/kernel-fmode-t.m4 \
$(top_srcdir)/config/kernel-fsync.m4 \
$(top_srcdir)/config/kernel-get-disk-ro.m4 \
diff --git a/udev/rules.d/Makefile.in b/udev/rules.d/Makefile.in
index 2712b6e25d3c..671fb7b759cf 100644
--- a/udev/rules.d/Makefile.in
+++ b/udev/rules.d/Makefile.in
@@ -64,6 +64,7 @@ am__aclocal_m4_deps = \
$(top_srcdir)/config/kernel-check-disk-size-change.m4 \
$(top_srcdir)/config/kernel-d-obtain-alias.m4 \
$(top_srcdir)/config/kernel-evict-inode.m4 \
+ $(top_srcdir)/config/kernel-fallocate.m4 \
$(top_srcdir)/config/kernel-fmode-t.m4 \
$(top_srcdir)/config/kernel-fsync.m4 \
$(top_srcdir)/config/kernel-get-disk-ro.m4 \
diff --git a/zfs_config.h.in b/zfs_config.h.in
index b90643f4652a..c91735a8e931 100644
--- a/zfs_config.h.in
+++ b/zfs_config.h.in
@@ -111,6 +111,9 @@
/* sops->evict_inode() exists */
#undef HAVE_EVICT_INODE
+/* fops->fallocate() exists */
+#undef HAVE_FILE_FALLOCATE
+
/* kernel defines fmode_t */
#undef HAVE_FMODE_T
@@ -132,6 +135,9 @@
/* Define to 1 if licensed under the GPL */
#undef HAVE_GPL_ONLY_SYMBOLS
+/* fops->fallocate() exists */
+#undef HAVE_INODE_FALLOCATE
+
/* insert_inode_locked() is available */
#undef HAVE_INSERT_INODE_LOCKED