diff options
61 files changed, 447 insertions, 0 deletions
diff --git a/Makefile.in b/Makefile.in index 37b0db771..64deb2369 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 a0fdde92c..4a38f36fc 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 350c67dd4..273e20542 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 94e3a63e6..73a22c4ef 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 fa0b8c762..5ce100dd0 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 ccf9924bd..81f778a5e 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 eb3f28d0f..644c0b2a3 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 c9811af10..e270f3744 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 60a97aa2a..81620379a 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 e53c87c4f..578fdbbc6 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 20658364b..b89e9e8e8 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 e95f55cb4..70532fbef 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 39862677f..6bacf9944 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 000000000..d551276c7 --- /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 b46455700..c41cdf694 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 @@ -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 b7c3be689..f574205dd 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 d92a983f8..a9f8be205 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 b5e53a437..2cb43ca3c 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 0106a5068..73f07f4b6 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 e0bc34296..8024d3095 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 d4bb07ce6..d7423a3c7 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 e88c69215..d18e5dd9c 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 3903cefdc..06c20479b 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 46255c8e6..245995dda 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 5dd6f4882..10dcd83e9 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 550b106bb..ee2f16821 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 2195ec9a3..cfc86794e 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 f68acbe71..43bdf0dc2 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 c87bbb323..d909fa66a 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 3fcb93de8..a0595ce5d 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 cbfff617a..533d96235 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 8951784ad..8390ce835 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 b77af2300..541f72b9d 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 7fb66ef7c..974f489ad 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 bf418b90e..f84cd39d9 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 2d6f74644..23c4b2917 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 9c693d43f..043f0fe1e 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 789214e5f..dad5d8561 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 058f143a5..d7ea24fff 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 840100f75..3a0b3a1af 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 81d011e1a..b8663bdd2 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 1107586e4..e5c353795 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 065f9dc0e..edb36b071 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 62db1c83f..301fde587 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 ae6626bae..3e3cb2df1 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 6870365be..1fb5e573d 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 c62a360df..9ba47ca73 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 39ec39311..fc071e22a 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 f428397b8..8e98be3d1 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 4a12e1096..12524ffcc 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 0ef2c1558..5ac41c9d2 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 2d197a488..9b5533755 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 f09668560..f8316f960 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 e50a0a4af..0264aa45d 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 46e7e0860..b5d5d2569 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 33ceab9a1..73c32494d 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 6e45dbbc3..70545c4c7 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 7fbdbc105..018d0a72e 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 2712b6e25..671fb7b75 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 b90643f46..c91735a8e 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 |