Linux 3.0 file_operations.fsync needs 4 arguments.
Change-Id: I1e376f35edb87e9eaa0feb82e69905f04ec8ee93
Signed-off-by: Wally Wang <wang@cray.com>
Reviewed-on: http://review.whamcloud.com/1950
Tested-by: Hudson
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Lai Siyao <laisiyao@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
* XXX Do we need to parse flags and mode in cfs_filp_open?
*/
cfs_file_t *cfs_filp_open (const char *name, int flags, int mode, int *err);
-#ifndef HAVE_FILE_FSYNC_2ARGS
-# define cfs_do_fsync(fp, flag) ((fp)->f_op->fsync(fp, (fp)->f_dentry, flag))
-#else
+#ifdef HAVE_FILE_FSYNC_4ARGS
+# define cfs_do_fsync(fp, flag) ((fp)->f_op->fsync(fp, 0, LLONG_MAX, flag))
+#elif defined(HAVE_FILE_FSYNC_2ARGS)
# define cfs_do_fsync(fp, flag) ((fp)->f_op->fsync(fp, flag))
+#else
+# define cfs_do_fsync(fp, flag) ((fp)->f_op->fsync(fp, (fp)->f_dentry, flag))
#endif
#define cfs_filp_close(f) filp_close(f, NULL)
#define cfs_filp_read(fp, buf, size, pos) (fp)->f_op->read((fp), (buf), (size), pos)
#
# 2.6.35 file_operations.fsync taken 2 arguments.
+# 3.0.0 file_operations.fsync takes 4 arguments.
#
AC_DEFUN([LC_FILE_FSYNC],
-[AC_MSG_CHECKING([if file_operations.fsync taken 2 arguments])
+[AC_MSG_CHECKING([if file_operations.fsync takes 4 or 2 arguments])
LB_LINUX_TRY_COMPILE([
#include <linux/fs.h>
],[
- ((struct file_operations *)0)->fsync(NULL, 0);
+ ((struct file_operations *)0)->fsync(NULL, 0, 0, 0);
],[
- AC_DEFINE(HAVE_FILE_FSYNC_2ARGS, 1,
- [file_operations.fsync taken 2 arguments])
- AC_MSG_RESULT([yes])
+ AC_DEFINE(HAVE_FILE_FSYNC_4ARGS, 1,
+ [file_operations.fsync takes 4 arguments])
+ AC_MSG_RESULT([yes, 4 args])
],[
- AC_MSG_RESULT([no])
+ LB_LINUX_TRY_COMPILE([
+ #include <linux/fs.h>
+ ],[
+ ((struct file_operations *)0)->fsync(NULL, 0);
+ ],[
+ AC_DEFINE(HAVE_FILE_FSYNC_2ARGS, 1,
+ [file_operations.fsync takes 2 arguments])
+ AC_MSG_RESULT([yes, 2 args])
+ ],[
+ AC_MSG_RESULT([no])
+ ])
])
])
LC_CACHE_UPCALL
LC_EXPORT_GENERIC_ERROR_REMOVE_PAGE
- # 2.6.35
+ # 2.6.35, 3.0.0
LC_FILE_FSYNC
LC_EXPORT_SIMPLE_SETATTR
return rc ? -EIO : 0;
}
-#ifndef HAVE_FILE_FSYNC_2ARGS
-int ll_fsync(struct file *file, struct dentry *dentry, int data)
-#else
+#ifdef HAVE_FILE_FSYNC_4ARGS
+int ll_fsync(struct file *file, loff_t start, loff_t end, int data)
+#elif defined(HAVE_FILE_FSYNC_2ARGS)
int ll_fsync(struct file *file, int data)
+#else
+int ll_fsync(struct file *file, struct dentry *dentry, int data)
#endif
{
struct inode *inode = file->f_dentry->d_inode;
int set_default);
int ll_dir_getstripe(struct inode *inode, struct lov_mds_md **lmm,
int *lmm_size, struct ptlrpc_request **request);
-#ifndef HAVE_FILE_FSYNC_2ARGS
-int ll_fsync(struct file *file, struct dentry *dentry, int data);
-#else
+#ifdef HAVE_FILE_FSYNC_4ARGS
+int ll_fsync(struct file *file, loff_t start, loff_t end, int data);
+#elif defined(HAVE_FILE_FSYNC_2ARGS)
int ll_fsync(struct file *file, int data);
+#else
+int ll_fsync(struct file *file, struct dentry *dentry, int data);
#endif
int ll_do_fiemap(struct inode *inode, struct ll_user_fiemap *fiemap,
int num_bytes);