Whamcloud - gitweb
LU-709 build: clean up libcfs/autoconf/lustre-libcfs.m4
authorPeng Tao <peng_tao@emc.com>
Fri, 27 Jan 2012 20:27:11 +0000 (04:27 +0800)
committerOleg Drokin <green@whamcloud.com>
Thu, 29 Mar 2012 04:30:16 +0000 (00:30 -0400)
1. cpu_online is found from v2.6.18 to latest
2. gfp_t is always defined from v2.6.18 to latest
3. HAVE_SCHED_SHOW_TASK is not used
4. task_struct has rcu field since v2.6.16
5. panic_notifier_list is atomic since v2.6.18
6. HAVE_NLMSG_MULTICAST_5ARGS is not used
7. HAVE_NETLINK and HAVE_NETLINK_NL2 are not used
8. kernel has kmem_cache from v2.6.18 to latest
9. HAVE_NETLINK_NS and HAVE_NETLINK_CBMUTEX is not used

Signed-off-by: Peng Tao <peng_tao@emc.com>
Change-Id: Ib10d4b9f19f96aa85f9be4d6f2dbaa7fb4cbbc34
Reviewed-on: http://review.whamcloud.com/2328
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Tested-by: Hudson
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
libcfs/autoconf/lustre-libcfs.m4
libcfs/include/libcfs/linux/linux-mem.h
libcfs/include/libcfs/linux/portals_compat25.h
libcfs/libcfs/linux/linux-debug.c
libcfs/libcfs/tracefile.c
libcfs/libcfs/watchdog.c
lnet/klnds/o2iblnd/o2iblnd.h
lustre/include/linux/lustre_compat25.h
lustre/ptlrpc/ptlrpcd.c
lustre/ptlrpc/service.c

index e292852..be9a858 100644 (file)
@@ -59,61 +59,6 @@ else
 fi
 ])
 
-#
-# LIBCFS_FUNC_CPU_ONLINE
-#
-# cpu_online is different in rh 2.4, vanilla 2.4, and 2.6
-#
-AC_DEFUN([LIBCFS_FUNC_CPU_ONLINE],
-[AC_MSG_CHECKING([if kernel defines cpu_online()])
-LB_LINUX_TRY_COMPILE([
-       #include <linux/sched.h>
-],[
-       cpu_online(0);
-],[
-       AC_MSG_RESULT([yes])
-       AC_DEFINE(HAVE_CPU_ONLINE, 1, [cpu_online found])
-],[
-       AC_MSG_RESULT([no])
-])
-])
-
-#
-# LIBCFS_TYPE_GFP_T
-#
-# check if gfp_t is typedef-ed
-#
-AC_DEFUN([LIBCFS_TYPE_GFP_T],
-[AC_MSG_CHECKING([if kernel defines gfp_t])
-LB_LINUX_TRY_COMPILE([
-        #include <linux/gfp.h>
-],[
-       return sizeof(gfp_t);
-],[
-       AC_MSG_RESULT([yes])
-       AC_DEFINE(HAVE_GFP_T, 1, [gfp_t found])
-],[
-       AC_MSG_RESULT([no])
-])
-])
-
-#
-# LIBCFS_FUNC_SHOW_TASK
-#
-# we export show_task(), but not all kernels have it (yet)
-#
-AC_DEFUN([LIBCFS_FUNC_SHOW_TASK],
-[LB_CHECK_SYMBOL_EXPORT([show_task],
-[kernel/ksyms.c kernel/sched.c],[
-AC_DEFINE(HAVE_SHOW_TASK, 1, [show_task is exported])
-],[
-        LB_CHECK_SYMBOL_EXPORT([sched_show_task],
-        [kernel/ksyms.c kernel/sched.c],[
-        AC_DEFINE(HAVE_SCHED_SHOW_TASK, 1, [sched_show_task is exported])
-        ],[])
-])
-])
-
 # check kernel __u64 type
 AC_DEFUN([LIBCFS_U64_LONG_LONG_LINUX],
 [
@@ -137,21 +82,6 @@ LB_LINUX_TRY_COMPILE([
 EXTRA_KCFLAGS="$tmp_flags"
 ])
 
-# check if task_struct with rcu memeber
-AC_DEFUN([LIBCFS_TASK_RCU],
-[AC_MSG_CHECKING([if task_struct has a rcu field])
-LB_LINUX_TRY_COMPILE([
-       #include <linux/sched.h>
-],[
-        memset(((struct task_struct *)0)->rcu.next, 0, 0);
-],[
-        AC_MSG_RESULT([yes])
-        AC_DEFINE(HAVE_TASK_RCU, 1, [task_struct has rcu field])
-],[
-        AC_MSG_RESULT([no])
-])
-])
-
 # LIBCFS_TASKLIST_LOCK
 # 2.6.18 remove tasklist_lock export
 AC_DEFUN([LIBCFS_TASKLIST_LOCK],
@@ -181,70 +111,6 @@ LB_LINUX_TRY_COMPILE([
 ])
 ])
 
-# 2.6.19 API change
-#panic_notifier_list use atomic_notifier operations
-#
-AC_DEFUN([LIBCFS_ATOMIC_PANIC_NOTIFIER],
-[AC_MSG_CHECKING([panic_notifier_list is atomic])
-LB_LINUX_TRY_COMPILE([
-       #include <linux/notifier.h>
-       #include <linux/kernel.h>
-],[
-       struct atomic_notifier_head panic_notifier_list;
-],[
-        AC_MSG_RESULT(yes)
-       AC_DEFINE(HAVE_ATOMIC_PANIC_NOTIFIER, 1,
-               [panic_notifier_list is atomic_notifier_head])
-],[
-        AC_MSG_RESULT(NO)
-])
-])
-
-# since 2.6.19 nlmsg_multicast() needs 5 argument.
-AC_DEFUN([LIBCFS_NLMSG_MULTICAST],
-[AC_MSG_CHECKING([nlmsg_multicast needs 5 argument])
-LB_LINUX_TRY_COMPILE([
-       #include <net/netlink.h>
-],[
-        nlmsg_multicast(NULL, NULL, 0, 0, 0);
-],[
-        AC_MSG_RESULT(yes)
-        AC_DEFINE(HAVE_NLMSG_MULTICAST_5ARGS, 1,
-                  [nlmsg_multicast needs 5 argument])
-],[
-        AC_MSG_RESULT(NO)
-])
-])
-
-#
-# LIBCFS_NETLINK
-#
-# If we have netlink.h, and nlmsg_new takes 2 args (2.6.19)
-#
-AC_DEFUN([LIBCFS_NETLINK],
-[AC_MSG_CHECKING([if netlink.h can be compiled])
-LB_LINUX_TRY_COMPILE([
-        #include <net/netlink.h>
-],[],[
-        AC_MSG_RESULT([yes])
-        AC_DEFINE(HAVE_NETLINK, 1, [net/netlink.h found])
-
-        AC_MSG_CHECKING([if nlmsg_new takes a 2nd argument])
-        LB_LINUX_TRY_COMPILE([
-                #include <net/netlink.h>
-        ],[
-                nlmsg_new(100, GFP_KERNEL);
-        ],[
-                AC_MSG_RESULT([yes])
-                AC_DEFINE(HAVE_NETLINK_NL2, 1, [nlmsg_new takes 2 args])
-        ],[
-                AC_MSG_RESULT([no])
-        ])
-],[
-        AC_MSG_RESULT([no])
-])
-])
-
 # 2.6.20 API change INIT_WORK use 2 args and not
 # store data inside
 AC_DEFUN([LIBCFS_3ARGS_INIT_WORK],
@@ -281,29 +147,6 @@ LB_LINUX_TRY_COMPILE([
 ])
 ])
 
-# 2.6.21 marks kmem_cache_t deprecated and uses struct kmem_cache
-# instead
-AC_DEFUN([LIBCFS_KMEM_CACHE],
-[AC_MSG_CHECKING([check kernel has struct kmem_cache])
-tmp_flags="$EXTRA_KCFLAGS"
-EXTRA_KCFLAGS="-Werror"
-LB_LINUX_TRY_COMPILE([
-        #include <linux/slab.h>
-        typedef struct kmem_cache cache_t;
-],[
-       cache_t *cachep = NULL;
-
-       kmem_cache_alloc(cachep, 0);
-],[
-        AC_MSG_RESULT(yes)
-        AC_DEFINE(HAVE_KMEM_CACHE, 1,
-                  [kernel has struct kmem_cache])
-],[
-        AC_MSG_RESULT(NO)
-])
-EXTRA_KCFLAGS="$tmp_flags"
-])
-
 # 2.6.23 lost dtor argument
 AC_DEFUN([LIBCFS_KMEM_CACHE_CREATE_DTOR],
 [AC_MSG_CHECKING([check kmem_cache_create has dtor argument])
@@ -336,24 +179,6 @@ LB_LINUX_TRY_COMPILE([
 ])
 ])
 
-# 2.6.24 
-AC_DEFUN([LIBCFS_NETLINK_CBMUTEX],
-[AC_MSG_CHECKING([for mutex in netlink_kernel_create])
-LB_LINUX_TRY_COMPILE([
-        #include <linux/netlink.h>
-],[
-        struct mutex *lock = NULL;
-
-        netlink_kernel_create(0, 0, NULL, lock, NULL);
-],[
-        AC_MSG_RESULT(yes)
-        AC_DEFINE(HAVE_NETLINK_CBMUTEX, 1,
-                  [netlink_kernel_create want mutex for callback])
-],[
-        AC_MSG_RESULT(NO)
-])
-])
-
 # 2.6.24 request not use real numbers for ctl_name
 AC_DEFUN([LIBCFS_SYSCTL_UNNUMBERED],
 [AC_MSG_CHECKING([for CTL_UNNUMBERED])
@@ -405,51 +230,6 @@ LB_LINUX_TRY_COMPILE([
 ])
 ])
 
-
-# 2.6.24 
-AC_DEFUN([LIBCFS_NETLINK_NETNS],
-[AC_MSG_CHECKING([for netlink support net ns])
-LB_LINUX_TRY_COMPILE([
-        #include <linux/netlink.h>
-],[
-        struct net *net = NULL;
-        struct mutex *lock = NULL;
-
-        netlink_kernel_create(net, 0, 0, NULL,
-                              lock,
-                              NULL);
-],[
-        AC_MSG_RESULT(yes)
-        AC_DEFINE(HAVE_NETLINK_NS, 1,
-                  [netlink is support network namespace])
-# XXX
-# for now - if kernel have netlink ns - he uses cbmutex
-        AC_DEFINE(HAVE_NETLINK_CBMUTEX, 1,
-                  [netlink_kernel_create want mutex for callback])
-
-],[
-        AC_MSG_RESULT(NO)
-])
-])
-
-# ~2.6.24
-AC_DEFUN([LIBCFS_NL_BROADCAST_GFP],
-[AC_MSG_CHECKING([for netlink_broadcast is want to have gfp parameter])
-LB_LINUX_TRY_COMPILE([
-        #include <linux/netlink.h>
-],[
-       gfp_t gfp = GFP_KERNEL;
-
-        netlink_broadcast(NULL, NULL, 0, 0, gfp);
-],[
-        AC_MSG_RESULT(yes)
-        AC_DEFINE(HAVE_NL_BROADCAST_GFP, 1,
-                  [netlink brouacast is want to have gfp paramter])
-],[
-        AC_MSG_RESULT(NO)
-])
-])
-
 #
 # LIBCFS_FUNC_DUMP_TRACE
 #
@@ -792,36 +572,26 @@ LB_LINUX_TRY_COMPILE([
 #
 AC_DEFUN([LIBCFS_PROG_LINUX],
 [
-LIBCFS_FUNC_CPU_ONLINE
-LIBCFS_TYPE_GFP_T
 LIBCFS_CONFIG_PANIC_DUMPLOG
 
-LIBCFS_FUNC_SHOW_TASK
 LIBCFS_U64_LONG_LONG_LINUX
-LIBCFS_TASK_RCU
+
 # 2.6.18
 LIBCFS_TASKLIST_LOCK
 LIBCFS_HAVE_IS_COMPAT_TASK
 # 2.6.19
-LIBCFS_NETLINK
-LIBCFS_NLMSG_MULTICAST
 LIBCFS_KMEM_CACHE_DESTROY_INT
-LIBCFS_ATOMIC_PANIC_NOTIFIER
 # 2.6.20
 LIBCFS_3ARGS_INIT_WORK
 # 2.6.21
 LIBCFS_2ARGS_REGISTER_SYSCTL
-LIBCFS_KMEM_CACHE
 # 2.6.23
 LIBCFS_KMEM_CACHE_CREATE_DTOR
-LIBCFS_NETLINK_CBMUTEX
 LC_REGISTER_SHRINKER
 # 2.6.24
 LIBCFS_SYSCTL_UNNUMBERED
 LIBCFS_SCATTERLIST_SETPAGE
-LIBCFS_NL_BROADCAST_GFP
 LIBCFS_NETWORK_NAMESPACE
-LIBCFS_NETLINK_NETNS
 LIBCFS_FUNC_DUMP_TRACE
 # 2.6.26
 LIBCFS_SEM_COUNT
index 80b71af..05dde15 100644 (file)
@@ -138,11 +138,7 @@ extern void cfs_free_page(cfs_page_t *page);
  * SLAB allocator
  * XXX Liang: move these declare to public file
  */
-#ifdef HAVE_KMEM_CACHE
 typedef struct kmem_cache cfs_mem_cache_t;
-#else
-typedef kmem_cache_t cfs_mem_cache_t;
-#endif
 extern cfs_mem_cache_t * cfs_mem_cache_create (const char *, size_t, size_t, unsigned long);
 extern int cfs_mem_cache_destroy ( cfs_mem_cache_t * );
 extern void *cfs_mem_cache_alloc ( cfs_mem_cache_t *, int);
index 56a147b..be1a4af 100644 (file)
 #define PAGE_LIST_ENTRY lru
 #define PAGE_LIST(page) ((page)->lru)
 
-#ifndef HAVE_CPU_ONLINE
-#define cfs_cpu_online(cpu) ((1<<cpu) & (cpu_online_map))
-#else
-#define cfs_cpu_online(cpu) cpu_online(cpu)
-#endif
-
 #ifndef __user
 #define __user
 #endif
index c40bcc8..3affaa1 100644 (file)
@@ -336,20 +336,12 @@ static struct notifier_block libcfs_panic_notifier = {
 
 void libcfs_register_panic_notifier(void)
 {
-#ifdef HAVE_ATOMIC_PANIC_NOTIFIER
         atomic_notifier_chain_register(&panic_notifier_list, &libcfs_panic_notifier);
-#else
-        notifier_chain_register(&panic_notifier_list, &libcfs_panic_notifier);
-#endif
 }
 
 void libcfs_unregister_panic_notifier(void)
 {
-#ifdef HAVE_ATOMIC_PANIC_NOTIFIER
         atomic_notifier_chain_unregister(&panic_notifier_list, &libcfs_panic_notifier);
-#else
-        notifier_chain_unregister(&panic_notifier_list, &libcfs_panic_notifier);
-#endif
 }
 
 EXPORT_SYMBOL(libcfs_debug_dumpstack);
index 22c8ebf..76b76ec 100644 (file)
@@ -1063,7 +1063,7 @@ static int tracefiled(void *arg)
                         printk(CFS_KERN_ERR "total cpus(%d): ",
                                cfs_num_possible_cpus());
                         for (i = 0; i < cfs_num_possible_cpus(); i++)
-                                if (cfs_cpu_online(i))
+                                if (cpu_online(i))
                                         printk(CFS_KERN_ERR "%d(on) ", i);
                                 else
                                         printk(CFS_KERN_ERR "%d(off) ", i);
index 58a3043..b1bdb71 100644 (file)
@@ -107,11 +107,8 @@ lcw_dump(struct lc_watchdog *lcw)
         ENTRY;
 #if defined(HAVE_TASKLIST_LOCK)
         cfs_read_lock(&tasklist_lock);
-#elif defined(HAVE_TASK_RCU)
-        rcu_read_lock();
 #else
-        CERROR("unable to dump stack because of missing export\n");
-        RETURN_EXIT;
+        rcu_read_lock();
 #endif
        if (lcw->lcw_task == NULL) {
                 LCONSOLE_WARN("Process " LPPID " was not found in the task "
@@ -123,7 +120,7 @@ lcw_dump(struct lc_watchdog *lcw)
 
 #if defined(HAVE_TASKLIST_LOCK)
         cfs_read_unlock(&tasklist_lock);
-#elif defined(HAVE_TASK_RCU)
+#else
         rcu_read_unlock();
 #endif
         EXIT;
index 6c64d0b..dfa102c 100644 (file)
 #include <lnet/lib-lnet.h>
 #include <lnet/lnet-sysctl.h>
 
-#if !HAVE_GFP_T
-typedef int gfp_t;
-#endif
-
 #include <rdma/rdma_cm.h>
 #include <rdma/ib_cm.h>
 #include <rdma/ib_verbs.h>
index 4b421d7..b0686f7 100644 (file)
@@ -167,10 +167,6 @@ do {cfs_mutex_lock_nested(&(inode)->i_mutex, I_MUTEX_PARENT); } while(0)
 #define set_page_private(page, v) ((page)->private = (v))
 #endif
 
-#ifndef HAVE_GFP_T
-#define gfp_t int
-#endif
-
 #define lock_dentry(___dentry)          cfs_spin_lock(&(___dentry)->d_lock)
 #define unlock_dentry(___dentry)        cfs_spin_unlock(&(___dentry)->d_lock)
 
index 478f51b..4add2d7 100644 (file)
@@ -413,7 +413,7 @@ static int ptlrpcd(void *arg)
                 int index = pc->pc_index;
 
                 if (index >= 0 && index < cfs_num_possible_cpus()) {
-                        while (!cfs_cpu_online(index)) {
+                        while (!cpu_online(index)) {
                                 if (++index >= cfs_num_possible_cpus())
                                         index = 0;
                         }
index 530e23b..3002099 100644 (file)
@@ -2110,7 +2110,7 @@ static int ptlrpc_main(void *arg)
 
                 for (cpu = 0, num_cpu = 0; cpu < cfs_num_possible_cpus();
                      cpu++) {
-                        if (!cfs_cpu_online(cpu))
+                        if (!cpu_online(cpu))
                                 continue;
                         if (num_cpu == thread->t_id % cfs_num_online_cpus())
                                 break;
@@ -2383,7 +2383,7 @@ static int ptlrpc_start_hr_threads(struct ptlrpc_hr_service *hr)
 
         for (n = 0, cpu = 0; n < hr->hr_n_threads; n++) {
 #if defined(CONFIG_SMP) && defined(HAVE_NODE_TO_CPUMASK)
-                while(!cfs_cpu_online(cpu)) {
+                while (!cpu_online(cpu)) {
                         cpu++;
                         if (cpu >= cfs_num_possible_cpus())
                                 cpu = 0;