From: Peng Tao Date: Fri, 27 Jan 2012 20:27:11 +0000 (+0800) Subject: LU-709 build: clean up libcfs/autoconf/lustre-libcfs.m4 X-Git-Tag: 2.2.51~27 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=970d2e6445ac505b8b2fc1e773d667fa518de3ae LU-709 build: clean up libcfs/autoconf/lustre-libcfs.m4 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 Change-Id: Ib10d4b9f19f96aa85f9be4d6f2dbaa7fb4cbbc34 Reviewed-on: http://review.whamcloud.com/2328 Reviewed-by: Andreas Dilger Tested-by: Hudson Tested-by: Maloo Reviewed-by: Oleg Drokin --- diff --git a/libcfs/autoconf/lustre-libcfs.m4 b/libcfs/autoconf/lustre-libcfs.m4 index e292852..be9a858 100644 --- a/libcfs/autoconf/lustre-libcfs.m4 +++ b/libcfs/autoconf/lustre-libcfs.m4 @@ -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 -],[ - 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 -],[ - 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 -],[ - 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 - #include -],[ - 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 -],[ - 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 -],[],[ - 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 - ],[ - 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 - 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 -],[ - 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 -],[ - 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 -],[ - 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 diff --git a/libcfs/include/libcfs/linux/linux-mem.h b/libcfs/include/libcfs/linux/linux-mem.h index 80b71af..05dde15 100644 --- a/libcfs/include/libcfs/linux/linux-mem.h +++ b/libcfs/include/libcfs/linux/linux-mem.h @@ -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); diff --git a/libcfs/include/libcfs/linux/portals_compat25.h b/libcfs/include/libcfs/linux/portals_compat25.h index 56a147b..be1a4af 100644 --- a/libcfs/include/libcfs/linux/portals_compat25.h +++ b/libcfs/include/libcfs/linux/portals_compat25.h @@ -72,12 +72,6 @@ #define PAGE_LIST_ENTRY lru #define PAGE_LIST(page) ((page)->lru) -#ifndef HAVE_CPU_ONLINE -#define cfs_cpu_online(cpu) ((1<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; diff --git a/lnet/klnds/o2iblnd/o2iblnd.h b/lnet/klnds/o2iblnd/o2iblnd.h index 6c64d0b..dfa102c 100644 --- a/lnet/klnds/o2iblnd/o2iblnd.h +++ b/lnet/klnds/o2iblnd/o2iblnd.h @@ -79,10 +79,6 @@ #include #include -#if !HAVE_GFP_T -typedef int gfp_t; -#endif - #include #include #include diff --git a/lustre/include/linux/lustre_compat25.h b/lustre/include/linux/lustre_compat25.h index 4b421d7..b0686f7 100644 --- a/lustre/include/linux/lustre_compat25.h +++ b/lustre/include/linux/lustre_compat25.h @@ -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) diff --git a/lustre/ptlrpc/ptlrpcd.c b/lustre/ptlrpc/ptlrpcd.c index 478f51b..4add2d7 100644 --- a/lustre/ptlrpc/ptlrpcd.c +++ b/lustre/ptlrpc/ptlrpcd.c @@ -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; } diff --git a/lustre/ptlrpc/service.c b/lustre/ptlrpc/service.c index 530e23b..3002099 100644 --- a/lustre/ptlrpc/service.c +++ b/lustre/ptlrpc/service.c @@ -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;