From: Peng Tao Date: Thu, 16 Aug 2012 07:59:21 +0000 (+0800) Subject: LU-1756 kernel: cleanup lustre_compat25.h X-Git-Tag: 2.3.51~84 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=78fc98c662e5a7d98663f318077d621448070070 LU-1756 kernel: cleanup lustre_compat25.h 1. unused functions: ll_remove_suid(), labs() 2. abs() is always defined 3. use SLAB_DESTROY_BY_RCU directly 4. call sb_any_quota_loaded() directl Signed-off-by: Peng Tao Change-Id: Ic52e1a75f3d71887ae91f03a465112ab6c08c746 Reviewed-on: http://review.whamcloud.com/3688 Tested-by: Hudson Tested-by: Maloo Reviewed-by: Andreas Dilger Reviewed-by: Niu Yawei Reviewed-by: Yang Sheng --- diff --git a/libcfs/include/libcfs/user-mem.h b/libcfs/include/libcfs/user-mem.h index 2c5533c..423ba8e 100644 --- a/libcfs/include/libcfs/user-mem.h +++ b/libcfs/include/libcfs/user-mem.h @@ -76,7 +76,7 @@ typedef struct { } cfs_mem_cache_t; #define CFS_SLAB_HWCACHE_ALIGN 0 -#define CFS_SLAB_DESTROY_BY_RCU 0 +#define SLAB_DESTROY_BY_RCU 0 #define CFS_SLAB_KERNEL 0 #define CFS_SLAB_NOFS 0 diff --git a/lustre/autoconf/lustre-core.m4 b/lustre/autoconf/lustre-core.m4 index e359744..fae89c8 100644 --- a/lustre/autoconf/lustre-core.m4 +++ b/lustre/autoconf/lustre-core.m4 @@ -1020,22 +1020,6 @@ LB_LINUX_TRY_COMPILE([ ]) ]) -# 2.6.27 has file_remove_suid instead of remove_suid -AC_DEFUN([LC_FILE_REMOVE_SUID], -[AC_MSG_CHECKING([kernel has file_remove_suid]) -LB_LINUX_TRY_COMPILE([ - #include -],[ - file_remove_suid(NULL); -],[ - AC_DEFINE(HAVE_FILE_REMOVE_SUID, 1, - [kernel have file_remove_suid]) - AC_MSG_RESULT([yes]) -],[ - AC_MSG_RESULT([no]) -]) -]) - # 2.6.27 have new page locking API AC_DEFUN([LC_TRYLOCKPAGE], [AC_MSG_CHECKING([kernel uses trylock_page for page lock]) @@ -1947,7 +1931,6 @@ AC_DEFUN([LC_PROG_LINUX], LC_PGMKWRITE_USE_VMFAULT LC_PGMKWRITE_COMPACT LC_INODE_PERMISION_2ARGS - LC_FILE_REMOVE_SUID LC_TRYLOCKPAGE LC_READ_INODE_IN_SBOPS LC_EXPORT_INODE_PERMISSION diff --git a/lustre/include/linux/lustre_compat25.h b/lustre/include/linux/lustre_compat25.h index 172da72..b7dcb60 100644 --- a/lustre/include/linux/lustre_compat25.h +++ b/lustre/include/linux/lustre_compat25.h @@ -553,16 +553,6 @@ static inline int ll_crypto_hmac(struct crypto_tfm *tfm, #define ll_crypto_tfm_alg_max_keysize crypto_tfm_alg_max_keysize #endif /* HAVE_ASYNC_BLOCK_CIPHER */ -#ifdef HAVE_FILE_REMOVE_SUID -# define ll_remove_suid(file, mnt) file_remove_suid(file) -#else -# ifdef HAVE_SECURITY_PLUG -# define ll_remove_suid(file,mnt) remove_suid(file->f_dentry,mnt) -# else -# define ll_remove_suid(file,mnt) remove_suid(file->f_dentry) -# endif -#endif - #ifdef HAVE_SECURITY_PLUG #define ll_vfs_rmdir(dir,entry,mnt) vfs_rmdir(dir,entry,mnt) #define ll_vfs_mkdir(inode,dir,mnt,mode) vfs_mkdir(inode,dir,mnt,mode) @@ -609,42 +599,24 @@ static inline int ll_crypto_hmac(struct crypto_tfm *tfm, #define cfs_path_put(nd) path_release(nd) #endif -#ifndef abs -static inline int abs(int x) -{ - return (x < 0) ? -x : x; -} -#endif - -#ifndef labs -static inline long labs(long x) -{ - return (x < 0) ? -x : x; -} -#endif /* HAVE_REGISTER_SHRINKER */ - #ifndef HAVE_SIMPLE_SETATTR #define simple_setattr(dentry, ops) inode_setattr((dentry)->d_inode, ops) #endif #ifndef SLAB_DESTROY_BY_RCU -#define CFS_SLAB_DESTROY_BY_RCU 0 -#else -#define CFS_SLAB_DESTROY_BY_RCU SLAB_DESTROY_BY_RCU +#define SLAB_DESTROY_BY_RCU 0 #endif -#ifdef HAVE_SB_HAS_QUOTA_ACTIVE -#define ll_sb_has_quota_active(sb, type) sb_has_quota_active(sb, type) -#else -#define ll_sb_has_quota_active(sb, type) sb_has_quota_enabled(sb, type) +#ifndef HAVE_SB_HAS_QUOTA_ACTIVE +#define sb_has_quota_active(sb, type) sb_has_quota_enabled(sb, type) #endif -#ifdef HAVE_SB_ANY_QUOTA_LOADED -#define ll_sb_any_quota_active(sb) sb_any_quota_loaded(sb) -#elif defined(HAVE_SB_ANY_QUOTA_ACTIVE) -#define ll_sb_any_quota_active(sb) sb_any_quota_active(sb) -#else -#define ll_sb_any_quota_active(sb) sb_any_quota_enabled(sb) +#ifndef HAVE_SB_ANY_QUOTA_LOADED +# ifdef HAVE_SB_ANY_QUOTA_ACTIVE +# define sb_any_quota_loaded(sb) sb_any_quota_active(sb) +# else +# define sb_any_quota_loaded(sb) sb_any_quota_enabled(sb) +# endif #endif static inline int diff --git a/lustre/ldlm/ldlm_lockd.c b/lustre/ldlm/ldlm_lockd.c index 6a6eabc..bb51369 100644 --- a/lustre/ldlm/ldlm_lockd.c +++ b/lustre/ldlm/ldlm_lockd.c @@ -2854,13 +2854,13 @@ int ldlm_init(void) if (ldlm_resource_slab == NULL) return -ENOMEM; - ldlm_lock_slab = cfs_mem_cache_create("ldlm_locks", - sizeof(struct ldlm_lock), 0, - CFS_SLAB_HWCACHE_ALIGN | CFS_SLAB_DESTROY_BY_RCU); - if (ldlm_lock_slab == NULL) { - cfs_mem_cache_destroy(ldlm_resource_slab); - return -ENOMEM; - } + ldlm_lock_slab = cfs_mem_cache_create("ldlm_locks", + sizeof(struct ldlm_lock), 0, + CFS_SLAB_HWCACHE_ALIGN | SLAB_DESTROY_BY_RCU); + if (ldlm_lock_slab == NULL) { + cfs_mem_cache_destroy(ldlm_resource_slab); + return -ENOMEM; + } ldlm_interval_slab = cfs_mem_cache_create("interval_node", sizeof(struct ldlm_interval), diff --git a/lustre/lvfs/fsfilt_ext3.c b/lustre/lvfs/fsfilt_ext3.c index ca12f9a..b1aa6c3 100644 --- a/lustre/lvfs/fsfilt_ext3.c +++ b/lustre/lvfs/fsfilt_ext3.c @@ -406,11 +406,11 @@ static int fsfilt_ext3_credits_needed(int objcount, struct fsfilt_objinfo *fso, needed += EXT3_DATA_TRANS_BLOCKS(sb); #if defined(CONFIG_QUOTA) - /* We assume that there will be 1 bit set in s_dquot.flags for each - * quota file that is active. This is at least true for now. - */ - needed += hweight32(ll_sb_any_quota_active(sb)) * - FSFILT_SINGLEDATA_TRANS_BLOCKS(sb); + /* We assume that there will be 1 bit set in s_dquot.flags for each + * quota file that is active. This is at least true for now. + */ + needed += hweight32(sb_any_quota_loaded(sb)) * + FSFILT_SINGLEDATA_TRANS_BLOCKS(sb); #endif return needed; diff --git a/lustre/quota/quota_context.c b/lustre/quota/quota_context.c index 05ba43a..9f67b0c 100644 --- a/lustre/quota/quota_context.c +++ b/lustre/quota/quota_context.c @@ -244,7 +244,7 @@ check_cur_qunit(struct obd_device *obd, int ret = 0; ENTRY; - if (!ll_sb_has_quota_active(sb, QDATA_IS_GRP(qdata))) + if (!sb_has_quota_active(sb, QDATA_IS_GRP(qdata))) RETURN(0); cfs_spin_lock(&qctxt->lqc_lock); @@ -1517,7 +1517,7 @@ static int qslave_recovery_main(void *arg) int ret; mutex_lock(&dqopt->dqonoff_mutex); - if (!ll_sb_has_quota_active(qctxt->lqc_sb, type)) { + if (!sb_has_quota_active(qctxt->lqc_sb, type)) { mutex_unlock(&dqopt->dqonoff_mutex); break; } @@ -1576,8 +1576,8 @@ qslave_start_recovery(struct obd_device *obd, struct lustre_quota_ctxt *qctxt) int rc; ENTRY; - if (!ll_sb_any_quota_active(qctxt->lqc_sb)) - goto exit; + if (!sb_any_quota_loaded(qctxt->lqc_sb)) + goto exit; data.obd = obd; data.qctxt = qctxt; diff --git a/lustre/quota/quota_interface.c b/lustre/quota/quota_interface.c index 53d450c..abb258e 100644 --- a/lustre/quota/quota_interface.c +++ b/lustre/quota/quota_interface.c @@ -158,8 +158,8 @@ static int filter_quota_enforce(struct obd_device *obd, unsigned int ignore) { ENTRY; - if (!ll_sb_any_quota_active(obd->u.obt.obt_sb)) - RETURN(0); + if (!sb_any_quota_loaded(obd->u.obt.obt_sb)) + RETURN(0); if (ignore) { CDEBUG(D_QUOTA, "blocks will be written with ignoring quota.\n"); @@ -180,8 +180,8 @@ static int filter_quota_getflag(struct obd_device *obd, struct obdo *oa) struct obd_quotactl *oqctl; ENTRY; - if (!ll_sb_any_quota_active(obt->obt_sb)) - RETURN(0); + if (!sb_any_quota_loaded(obt->obt_sb)) + RETURN(0); OBD_ALLOC_PTR(oqctl); if (!oqctl) @@ -195,7 +195,7 @@ static int filter_quota_getflag(struct obd_device *obd, struct obdo *oa) struct lustre_qunit_size *lqs = NULL; /* check if quota is enabled */ - if (!ll_sb_has_quota_active(obt->obt_sb, cnt)) + if (!sb_has_quota_active(obt->obt_sb, cnt)) continue; lqs = quota_search_lqs(LQS_KEY(cnt, GET_OA_ID(cnt, oa)), @@ -293,7 +293,7 @@ static int quota_check_common(struct obd_device *obd, const unsigned int id[], qdata[i].qd_count = 0; /* check if quota is enabled */ - if (!ll_sb_has_quota_active(qctxt->lqc_sb, i)) + if (!sb_has_quota_active(qctxt->lqc_sb, i)) continue; /* ignore root user */ @@ -399,12 +399,12 @@ int quota_is_set(struct obd_device *obd, const unsigned int id[], int flag) struct lustre_qunit_size *lqs; int i, q_set = 0; - if (!ll_sb_any_quota_active(obd->u.obt.obt_qctxt.lqc_sb)) - RETURN(0); + if (!sb_any_quota_loaded(obd->u.obt.obt_qctxt.lqc_sb)) + RETURN(0); for (i = 0; i < MAXQUOTAS; i++) { /* check if quota is enabled */ - if (!ll_sb_has_quota_active(obd->u.obt.obt_qctxt.lqc_sb, i)) + if (!sb_has_quota_active(obd->u.obt.obt_qctxt.lqc_sb, i)) continue; lqs = quota_search_lqs(LQS_KEY(i, id[i]), &obd->u.obt.obt_qctxt, 0); @@ -571,10 +571,10 @@ static int quota_pending_commit(struct obd_device *obd, const unsigned int id[], struct qunit_data qdata[MAXQUOTAS]; ENTRY; - CDEBUG(D_QUOTA, "commit pending quota for %s\n", obd->obd_name); - CLASSERT(MAXQUOTAS < 4); - if (!ll_sb_any_quota_active(qctxt->lqc_sb)) - RETURN(0); + CDEBUG(D_QUOTA, "commit pending quota for %s\n", obd->obd_name); + CLASSERT(MAXQUOTAS < 4); + if (!sb_any_quota_loaded(qctxt->lqc_sb)) + RETURN(0); cfs_gettimeofday(&work_start); for (i = 0; i < MAXQUOTAS; i++) { diff --git a/lustre/quota/quota_master.c b/lustre/quota/quota_master.c index efd323d..59adaa5 100644 --- a/lustre/quota/quota_master.c +++ b/lustre/quota/quota_master.c @@ -368,8 +368,8 @@ int dqacq_handler(struct obd_device *obd, struct qunit_data *qdata, int opc) if (OBD_FAIL_CHECK(OBD_FAIL_OBD_DQACQ)) RETURN(-EIO); - if (!ll_sb_has_quota_active(qctxt->lqc_sb, - QDATA_IS_GRP(qdata) ? GRPQUOTA : USRQUOTA)) + if (!sb_has_quota_active(qctxt->lqc_sb, + QDATA_IS_GRP(qdata) ? GRPQUOTA : USRQUOTA)) RETURN(-EIO); lqs = quota_search_lqs(LQS_KEY(QDATA_IS_GRP(qdata), qdata->qd_id), @@ -1736,8 +1736,8 @@ int mds_quota_recovery(struct obd_device *obd) int rc = 0; ENTRY; - if (!ll_sb_any_quota_active(obd->u.obt.obt_qctxt.lqc_sb)) - RETURN(0); + if (!sb_any_quota_loaded(obd->u.obt.obt_qctxt.lqc_sb)) + RETURN(0); if (unlikely(!mds->mds_quota || obd->obd_stopping)) RETURN(rc);