Whamcloud - gitweb
b=22360 Check for file_operations .flush fl_owner_t id parameter
authorAndreas Dilger <andreas.dilger@oracle.com>
Wed, 30 Jun 2010 21:09:54 +0000 (23:09 +0200)
committerJohann Lombardi <johann@sun.com>
Wed, 30 Jun 2010 21:09:54 +0000 (23:09 +0200)
i=johann

Since 2.6.18 (commit 75e1fcc0b18df0a65ab113198e9dc0e98999a08c) the
file_operations .flush() method has taken an fl_owner_t id parameter.
This is backported to some older vendor kernels, so a simple kernel
version check, as usual, is not sufficient to determine whether this
parameter is present or not.

lustre/autoconf/lustre-core.m4
lustre/llite/file.c

index 9673e85..7ac01bf 100644 (file)
@@ -557,6 +557,30 @@ LB_LINUX_TRY_COMPILE([
 ])
 
 #
+# LC_FLUSH_OWNER_ID
+# starting from 2.6.18 the file_operations .flush
+# method has a new "fl_owner_t id" parameter
+#
+AC_DEFUN([LC_FLUSH_OWNER_ID],
+[AC_MSG_CHECKING([if file_operations .flush has an fl_owner_t id])
+LB_LINUX_TRY_COMPILE([
+        #include <linux/fs.h>
+],[
+        struct file_operations *fops = NULL;
+        fl_owner_t id;
+        int i;
+
+        i = fops->flush(NULL, id);
+],[
+        AC_DEFINE(HAVE_FLUSH_OWNER_ID, 1,
+                [file_operations .flush method has an fl_owner_t id])
+        AC_MSG_RESULT([yes])
+],[
+        AC_MSG_RESULT([no])
+])
+])
+
+#
 # LC_STATFS_DENTRY_PARAM
 # starting from 2.6.18 linux kernel uses dentry instead of
 # super_block for first vfs_statfs argument
@@ -1820,6 +1844,7 @@ AC_DEFUN([LC_PROG_LINUX],
           LC_UMOUNTBEGIN_HAS_VFSMOUNT
           LC_INODE_IPRIVATE
           LC_EXPORT_FILEMAP_FDATAWRITE_RANGE
+          LC_FLUSH_OWNER_ID
           if test x$enable_server = xyes ; then
                 LC_EXPORT_INVALIDATE_MAPPING_PAGES
           fi
index e324ed3..39c70c4 100644 (file)
@@ -3029,10 +3029,10 @@ loff_t ll_file_seek(struct file *file, loff_t offset, int origin)
         RETURN(retval);
 }
 
-#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,5)
-int ll_flush(struct file *file)
-#else
+#ifdef HAVE_FLUSH_OWNER_ID
 int ll_flush(struct file *file, fl_owner_t id)
+#else
+int ll_flush(struct file *file)
 #endif
 {
         struct inode *inode = file->f_dentry->d_inode;