Linux 3.1 compat, fops->fsync()

The Linux 3.1 kernel updated the fops->fsync() callback yet again.
They now pass the requested range and delegate the responsibility
for calling filemap_write_and_wait_range() to the callback.  In
addition imutex is no longer held by the caller and the callback
is responsible for taking the lock if required.

This commit updates the code to provide a zpl_fsync() function
for the updated API.  Implementations for the previous two APIs
are also maintained for compatibility.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #445
This commit is contained in:
Brian Behlendorf
2011-11-09 20:47:59 -08:00
parent 8c19f5b407
commit adcd70bd1a
5 changed files with 390 additions and 44 deletions
Vendored
+272 -16
View File
@@ -14418,8 +14418,9 @@ fi
{ $as_echo "$as_me:$LINENO: checking whether fops->fsync() wants 2 args" >&5
$as_echo_n "checking whether fops->fsync() wants 2 args... " >&6; }
{ $as_echo "$as_me:$LINENO: checking whether fops->fsync() wants" >&5
$as_echo_n "checking whether fops->fsync() wants... " >&6; }
cat confdefs.h - <<_ACEOF >conftest.c
@@ -14436,7 +14437,7 @@ int
main (void)
{
int (*fsync) (struct file *, int datasync) = NULL;
int (*fsync) (struct file *, struct dentry *, int) = NULL;
struct file_operations fops __attribute__ ((unused));
fops.fsync = fsync;
@@ -14462,11 +14463,11 @@ _ACEOF
$as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
{ $as_echo "$as_me:$LINENO: result: yes" >&5
$as_echo "yes" >&6; }
{ $as_echo "$as_me:$LINENO: result: dentry" >&5
$as_echo "dentry" >&6; }
cat >>confdefs.h <<\_ACEOF
#define HAVE_2ARGS_FSYNC 1
#define HAVE_FSYNC_WITH_DENTRY 1
_ACEOF
@@ -14474,8 +14475,6 @@ 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; }
@@ -14486,6 +14485,135 @@ fi
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)
{
int (*fsync) (struct file *, int) = NULL;
struct file_operations fops __attribute__ ((unused));
fops.fsync = fsync;
;
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: no dentry" >&5
$as_echo "no dentry" >&6; }
cat >>confdefs.h <<\_ACEOF
#define HAVE_FSYNC_WITHOUT_DENTRY 1
_ACEOF
else
$as_echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
fi
rm -Rf build
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)
{
int (*fsync) (struct file *, loff_t, loff_t, int) = NULL;
struct file_operations fops __attribute__ ((unused));
fops.fsync = fsync;
;
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: range" >&5
$as_echo "range" >&6; }
cat >>confdefs.h <<\_ACEOF
#define HAVE_FSYNC_RANGE 1
_ACEOF
else
$as_echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
fi
rm -Rf build
{ $as_echo "$as_me:$LINENO: checking whether sops->evict_inode() exists" >&5
$as_echo_n "checking whether sops->evict_inode() exists... " >&6; }
@@ -19027,8 +19155,9 @@ fi
{ $as_echo "$as_me:$LINENO: checking whether fops->fsync() wants 2 args" >&5
$as_echo_n "checking whether fops->fsync() wants 2 args... " >&6; }
{ $as_echo "$as_me:$LINENO: checking whether fops->fsync() wants" >&5
$as_echo_n "checking whether fops->fsync() wants... " >&6; }
cat confdefs.h - <<_ACEOF >conftest.c
@@ -19045,7 +19174,7 @@ int
main (void)
{
int (*fsync) (struct file *, int datasync) = NULL;
int (*fsync) (struct file *, struct dentry *, int) = NULL;
struct file_operations fops __attribute__ ((unused));
fops.fsync = fsync;
@@ -19071,11 +19200,11 @@ _ACEOF
$as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
{ $as_echo "$as_me:$LINENO: result: yes" >&5
$as_echo "yes" >&6; }
{ $as_echo "$as_me:$LINENO: result: dentry" >&5
$as_echo "dentry" >&6; }
cat >>confdefs.h <<\_ACEOF
#define HAVE_2ARGS_FSYNC 1
#define HAVE_FSYNC_WITH_DENTRY 1
_ACEOF
@@ -19083,8 +19212,6 @@ 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; }
@@ -19095,6 +19222,135 @@ fi
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)
{
int (*fsync) (struct file *, int) = NULL;
struct file_operations fops __attribute__ ((unused));
fops.fsync = fsync;
;
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: no dentry" >&5
$as_echo "no dentry" >&6; }
cat >>confdefs.h <<\_ACEOF
#define HAVE_FSYNC_WITHOUT_DENTRY 1
_ACEOF
else
$as_echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
fi
rm -Rf build
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)
{
int (*fsync) (struct file *, loff_t, loff_t, int) = NULL;
struct file_operations fops __attribute__ ((unused));
fops.fsync = fsync;
;
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: range" >&5
$as_echo "range" >&6; }
cat >>confdefs.h <<\_ACEOF
#define HAVE_FSYNC_RANGE 1
_ACEOF
else
$as_echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
fi
rm -Rf build
{ $as_echo "$as_me:$LINENO: checking whether sops->evict_inode() exists" >&5
$as_echo_n "checking whether sops->evict_inode() exists... " >&6; }