From de536a8e6a668c0f65f9a527fd7eabe36d281547 Mon Sep 17 00:00:00 2001 From: Andreas Dilger Date: Wed, 30 Jun 2010 23:09:54 +0200 Subject: [PATCH] b=22360 Check for file_operations .flush fl_owner_t id parameter 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 | 25 +++++++++++++++++++++++++ lustre/llite/file.c | 6 +++--- 2 files changed, 28 insertions(+), 3 deletions(-) diff --git a/lustre/autoconf/lustre-core.m4 b/lustre/autoconf/lustre-core.m4 index 9673e85..7ac01bf 100644 --- a/lustre/autoconf/lustre-core.m4 +++ b/lustre/autoconf/lustre-core.m4 @@ -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 +],[ + 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 diff --git a/lustre/llite/file.c b/lustre/llite/file.c index e324ed3..39c70c4 100644 --- a/lustre/llite/file.c +++ b/lustre/llite/file.c @@ -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; -- 1.8.3.1