From 0a9c652a6a8a24504278715cc17f783b20b225c2 Mon Sep 17 00:00:00 2001 From: Peng Tao Date: Tue, 15 May 2012 13:55:03 +0800 Subject: [PATCH] LU-709 build: clean up percpu_counter and sb.s_time_gran 1. linux/percpu_counter.h exists since v2.6.12, percpu_counter_init() takes two arguments since v2.6.17, and percpu_counter is not used in lustre 2. superblock.s_time_gran exists since v2.6.12 3. get_sb_time_gran() doesn't exist since v2.6.12 Signed-off-by: Peng Tao Change-Id: Id80b0bfc702f509218fcf29d01334894d122b9c8 Reviewed-on: http://review.whamcloud.com/2317 Tested-by: Hudson Tested-by: Maloo Reviewed-by: Andreas Dilger Reviewed-by: Yang Sheng --- lustre/autoconf/lustre-core.m4 | 63 ---------------------------------- lustre/include/linux/lustre_compat25.h | 10 ------ lustre/osd-ldiskfs/osd_handler.c | 14 ++++---- 3 files changed, 7 insertions(+), 80 deletions(-) diff --git a/lustre/autoconf/lustre-core.m4 b/lustre/autoconf/lustre-core.m4 index 7a4b5b7..e5c1cb8 100644 --- a/lustre/autoconf/lustre-core.m4 +++ b/lustre/autoconf/lustre-core.m4 @@ -451,32 +451,6 @@ AC_DEFUN([LC_CONFIG_GSS], fi ]) -AC_DEFUN([LC_PERCPU_COUNTER], -[AC_MSG_CHECKING([if have struct percpu_counter defined]) -LB_LINUX_TRY_COMPILE([ - #include -],[],[ - AC_DEFINE(HAVE_PERCPU_COUNTER, 1, [percpu_counter found]) - AC_MSG_RESULT([yes]) - - AC_MSG_CHECKING([if percpu_counter_inc takes the 2nd argument]) - LB_LINUX_TRY_COMPILE([ - #include - ],[ - struct percpu_counter c; - percpu_counter_init(&c, 0); - ],[ - AC_DEFINE(HAVE_PERCPU_2ND_ARG, 1, [percpu_counter_init has two - arguments]) - AC_MSG_RESULT([yes]) - ],[ - AC_MSG_RESULT([no]) - ]) -],[ - AC_MSG_RESULT([no]) -]) -]) - AC_DEFUN([LC_TASK_CLENV_STORE], [ AC_MSG_CHECKING([if we can store cl_env in task_struct]) @@ -485,38 +459,6 @@ AC_DEFUN([LC_TASK_CLENV_STORE], fi ]) -# ~2.6.11 - -AC_DEFUN([LC_S_TIME_GRAN], -[AC_MSG_CHECKING([if super block has s_time_gran member]) -LB_LINUX_TRY_COMPILE([ - #include -],[ - struct super_block *sb = NULL; - - return sb->s_time_gran; -],[ - AC_MSG_RESULT([yes]) - AC_DEFINE(HAVE_S_TIME_GRAN, 1, [super block has s_time_gran member]) -],[ - AC_MSG_RESULT([no]) -]) -]) - -AC_DEFUN([LC_SB_TIME_GRAN], -[AC_MSG_CHECKING([if kernel has old get_sb_time_gran]) -LB_LINUX_TRY_COMPILE([ - #include -],[ - return get_sb_time_gran(NULL); -],[ - AC_MSG_RESULT([yes]) - AC_DEFINE(HAVE_SB_TIME_GRAN, 1, [kernel has old get_sb_time_gran]) -],[ - AC_MSG_RESULT([no]) -]) -]) - # 2.6.12 # ~2.6.12 merge patch from oracle to convert tree_lock from spinlock to rwlock @@ -2010,13 +1952,8 @@ AC_DEFUN([LC_PROG_LINUX], LC_CAPA_CRYPTO LC_CONFIG_RMTCLIENT LC_CONFIG_GSS - LC_PERCPU_COUNTER LC_TASK_CLENV_STORE - # ~2.6.11 - LC_S_TIME_GRAN - LC_SB_TIME_GRAN - # 2.6.12 LC_RW_TREE_LOCK diff --git a/lustre/include/linux/lustre_compat25.h b/lustre/include/linux/lustre_compat25.h index 922d054..d5ae11a 100644 --- a/lustre/include/linux/lustre_compat25.h +++ b/lustre/include/linux/lustre_compat25.h @@ -343,16 +343,6 @@ static inline unsigned int mnt_get_count(struct vfsmount *mnt) #define ll_do_statfs(sb, sfs) (sb)->s_op->statfs((sb), (sfs)) #endif -#ifndef HAVE_SB_TIME_GRAN -#ifndef HAVE_S_TIME_GRAN -#error Need s_time_gran patch! -#endif -static inline u32 get_sb_time_gran(struct super_block *sb) -{ - return sb->s_time_gran; -} -#endif - #ifdef HAVE_RW_TREE_LOCK #define TREE_READ_LOCK_IRQ(mapping) read_lock_irq(&(mapping)->tree_lock) #define TREE_READ_UNLOCK_IRQ(mapping) read_unlock_irq(&(mapping)->tree_lock) diff --git a/lustre/osd-ldiskfs/osd_handler.c b/lustre/osd-ldiskfs/osd_handler.c index 6a49986..c2e0e4f 100644 --- a/lustre/osd-ldiskfs/osd_handler.c +++ b/lustre/osd-ldiskfs/osd_handler.c @@ -1389,15 +1389,15 @@ int osd_object_auth(const struct lu_env *env, struct dt_object *dt, } static struct timespec *osd_inode_time(const struct lu_env *env, - struct inode *inode, __u64 seconds) + struct inode *inode, __u64 seconds) { - struct osd_thread_info *oti = osd_oti_get(env); - struct timespec *t = &oti->oti_time; + struct osd_thread_info *oti = osd_oti_get(env); + struct timespec *t = &oti->oti_time; - t->tv_sec = seconds; - t->tv_nsec = 0; - *t = timespec_trunc(*t, get_sb_time_gran(inode->i_sb)); - return t; + t->tv_sec = seconds; + t->tv_nsec = 0; + *t = timespec_trunc(*t, inode->i_sb->s_time_gran); + return t; } -- 1.8.3.1