[XFS] endianess annotations and cleanup for the quota code
authorChristoph Hellwig <hch@sgi.com>
Wed, 2 Nov 2005 04:01:12 +0000 (15:01 +1100)
committerNathan Scott <nathans@sgi.com>
Wed, 2 Nov 2005 04:01:12 +0000 (15:01 +1100)
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>
fs/xfs/quota/xfs_dquot.c
fs/xfs/quota/xfs_dquot_item.c
fs/xfs/quota/xfs_qm.c
fs/xfs/quota/xfs_qm_syscalls.c
fs/xfs/quota/xfs_trans_dquot.c
fs/xfs/xfs_arch.h
fs/xfs/xfs_log_recover.c
fs/xfs/xfs_quota.h

index d3c23ac..00b5043 100644 (file)
@@ -96,7 +96,7 @@ xfs_qm_dqinit(
 
        brandnewdquot = xfs_qm_dqalloc_incore(&dqp);
        dqp->dq_flags = type;
-       INT_SET(dqp->q_core.d_id, ARCH_CONVERT, id);
+       dqp->q_core.d_id = cpu_to_be32(id);
        dqp->q_mount = mp;
 
        /*
@@ -178,10 +178,10 @@ xfs_qm_dqinit_core(
        /*
         * Caller has zero'd the entire dquot 'chunk' already.
         */
-       INT_SET(d->dd_diskdq.d_magic, ARCH_CONVERT, XFS_DQUOT_MAGIC);
-       INT_SET(d->dd_diskdq.d_version, ARCH_CONVERT, XFS_DQUOT_VERSION);
-       INT_SET(d->dd_diskdq.d_id, ARCH_CONVERT, id);
-       INT_SET(d->dd_diskdq.d_flags, ARCH_CONVERT, type);
+       d->dd_diskdq.d_magic = cpu_to_be16(XFS_DQUOT_MAGIC);
+       d->dd_diskdq.d_version = XFS_DQUOT_VERSION;
+       d->dd_diskdq.d_id = cpu_to_be32(id);
+       d->dd_diskdq.d_flags = type;
 }
 
 
@@ -211,19 +211,13 @@ __xfs_dqtrace_entry(
                     (void *)(__psint_t)dqp->q_nrefs,
                     (void *)(__psint_t)dqp->dq_flags,
                     (void *)(__psint_t)dqp->q_res_bcount,
-                    (void *)(__psint_t)INT_GET(dqp->q_core.d_bcount,
-                                               ARCH_CONVERT),
-                    (void *)(__psint_t)INT_GET(dqp->q_core.d_icount,
-                                               ARCH_CONVERT),
-                    (void *)(__psint_t)INT_GET(dqp->q_core.d_blk_hardlimit,
-                                               ARCH_CONVERT),
-                    (void *)(__psint_t)INT_GET(dqp->q_core.d_blk_softlimit,
-                                               ARCH_CONVERT),
-                    (void *)(__psint_t)INT_GET(dqp->q_core.d_ino_hardlimit,
-                                               ARCH_CONVERT),
-                    (void *)(__psint_t)INT_GET(dqp->q_core.d_ino_softlimit,
-                                               ARCH_CONVERT),
-                    (void *)(__psint_t)INT_GET(dqp->q_core.d_id, ARCH_CONVERT),
+                    (void *)(__psint_t)be64_to_cpu(dqp->q_core.d_bcount),
+                    (void *)(__psint_t)be64_to_cpu(dqp->q_core.d_icount),
+                    (void *)(__psint_t)be64_to_cpu(dqp->q_core.d_blk_hardlimit),
+                    (void *)(__psint_t)be64_to_cpu(dqp->q_core.d_blk_softlimit),
+                    (void *)(__psint_t)be64_to_cpu(dqp->q_core.d_ino_hardlimit),
+                    (void *)(__psint_t)be64_to_cpu(dqp->q_core.d_ino_softlimit),
+                    (void *)(__psint_t)be32_to_cpu(dqp->q_core.d_id),
                     (void *)(__psint_t)current_pid(),
                     (void *)(__psint_t)ino,
                     (void *)(__psint_t)retaddr,
@@ -248,17 +242,17 @@ xfs_qm_adjust_dqlimits(
        ASSERT(d->d_id);
 
        if (q->qi_bsoftlimit && !d->d_blk_softlimit)
-               INT_SET(d->d_blk_softlimit, ARCH_CONVERT, q->qi_bsoftlimit);
+               d->d_blk_softlimit = cpu_to_be64(q->qi_bsoftlimit);
        if (q->qi_bhardlimit && !d->d_blk_hardlimit)
-               INT_SET(d->d_blk_hardlimit, ARCH_CONVERT, q->qi_bhardlimit);
+               d->d_blk_hardlimit = cpu_to_be64(q->qi_bhardlimit);
        if (q->qi_isoftlimit && !d->d_ino_softlimit)
-               INT_SET(d->d_ino_softlimit, ARCH_CONVERT, q->qi_isoftlimit);
+               d->d_ino_softlimit = cpu_to_be64(q->qi_isoftlimit);
        if (q->qi_ihardlimit && !d->d_ino_hardlimit)
-               INT_SET(d->d_ino_hardlimit, ARCH_CONVERT, q->qi_ihardlimit);
+               d->d_ino_hardlimit = cpu_to_be64(q->qi_ihardlimit);
        if (q->qi_rtbsoftlimit && !d->d_rtb_softlimit)
-               INT_SET(d->d_rtb_softlimit, ARCH_CONVERT, q->qi_rtbsoftlimit);
+               d->d_rtb_softlimit = cpu_to_be64(q->qi_rtbsoftlimit);
        if (q->qi_rtbhardlimit && !d->d_rtb_hardlimit)
-               INT_SET(d->d_rtb_hardlimit, ARCH_CONVERT, q->qi_rtbhardlimit);
+               d->d_rtb_hardlimit = cpu_to_be64(q->qi_rtbhardlimit);
 }
 
 /*
@@ -282,81 +276,81 @@ xfs_qm_adjust_dqtimers(
        ASSERT(d->d_id);
 
 #ifdef QUOTADEBUG
-       if (INT_GET(d->d_blk_hardlimit, ARCH_CONVERT))
-               ASSERT(INT_GET(d->d_blk_softlimit, ARCH_CONVERT) <=
-                       INT_GET(d->d_blk_hardlimit, ARCH_CONVERT));
-       if (INT_GET(d->d_ino_hardlimit, ARCH_CONVERT))
-               ASSERT(INT_GET(d->d_ino_softlimit, ARCH_CONVERT) <=
-                       INT_GET(d->d_ino_hardlimit, ARCH_CONVERT));
-       if (INT_GET(d->d_rtb_hardlimit, ARCH_CONVERT))
-               ASSERT(INT_GET(d->d_rtb_softlimit, ARCH_CONVERT) <=
-                       INT_GET(d->d_rtb_hardlimit, ARCH_CONVERT));
+       if (d->d_blk_hardlimit)
+               ASSERT(be64_to_cpu(d->d_blk_softlimit) <=
+                      be64_to_cpu(d->d_blk_hardlimit));
+       if (d->d_ino_hardlimit)
+               ASSERT(be64_to_cpu(d->d_ino_softlimit) <=
+                      be64_to_cpu(d->d_ino_hardlimit));
+       if (d->d_rtb_hardlimit)
+               ASSERT(be64_to_cpu(d->d_rtb_softlimit) <=
+                      be64_to_cpu(d->d_rtb_hardlimit));
 #endif
        if (!d->d_btimer) {
-               if ((INT_GET(d->d_blk_softlimit, ARCH_CONVERT) &&
-                   (INT_GET(d->d_bcount, ARCH_CONVERT) >=
-                               INT_GET(d->d_blk_softlimit, ARCH_CONVERT))) ||
-                   (INT_GET(d->d_blk_hardlimit, ARCH_CONVERT) &&
-                   (INT_GET(d->d_bcount, ARCH_CONVERT) >=
-                               INT_GET(d->d_blk_hardlimit, ARCH_CONVERT)))) {
-                       INT_SET(d->d_btimer, ARCH_CONVERT,
-                               get_seconds() + XFS_QI_BTIMELIMIT(mp));
+               if ((d->d_blk_softlimit &&
+                    (be64_to_cpu(d->d_bcount) >=
+                     be64_to_cpu(d->d_blk_softlimit))) ||
+                   (d->d_blk_hardlimit &&
+                    (be64_to_cpu(d->d_bcount) >=
+                     be64_to_cpu(d->d_blk_hardlimit)))) {
+                       d->d_btimer = cpu_to_be32(get_seconds() +
+                                       XFS_QI_BTIMELIMIT(mp));
                } else {
                        d->d_bwarns = 0;
                }
        } else {
                if ((!d->d_blk_softlimit ||
-                   (INT_GET(d->d_bcount, ARCH_CONVERT) <
-                               INT_GET(d->d_blk_softlimit, ARCH_CONVERT))) &&
+                    (be64_to_cpu(d->d_bcount) <
+                     be64_to_cpu(d->d_blk_softlimit))) &&
                    (!d->d_blk_hardlimit ||
-                   (INT_GET(d->d_bcount, ARCH_CONVERT) <
-                               INT_GET(d->d_blk_hardlimit, ARCH_CONVERT)))) {
+                   (be64_to_cpu(d->d_bcount) <
+                    be64_to_cpu(d->d_blk_hardlimit)))) {
                        d->d_btimer = 0;
                }
        }
 
        if (!d->d_itimer) {
-               if ((INT_GET(d->d_ino_softlimit, ARCH_CONVERT) &&
-                   (INT_GET(d->d_icount, ARCH_CONVERT) >=
-                               INT_GET(d->d_ino_softlimit, ARCH_CONVERT))) ||
-                   (INT_GET(d->d_ino_hardlimit, ARCH_CONVERT) &&
-                   (INT_GET(d->d_icount, ARCH_CONVERT) >=
-                               INT_GET(d->d_ino_hardlimit, ARCH_CONVERT)))) {
-                       INT_SET(d->d_itimer, ARCH_CONVERT,
-                               get_seconds() + XFS_QI_ITIMELIMIT(mp));
+               if ((d->d_ino_softlimit &&
+                    (be64_to_cpu(d->d_icount) >=
+                     be64_to_cpu(d->d_ino_softlimit))) ||
+                   (d->d_ino_hardlimit &&
+                    (be64_to_cpu(d->d_icount) >=
+                     be64_to_cpu(d->d_ino_hardlimit)))) {
+                       d->d_itimer = cpu_to_be32(get_seconds() +
+                                       XFS_QI_ITIMELIMIT(mp));
                } else {
                        d->d_iwarns = 0;
                }
        } else {
                if ((!d->d_ino_softlimit ||
-                   (INT_GET(d->d_icount, ARCH_CONVERT) <
-                               INT_GET(d->d_ino_softlimit, ARCH_CONVERT)))  &&
+                    (be64_to_cpu(d->d_icount) <
+                     be64_to_cpu(d->d_ino_softlimit)))  &&
                    (!d->d_ino_hardlimit ||
-                   (INT_GET(d->d_icount, ARCH_CONVERT) <
-                               INT_GET(d->d_ino_hardlimit, ARCH_CONVERT)))) {
+                    (be64_to_cpu(d->d_icount) <
+                     be64_to_cpu(d->d_ino_hardlimit)))) {
                        d->d_itimer = 0;
                }
        }
 
        if (!d->d_rtbtimer) {
-               if ((INT_GET(d->d_rtb_softlimit, ARCH_CONVERT) &&
-                   (INT_GET(d->d_rtbcount, ARCH_CONVERT) >=
-                               INT_GET(d->d_rtb_softlimit, ARCH_CONVERT))) ||
-                   (INT_GET(d->d_rtb_hardlimit, ARCH_CONVERT) &&
-                   (INT_GET(d->d_rtbcount, ARCH_CONVERT) >=
-                               INT_GET(d->d_rtb_hardlimit, ARCH_CONVERT)))) {
-                       INT_SET(d->d_rtbtimer, ARCH_CONVERT,
-                               get_seconds() + XFS_QI_RTBTIMELIMIT(mp));
+               if ((d->d_rtb_softlimit &&
+                    (be64_to_cpu(d->d_rtbcount) >=
+                     be64_to_cpu(d->d_rtb_softlimit))) ||
+                   (d->d_rtb_hardlimit &&
+                    (be64_to_cpu(d->d_rtbcount) >=
+                     be64_to_cpu(d->d_rtb_hardlimit)))) {
+                       d->d_rtbtimer = cpu_to_be32(get_seconds() +
+                                       XFS_QI_RTBTIMELIMIT(mp));
                } else {
                        d->d_rtbwarns = 0;
                }
        } else {
                if ((!d->d_rtb_softlimit ||
-                   (INT_GET(d->d_rtbcount, ARCH_CONVERT) <
-                               INT_GET(d->d_rtb_softlimit, ARCH_CONVERT))) &&
+                    (be64_to_cpu(d->d_rtbcount) <
+                     be64_to_cpu(d->d_rtb_softlimit))) &&
                    (!d->d_rtb_hardlimit ||
-                   (INT_GET(d->d_rtbcount, ARCH_CONVERT) <
-                               INT_GET(d->d_rtb_hardlimit, ARCH_CONVERT)))) {
+                    (be64_to_cpu(d->d_rtbcount) <
+                     be64_to_cpu(d->d_rtb_hardlimit)))) {
                        d->d_rtbtimer = 0;
                }
        }
@@ -474,7 +468,7 @@ xfs_qm_dqalloc(
         * Make a chunk of dquots out of this buffer and log
         * the entire thing.
         */
-       xfs_qm_init_dquot_blk(tp, mp, INT_GET(dqp->q_core.d_id, ARCH_CONVERT),
+       xfs_qm_init_dquot_blk(tp, mp, be32_to_cpu(dqp->q_core.d_id),
                              dqp->dq_flags & XFS_DQ_ALLTYPES, bp);
 
        /*
@@ -538,7 +532,7 @@ xfs_qm_dqtobp(
        xfs_trans_t     *tp = (tpp ? *tpp : NULL);
 
        mp = dqp->q_mount;
-       id = INT_GET(dqp->q_core.d_id, ARCH_CONVERT);
+       id = be32_to_cpu(dqp->q_core.d_id);
        nmaps = 1;
        newdquot = B_FALSE;
 
@@ -677,16 +671,16 @@ xfs_qm_dqread(
 
        /* copy everything from disk dquot to the incore dquot */
        memcpy(&dqp->q_core, ddqp, sizeof(xfs_disk_dquot_t));
-       ASSERT(INT_GET(dqp->q_core.d_id, ARCH_CONVERT) == id);
+       ASSERT(be32_to_cpu(dqp->q_core.d_id) == id);
        xfs_qm_dquot_logitem_init(dqp);
 
        /*
         * Reservation counters are defined as reservation plus current usage
         * to avoid having to add everytime.
         */
-       dqp->q_res_bcount = INT_GET(ddqp->d_bcount, ARCH_CONVERT);
-       dqp->q_res_icount = INT_GET(ddqp->d_icount, ARCH_CONVERT);
-       dqp->q_res_rtbcount = INT_GET(ddqp->d_rtbcount, ARCH_CONVERT);
+       dqp->q_res_bcount = be64_to_cpu(ddqp->d_bcount);
+       dqp->q_res_icount = be64_to_cpu(ddqp->d_icount);
+       dqp->q_res_rtbcount = be64_to_cpu(ddqp->d_rtbcount);
 
        /* Mark the buf so that this will stay incore a little longer */
        XFS_BUF_SET_VTYPE_REF(bp, B_FS_DQUOT, XFS_DQUOT_REF);
@@ -812,7 +806,7 @@ xfs_qm_dqlookup(
                 * dqlock to look at the id field of the dquot, since the
                 * id can't be modified without the hashlock anyway.
                 */
-               if (INT_GET(dqp->q_core.d_id, ARCH_CONVERT) == id && dqp->q_mount == mp) {
+               if (be32_to_cpu(dqp->q_core.d_id) == id && dqp->q_mount == mp) {
                        xfs_dqtrace_entry(dqp, "DQFOUND BY LOOKUP");
                        /*
                         * All in core dquots must be on the dqlist of mp
@@ -843,7 +837,7 @@ xfs_qm_dqlookup(
                         * id couldn't have changed; we had the hashlock all
                         * along
                         */
-                       ASSERT(INT_GET(dqp->q_core.d_id, ARCH_CONVERT) == id);
+                       ASSERT(be32_to_cpu(dqp->q_core.d_id) == id);
 
                        if (flist_locked) {
                                if (dqp->q_nrefs != 0) {
@@ -1265,7 +1259,7 @@ xfs_qm_dqflush(
                return (error);
        }
 
-       if (xfs_qm_dqcheck(&dqp->q_core, INT_GET(ddqp->d_id, ARCH_CONVERT),
+       if (xfs_qm_dqcheck(&dqp->q_core, be32_to_cpu(ddqp->d_id),
                           0, XFS_QMOPT_DOWARN, "dqflush (incore copy)")) {
                xfs_force_shutdown(dqp->q_mount, XFS_CORRUPT_INCORE);
                return XFS_ERROR(EIO);
@@ -1418,8 +1412,8 @@ xfs_dqlock2(
 {
        if (d1 && d2) {
                ASSERT(d1 != d2);
-               if (INT_GET(d1->q_core.d_id, ARCH_CONVERT) >
-                   INT_GET(d2->q_core.d_id, ARCH_CONVERT)) {
+               if (be32_to_cpu(d1->q_core.d_id) >
+                   be32_to_cpu(d2->q_core.d_id)) {
                        xfs_dqlock(d2);
                        xfs_dqlock(d1);
                } else {
@@ -1541,33 +1535,33 @@ xfs_qm_dqprint(xfs_dquot_t *dqp)
 {
        cmn_err(CE_DEBUG, "-----------KERNEL DQUOT----------------");
        cmn_err(CE_DEBUG, "---- dquotID =  %d",
-               (int)INT_GET(dqp->q_core.d_id, ARCH_CONVERT));
+               (int)be32_to_cpu(dqp->q_core.d_id));
        cmn_err(CE_DEBUG, "---- type    =  %s", DQFLAGTO_TYPESTR(dqp));
        cmn_err(CE_DEBUG, "---- fs      =  0x%p", dqp->q_mount);
        cmn_err(CE_DEBUG, "---- blkno   =  0x%x", (int) dqp->q_blkno);
        cmn_err(CE_DEBUG, "---- boffset =  0x%x", (int) dqp->q_bufoffset);
        cmn_err(CE_DEBUG, "---- blkhlimit =  %Lu (0x%x)",
-               INT_GET(dqp->q_core.d_blk_hardlimit, ARCH_CONVERT),
-               (int) INT_GET(dqp->q_core.d_blk_hardlimit, ARCH_CONVERT));
+               be64_to_cpu(dqp->q_core.d_blk_hardlimit),
+               (int)be64_to_cpu(dqp->q_core.d_blk_hardlimit));
        cmn_err(CE_DEBUG, "---- blkslimit =  %Lu (0x%x)",
-               INT_GET(dqp->q_core.d_blk_softlimit, ARCH_CONVERT),
-               (int)INT_GET(dqp->q_core.d_blk_softlimit, ARCH_CONVERT));
+               be64_to_cpu(dqp->q_core.d_blk_softlimit),
+               (int)be64_to_cpu(dqp->q_core.d_blk_softlimit));
        cmn_err(CE_DEBUG, "---- inohlimit =  %Lu (0x%x)",
-               INT_GET(dqp->q_core.d_ino_hardlimit, ARCH_CONVERT),
-               (int)INT_GET(dqp->q_core.d_ino_hardlimit, ARCH_CONVERT));
+               be64_to_cpu(dqp->q_core.d_ino_hardlimit),
+               (int)be64_to_cpu(dqp->q_core.d_ino_hardlimit));
        cmn_err(CE_DEBUG, "---- inoslimit =  %Lu (0x%x)",
-               INT_GET(dqp->q_core.d_ino_softlimit, ARCH_CONVERT),
-               (int)INT_GET(dqp->q_core.d_ino_softlimit, ARCH_CONVERT));
+               be64_to_cpu(dqp->q_core.d_ino_softlimit),
+               (int)be64_to_cpu(dqp->q_core.d_ino_softlimit));
        cmn_err(CE_DEBUG, "---- bcount  =  %Lu (0x%x)",
-               INT_GET(dqp->q_core.d_bcount, ARCH_CONVERT),
-               (int)INT_GET(dqp->q_core.d_bcount, ARCH_CONVERT));
+               be64_to_cpu(dqp->q_core.d_bcount),
+               (int)be64_to_cpu(dqp->q_core.d_bcount));
        cmn_err(CE_DEBUG, "---- icount  =  %Lu (0x%x)",
-               INT_GET(dqp->q_core.d_icount, ARCH_CONVERT),
-               (int)INT_GET(dqp->q_core.d_icount, ARCH_CONVERT));
+               be64_to_cpu(dqp->q_core.d_icount),
+               (int)be64_to_cpu(dqp->q_core.d_icount));
        cmn_err(CE_DEBUG, "---- btimer  =  %d",
-               (int)INT_GET(dqp->q_core.d_btimer, ARCH_CONVERT));
+               (int)be32_to_cpu(dqp->q_core.d_btimer));
        cmn_err(CE_DEBUG, "---- itimer  =  %d",
-               (int)INT_GET(dqp->q_core.d_itimer, ARCH_CONVERT));
+               (int)be32_to_cpu(dqp->q_core.d_itimer));
        cmn_err(CE_DEBUG, "---------------------------");
 }
 #endif
index ea10006..2f69822 100644 (file)
@@ -450,7 +450,7 @@ xfs_qm_dquot_logitem_init(
        lp->qli_item.li_mountp = dqp->q_mount;
        lp->qli_dquot = dqp;
        lp->qli_format.qlf_type = XFS_LI_DQUOT;
-       lp->qli_format.qlf_id = INT_GET(dqp->q_core.d_id, ARCH_CONVERT);
+       lp->qli_format.qlf_id = be32_to_cpu(dqp->q_core.d_id);
        lp->qli_format.qlf_blkno = dqp->q_blkno;
        lp->qli_format.qlf_len = 1;
        /*
index a545d3e..79aadb1 100644 (file)
@@ -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);
        }
 }
index a990510..24690e1 100644 (file)
@@ -638,13 +638,13 @@ xfs_qm_scall_setqlim(
         */
        hard = (newlim->d_fieldmask & FS_DQ_BHARD) ?
                (xfs_qcnt_t) XFS_BB_TO_FSB(mp, newlim->d_blk_hardlimit) :
-                       INT_GET(ddq->d_blk_hardlimit, ARCH_CONVERT);
+                       be64_to_cpu(ddq->d_blk_hardlimit);
        soft = (newlim->d_fieldmask & FS_DQ_BSOFT) ?
                (xfs_qcnt_t) XFS_BB_TO_FSB(mp, newlim->d_blk_softlimit) :
-                       INT_GET(ddq->d_blk_softlimit, ARCH_CONVERT);
+                       be64_to_cpu(ddq->d_blk_softlimit);
        if (hard == 0 || hard >= soft) {
-               INT_SET(ddq->d_blk_hardlimit, ARCH_CONVERT, hard);
-               INT_SET(ddq->d_blk_softlimit, ARCH_CONVERT, soft);
+               ddq->d_blk_hardlimit = cpu_to_be64(hard);
+               ddq->d_blk_softlimit = cpu_to_be64(soft);
                if (id == 0) {
                        mp->m_quotainfo->qi_bhardlimit = hard;
                        mp->m_quotainfo->qi_bsoftlimit = soft;
@@ -654,13 +654,13 @@ xfs_qm_scall_setqlim(
        }
        hard = (newlim->d_fieldmask & FS_DQ_RTBHARD) ?
                (xfs_qcnt_t) XFS_BB_TO_FSB(mp, newlim->d_rtb_hardlimit) :
-                       INT_GET(ddq->d_rtb_hardlimit, ARCH_CONVERT);
+                       be64_to_cpu(ddq->d_rtb_hardlimit);
        soft = (newlim->d_fieldmask & FS_DQ_RTBSOFT) ?
                (xfs_qcnt_t) XFS_BB_TO_FSB(mp, newlim->d_rtb_softlimit) :
-                       INT_GET(ddq->d_rtb_softlimit, ARCH_CONVERT);
+                       be64_to_cpu(ddq->d_rtb_softlimit);
        if (hard == 0 || hard >= soft) {
-               INT_SET(ddq->d_rtb_hardlimit, ARCH_CONVERT, hard);
-               INT_SET(ddq->d_rtb_softlimit, ARCH_CONVERT, soft);
+               ddq->d_rtb_hardlimit = cpu_to_be64(hard);
+               ddq->d_rtb_softlimit = cpu_to_be64(soft);
                if (id == 0) {
                        mp->m_quotainfo->qi_rtbhardlimit = hard;
                        mp->m_quotainfo->qi_rtbsoftlimit = soft;
@@ -671,13 +671,13 @@ xfs_qm_scall_setqlim(
 
        hard = (newlim->d_fieldmask & FS_DQ_IHARD) ?
                (xfs_qcnt_t) newlim->d_ino_hardlimit :
-                       INT_GET(ddq->d_ino_hardlimit, ARCH_CONVERT);
+                       be64_to_cpu(ddq->d_ino_hardlimit);
        soft = (newlim->d_fieldmask & FS_DQ_ISOFT) ?
                (xfs_qcnt_t) newlim->d_ino_softlimit :
-                       INT_GET(ddq->d_ino_softlimit, ARCH_CONVERT);
+                       be64_to_cpu(ddq->d_ino_softlimit);
        if (hard == 0 || hard >= soft) {
-               INT_SET(ddq->d_ino_hardlimit, ARCH_CONVERT, hard);
-               INT_SET(ddq->d_ino_softlimit, ARCH_CONVERT, soft);
+               ddq->d_ino_hardlimit = cpu_to_be64(hard);
+               ddq->d_ino_softlimit = cpu_to_be64(soft);
                if (id == 0) {
                        mp->m_quotainfo->qi_ihardlimit = hard;
                        mp->m_quotainfo->qi_isoftlimit = soft;
@@ -690,11 +690,11 @@ xfs_qm_scall_setqlim(
         * Update warnings counter(s) if requested
         */
        if (newlim->d_fieldmask & FS_DQ_BWARNS)
-               INT_SET(ddq->d_bwarns, ARCH_CONVERT, newlim->d_bwarns);
+               ddq->d_bwarns = cpu_to_be16(newlim->d_bwarns);
        if (newlim->d_fieldmask & FS_DQ_IWARNS)
-               INT_SET(ddq->d_iwarns, ARCH_CONVERT, newlim->d_iwarns);
+               ddq->d_iwarns = cpu_to_be16(newlim->d_iwarns);
        if (newlim->d_fieldmask & FS_DQ_RTBWARNS)
-               INT_SET(ddq->d_rtbwarns, ARCH_CONVERT, newlim->d_rtbwarns);
+               ddq->d_rtbwarns = cpu_to_be16(newlim->d_rtbwarns);
 
        if (id == 0) {
                /*
@@ -706,15 +706,15 @@ xfs_qm_scall_setqlim(
                 */
                if (newlim->d_fieldmask & FS_DQ_BTIMER) {
                        mp->m_quotainfo->qi_btimelimit = newlim->d_btimer;
-                       INT_SET(ddq->d_btimer, ARCH_CONVERT, newlim->d_btimer);
+                       ddq->d_btimer = cpu_to_be32(newlim->d_btimer);
                }
                if (newlim->d_fieldmask & FS_DQ_ITIMER) {
                        mp->m_quotainfo->qi_itimelimit = newlim->d_itimer;
-                       INT_SET(ddq->d_itimer, ARCH_CONVERT, newlim->d_itimer);
+                       ddq->d_itimer = cpu_to_be32(newlim->d_itimer);
                }
                if (newlim->d_fieldmask & FS_DQ_RTBTIMER) {
                        mp->m_quotainfo->qi_rtbtimelimit = newlim->d_rtbtimer;
-                       INT_SET(ddq->d_rtbtimer, ARCH_CONVERT, newlim->d_rtbtimer);
+                       ddq->d_rtbtimer = cpu_to_be32(newlim->d_rtbtimer);
                }
                if (newlim->d_fieldmask & FS_DQ_BWARNS)
                        mp->m_quotainfo->qi_bwarnlimit = newlim->d_bwarns;
@@ -885,33 +885,27 @@ xfs_qm_export_dquot(
 {
        memset(dst, 0, sizeof(*dst));
        dst->d_version = FS_DQUOT_VERSION;  /* different from src->d_version */
-       dst->d_flags =
-               xfs_qm_export_qtype_flags(INT_GET(src->d_flags, ARCH_CONVERT));
-       dst->d_id = INT_GET(src->d_id, ARCH_CONVERT);
-       dst->d_blk_hardlimit = (__uint64_t)
-               XFS_FSB_TO_BB(mp, INT_GET(src->d_blk_hardlimit, ARCH_CONVERT));
-       dst->d_blk_softlimit = (__uint64_t)
-               XFS_FSB_TO_BB(mp, INT_GET(src->d_blk_softlimit, ARCH_CONVERT));
-       dst->d_ino_hardlimit = (__uint64_t)
-               INT_GET(src->d_ino_hardlimit, ARCH_CONVERT);
-       dst->d_ino_softlimit = (__uint64_t)
-               INT_GET(src->d_ino_softlimit, ARCH_CONVERT);
-       dst->d_bcount = (__uint64_t)
-               XFS_FSB_TO_BB(mp, INT_GET(src->d_bcount, ARCH_CONVERT));
-       dst->d_icount = (__uint64_t) INT_GET(src->d_icount, ARCH_CONVERT);
-       dst->d_btimer = (__uint32_t) INT_GET(src->d_btimer, ARCH_CONVERT);
-       dst->d_itimer = (__uint32_t) INT_GET(src->d_itimer, ARCH_CONVERT);
-       dst->d_iwarns = INT_GET(src->d_iwarns, ARCH_CONVERT);
-       dst->d_bwarns = INT_GET(src->d_bwarns, ARCH_CONVERT);
-
-       dst->d_rtb_hardlimit = (__uint64_t)
-               XFS_FSB_TO_BB(mp, INT_GET(src->d_rtb_hardlimit, ARCH_CONVERT));
-       dst->d_rtb_softlimit = (__uint64_t)
-               XFS_FSB_TO_BB(mp, INT_GET(src->d_rtb_softlimit, ARCH_CONVERT));
-       dst->d_rtbcount = (__uint64_t)
-               XFS_FSB_TO_BB(mp, INT_GET(src->d_rtbcount, ARCH_CONVERT));
-       dst->d_rtbtimer = (__uint32_t) INT_GET(src->d_rtbtimer, ARCH_CONVERT);
-       dst->d_rtbwarns = INT_GET(src->d_rtbwarns, ARCH_CONVERT);
+       dst->d_flags = xfs_qm_export_qtype_flags(src->d_flags);
+       dst->d_id = be32_to_cpu(src->d_id);
+       dst->d_blk_hardlimit =
+               XFS_FSB_TO_BB(mp, be64_to_cpu(src->d_blk_hardlimit));
+       dst->d_blk_softlimit =
+               XFS_FSB_TO_BB(mp, be64_to_cpu(src->d_blk_softlimit));
+       dst->d_ino_hardlimit = be64_to_cpu(src->d_ino_hardlimit);
+       dst->d_ino_softlimit = be64_to_cpu(src->d_ino_softlimit);
+       dst->d_bcount = XFS_FSB_TO_BB(mp, be64_to_cpu(src->d_bcount));
+       dst->d_icount = be64_to_cpu(src->d_icount);
+       dst->d_btimer = be32_to_cpu(src->d_btimer);
+       dst->d_itimer = be32_to_cpu(src->d_itimer);
+       dst->d_iwarns = be16_to_cpu(src->d_iwarns);
+       dst->d_bwarns = be16_to_cpu(src->d_bwarns);
+       dst->d_rtb_hardlimit =
+               XFS_FSB_TO_BB(mp, be64_to_cpu(src->d_rtb_hardlimit));
+       dst->d_rtb_softlimit =
+               XFS_FSB_TO_BB(mp, be64_to_cpu(src->d_rtb_softlimit));
+       dst->d_rtbcount = XFS_FSB_TO_BB(mp, be64_to_cpu(src->d_rtbcount));
+       dst->d_rtbtimer = be32_to_cpu(src->d_rtbtimer);
+       dst->d_rtbwarns = be16_to_cpu(src->d_rtbwarns);
 
        /*
         * Internally, we don't reset all the timers when quota enforcement
@@ -1205,10 +1199,10 @@ xfs_qm_dqtest_failed(
        qmtest_nfails++;
        if (error)
                cmn_err(CE_DEBUG, "quotacheck failed id=%d, err=%d\nreason: %s",
-                      INT_GET(d->d_id, ARCH_CONVERT), error, reason);
+                      d->d_id, error, reason);
        else
                cmn_err(CE_DEBUG, "quotacheck failed id=%d (%s) [%d != %d]",
-                      INT_GET(d->d_id, ARCH_CONVERT), reason, (int)a, (int)b);
+                      d->d_id, reason, (int)a, (int)b);
        xfs_qm_dqtest_print(d);
        if (dqp)
                xfs_qm_dqprint(dqp);
@@ -1220,21 +1214,21 @@ xfs_dqtest_cmp2(
        xfs_dquot_t     *dqp)
 {
        int err = 0;
-       if (INT_GET(dqp->q_core.d_icount, ARCH_CONVERT) != d->d_icount) {
+       if (be64_to_cpu(dqp->q_core.d_icount) != d->d_icount) {
                xfs_qm_dqtest_failed(d, dqp, "icount mismatch",
-                       INT_GET(dqp->q_core.d_icount, ARCH_CONVERT),
+                       be64_to_cpu(dqp->q_core.d_icount),
                        d->d_icount, 0);
                err++;
        }
-       if (INT_GET(dqp->q_core.d_bcount, ARCH_CONVERT) != d->d_bcount) {
+       if (be64_to_cpu(dqp->q_core.d_bcount) != d->d_bcount) {
                xfs_qm_dqtest_failed(d, dqp, "bcount mismatch",
-                       INT_GET(dqp->q_core.d_bcount, ARCH_CONVERT),
+                       be64_to_cpu(dqp->q_core.d_bcount),
                        d->d_bcount, 0);
                err++;
        }
-       if (INT_GET(dqp->q_core.d_blk_softlimit, ARCH_CONVERT) &&
-           INT_GET(dqp->q_core.d_bcount, ARCH_CONVERT) >=
-           INT_GET(dqp->q_core.d_blk_softlimit, ARCH_CONVERT)) {
+       if (dqp->q_core.d_blk_softlimit &&
+           be64_to_cpu(dqp->q_core.d_bcount) >=
+           be64_to_cpu(dqp->q_core.d_blk_softlimit)) {
                if (!dqp->q_core.d_btimer && dqp->q_core.d_id) {
                        cmn_err(CE_DEBUG,
                                "%d [%s] [0x%p] BLK TIMER NOT STARTED",
@@ -1242,9 +1236,9 @@ xfs_dqtest_cmp2(
                        err++;
                }
        }
-       if (INT_GET(dqp->q_core.d_ino_softlimit, ARCH_CONVERT) &&
-           INT_GET(dqp->q_core.d_icount, ARCH_CONVERT) >=
-           INT_GET(dqp->q_core.d_ino_softlimit, ARCH_CONVERT)) {
+       if (dqp->q_core.d_ino_softlimit &&
+           be64_to_cpu(dqp->q_core.d_icount) >=
+           be64_to_cpu(dqp->q_core.d_ino_softlimit)) {
                if (!dqp->q_core.d_itimer && dqp->q_core.d_id) {
                        cmn_err(CE_DEBUG,
                                "%d [%s] [0x%p] INO TIMER NOT STARTED",
index e94bed4..3290975 100644 (file)
@@ -413,25 +413,25 @@ xfs_trans_apply_dquot_deltas(
                                qtrx->qt_delrtb_delta;
 #ifdef QUOTADEBUG
                        if (totalbdelta < 0)
-                               ASSERT(INT_GET(d->d_bcount, ARCH_CONVERT) >=
+                               ASSERT(be64_to_cpu(d->d_bcount) >=
                                       (xfs_qcnt_t) -totalbdelta);
 
                        if (totalrtbdelta < 0)
-                               ASSERT(INT_GET(d->d_rtbcount, ARCH_CONVERT) >=
+                               ASSERT(be64_to_cpu(d->d_rtbcount) >=
                                       (xfs_qcnt_t) -totalrtbdelta);
 
                        if (qtrx->qt_icount_delta < 0)
-                               ASSERT(INT_GET(d->d_icount, ARCH_CONVERT) >=
+                               ASSERT(be64_to_cpu(d->d_icount) >=
                                       (xfs_qcnt_t) -qtrx->qt_icount_delta);
 #endif
                        if (totalbdelta)
-                               INT_MOD(d->d_bcount, ARCH_CONVERT, (xfs_qcnt_t)totalbdelta);
+                               be64_add(&d->d_bcount, (xfs_qcnt_t)totalbdelta);
 
                        if (qtrx->qt_icount_delta)
-                               INT_MOD(d->d_icount, ARCH_CONVERT, (xfs_qcnt_t)qtrx->qt_icount_delta);
+                               be64_add(&d->d_icount, (xfs_qcnt_t)qtrx->qt_icount_delta);
 
                        if (totalrtbdelta)
-                               INT_MOD(d->d_rtbcount, ARCH_CONVERT, (xfs_qcnt_t)totalrtbdelta);
+                               be64_add(&d->d_rtbcount, (xfs_qcnt_t)totalrtbdelta);
 
                        /*
                         * Get any default limits in use.
@@ -515,11 +515,11 @@ xfs_trans_apply_dquot_deltas(
                        }
 
                        ASSERT(dqp->q_res_bcount >=
-                               INT_GET(dqp->q_core.d_bcount, ARCH_CONVERT));
+                               be64_to_cpu(dqp->q_core.d_bcount));
                        ASSERT(dqp->q_res_icount >=
-                               INT_GET(dqp->q_core.d_icount, ARCH_CONVERT));
+                               be64_to_cpu(dqp->q_core.d_icount));
                        ASSERT(dqp->q_res_rtbcount >=
-                               INT_GET(dqp->q_core.d_rtbcount, ARCH_CONVERT));
+                               be64_to_cpu(dqp->q_core.d_rtbcount));
                }
                /*
                 * Do the group quotas next
@@ -626,26 +626,26 @@ xfs_trans_dqresv(
        }
        ASSERT(XFS_DQ_IS_LOCKED(dqp));
        if (flags & XFS_TRANS_DQ_RES_BLKS) {
-               hardlimit = INT_GET(dqp->q_core.d_blk_hardlimit, ARCH_CONVERT);
+               hardlimit = be64_to_cpu(dqp->q_core.d_blk_hardlimit);
                if (!hardlimit)
                        hardlimit = q->qi_bhardlimit;
-               softlimit = INT_GET(dqp->q_core.d_blk_softlimit, ARCH_CONVERT);
+               softlimit = be64_to_cpu(dqp->q_core.d_blk_softlimit);
                if (!softlimit)
                        softlimit = q->qi_bsoftlimit;
-               timer = INT_GET(dqp->q_core.d_btimer, ARCH_CONVERT);
-               warns = INT_GET(dqp->q_core.d_bwarns, ARCH_CONVERT);
+               timer = be32_to_cpu(dqp->q_core.d_btimer);
+               warns = be16_to_cpu(dqp->q_core.d_bwarns);
                warnlimit = XFS_QI_BWARNLIMIT(dqp->q_mount);
                resbcountp = &dqp->q_res_bcount;
        } else {
                ASSERT(flags & XFS_TRANS_DQ_RES_RTBLKS);
-               hardlimit = INT_GET(dqp->q_core.d_rtb_hardlimit, ARCH_CONVERT);
+               hardlimit = be64_to_cpu(dqp->q_core.d_rtb_hardlimit);
                if (!hardlimit)
                        hardlimit = q->qi_rtbhardlimit;
-               softlimit = INT_GET(dqp->q_core.d_rtb_softlimit, ARCH_CONVERT);
+               softlimit = be64_to_cpu(dqp->q_core.d_rtb_softlimit);
                if (!softlimit)
                        softlimit = q->qi_rtbsoftlimit;
-               timer = INT_GET(dqp->q_core.d_rtbtimer, ARCH_CONVERT);
-               warns = INT_GET(dqp->q_core.d_rtbwarns, ARCH_CONVERT);
+               timer = be32_to_cpu(dqp->q_core.d_rtbtimer);
+               warns = be16_to_cpu(dqp->q_core.d_rtbwarns);
                warnlimit = XFS_QI_RTBWARNLIMIT(dqp->q_mount);
                resbcountp = &dqp->q_res_rtbcount;
        }
@@ -684,16 +684,14 @@ xfs_trans_dqresv(
                        }
                }
                if (ninos > 0) {
-                       count = INT_GET(dqp->q_core.d_icount, ARCH_CONVERT);
-                       timer = INT_GET(dqp->q_core.d_itimer, ARCH_CONVERT);
-                       warns = INT_GET(dqp->q_core.d_iwarns, ARCH_CONVERT);
+                       count = be64_to_cpu(dqp->q_core.d_icount);
+                       timer = be32_to_cpu(dqp->q_core.d_itimer);
+                       warns = be16_to_cpu(dqp->q_core.d_iwarns);
                        warnlimit = XFS_QI_IWARNLIMIT(dqp->q_mount);
-                       hardlimit = INT_GET(dqp->q_core.d_ino_hardlimit,
-                                               ARCH_CONVERT);
+                       hardlimit = be64_to_cpu(dqp->q_core.d_ino_hardlimit);
                        if (!hardlimit)
                                hardlimit = q->qi_ihardlimit;
-                       softlimit = INT_GET(dqp->q_core.d_ino_softlimit,
-                                               ARCH_CONVERT);
+                       softlimit = be64_to_cpu(dqp->q_core.d_ino_softlimit);
                        if (!softlimit)
                                softlimit = q->qi_isoftlimit;
                        if (hardlimit > 0ULL && count >= hardlimit) {
@@ -740,9 +738,9 @@ xfs_trans_dqresv(
                                            XFS_TRANS_DQ_RES_INOS,
                                            ninos);
        }
-       ASSERT(dqp->q_res_bcount >= INT_GET(dqp->q_core.d_bcount, ARCH_CONVERT));
-       ASSERT(dqp->q_res_rtbcount >= INT_GET(dqp->q_core.d_rtbcount, ARCH_CONVERT));
-       ASSERT(dqp->q_res_icount >= INT_GET(dqp->q_core.d_icount, ARCH_CONVERT));
+       ASSERT(dqp->q_res_bcount >= be64_to_cpu(dqp->q_core.d_bcount));
+       ASSERT(dqp->q_res_rtbcount >= be64_to_cpu(dqp->q_core.d_rtbcount));
+       ASSERT(dqp->q_res_icount >= be64_to_cpu(dqp->q_core.d_icount));
 
 error_return:
        if (! (flags & XFS_QMOPT_DQLOCK)) {
index 3191dc6..68e5051 100644 (file)
     } \
 }
 
+static inline void be16_add(__be16 *a, __s16 b)
+{
+       *a = cpu_to_be16(be16_to_cpu(*a) + b);
+}
+
+static inline void be32_add(__be32 *a, __s32 b)
+{
+       *a = cpu_to_be32(be32_to_cpu(*a) + b);
+}
+
+static inline void be64_add(__be64 *a, __s64 b)
+{
+       *a = cpu_to_be64(be64_to_cpu(*a) + b);
+}
+
 /*
  * In directories inode numbers are stored as unaligned arrays of unsigned
  * 8bit integers on disk.
index b628c9e..6326898 100644 (file)
@@ -1998,79 +1998,74 @@ xfs_qm_dqcheck(
         * This is all fine; things are still consistent, and we haven't lost
         * any quota information. Just don't complain about bad dquot blks.
         */
-       if (INT_GET(ddq->d_magic, ARCH_CONVERT) != XFS_DQUOT_MAGIC) {
+       if (be16_to_cpu(ddq->d_magic) != XFS_DQUOT_MAGIC) {
                if (flags & XFS_QMOPT_DOWARN)
                        cmn_err(CE_ALERT,
                        "%s : XFS dquot ID 0x%x, magic 0x%x != 0x%x",
-                       str, id,
-                       INT_GET(ddq->d_magic, ARCH_CONVERT), XFS_DQUOT_MAGIC);
+                       str, id, be16_to_cpu(ddq->d_magic), XFS_DQUOT_MAGIC);
                errs++;
        }
-       if (INT_GET(ddq->d_version, ARCH_CONVERT) != XFS_DQUOT_VERSION) {
+       if (ddq->d_version != XFS_DQUOT_VERSION) {
                if (flags & XFS_QMOPT_DOWARN)
                        cmn_err(CE_ALERT,
                        "%s : XFS dquot ID 0x%x, version 0x%x != 0x%x",
-                       str, id,
-                       INT_GET(ddq->d_magic, ARCH_CONVERT), XFS_DQUOT_VERSION);
+                       str, id, ddq->d_version, XFS_DQUOT_VERSION);
                errs++;
        }
 
-       if (INT_GET(ddq->d_flags, ARCH_CONVERT) != XFS_DQ_USER &&
-           INT_GET(ddq->d_flags, ARCH_CONVERT) != XFS_DQ_PROJ &&
-           INT_GET(ddq->d_flags, ARCH_CONVERT) != XFS_DQ_GROUP) {
+       if (ddq->d_flags != XFS_DQ_USER &&
+           ddq->d_flags != XFS_DQ_PROJ &&
+           ddq->d_flags != XFS_DQ_GROUP) {
                if (flags & XFS_QMOPT_DOWARN)
                        cmn_err(CE_ALERT,
                        "%s : XFS dquot ID 0x%x, unknown flags 0x%x",
-                       str, id, INT_GET(ddq->d_flags, ARCH_CONVERT));
+                       str, id, ddq->d_flags);
                errs++;
        }
 
-       if (id != -1 && id != INT_GET(ddq->d_id, ARCH_CONVERT)) {
+       if (id != -1 && id != be32_to_cpu(ddq->d_id)) {
                if (flags & XFS_QMOPT_DOWARN)
                        cmn_err(CE_ALERT,
                        "%s : ondisk-dquot 0x%p, ID mismatch: "
                        "0x%x expected, found id 0x%x",
-                       str, ddq, id, INT_GET(ddq->d_id, ARCH_CONVERT));
+                       str, ddq, id, be32_to_cpu(ddq->d_id));
                errs++;
        }
 
        if (!errs && ddq->d_id) {
-               if (INT_GET(ddq->d_blk_softlimit, ARCH_CONVERT) &&
-                   INT_GET(ddq->d_bcount, ARCH_CONVERT) >=
-                               INT_GET(ddq->d_blk_softlimit, ARCH_CONVERT)) {
+               if (ddq->d_blk_softlimit &&
+                   be64_to_cpu(ddq->d_bcount) >=
+                               be64_to_cpu(ddq->d_blk_softlimit)) {
                        if (!ddq->d_btimer) {
                                if (flags & XFS_QMOPT_DOWARN)
                                        cmn_err(CE_ALERT,
                                        "%s : Dquot ID 0x%x (0x%p) "
                                        "BLK TIMER NOT STARTED",
-                                       str, (int)
-                                       INT_GET(ddq->d_id, ARCH_CONVERT), ddq);
+                                       str, (int)be32_to_cpu(ddq->d_id), ddq);
                                errs++;
                        }
                }
-               if (INT_GET(ddq->d_ino_softlimit, ARCH_CONVERT) &&
-                   INT_GET(ddq->d_icount, ARCH_CONVERT) >=
-                               INT_GET(ddq->d_ino_softlimit, ARCH_CONVERT)) {
+               if (ddq->d_ino_softlimit &&
+                   be64_to_cpu(ddq->d_icount) >=
+                               be64_to_cpu(ddq->d_ino_softlimit)) {
                        if (!ddq->d_itimer) {
                                if (flags & XFS_QMOPT_DOWARN)
                                        cmn_err(CE_ALERT,
                                        "%s : Dquot ID 0x%x (0x%p) "
                                        "INODE TIMER NOT STARTED",
-                                       str, (int)
-                                       INT_GET(ddq->d_id, ARCH_CONVERT), ddq);
+                                       str, (int)be32_to_cpu(ddq->d_id), ddq);
                                errs++;
                        }
                }
-               if (INT_GET(ddq->d_rtb_softlimit, ARCH_CONVERT) &&
-                   INT_GET(ddq->d_rtbcount, ARCH_CONVERT) >=
-                               INT_GET(ddq->d_rtb_softlimit, ARCH_CONVERT)) {
+               if (ddq->d_rtb_softlimit &&
+                   be64_to_cpu(ddq->d_rtbcount) >=
+                               be64_to_cpu(ddq->d_rtb_softlimit)) {
                        if (!ddq->d_rtbtimer) {
                                if (flags & XFS_QMOPT_DOWARN)
                                        cmn_err(CE_ALERT,
                                        "%s : Dquot ID 0x%x (0x%p) "
                                        "RTBLK TIMER NOT STARTED",
-                                       str, (int)
-                                       INT_GET(ddq->d_id, ARCH_CONVERT), ddq);
+                                       str, (int)be32_to_cpu(ddq->d_id), ddq);
                                errs++;
                        }
                }
@@ -2088,10 +2083,11 @@ xfs_qm_dqcheck(
        ASSERT(id != -1);
        ASSERT(flags & XFS_QMOPT_DQREPAIR);
        memset(d, 0, sizeof(xfs_dqblk_t));
-       INT_SET(d->dd_diskdq.d_magic, ARCH_CONVERT, XFS_DQUOT_MAGIC);
-       INT_SET(d->dd_diskdq.d_version, ARCH_CONVERT, XFS_DQUOT_VERSION);
-       INT_SET(d->dd_diskdq.d_id, ARCH_CONVERT, id);
-       INT_SET(d->dd_diskdq.d_flags, ARCH_CONVERT, type);
+
+       d->dd_diskdq.d_magic = cpu_to_be16(XFS_DQUOT_MAGIC);
+       d->dd_diskdq.d_version = XFS_DQUOT_VERSION;
+       d->dd_diskdq.d_flags = type;
+       d->dd_diskdq.d_id = cpu_to_be32(id);
 
        return errs;
 }
index fc763a8..82a08ba 100644 (file)
@@ -45,28 +45,28 @@ typedef __uint16_t  xfs_qwarncnt_t;
  * to construct the on disk structure.
  */
 typedef struct xfs_disk_dquot {
-/*16*/ u_int16_t       d_magic;        /* dquot magic = XFS_DQUOT_MAGIC */
-/*8 */ u_int8_t        d_version;      /* dquot version */
-/*8 */ u_int8_t        d_flags;        /* XFS_DQ_USER/PROJ/GROUP */
-/*32*/ xfs_dqid_t      d_id;           /* user,project,group id */
-/*64*/ xfs_qcnt_t      d_blk_hardlimit;/* absolute limit on disk blks */
-/*64*/ xfs_qcnt_t      d_blk_softlimit;/* preferred limit on disk blks */
-/*64*/ xfs_qcnt_t      d_ino_hardlimit;/* maximum # allocated inodes */
-/*64*/ xfs_qcnt_t      d_ino_softlimit;/* preferred inode limit */
-/*64*/ xfs_qcnt_t      d_bcount;       /* disk blocks owned by the user */
-/*64*/ xfs_qcnt_t      d_icount;       /* inodes owned by the user */
-/*32*/ __int32_t       d_itimer;       /* zero if within inode limits if not,
+       __be16          d_magic;        /* dquot magic = XFS_DQUOT_MAGIC */
+       __u8            d_version;      /* dquot version */
+       __u8            d_flags;        /* XFS_DQ_USER/PROJ/GROUP */
+       __be32          d_id;           /* user,project,group id */
+       __be64          d_blk_hardlimit;/* absolute limit on disk blks */
+       __be64          d_blk_softlimit;/* preferred limit on disk blks */
+       __be64          d_ino_hardlimit;/* maximum # allocated inodes */
+       __be64          d_ino_softlimit;/* preferred inode limit */
+       __be64          d_bcount;       /* disk blocks owned by the user */
+       __be64          d_icount;       /* inodes owned by the user */
+       __be32          d_itimer;       /* zero if within inode limits if not,
                                           this is when we refuse service */
-/*32*/ __int32_t       d_btimer;       /* similar to above; for disk blocks */
-/*16*/ xfs_qwarncnt_t  d_iwarns;       /* warnings issued wrt num inodes */
-/*16*/ xfs_qwarncnt_t  d_bwarns;       /* warnings issued wrt disk blocks */
-/*32*/ __int32_t       d_pad0;         /* 64 bit align */
-/*64*/ xfs_qcnt_t      d_rtb_hardlimit;/* absolute limit on realtime blks */
-/*64*/ xfs_qcnt_t      d_rtb_softlimit;/* preferred limit on RT disk blks */
-/*64*/ xfs_qcnt_t      d_rtbcount;     /* realtime blocks owned */
-/*32*/ __int32_t       d_rtbtimer;     /* similar to above; for RT disk blocks */
-/*16*/ xfs_qwarncnt_t  d_rtbwarns;     /* warnings issued wrt RT disk blocks */
-/*16*/ __uint16_t      d_pad;
+       __be32          d_btimer;       /* similar to above; for disk blocks */
+       __be16          d_iwarns;       /* warnings issued wrt num inodes */
+       __be16          d_bwarns;       /* warnings issued wrt disk blocks */
+       __be32          d_pad0;         /* 64 bit align */
+       __be64          d_rtb_hardlimit;/* absolute limit on realtime blks */
+       __be64          d_rtb_softlimit;/* preferred limit on RT disk blks */
+       __be64          d_rtbcount;     /* realtime blocks owned */
+       __be32          d_rtbtimer;     /* similar to above; for RT disk blocks */
+       __be16          d_rtbwarns;     /* warnings issued wrt RT disk blocks */
+       __be16          d_pad;
 } xfs_disk_dquot_t;
 
 /*