aboutsummaryrefslogtreecommitdiff
path: root/fs/xfs/quota/xfs_qm.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@sgi.com>2005-11-02 15:01:12 +1100
committerNathan Scott <nathans@sgi.com>2005-11-02 15:01:12 +1100
commit1149d96ae825a1e1e9d66774175372c003f29caf (patch)
treebfc8b5c03a39283228922e711fd2675bd281db50 /fs/xfs/quota/xfs_qm.c
parentfa7e7d71e05f12921fefdc23386183578d3ed8c7 (diff)
[XFS] endianess annotations and cleanup for the quota code
SGI-PV: 943272 SGI-Modid: xfs-linux:xfs-kern:199767a Signed-off-by: Christoph Hellwig <hch@sgi.com> Signed-off-by: Nathan Scott <nathans@sgi.com>
Diffstat (limited to 'fs/xfs/quota/xfs_qm.c')
-rw-r--r--fs/xfs/quota/xfs_qm.c102
1 files changed, 42 insertions, 60 deletions
diff --git a/fs/xfs/quota/xfs_qm.c b/fs/xfs/quota/xfs_qm.c
index a545d3e142f..79aadb1c1f4 100644
--- a/fs/xfs/quota/xfs_qm.c
+++ b/fs/xfs/quota/xfs_qm.c
@@ -91,10 +91,10 @@ extern mutex_t qcheck_lock;
for (dqp = (l)->qh_next; dqp != NULL; dqp = dqp->NXT) { \
cmn_err(CE_DEBUG, " %d. \"%d (%s)\" " \
"bcnt = %d, icnt = %d, refs = %d", \
- ++i, (int) INT_GET(dqp->q_core.d_id, ARCH_CONVERT), \
+ ++i, (int) be32_to_cpu(dqp->q_core.d_id), \
DQFLAGTO_TYPESTR(dqp), \
- (int) INT_GET(dqp->q_core.d_bcount, ARCH_CONVERT), \
- (int) INT_GET(dqp->q_core.d_icount, ARCH_CONVERT), \
+ (int) be64_to_cpu(dqp->q_core.d_bcount), \
+ (int) be64_to_cpu(dqp->q_core.d_icount), \
(int) dqp->q_nrefs); } \
}
#else
@@ -727,7 +727,7 @@ xfs_qm_dqattach_one(
*/
if (udqhint &&
(dqp = udqhint->q_gdquot) &&
- (INT_GET(dqp->q_core.d_id, ARCH_CONVERT) == id)) {
+ (be32_to_cpu(dqp->q_core.d_id) == id)) {
ASSERT(XFS_DQ_IS_LOCKED(udqhint));
xfs_dqlock(dqp);
XFS_DQHOLD(dqp);
@@ -1197,42 +1197,24 @@ xfs_qm_init_quotainfo(
* a user or group before he or she can not perform any
* more writing. If it is zero, a default is used.
*/
- qinf->qi_btimelimit =
- INT_GET(ddqp->d_btimer, ARCH_CONVERT) ?
- INT_GET(ddqp->d_btimer, ARCH_CONVERT) :
- XFS_QM_BTIMELIMIT;
- qinf->qi_itimelimit =
- INT_GET(ddqp->d_itimer, ARCH_CONVERT) ?
- INT_GET(ddqp->d_itimer, ARCH_CONVERT) :
- XFS_QM_ITIMELIMIT;
- qinf->qi_rtbtimelimit =
- INT_GET(ddqp->d_rtbtimer, ARCH_CONVERT) ?
- INT_GET(ddqp->d_rtbtimer, ARCH_CONVERT) :
- XFS_QM_RTBTIMELIMIT;
- qinf->qi_bwarnlimit =
- INT_GET(ddqp->d_bwarns, ARCH_CONVERT) ?
- INT_GET(ddqp->d_bwarns, ARCH_CONVERT) :
- XFS_QM_BWARNLIMIT;
- qinf->qi_iwarnlimit =
- INT_GET(ddqp->d_iwarns, ARCH_CONVERT) ?
- INT_GET(ddqp->d_iwarns, ARCH_CONVERT) :
- XFS_QM_IWARNLIMIT;
- qinf->qi_rtbwarnlimit =
- INT_GET(ddqp->d_rtbwarns, ARCH_CONVERT) ?
- INT_GET(ddqp->d_rtbwarns, ARCH_CONVERT) :
- XFS_QM_RTBWARNLIMIT;
- qinf->qi_bhardlimit =
- INT_GET(ddqp->d_blk_hardlimit, ARCH_CONVERT);
- qinf->qi_bsoftlimit =
- INT_GET(ddqp->d_blk_softlimit, ARCH_CONVERT);
- qinf->qi_ihardlimit =
- INT_GET(ddqp->d_ino_hardlimit, ARCH_CONVERT);
- qinf->qi_isoftlimit =
- INT_GET(ddqp->d_ino_softlimit, ARCH_CONVERT);
- qinf->qi_rtbhardlimit =
- INT_GET(ddqp->d_rtb_hardlimit, ARCH_CONVERT);
- qinf->qi_rtbsoftlimit =
- INT_GET(ddqp->d_rtb_softlimit, ARCH_CONVERT);
+ qinf->qi_btimelimit = ddqp->d_btimer ?
+ be32_to_cpu(ddqp->d_btimer) : XFS_QM_BTIMELIMIT;
+ qinf->qi_itimelimit = ddqp->d_itimer ?
+ be32_to_cpu(ddqp->d_itimer) : XFS_QM_ITIMELIMIT;
+ qinf->qi_rtbtimelimit = ddqp->d_rtbtimer ?
+ be32_to_cpu(ddqp->d_rtbtimer) : XFS_QM_RTBTIMELIMIT;
+ qinf->qi_bwarnlimit = ddqp->d_bwarns ?
+ be16_to_cpu(ddqp->d_bwarns) : XFS_QM_BWARNLIMIT;
+ qinf->qi_iwarnlimit = ddqp->d_iwarns ?
+ be16_to_cpu(ddqp->d_iwarns) : XFS_QM_IWARNLIMIT;
+ qinf->qi_rtbwarnlimit = ddqp->d_rtbwarns ?
+ be16_to_cpu(ddqp->d_rtbwarns) : XFS_QM_RTBWARNLIMIT;
+ qinf->qi_bhardlimit = be64_to_cpu(ddqp->d_blk_hardlimit);
+ qinf->qi_bsoftlimit = be64_to_cpu(ddqp->d_blk_softlimit);
+ qinf->qi_ihardlimit = be64_to_cpu(ddqp->d_ino_hardlimit);
+ qinf->qi_isoftlimit = be64_to_cpu(ddqp->d_ino_softlimit);
+ qinf->qi_rtbhardlimit = be64_to_cpu(ddqp->d_rtb_hardlimit);
+ qinf->qi_rtbsoftlimit = be64_to_cpu(ddqp->d_rtb_softlimit);
/*
* We sent the XFS_QMOPT_DQSUSER flag to dqget because
@@ -1511,15 +1493,15 @@ xfs_qm_reset_dqcounts(
*/
(void) xfs_qm_dqcheck(ddq, id+j, type, XFS_QMOPT_DQREPAIR,
"xfs_quotacheck");
- INT_SET(ddq->d_bcount, ARCH_CONVERT, 0ULL);
- INT_SET(ddq->d_icount, ARCH_CONVERT, 0ULL);
- INT_SET(ddq->d_rtbcount, ARCH_CONVERT, 0ULL);
- INT_SET(ddq->d_btimer, ARCH_CONVERT, (time_t)0);
- INT_SET(ddq->d_itimer, ARCH_CONVERT, (time_t)0);
- INT_SET(ddq->d_rtbtimer, ARCH_CONVERT, (time_t)0);
- INT_SET(ddq->d_bwarns, ARCH_CONVERT, 0UL);
- INT_SET(ddq->d_iwarns, ARCH_CONVERT, 0UL);
- INT_SET(ddq->d_rtbwarns, ARCH_CONVERT, 0UL);
+ ddq->d_bcount = 0;
+ ddq->d_icount = 0;
+ ddq->d_rtbcount = 0;
+ ddq->d_btimer = 0;
+ ddq->d_itimer = 0;
+ ddq->d_rtbtimer = 0;
+ ddq->d_bwarns = 0;
+ ddq->d_iwarns = 0;
+ ddq->d_rtbwarns = 0;
ddq = (xfs_disk_dquot_t *) ((xfs_dqblk_t *)ddq + 1);
}
@@ -1692,14 +1674,14 @@ xfs_qm_quotacheck_dqadjust(
* Adjust the inode count and the block count to reflect this inode's
* resource usage.
*/
- INT_MOD(dqp->q_core.d_icount, ARCH_CONVERT, +1);
+ be64_add(&dqp->q_core.d_icount, 1);
dqp->q_res_icount++;
if (nblks) {
- INT_MOD(dqp->q_core.d_bcount, ARCH_CONVERT, nblks);
+ be64_add(&dqp->q_core.d_bcount, nblks);
dqp->q_res_bcount += nblks;
}
if (rtblks) {
- INT_MOD(dqp->q_core.d_rtbcount, ARCH_CONVERT, rtblks);
+ be64_add(&dqp->q_core.d_rtbcount, rtblks);
dqp->q_res_rtbcount += rtblks;
}
@@ -2186,7 +2168,7 @@ xfs_qm_shake_freelist(
xfs_dqtrace_entry(dqp, "DQSHAKE: UNLINKING");
#ifdef QUOTADEBUG
cmn_err(CE_DEBUG, "Shake 0x%p, ID 0x%x\n",
- dqp, INT_GET(dqp->q_core.d_id, ARCH_CONVERT));
+ dqp, be32_to_cpu(dqp->q_core.d_id));
#endif
ASSERT(dqp->q_nrefs == 0);
nextdqp = dqp->dq_flnext;
@@ -2654,7 +2636,7 @@ xfs_qm_vop_chown_reserve(
XFS_QMOPT_RES_RTBLKS : XFS_QMOPT_RES_REGBLKS;
if (XFS_IS_UQUOTA_ON(mp) && udqp &&
- ip->i_d.di_uid != (uid_t)INT_GET(udqp->q_core.d_id, ARCH_CONVERT)) {
+ ip->i_d.di_uid != (uid_t)be32_to_cpu(udqp->q_core.d_id)) {
delblksudq = udqp;
/*
* If there are delayed allocation blocks, then we have to
@@ -2667,10 +2649,10 @@ xfs_qm_vop_chown_reserve(
}
}
if (XFS_IS_OQUOTA_ON(ip->i_mount) && gdqp) {
- if ((XFS_IS_GQUOTA_ON(ip->i_mount) && ip->i_d.di_gid !=
- INT_GET(gdqp->q_core.d_id, ARCH_CONVERT)) ||
- (XFS_IS_PQUOTA_ON(ip->i_mount) && ip->i_d.di_projid !=
- INT_GET(gdqp->q_core.d_id, ARCH_CONVERT))) {
+ if ((XFS_IS_GQUOTA_ON(ip->i_mount) &&
+ ip->i_d.di_gid != be32_to_cpu(gdqp->q_core.d_id)) ||
+ (XFS_IS_PQUOTA_ON(ip->i_mount) &&
+ ip->i_d.di_projid != be32_to_cpu(gdqp->q_core.d_id))) {
delblksgdq = gdqp;
if (delblks) {
ASSERT(ip->i_gdquot);
@@ -2760,7 +2742,7 @@ xfs_qm_vop_dqattach_and_dqmod_newinode(
xfs_dqunlock(udqp);
ASSERT(ip->i_udquot == NULL);
ip->i_udquot = udqp;
- ASSERT(ip->i_d.di_uid == INT_GET(udqp->q_core.d_id, ARCH_CONVERT));
+ ASSERT(ip->i_d.di_uid == be32_to_cpu(udqp->q_core.d_id));
xfs_trans_mod_dquot(tp, udqp, XFS_TRANS_DQ_ICOUNT, 1);
}
if (gdqp) {
@@ -2769,7 +2751,7 @@ xfs_qm_vop_dqattach_and_dqmod_newinode(
xfs_dqunlock(gdqp);
ASSERT(ip->i_gdquot == NULL);
ip->i_gdquot = gdqp;
- ASSERT(ip->i_d.di_gid == INT_GET(gdqp->q_core.d_id, ARCH_CONVERT));
+ ASSERT(ip->i_d.di_gid == be32_to_cpu(gdqp->q_core.d_id));
xfs_trans_mod_dquot(tp, gdqp, XFS_TRANS_DQ_ICOUNT, 1);
}
}