Whamcloud - gitweb
LU-812 vfs: address_space_operations.migratepage has 4 args
authorJames Simmons <uja.ornl@gmail.com>
Thu, 12 Jul 2012 15:05:06 +0000 (11:05 -0400)
committerOleg Drokin <green@whamcloud.com>
Tue, 31 Jul 2012 16:28:57 +0000 (12:28 -0400)
Linux 3.3 address_space_operations.migratepage has 4 args.
Add detection in build configure and condition in code for
the new argument. Before Linux 3.3 the migration_mode values
were located in migrate.h instead of migrate_mode.h

Signed-off-by: James Simmons <uja.ornl@gmail.com>
Signed-off-by: Wally Wang <wang@cray.com>
Change-Id: I5be5de9c6693b09ddbbc92e729b79bfa1d99ee3a
Reviewed-on: http://review.whamcloud.com/2279
Tested-by: Hudson
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
lustre/autoconf/lustre-core.m4
lustre/llite/rw26.c

index 58b6996..ae02fd0 100644 (file)
@@ -1791,6 +1791,44 @@ AC_DEFINE(HAVE_SIMPLE_SETATTR, 1,
 ])
 
 #
+# 3.3 introduces migrate_mode.h and migratepage has 4 args
+#
+AC_DEFUN([LC_HAVE_MIGRATE_HEADER],
+[LB_CHECK_FILE([$LINUX/include/linux/migrate.h],[
+               AC_DEFINE(HAVE_MIGRATE_H, 1,
+               [kernel has include/linux/migrate.h])
+],[LB_CHECK_FILE([$LINUX/include/linux/migrate_mode.h],[
+               AC_DEFINE(HAVE_MIGRATE_MODE_H, 1,
+                       [kernel has include/linux/migrate_mode.h])
+],[
+       AC_MSG_RESULT([no])
+])
+])
+])
+
+AC_DEFUN([LC_MIGRATEPAGE_4ARGS],
+[AC_MSG_CHECKING([if address_space_operations.migratepage has 4 args])
+LB_LINUX_TRY_COMPILE([
+       #include <linux/fs.h>
+#ifdef HAVE_MIGRATE_H
+       #include <linux/migrate.h>
+#elif defined(HAVE_MIGRATE_MODE_H)
+       #include <linux/migrate_mode.h>
+#endif
+],[
+       struct address_space_operations aops;
+
+       aops.migratepage(NULL, NULL, NULL, MIGRATE_ASYNC);
+],[
+       AC_DEFINE(HAVE_MIGRATEPAGE_4ARGS, 1,
+               [address_space_operations.migratepage has 4 args])
+       AC_MSG_RESULT([yes])
+],[
+       AC_MSG_RESULT([no])
+])
+])
+
+#
 # LC_PROG_LINUX
 #
 # Lustre linux kernel checks
@@ -1932,6 +1970,10 @@ AC_DEFUN([LC_PROG_LINUX],
          # 2.6.39
          LC_REQUEST_QUEUE_UNPLUG_FN
 
+       # 3.3
+       LC_HAVE_MIGRATE_HEADER
+       LC_MIGRATEPAGE_4ARGS
+
          #
          if test x$enable_server = xyes ; then
              AC_DEFINE(HAVE_SERVER_SUPPORT, 1, [support server])
index 041e1aa..917ba3f 100644 (file)
 #include <asm/system.h>
 #include <asm/uaccess.h>
 
+#ifdef HAVE_MIGRATE_H
+#include <linux/migrate.h>
+#elif defined(HAVE_MIGRATE_MODE_H)
+#include <linux/migrate_mode.h>
+#endif
 #include <linux/fs.h>
 #include <linux/buffer_head.h>
 #include <linux/writeback.h>
@@ -540,7 +545,11 @@ static int ll_write_end(struct file *file, struct address_space *mapping,
 
 #ifdef CONFIG_MIGRATION
 int ll_migratepage(struct address_space *mapping,
-                   struct page *newpage, struct page *page)
+               struct page *newpage, struct page *page
+#ifdef HAVE_MIGRATEPAGE_4ARGS
+               , enum migrate_mode mode
+#endif
+               )
 {
         /* Always fail page migration until we have a proper implementation */
         return -EIO;