aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/quota/xfs_qm.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@sgi.com>2005-11-01 23:01:12 -0500
committerNathan Scott <nathans@sgi.com>2005-11-01 23:01:12 -0500
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 a545d3e142f6..79aadb1c1f44 100644
--- a/fs/xfs/quota/xfs_qm.c
+++ b/fs/xfs/quota/xfs_qm.c
@@ -91,10 +91,10 @@ extern mutex_t qcheck_lock;
91 for (dqp = (l)->qh_next; dqp != NULL; dqp = dqp->NXT) { \ 91 for (dqp = (l)->qh_next; dqp != NULL; dqp = dqp->NXT) { \
92 cmn_err(CE_DEBUG, " %d. \"%d (%s)\" " \ 92 cmn_err(CE_DEBUG, " %d. \"%d (%s)\" " \
93 "bcnt = %d, icnt = %d, refs = %d", \ 93 "bcnt = %d, icnt = %d, refs = %d", \
94 ++i, (int) INT_GET(dqp->q_core.d_id, ARCH_CONVERT), \ 94 ++i, (int) be32_to_cpu(dqp->q_core.d_id), \
95 DQFLAGTO_TYPESTR(dqp), \ 95 DQFLAGTO_TYPESTR(dqp), \
96 (int) INT_GET(dqp->q_core.d_bcount, ARCH_CONVERT), \ 96 (int) be64_to_cpu(dqp->q_core.d_bcount), \
97 (int) INT_GET(dqp->q_core.d_icount, ARCH_CONVERT), \ 97 (int) be64_to_cpu(dqp->q_core.d_icount), \
98 (int) dqp->q_nrefs); } \ 98 (int) dqp->q_nrefs); } \
99} 99}
100#else 100#else
@@ -727,7 +727,7 @@ xfs_qm_dqattach_one(
727 */ 727 */
728 if (udqhint && 728 if (udqhint &&
729 (dqp = udqhint->q_gdquot) && 729 (dqp = udqhint->q_gdquot) &&
730 (INT_GET(dqp->q_core.d_id, ARCH_CONVERT) == id)) { 730 (be32_to_cpu(dqp->q_core.d_id) == id)) {
731 ASSERT(XFS_DQ_IS_LOCKED(udqhint)); 731 ASSERT(XFS_DQ_IS_LOCKED(udqhint));
732 xfs_dqlock(dqp); 732 xfs_dqlock(dqp);
733 XFS_DQHOLD(dqp); 733 XFS_DQHOLD(dqp);
@@ -1197,42 +1197,24 @@ xfs_qm_init_quotainfo(
1197 * a user or group before he or she can not perform any 1197 * a user or group before he or she can not perform any
1198 * more writing. If it is zero, a default is used. 1198 * more writing. If it is zero, a default is used.
1199 */ 1199 */
1200 qinf->qi_btimelimit = 1200 qinf->qi_btimelimit = ddqp->d_btimer ?
1201 INT_GET(ddqp->d_btimer, ARCH_CONVERT) ? 1201 be32_to_cpu(ddqp->d_btimer) : XFS_QM_BTIMELIMIT;
1202 INT_GET(ddqp->d_btimer, ARCH_CONVERT) : 1202 qinf->qi_itimelimit = ddqp->d_itimer ?
1203 XFS_QM_BTIMELIMIT; 1203 be32_to_cpu(ddqp->d_itimer) : XFS_QM_ITIMELIMIT;
1204 qinf->qi_itimelimit = 1204 qinf->qi_rtbtimelimit = ddqp->d_rtbtimer ?
1205 INT_GET(ddqp->d_itimer, ARCH_CONVERT) ? 1205 be32_to_cpu(ddqp->d_rtbtimer) : XFS_QM_RTBTIMELIMIT;
1206 INT_GET(ddqp->d_itimer, ARCH_CONVERT) : 1206 qinf->qi_bwarnlimit = ddqp->d_bwarns ?
1207 XFS_QM_ITIMELIMIT; 1207 be16_to_cpu(ddqp->d_bwarns) : XFS_QM_BWARNLIMIT;
1208 qinf->qi_rtbtimelimit = 1208 qinf->qi_iwarnlimit = ddqp->d_iwarns ?
1209 INT_GET(ddqp->d_rtbtimer, ARCH_CONVERT) ? 1209 be16_to_cpu(ddqp->d_iwarns) : XFS_QM_IWARNLIMIT;
1210 INT_GET(ddqp->d_rtbtimer, ARCH_CONVERT) : 1210 qinf->qi_rtbwarnlimit = ddqp->d_rtbwarns ?
1211 XFS_QM_RTBTIMELIMIT; 1211 be16_to_cpu(ddqp->d_rtbwarns) : XFS_QM_RTBWARNLIMIT;
1212 qinf->qi_bwarnlimit = 1212 qinf->qi_bhardlimit = be64_to_cpu(ddqp->d_blk_hardlimit);
1213 INT_GET(ddqp->d_bwarns, ARCH_CONVERT) ? 1213 qinf->qi_bsoftlimit = be64_to_cpu(ddqp->d_blk_softlimit);
1214 INT_GET(ddqp->d_bwarns, ARCH_CONVERT) : 1214 qinf->qi_ihardlimit = be64_to_cpu(ddqp->d_ino_hardlimit);
1215 XFS_QM_BWARNLIMIT; 1215 qinf->qi_isoftlimit = be64_to_cpu(ddqp->d_ino_softlimit);
1216 qinf->qi_iwarnlimit = 1216 qinf->qi_rtbhardlimit = be64_to_cpu(ddqp->d_rtb_hardlimit);
1217 INT_GET(ddqp->d_iwarns, ARCH_CONVERT) ? 1217 qinf->qi_rtbsoftlimit = be64_to_cpu(ddqp->d_rtb_softlimit);
1218 INT_GET(ddqp->d_iwarns, ARCH_CONVERT) :
1219 XFS_QM_IWARNLIMIT;
1220 qinf->qi_rtbwarnlimit =
1221 INT_GET(ddqp->d_rtbwarns, ARCH_CONVERT) ?
1222 INT_GET(ddqp->d_rtbwarns, ARCH_CONVERT) :
1223 XFS_QM_RTBWARNLIMIT;
1224 qinf->qi_bhardlimit =
1225 INT_GET(ddqp->d_blk_hardlimit, ARCH_CONVERT);
1226 qinf->qi_bsoftlimit =
1227 INT_GET(ddqp->d_blk_softlimit, ARCH_CONVERT);
1228 qinf->qi_ihardlimit =
1229 INT_GET(ddqp->d_ino_hardlimit, ARCH_CONVERT);
1230 qinf->qi_isoftlimit =
1231 INT_GET(ddqp->d_ino_softlimit, ARCH_CONVERT);
1232 qinf->qi_rtbhardlimit =
1233 INT_GET(ddqp->d_rtb_hardlimit, ARCH_CONVERT);
1234 qinf->qi_rtbsoftlimit =
1235 INT_GET(ddqp->d_rtb_softlimit, ARCH_CONVERT);
1236 1218
1237 /* 1219 /*
1238 * We sent the XFS_QMOPT_DQSUSER flag to dqget because 1220 * We sent the XFS_QMOPT_DQSUSER flag to dqget because
@@ -1511,15 +1493,15 @@ xfs_qm_reset_dqcounts(
1511 */ 1493 */
1512 (void) xfs_qm_dqcheck(ddq, id+j, type, XFS_QMOPT_DQREPAIR, 1494 (void) xfs_qm_dqcheck(ddq, id+j, type, XFS_QMOPT_DQREPAIR,
1513 "xfs_quotacheck"); 1495 "xfs_quotacheck");
1514 INT_SET(ddq->d_bcount, ARCH_CONVERT, 0ULL); 1496 ddq->d_bcount = 0;
1515 INT_SET(ddq->d_icount, ARCH_CONVERT, 0ULL); 1497 ddq->d_icount = 0;
1516 INT_SET(ddq->d_rtbcount, ARCH_CONVERT, 0ULL); 1498 ddq->d_rtbcount = 0;
1517 INT_SET(ddq->d_btimer, ARCH_CONVERT, (time_t)0); 1499 ddq->d_btimer = 0;
1518 INT_SET(ddq->d_itimer, ARCH_CONVERT, (time_t)0); 1500 ddq->d_itimer = 0;
1519 INT_SET(ddq->d_rtbtimer, ARCH_CONVERT, (time_t)0); 1501 ddq->d_rtbtimer = 0;
1520 INT_SET(ddq->d_bwarns, ARCH_CONVERT, 0UL); 1502 ddq->d_bwarns = 0;
1521 INT_SET(ddq->d_iwarns, ARCH_CONVERT, 0UL); 1503 ddq->d_iwarns = 0;
1522 INT_SET(ddq->d_rtbwarns, ARCH_CONVERT, 0UL); 1504 ddq->d_rtbwarns = 0;
1523 ddq = (xfs_disk_dquot_t *) ((xfs_dqblk_t *)ddq + 1); 1505 ddq = (xfs_disk_dquot_t *) ((xfs_dqblk_t *)ddq + 1);
1524 } 1506 }
1525 1507
@@ -1692,14 +1674,14 @@ xfs_qm_quotacheck_dqadjust(
1692 * Adjust the inode count and the block count to reflect this inode's 1674 * Adjust the inode count and the block count to reflect this inode's
1693 * resource usage. 1675 * resource usage.
1694 */ 1676 */
1695 INT_MOD(dqp->q_core.d_icount, ARCH_CONVERT, +1); 1677 be64_add(&dqp->q_core.d_icount, 1);
1696 dqp->q_res_icount++; 1678 dqp->q_res_icount++;
1697 if (nblks) { 1679 if (nblks) {
1698 INT_MOD(dqp->q_core.d_bcount, ARCH_CONVERT, nblks); 1680 be64_add(&dqp->q_core.d_bcount, nblks);
1699 dqp->q_res_bcount += nblks; 1681 dqp->q_res_bcount += nblks;
1700 } 1682 }
1701 if (rtblks) { 1683 if (rtblks) {
1702 INT_MOD(dqp->q_core.d_rtbcount, ARCH_CONVERT, rtblks); 1684 be64_add(&dqp->q_core.d_rtbcount, rtblks);
1703 dqp->q_res_rtbcount += rtblks; 1685 dqp->q_res_rtbcount += rtblks;
1704 } 1686 }
1705 1687
@@ -2186,7 +2168,7 @@ xfs_qm_shake_freelist(
2186 xfs_dqtrace_entry(dqp, "DQSHAKE: UNLINKING"); 2168 xfs_dqtrace_entry(dqp, "DQSHAKE: UNLINKING");
2187#ifdef QUOTADEBUG 2169#ifdef QUOTADEBUG
2188 cmn_err(CE_DEBUG, "Shake 0x%p, ID 0x%x\n", 2170 cmn_err(CE_DEBUG, "Shake 0x%p, ID 0x%x\n",
2189 dqp, INT_GET(dqp->q_core.d_id, ARCH_CONVERT)); 2171 dqp, be32_to_cpu(dqp->q_core.d_id));
2190#endif 2172#endif
2191 ASSERT(dqp->q_nrefs == 0); 2173 ASSERT(dqp->q_nrefs == 0);
2192 nextdqp = dqp->dq_flnext; 2174 nextdqp = dqp->dq_flnext;
@@ -2654,7 +2636,7 @@ xfs_qm_vop_chown_reserve(
2654 XFS_QMOPT_RES_RTBLKS : XFS_QMOPT_RES_REGBLKS; 2636 XFS_QMOPT_RES_RTBLKS : XFS_QMOPT_RES_REGBLKS;
2655 2637
2656 if (XFS_IS_UQUOTA_ON(mp) && udqp && 2638 if (XFS_IS_UQUOTA_ON(mp) && udqp &&
2657 ip->i_d.di_uid != (uid_t)INT_GET(udqp->q_core.d_id, ARCH_CONVERT)) { 2639 ip->i_d.di_uid != (uid_t)be32_to_cpu(udqp->q_core.d_id)) {
2658 delblksudq = udqp; 2640 delblksudq = udqp;
2659 /* 2641 /*
2660 * If there are delayed allocation blocks, then we have to 2642 * If there are delayed allocation blocks, then we have to
@@ -2667,10 +2649,10 @@ xfs_qm_vop_chown_reserve(
2667 } 2649 }
2668 } 2650 }
2669 if (XFS_IS_OQUOTA_ON(ip->i_mount) && gdqp) { 2651 if (XFS_IS_OQUOTA_ON(ip->i_mount) && gdqp) {
2670 if ((XFS_IS_GQUOTA_ON(ip->i_mount) && ip->i_d.di_gid != 2652 if ((XFS_IS_GQUOTA_ON(ip->i_mount) &&
2671 INT_GET(gdqp->q_core.d_id, ARCH_CONVERT)) || 2653 ip->i_d.di_gid != be32_to_cpu(gdqp->q_core.d_id)) ||
2672 (XFS_IS_PQUOTA_ON(ip->i_mount) && ip->i_d.di_projid != 2654 (XFS_IS_PQUOTA_ON(ip->i_mount) &&
2673 INT_GET(gdqp->q_core.d_id, ARCH_CONVERT))) { 2655 ip->i_d.di_projid != be32_to_cpu(gdqp->q_core.d_id))) {
2674 delblksgdq = gdqp; 2656 delblksgdq = gdqp;
2675 if (delblks) { 2657 if (delblks) {
2676 ASSERT(ip->i_gdquot); 2658 ASSERT(ip->i_gdquot);
@@ -2760,7 +2742,7 @@ xfs_qm_vop_dqattach_and_dqmod_newinode(
2760 xfs_dqunlock(udqp); 2742 xfs_dqunlock(udqp);
2761 ASSERT(ip->i_udquot == NULL); 2743 ASSERT(ip->i_udquot == NULL);
2762 ip->i_udquot = udqp; 2744 ip->i_udquot = udqp;
2763 ASSERT(ip->i_d.di_uid == INT_GET(udqp->q_core.d_id, ARCH_CONVERT)); 2745 ASSERT(ip->i_d.di_uid == be32_to_cpu(udqp->q_core.d_id));
2764 xfs_trans_mod_dquot(tp, udqp, XFS_TRANS_DQ_ICOUNT, 1); 2746 xfs_trans_mod_dquot(tp, udqp, XFS_TRANS_DQ_ICOUNT, 1);
2765 } 2747 }
2766 if (gdqp) { 2748 if (gdqp) {
@@ -2769,7 +2751,7 @@ xfs_qm_vop_dqattach_and_dqmod_newinode(
2769 xfs_dqunlock(gdqp); 2751 xfs_dqunlock(gdqp);
2770 ASSERT(ip->i_gdquot == NULL); 2752 ASSERT(ip->i_gdquot == NULL);
2771 ip->i_gdquot = gdqp; 2753 ip->i_gdquot = gdqp;
2772 ASSERT(ip->i_d.di_gid == INT_GET(gdqp->q_core.d_id, ARCH_CONVERT)); 2754 ASSERT(ip->i_d.di_gid == be32_to_cpu(gdqp->q_core.d_id));
2773 xfs_trans_mod_dquot(tp, gdqp, XFS_TRANS_DQ_ICOUNT, 1); 2755 xfs_trans_mod_dquot(tp, gdqp, XFS_TRANS_DQ_ICOUNT, 1);
2774 } 2756 }
2775} 2757}