In SLES11 SP0 (2.6.27.19-5.1), .page_mkwrite uses struct page *
instead of struct vm_fault * as its second parameter.
Signed-off-by: Peng Tao <peng_tao@emc.com>
Change-Id: I249174b34d90edb31bc3dce79a79da3c795975d5
Reviewed-on: http://review.whamcloud.com/2277
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Tested-by: Hudson
Reviewed-by: Yang Sheng <ys@whamcloud.com>
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: James Simmons <uja.ornl@gmail.com>
Reviewed-by: Jinshan Xiong <jinshan.xiong@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
+AC_DEFUN([LC_PGMKWRITE_USE_VMFAULT],
+[AC_MSG_CHECKING([kernel .page_mkwrite uses struct vm_fault *])
+tmp_flags="$EXTRA_KCFLAGS"
+EXTRA_KCFLAGS="-Werror"
+LB_LINUX_TRY_COMPILE([
+ #include <linux/mm.h>
+],[
+ ((struct vm_operations_struct *)0)->page_mkwrite((struct vm_area_struct *)0, (struct vm_fault *)0);
+], [
+ AC_MSG_RESULT([yes])
+ AC_DEFINE(HAVE_PGMKWRITE_USE_VMFAULT, 1,
+ [kernel vm_operation_struct.page_mkwrite uses struct vm_fault * as second parameter])
+],[
+ AC_MSG_RESULT([no])
+])
+EXTRA_KCFLAGS="$tmp_flags"
+])
+
AC_DEFUN([LC_INODE_PERMISION_2ARGS],
[AC_MSG_CHECKING([inode_operations->permission has two args])
LB_LINUX_TRY_COMPILE([
AC_DEFUN([LC_INODE_PERMISION_2ARGS],
[AC_MSG_CHECKING([inode_operations->permission has two args])
LB_LINUX_TRY_COMPILE([
LC_FS_STRUCT_USE_PATH
# 2.6.27
LC_FS_STRUCT_USE_PATH
# 2.6.27
+ LC_PGMKWRITE_USE_VMFAULT
LC_INODE_PERMISION_2ARGS
LC_FILE_REMOVE_SUID
LC_TRYLOCKPAGE
LC_INODE_PERMISION_2ARGS
LC_FILE_REMOVE_SUID
LC_TRYLOCKPAGE
-static int ll_page_mkwrite(struct vm_area_struct *vma, struct page *vmpage)
-{
- int count = 0;
- bool printed = false;
- bool retry;
- int result;
-
- do {
- retry = false;
- result = ll_page_mkwrite0(vma, vmpage, &retry);
-
- if (!printed && ++count > 16) {
- CWARN("app(%s): the page %lu of file %lu is under heavy"
- " contention.\n",
- current->comm, page_index(vmpage),
- vma->vm_file->f_dentry->d_inode->i_ino);
- printed = true;
- }
- } while (retry);
-
- if (result == 0)
- unlock_page(vmpage);
- else if (result == -ENODATA)
- result = 0; /* kernel will know truncate has happened and
- * retry */
-
- return result;
-}
-
#else
/**
* Lustre implementation of a vm_operations_struct::fault() method, called by
#else
/**
* Lustre implementation of a vm_operations_struct::fault() method, called by
+#ifndef HAVE_PGMKWRITE_USE_VMFAULT
+static int ll_page_mkwrite(struct vm_area_struct *vma, struct page *vmpage)
+{
+ int count = 0;
+ bool printed = false;
+ bool retry;
+ int result;
+
+ do {
+ retry = false;
+ result = ll_page_mkwrite0(vma, vmpage, &retry);
+
+ if (!printed && ++count > 16) {
+ CWARN("app(%s): the page %lu of file %lu is under heavy"
+ " contention.\n",
+ current->comm, page_index(vmpage),
+ vma->vm_file->f_dentry->d_inode->i_ino);
+ printed = true;
+ }
+ } while (retry);
+
+ if (result == 0)
+ unlock_page(vmpage);
+ else if (result == -ENODATA)
+ result = 0; /* kernel will know truncate has happened and
+ * retry */
+
+ return result;
+}
+#else
static int ll_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf)
{
int count = 0;
static int ll_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf)
{
int count = 0;