From 77a5896c94f30149e4c511ec83e9aada90153d38 Mon Sep 17 00:00:00 2001 From: Rahul Deshmukh Date: Wed, 3 Mar 2010 17:03:31 -0800 Subject: [PATCH] b=21500 2.6.31-fc12 patchless client support i=adilger i=brian i=sheng.yang --- build/autoconf/lustre-build-linux.m4 | 58 +++++++++++++++++++++++++++++++--- lnet/lnet/api-ni.c | 6 ++-- lustre/autoconf/lustre-core.m4 | 37 ++++++++++++++++++++++ lustre/include/linux/lustre_compat25.h | 4 +++ lustre/llite/lloop.c | 2 +- lustre/obdclass/cl_lock.c | 4 +++ lustre/obdclass/genops.c | 2 +- 7 files changed, 103 insertions(+), 10 deletions(-) diff --git a/build/autoconf/lustre-build-linux.m4 b/build/autoconf/lustre-build-linux.m4 index 186a175..17ec83e 100644 --- a/build/autoconf/lustre-build-linux.m4 +++ b/build/autoconf/lustre-build-linux.m4 @@ -512,6 +512,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 @@ -536,11 +587,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 4d3fd1a..5c335b4 100644 --- a/lnet/lnet/api-ni.c +++ b/lnet/lnet/api-ni.c @@ -1003,10 +1003,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 fdc02db..2f2ba80 100644 --- a/lustre/autoconf/lustre-core.m4 +++ b/lustre/autoconf/lustre-core.m4 @@ -1815,6 +1815,39 @@ AC_DEFUN([LC_LINUX_FIEMAP_H], []) ]) +# LC_LOCK_MAP_ACQUIRE +# after 2.6.27 lock_map_acquire replaces lock_acquire +AC_DEFUN([LC_LOCK_MAP_ACQUIRE], +[AC_MSG_CHECKING([if lock_map_acquire is defined]) +LB_LINUX_TRY_COMPILE([ + #include +],[ + lock_map_acquire(NULL); +],[ + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_LOCK_MAP_ACQUIRE, 1, + [lock_map_acquire is defined]) +],[ + AC_MSG_RESULT(no) +]) +]) + +# 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 # @@ -1955,6 +1988,7 @@ AC_DEFUN([LC_PROG_LINUX], LC_QUOTA_ON_5ARGS LC_QUOTA_OFF_3ARGS LC_VFS_DQ_OFF + LC_LOCK_MAP_ACQUIRE # 2.6.27.15-2 sles11 LC_BI_HW_SEGMENTS @@ -1962,6 +1996,9 @@ AC_DEFUN([LC_PROG_LINUX], LC_VFS_SYMLINK_5ARGS LC_SB_ANY_QUOTA_ACTIVE LC_SB_HAS_QUOTA_ACTIVE + + # 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 fe7a720..4d70eb7 100644 --- a/lustre/include/linux/lustre_compat25.h +++ b/lustre/include/linux/lustre_compat25.h @@ -795,5 +795,9 @@ static inline int ll_quota_off(struct super_block *sb, int off, int remount) return -ENOSYS; } +#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 4f56ef9..7dc924a 100644 --- a/lustre/llite/lloop.c +++ b/lustre/llite/lloop.c @@ -541,7 +541,7 @@ static int loop_set_fd(struct lloop_device *lo, struct file *unused, lo->lo_queue->unplug_fn = loop_unplug; /* queue parameters */ - blk_queue_hardsect_size(lo->lo_queue, CFS_PAGE_SIZE); + blk_queue_logical_block_size(lo->lo_queue, CFS_PAGE_SIZE); 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/cl_lock.c b/lustre/obdclass/cl_lock.c index 3e8b004..575a54d 100644 --- a/lustre/obdclass/cl_lock.c +++ b/lustre/obdclass/cl_lock.c @@ -158,9 +158,13 @@ static void cl_lock_lockdep_acquire(const struct lu_env *env, struct cl_lock *lock, __u32 enqflags) { cl_lock_counters(env, lock)->ctc_nr_locks_acquired++; +#ifdef HAVE_LOCK_MAP_ACQUIRE + lock_map_acquire(&lock->dep_map); +#else /* HAVE_LOCK_MAP_ACQUIRE */ lock_acquire(&lock->dep_map, !!(enqflags & CEF_ASYNC), /* try: */ 0, lock->cll_descr.cld_mode <= CLM_READ, /* check: */ 2, RETIP); +#endif /* HAVE_LOCK_MAP_ACQUIRE */ } static void cl_lock_lockdep_release(const struct lu_env *env, diff --git a/lustre/obdclass/genops.c b/lustre/obdclass/genops.c index 853dd86..a8c6c34 100644 --- a/lustre/obdclass/genops.c +++ b/lustre/obdclass/genops.c @@ -117,7 +117,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 (!cfs_request_module("%s", modname)) { -- 1.8.3.1