From: James Simmons Date: Thu, 12 Jul 2012 15:05:06 +0000 (-0400) Subject: LU-812 vfs: address_space_operations.migratepage has 4 args X-Git-Tag: 2.2.93~35 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=5c00de88f0e8a61888a55410459ecfb4fea814e8;ds=sidebyside LU-812 vfs: address_space_operations.migratepage has 4 args 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 Signed-off-by: Wally Wang Change-Id: I5be5de9c6693b09ddbbc92e729b79bfa1d99ee3a Reviewed-on: http://review.whamcloud.com/2279 Tested-by: Hudson Tested-by: Maloo Reviewed-by: Andreas Dilger --- diff --git a/lustre/autoconf/lustre-core.m4 b/lustre/autoconf/lustre-core.m4 index 58b6996..ae02fd0 100644 --- a/lustre/autoconf/lustre-core.m4 +++ b/lustre/autoconf/lustre-core.m4 @@ -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 +#ifdef HAVE_MIGRATE_H + #include +#elif defined(HAVE_MIGRATE_MODE_H) + #include +#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]) diff --git a/lustre/llite/rw26.c b/lustre/llite/rw26.c index 041e1aa..917ba3f 100644 --- a/lustre/llite/rw26.c +++ b/lustre/llite/rw26.c @@ -48,6 +48,11 @@ #include #include +#ifdef HAVE_MIGRATE_H +#include +#elif defined(HAVE_MIGRATE_MODE_H) +#include +#endif #include #include #include @@ -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;