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 <tao.peng@emc.com>
Change-Id: Ic52e1a75f3d71887ae91f03a465112ab6c08c746
Reviewed-on: http://review.whamcloud.com/3688
Tested-by: Hudson
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Niu Yawei <niu@whamcloud.com>
Reviewed-by: Yang Sheng <ys@whamcloud.com>
} cfs_mem_cache_t;
#define CFS_SLAB_HWCACHE_ALIGN 0
} 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
#define CFS_SLAB_KERNEL 0
#define CFS_SLAB_NOFS 0
-# 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 <linux/fs.h>
-],[
- 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])
# 2.6.27 have new page locking API
AC_DEFUN([LC_TRYLOCKPAGE],
[AC_MSG_CHECKING([kernel uses trylock_page for page lock])
LC_PGMKWRITE_USE_VMFAULT
LC_PGMKWRITE_COMPACT
LC_INODE_PERMISION_2ARGS
LC_PGMKWRITE_USE_VMFAULT
LC_PGMKWRITE_COMPACT
LC_INODE_PERMISION_2ARGS
LC_TRYLOCKPAGE
LC_READ_INODE_IN_SBOPS
LC_EXPORT_INODE_PERMISSION
LC_TRYLOCKPAGE
LC_READ_INODE_IN_SBOPS
LC_EXPORT_INODE_PERMISSION
#define ll_crypto_tfm_alg_max_keysize crypto_tfm_alg_max_keysize
#endif /* HAVE_ASYNC_BLOCK_CIPHER */
#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)
#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)
#define cfs_path_put(nd) path_release(nd)
#endif
#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
#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
-#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)
-#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
if (ldlm_resource_slab == NULL)
return -ENOMEM;
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),
ldlm_interval_slab = cfs_mem_cache_create("interval_node",
sizeof(struct ldlm_interval),
needed += EXT3_DATA_TRANS_BLOCKS(sb);
#if defined(CONFIG_QUOTA)
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);
- 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);
RETURN(0);
cfs_spin_lock(&qctxt->lqc_lock);
int ret;
mutex_lock(&dqopt->dqonoff_mutex);
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;
}
mutex_unlock(&dqopt->dqonoff_mutex);
break;
}
- 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;
data.obd = obd;
data.qctxt = qctxt;
- 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");
if (ignore) {
CDEBUG(D_QUOTA, "blocks will be written with ignoring quota.\n");
struct obd_quotactl *oqctl;
ENTRY;
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)
OBD_ALLOC_PTR(oqctl);
if (!oqctl)
struct lustre_qunit_size *lqs = NULL;
/* check if quota is enabled */
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)),
continue;
lqs = quota_search_lqs(LQS_KEY(cnt, GET_OA_ID(cnt, oa)),
qdata[i].qd_count = 0;
/* check if quota is enabled */
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 */
continue;
/* ignore root user */
struct lustre_qunit_size *lqs;
int i, q_set = 0;
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 */
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);
continue;
lqs = quota_search_lqs(LQS_KEY(i, id[i]),
&obd->u.obt.obt_qctxt, 0);
struct qunit_data qdata[MAXQUOTAS];
ENTRY;
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++) {
cfs_gettimeofday(&work_start);
for (i = 0; i < MAXQUOTAS; i++) {
if (OBD_FAIL_CHECK(OBD_FAIL_OBD_DQACQ))
RETURN(-EIO);
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),
RETURN(-EIO);
lqs = quota_search_lqs(LQS_KEY(QDATA_IS_GRP(qdata), qdata->qd_id),
- 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);
if (unlikely(!mds->mds_quota || obd->obd_stopping))
RETURN(rc);