Whamcloud - gitweb
LU-812 compat: file_operations.fsync needs 4 arguments
authorWally Wang <wang@cray.com>
Fri, 9 Mar 2012 18:39:49 +0000 (10:39 -0800)
committerOleg Drokin <green@whamcloud.com>
Thu, 29 Mar 2012 04:57:17 +0000 (00:57 -0400)
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>
libcfs/include/libcfs/linux/linux-fs.h
lustre/autoconf/lustre-core.m4
lustre/llite/file.c
lustre/llite/llite_internal.h

index bcc8850..774e958 100644 (file)
@@ -68,10 +68,12 @@ typedef struct kstatfs cfs_kstatfs_t;
  * 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)
index 061d457..4818462 100644 (file)
@@ -1975,19 +1975,30 @@ LB_LINUX_TRY_COMPILE([
 
 #
 # 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])
+        ])
 ])
 ])
 
@@ -2244,7 +2255,7 @@ AC_DEFUN([LC_PROG_LINUX],
          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
 
index b69a202..c458bb4 100644 (file)
@@ -1989,10 +1989,12 @@ int ll_flush(struct file *file)
         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;
index 693239c..eb54145 100644 (file)
@@ -744,10 +744,12 @@ int ll_dir_setstripe(struct inode *inode, struct lov_user_md *lump,
                      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);