From 5be296ca88897cceec45fb80d4b7519eba3cb47a Mon Sep 17 00:00:00 2001 From: yangsheng Date: Thu, 25 Mar 2010 00:24:48 +0800 Subject: [PATCH] b=21500 2.6.31-fc12 patchless client support. i=brian i=rahul i=adilger --- build/autoconf/lustre-build-linux.m4 | 58 +++++++++++++++++++++++++++++++--- lnet/lnet/api-ni.c | 6 ++-- lustre/autoconf/lustre-core.m4 | 19 +++++++++++ lustre/include/linux/lustre_compat25.h | 4 +++ lustre/llite/lloop.c | 4 +-- lustre/obdclass/genops.c | 2 +- 6 files changed, 82 insertions(+), 11 deletions(-) diff --git a/build/autoconf/lustre-build-linux.m4 b/build/autoconf/lustre-build-linux.m4 index 32991cd..8e1025f 100644 --- a/build/autoconf/lustre-build-linux.m4 +++ b/build/autoconf/lustre-build-linux.m4 @@ -539,6 +539,57 @@ else fi ]) +# LC_MODULE_LOADING +# after 2.6.28 CONFIG_KMOD is removed, and only CONFIG_MODULES remains +# so we test if request_module is implemented or not +AC_DEFUN([LC_MODULE_LOADING], +[AC_MSG_CHECKING([if kernel module loading is possible]) +LB_LINUX_TRY_MAKE([ + #include +],[ + int myretval=ENOSYS ; + return myretval; +],[ + $makerule LUSTRE_KERNEL_TEST=conftest.i +],[ + grep request_module build/conftest.i | grep -v `grep "int myretval=" build/conftest.i | cut -d= -f2 | cut -d" " -f1` >/dev/null +],[ + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_MODULE_LOADING_SUPPORT, 1, + [kernel module loading is possible]) +],[ + AC_MSG_RESULT(no) + AC_MSG_WARN([]) + AC_MSG_WARN([Kernel module loading support is highly recommended.]) + AC_MSG_WARN([]) +]) +]) + +# LC_MODULE_LOADING +# after 2.6.28 CONFIG_KMOD is removed, and only CONFIG_MODULES remains +# so we test if request_module is implemented or not +AC_DEFUN([LC_MODULE_LOADING], +[AC_MSG_CHECKING([if kernel module loading is possible]) +LB_LINUX_TRY_MAKE([ + #include +],[ + int myretval=ENOSYS ; + return myretval; +],[ + $makerule LUSTRE_KERNEL_TEST=conftest.i +],[ + grep request_module build/conftest.i | grep -v `grep "int myretval=" build/conftest.i | cut -d= -f2 | cut -d" " -f1` >/dev/null +],[ + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_MODULE_LOADING_SUPPORT, 1, + [kernel module loading is possible]) +],[ + AC_MSG_RESULT(no) + AC_MSG_WARN([]) + AC_MSG_WARN([Kernel module loading support is highly recommended.]) + AC_MSG_WARN([]) +]) +]) # # LB_PROG_LINUX @@ -563,11 +614,8 @@ if test "x$ARCH_UM" = "x" ; then fi ]) -LB_LINUX_CONFIG([KMOD],[],[ - AC_MSG_WARN([]) - AC_MSG_WARN([Kernel module loading support is highly recommended.]) - AC_MSG_WARN([]) -]) +# 2.6.28 +LC_MODULE_LOADING #LB_LINUX_CONFIG_BIG_STACK diff --git a/lnet/lnet/api-ni.c b/lnet/lnet/api-ni.c index 94031c3..7405622 100644 --- a/lnet/lnet/api-ni.c +++ b/lnet/lnet/api-ni.c @@ -1079,10 +1079,10 @@ lnet_startup_lndnis (void) CERROR("Can't load LND %s, module %s, rc=%d\n", libcfs_lnd2str(lnd_type), libcfs_lnd2modname(lnd_type), rc); -#ifndef CONFIG_KMOD +#ifndef HAVE_MODULE_LOADING_SUPPORT LCONSOLE_ERROR_MSG(0x104, "Your kernel must be " - "compiled with CONFIG_KMOD set for " - "automatic module loading."); + "compiled with kernel module " + "loading support."); #endif goto failed; } diff --git a/lustre/autoconf/lustre-core.m4 b/lustre/autoconf/lustre-core.m4 index 120942a..ab2d031 100644 --- a/lustre/autoconf/lustre-core.m4 +++ b/lustre/autoconf/lustre-core.m4 @@ -1719,6 +1719,22 @@ LB_LINUX_TRY_COMPILE([ ]) ]) +# 2.6.31 replaces blk_queue_hardsect_size by blk_queue_logical_block_size function +AC_DEFUN([LC_BLK_QUEUE_LOG_BLK_SIZE], +[AC_MSG_CHECKING([if blk_queue_logical_block_size is defined]) +LB_LINUX_TRY_COMPILE([ + #include +],[ + blk_queue_logical_block_size(NULL, 0); +],[ + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_BLK_QUEUE_LOG_BLK_SIZE, 1, + [blk_queue_logical_block_size is defined]) +],[ + AC_MSG_RESULT(no) +]) +]) + # # LC_PROG_LINUX # @@ -1871,6 +1887,9 @@ AC_DEFUN([LC_PROG_LINUX], LC_D_OBTAIN_ALIAS LC_BLKDEV_PUT_2ARGS LC_DENTRY_OPEN_4ARGS + + # 2.6.31 + LC_BLK_QUEUE_LOG_BLK_SIZE ]) # diff --git a/lustre/include/linux/lustre_compat25.h b/lustre/include/linux/lustre_compat25.h index 78ca298..468ce53 100644 --- a/lustre/include/linux/lustre_compat25.h +++ b/lustre/include/linux/lustre_compat25.h @@ -654,5 +654,9 @@ static inline int ll_quota_off(struct super_block *sb, int off, int remount) #define atomic_inc_not_zero(v) atomic_add_unless((v), 1, 0) #endif /* !atomic_inc_not_zero */ +#ifndef HAVE_BLK_QUEUE_LOG_BLK_SIZE /* added in 2.6.31 */ +#define blk_queue_logical_block_size(q, sz) blk_queue_hardsect_size(q, sz) +#endif + #endif /* __KERNEL__ */ #endif /* _COMPAT25_H */ diff --git a/lustre/llite/lloop.c b/lustre/llite/lloop.c index 4a0e35e..736ed41 100644 --- a/lustre/llite/lloop.c +++ b/lustre/llite/lloop.c @@ -503,8 +503,8 @@ static int loop_set_fd(struct lloop_device *lo, struct file *unused, * using unsigned type cast instead of unsigned short cast in order * to avoid truncate of CFS_PAGE_SIZE (= 2**16) value */ - blk_queue_hardsect_size(lo->lo_queue, - min_t(unsigned, CFS_PAGE_SIZE, 16384)); + blk_queue_logical_block_size(lo->lo_queue, + min_t(unsigned, CFS_PAGE_SIZE, 16384)); blk_queue_max_sectors(lo->lo_queue, LLOOP_MAX_SEGMENTS << (CFS_PAGE_SHIFT - 9)); blk_queue_max_phys_segments(lo->lo_queue, LLOOP_MAX_SEGMENTS); diff --git a/lustre/obdclass/genops.c b/lustre/obdclass/genops.c index 0bf5fd5..eab7402 100644 --- a/lustre/obdclass/genops.c +++ b/lustre/obdclass/genops.c @@ -116,7 +116,7 @@ struct obd_type *class_get_type(const char *name) { struct obd_type *type = class_search_type(name); -#ifdef CONFIG_KMOD +#ifdef HAVE_MODULE_LOADING_SUPPORT if (!type) { const char *modname = name; if (strcmp(modname, LUSTRE_MDT_NAME) == 0) -- 1.8.3.1