Skip to content

Commit

Permalink
Linux 3.5 compat, iops->truncate_range() removed
Browse files Browse the repository at this point in the history
The vmtruncate_range() support has been removed from the kernel in
favor of using the fallocate method in the file_operations table.

Signed-off-by: Richard Yao <[email protected]>
Signed-off-by: Brian Behlendorf <[email protected]>
Issue #784
  • Loading branch information
ryao authored and behlendorf committed Jul 23, 2012
1 parent 756c3e5 commit ea1fdf4
Show file tree
Hide file tree
Showing 60 changed files with 225 additions and 0 deletions.
1 change: 1 addition & 0 deletions Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ am__aclocal_m4_deps = \
$(top_srcdir)/config/kernel-set-nlink.m4 \
$(top_srcdir)/config/kernel-show-options.m4 \
$(top_srcdir)/config/kernel-shrink.m4 \
$(top_srcdir)/config/kernel-truncate-range.m4 \
$(top_srcdir)/config/kernel-truncate-setsize.m4 \
$(top_srcdir)/config/kernel-xattr-handler.m4 \
$(top_srcdir)/config/kernel.m4 \
Expand Down
1 change: 1 addition & 0 deletions cmd/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ am__aclocal_m4_deps = \
$(top_srcdir)/config/kernel-set-nlink.m4 \
$(top_srcdir)/config/kernel-show-options.m4 \
$(top_srcdir)/config/kernel-shrink.m4 \
$(top_srcdir)/config/kernel-truncate-range.m4 \
$(top_srcdir)/config/kernel-truncate-setsize.m4 \
$(top_srcdir)/config/kernel-xattr-handler.m4 \
$(top_srcdir)/config/kernel.m4 \
Expand Down
1 change: 1 addition & 0 deletions cmd/mount_zfs/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ am__aclocal_m4_deps = \
$(top_srcdir)/config/kernel-set-nlink.m4 \
$(top_srcdir)/config/kernel-show-options.m4 \
$(top_srcdir)/config/kernel-shrink.m4 \
$(top_srcdir)/config/kernel-truncate-range.m4 \
$(top_srcdir)/config/kernel-truncate-setsize.m4 \
$(top_srcdir)/config/kernel-xattr-handler.m4 \
$(top_srcdir)/config/kernel.m4 \
Expand Down
1 change: 1 addition & 0 deletions cmd/vdev_id/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ am__aclocal_m4_deps = \
$(top_srcdir)/config/kernel-set-nlink.m4 \
$(top_srcdir)/config/kernel-show-options.m4 \
$(top_srcdir)/config/kernel-shrink.m4 \
$(top_srcdir)/config/kernel-truncate-range.m4 \
$(top_srcdir)/config/kernel-truncate-setsize.m4 \
$(top_srcdir)/config/kernel-xattr-handler.m4 \
$(top_srcdir)/config/kernel.m4 \
Expand Down
1 change: 1 addition & 0 deletions cmd/zdb/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ am__aclocal_m4_deps = \
$(top_srcdir)/config/kernel-set-nlink.m4 \
$(top_srcdir)/config/kernel-show-options.m4 \
$(top_srcdir)/config/kernel-shrink.m4 \
$(top_srcdir)/config/kernel-truncate-range.m4 \
$(top_srcdir)/config/kernel-truncate-setsize.m4 \
$(top_srcdir)/config/kernel-xattr-handler.m4 \
$(top_srcdir)/config/kernel.m4 \
Expand Down
1 change: 1 addition & 0 deletions cmd/zfs/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ am__aclocal_m4_deps = \
$(top_srcdir)/config/kernel-set-nlink.m4 \
$(top_srcdir)/config/kernel-show-options.m4 \
$(top_srcdir)/config/kernel-shrink.m4 \
$(top_srcdir)/config/kernel-truncate-range.m4 \
$(top_srcdir)/config/kernel-truncate-setsize.m4 \
$(top_srcdir)/config/kernel-xattr-handler.m4 \
$(top_srcdir)/config/kernel.m4 \
Expand Down
1 change: 1 addition & 0 deletions cmd/zinject/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ am__aclocal_m4_deps = \
$(top_srcdir)/config/kernel-set-nlink.m4 \
$(top_srcdir)/config/kernel-show-options.m4 \
$(top_srcdir)/config/kernel-shrink.m4 \
$(top_srcdir)/config/kernel-truncate-range.m4 \
$(top_srcdir)/config/kernel-truncate-setsize.m4 \
$(top_srcdir)/config/kernel-xattr-handler.m4 \
$(top_srcdir)/config/kernel.m4 \
Expand Down
1 change: 1 addition & 0 deletions cmd/zpios/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ am__aclocal_m4_deps = \
$(top_srcdir)/config/kernel-set-nlink.m4 \
$(top_srcdir)/config/kernel-show-options.m4 \
$(top_srcdir)/config/kernel-shrink.m4 \
$(top_srcdir)/config/kernel-truncate-range.m4 \
$(top_srcdir)/config/kernel-truncate-setsize.m4 \
$(top_srcdir)/config/kernel-xattr-handler.m4 \
$(top_srcdir)/config/kernel.m4 \
Expand Down
1 change: 1 addition & 0 deletions cmd/zpool/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ am__aclocal_m4_deps = \
$(top_srcdir)/config/kernel-set-nlink.m4 \
$(top_srcdir)/config/kernel-show-options.m4 \
$(top_srcdir)/config/kernel-shrink.m4 \
$(top_srcdir)/config/kernel-truncate-range.m4 \
$(top_srcdir)/config/kernel-truncate-setsize.m4 \
$(top_srcdir)/config/kernel-xattr-handler.m4 \
$(top_srcdir)/config/kernel.m4 \
Expand Down
1 change: 1 addition & 0 deletions cmd/zpool_id/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ am__aclocal_m4_deps = \
$(top_srcdir)/config/kernel-set-nlink.m4 \
$(top_srcdir)/config/kernel-show-options.m4 \
$(top_srcdir)/config/kernel-shrink.m4 \
$(top_srcdir)/config/kernel-truncate-range.m4 \
$(top_srcdir)/config/kernel-truncate-setsize.m4 \
$(top_srcdir)/config/kernel-xattr-handler.m4 \
$(top_srcdir)/config/kernel.m4 \
Expand Down
1 change: 1 addition & 0 deletions cmd/zpool_layout/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ am__aclocal_m4_deps = \
$(top_srcdir)/config/kernel-set-nlink.m4 \
$(top_srcdir)/config/kernel-show-options.m4 \
$(top_srcdir)/config/kernel-shrink.m4 \
$(top_srcdir)/config/kernel-truncate-range.m4 \
$(top_srcdir)/config/kernel-truncate-setsize.m4 \
$(top_srcdir)/config/kernel-xattr-handler.m4 \
$(top_srcdir)/config/kernel.m4 \
Expand Down
1 change: 1 addition & 0 deletions cmd/ztest/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ am__aclocal_m4_deps = \
$(top_srcdir)/config/kernel-set-nlink.m4 \
$(top_srcdir)/config/kernel-show-options.m4 \
$(top_srcdir)/config/kernel-shrink.m4 \
$(top_srcdir)/config/kernel-truncate-range.m4 \
$(top_srcdir)/config/kernel-truncate-setsize.m4 \
$(top_srcdir)/config/kernel-xattr-handler.m4 \
$(top_srcdir)/config/kernel.m4 \
Expand Down
1 change: 1 addition & 0 deletions cmd/zvol_id/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ am__aclocal_m4_deps = \
$(top_srcdir)/config/kernel-set-nlink.m4 \
$(top_srcdir)/config/kernel-show-options.m4 \
$(top_srcdir)/config/kernel-shrink.m4 \
$(top_srcdir)/config/kernel-truncate-range.m4 \
$(top_srcdir)/config/kernel-truncate-setsize.m4 \
$(top_srcdir)/config/kernel-xattr-handler.m4 \
$(top_srcdir)/config/kernel.m4 \
Expand Down
24 changes: 24 additions & 0 deletions config/kernel-truncate-range.m4
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
dnl #
dnl # 3.5.0 API change
dnl # torvalds/linux@17cf28afea2a1112f240a3a2da8af883be024811 removed
dnl # truncate_range(). The file hole punching functionality is now
dnl # provided by fallocate()
dnl #
AC_DEFUN([ZFS_AC_KERNEL_TRUNCATE_RANGE], [
AC_MSG_CHECKING([whether iops->truncate_range() exists])
ZFS_LINUX_TRY_COMPILE([
#include <linux/fs.h>
void truncate_range(struct inode *inode, loff_t start,
loff_t end) { return; }
static struct inode_operations iops __attribute__ ((unused)) = {
.truncate_range = truncate_range,
};
],[
],[
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_INODE_TRUNCATE_RANGE, 1,
[iops->truncate_range() exists])
],[
AC_MSG_RESULT(no)
])
])
1 change: 1 addition & 0 deletions config/kernel.m4
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ AC_DEFUN([ZFS_AC_CONFIG_KERNEL], [
ZFS_AC_KERNEL_NR_CACHED_OBJECTS
ZFS_AC_KERNEL_FREE_CACHED_OBJECTS
ZFS_AC_KERNEL_FALLOCATE
ZFS_AC_KERNEL_TRUNCATE_RANGE
ZFS_AC_KERNEL_CREATE_UMODE_T
ZFS_AC_KERNEL_AUTOMOUNT
ZFS_AC_KERNEL_ENCODE_FH_WITH_INODE
Expand Down
138 changes: 138 additions & 0 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -16135,6 +16135,75 @@ fi



{ $as_echo "$as_me:$LINENO: checking whether iops->truncate_range() exists" >&5
$as_echo_n "checking whether iops->truncate_range() 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>
void truncate_range(struct inode *inode, loff_t start,
loff_t end) { return; }
static struct inode_operations iops __attribute__ ((unused)) = {
.truncate_range = truncate_range,
};

int
main (void)
{


;
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_TRUNCATE_RANGE 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->create()/mkdir()/mknod() take umode_t" >&5
$as_echo_n "checking whether iops->create()/mkdir()/mknod() take umode_t... " >&6; }

Expand Down Expand Up @@ -22732,6 +22801,75 @@ fi



{ $as_echo "$as_me:$LINENO: checking whether iops->truncate_range() exists" >&5
$as_echo_n "checking whether iops->truncate_range() 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>
void truncate_range(struct inode *inode, loff_t start,
loff_t end) { return; }
static struct inode_operations iops __attribute__ ((unused)) = {
.truncate_range = truncate_range,
};

int
main (void)
{


;
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_TRUNCATE_RANGE 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->create()/mkdir()/mknod() take umode_t" >&5
$as_echo_n "checking whether iops->create()/mkdir()/mknod() take umode_t... " >&6; }

Expand Down
1 change: 1 addition & 0 deletions dracut/90zfs/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ am__aclocal_m4_deps = \
$(top_srcdir)/config/kernel-set-nlink.m4 \
$(top_srcdir)/config/kernel-show-options.m4 \
$(top_srcdir)/config/kernel-shrink.m4 \
$(top_srcdir)/config/kernel-truncate-range.m4 \
$(top_srcdir)/config/kernel-truncate-setsize.m4 \
$(top_srcdir)/config/kernel-xattr-handler.m4 \
$(top_srcdir)/config/kernel.m4 \
Expand Down
1 change: 1 addition & 0 deletions dracut/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ am__aclocal_m4_deps = \
$(top_srcdir)/config/kernel-set-nlink.m4 \
$(top_srcdir)/config/kernel-show-options.m4 \
$(top_srcdir)/config/kernel-shrink.m4 \
$(top_srcdir)/config/kernel-truncate-range.m4 \
$(top_srcdir)/config/kernel-truncate-setsize.m4 \
$(top_srcdir)/config/kernel-xattr-handler.m4 \
$(top_srcdir)/config/kernel.m4 \
Expand Down
1 change: 1 addition & 0 deletions etc/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ am__aclocal_m4_deps = \
$(top_srcdir)/config/kernel-set-nlink.m4 \
$(top_srcdir)/config/kernel-show-options.m4 \
$(top_srcdir)/config/kernel-shrink.m4 \
$(top_srcdir)/config/kernel-truncate-range.m4 \
$(top_srcdir)/config/kernel-truncate-setsize.m4 \
$(top_srcdir)/config/kernel-xattr-handler.m4 \
$(top_srcdir)/config/kernel.m4 \
Expand Down
1 change: 1 addition & 0 deletions etc/init.d/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ am__aclocal_m4_deps = \
$(top_srcdir)/config/kernel-set-nlink.m4 \
$(top_srcdir)/config/kernel-show-options.m4 \
$(top_srcdir)/config/kernel-shrink.m4 \
$(top_srcdir)/config/kernel-truncate-range.m4 \
$(top_srcdir)/config/kernel-truncate-setsize.m4 \
$(top_srcdir)/config/kernel-xattr-handler.m4 \
$(top_srcdir)/config/kernel.m4 \
Expand Down
1 change: 1 addition & 0 deletions etc/zfs/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ am__aclocal_m4_deps = \
$(top_srcdir)/config/kernel-set-nlink.m4 \
$(top_srcdir)/config/kernel-show-options.m4 \
$(top_srcdir)/config/kernel-shrink.m4 \
$(top_srcdir)/config/kernel-truncate-range.m4 \
$(top_srcdir)/config/kernel-truncate-setsize.m4 \
$(top_srcdir)/config/kernel-xattr-handler.m4 \
$(top_srcdir)/config/kernel.m4 \
Expand Down
1 change: 1 addition & 0 deletions include/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ am__aclocal_m4_deps = \
$(top_srcdir)/config/kernel-set-nlink.m4 \
$(top_srcdir)/config/kernel-show-options.m4 \
$(top_srcdir)/config/kernel-shrink.m4 \
$(top_srcdir)/config/kernel-truncate-range.m4 \
$(top_srcdir)/config/kernel-truncate-setsize.m4 \
$(top_srcdir)/config/kernel-xattr-handler.m4 \
$(top_srcdir)/config/kernel.m4 \
Expand Down
1 change: 1 addition & 0 deletions include/linux/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ am__aclocal_m4_deps = \
$(top_srcdir)/config/kernel-set-nlink.m4 \
$(top_srcdir)/config/kernel-show-options.m4 \
$(top_srcdir)/config/kernel-shrink.m4 \
$(top_srcdir)/config/kernel-truncate-range.m4 \
$(top_srcdir)/config/kernel-truncate-setsize.m4 \
$(top_srcdir)/config/kernel-xattr-handler.m4 \
$(top_srcdir)/config/kernel.m4 \
Expand Down
1 change: 1 addition & 0 deletions include/sys/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ am__aclocal_m4_deps = \
$(top_srcdir)/config/kernel-set-nlink.m4 \
$(top_srcdir)/config/kernel-show-options.m4 \
$(top_srcdir)/config/kernel-shrink.m4 \
$(top_srcdir)/config/kernel-truncate-range.m4 \
$(top_srcdir)/config/kernel-truncate-setsize.m4 \
$(top_srcdir)/config/kernel-xattr-handler.m4 \
$(top_srcdir)/config/kernel.m4 \
Expand Down
1 change: 1 addition & 0 deletions include/sys/fm/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ am__aclocal_m4_deps = \
$(top_srcdir)/config/kernel-set-nlink.m4 \
$(top_srcdir)/config/kernel-show-options.m4 \
$(top_srcdir)/config/kernel-shrink.m4 \
$(top_srcdir)/config/kernel-truncate-range.m4 \
$(top_srcdir)/config/kernel-truncate-setsize.m4 \
$(top_srcdir)/config/kernel-xattr-handler.m4 \
$(top_srcdir)/config/kernel.m4 \
Expand Down
1 change: 1 addition & 0 deletions include/sys/fm/fs/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ am__aclocal_m4_deps = \
$(top_srcdir)/config/kernel-set-nlink.m4 \
$(top_srcdir)/config/kernel-show-options.m4 \
$(top_srcdir)/config/kernel-shrink.m4 \
$(top_srcdir)/config/kernel-truncate-range.m4 \
$(top_srcdir)/config/kernel-truncate-setsize.m4 \
$(top_srcdir)/config/kernel-xattr-handler.m4 \
$(top_srcdir)/config/kernel.m4 \
Expand Down
1 change: 1 addition & 0 deletions include/sys/fs/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ am__aclocal_m4_deps = \
$(top_srcdir)/config/kernel-set-nlink.m4 \
$(top_srcdir)/config/kernel-show-options.m4 \
$(top_srcdir)/config/kernel-shrink.m4 \
$(top_srcdir)/config/kernel-truncate-range.m4 \
$(top_srcdir)/config/kernel-truncate-setsize.m4 \
$(top_srcdir)/config/kernel-xattr-handler.m4 \
$(top_srcdir)/config/kernel.m4 \
Expand Down
1 change: 1 addition & 0 deletions lib/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ am__aclocal_m4_deps = \
$(top_srcdir)/config/kernel-set-nlink.m4 \
$(top_srcdir)/config/kernel-show-options.m4 \
$(top_srcdir)/config/kernel-shrink.m4 \
$(top_srcdir)/config/kernel-truncate-range.m4 \
$(top_srcdir)/config/kernel-truncate-setsize.m4 \
$(top_srcdir)/config/kernel-xattr-handler.m4 \
$(top_srcdir)/config/kernel.m4 \
Expand Down
1 change: 1 addition & 0 deletions lib/libavl/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ am__aclocal_m4_deps = \
$(top_srcdir)/config/kernel-set-nlink.m4 \
$(top_srcdir)/config/kernel-show-options.m4 \
$(top_srcdir)/config/kernel-shrink.m4 \
$(top_srcdir)/config/kernel-truncate-range.m4 \
$(top_srcdir)/config/kernel-truncate-setsize.m4 \
$(top_srcdir)/config/kernel-xattr-handler.m4 \
$(top_srcdir)/config/kernel.m4 \
Expand Down
Loading

0 comments on commit ea1fdf4

Please sign in to comment.