[XFS] Clean up quotamount error handling.
[safe/jmp/linux-2.6] / fs / xfs / quota / xfs_dquot.c
index 5971f6f..15214fb 100644 (file)
@@ -1,35 +1,20 @@
 /*
- * Copyright (c) 2000-2003 Silicon Graphics, Inc.  All Rights Reserved.
+ * Copyright (c) 2000-2003 Silicon Graphics, Inc.
+ * All Rights Reserved.
  *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
  * published by the Free Software Foundation.
  *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * This program is distributed in the hope that it would be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
  *
- * Further, this software is distributed without any warranty that it is
- * free of the rightful claim of any third person regarding infringement
- * or the like.         Any license provided herein, whether implied or
- * otherwise, applies only to this software file.  Patent licenses, if
- * any, provided herein do not apply to combinations of this program with
- * other software, or any other product whatsoever.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc., 59
- * Temple Place - Suite 330, Boston MA 02111-1307, USA.
- *
- * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
- * Mountain View, CA  94043, or:
- *
- * http://www.sgi.com
- *
- * For further information regarding this notice, see:
- *
- * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write the Free Software Foundation,
+ * Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
-
 #include "xfs.h"
 #include "xfs_fs.h"
 #include "xfs_bit.h"
@@ -38,7 +23,6 @@
 #include "xfs_trans.h"
 #include "xfs_sb.h"
 #include "xfs_ag.h"
-#include "xfs_dir.h"
 #include "xfs_dir2.h"
 #include "xfs_alloc.h"
 #include "xfs_dmapi.h"
@@ -47,7 +31,6 @@
 #include "xfs_bmap_btree.h"
 #include "xfs_alloc_btree.h"
 #include "xfs_ialloc_btree.h"
-#include "xfs_dir_sf.h"
 #include "xfs_dir2_sf.h"
 #include "xfs_attr_sf.h"
 #include "xfs_dinode.h"
 #include "xfs_itable.h"
 #include "xfs_rw.h"
 #include "xfs_acl.h"
-#include "xfs_cap.h"
-#include "xfs_mac.h"
 #include "xfs_attr.h"
 #include "xfs_buf_item.h"
 #include "xfs_trans_space.h"
 #include "xfs_trans_priv.h"
-
 #include "xfs_qm.h"
 
 
@@ -112,7 +92,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;
 
        /*
@@ -120,7 +100,7 @@ xfs_qm_dqinit(
         */
        if (brandnewdquot) {
                dqp->dq_flnext = dqp->dq_flprev = dqp;
-               mutex_init(&dqp->q_qlock,  MUTEX_DEFAULT, "xdq");
+               mutex_init(&dqp->q_qlock);
                initnsema(&dqp->q_flock, 1, "fdq");
                sv_init(&dqp->q_pinwait, SV_DEFAULT, "pdq");
 
@@ -194,10 +174,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;
 }
 
 
@@ -227,19 +207,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,
@@ -264,17 +238,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);
 }
 
 /*
@@ -298,81 +272,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;
                }
        }
@@ -466,7 +440,7 @@ xfs_qm_dqalloc(
                              XFS_BMAPI_METADATA | XFS_BMAPI_WRITE,
                              &firstblock,
                              XFS_QM_DQALLOC_SPACE_RES(mp),
-                             &map, &nmaps, &flist))) {
+                             &map, &nmaps, &flist, NULL))) {
                goto error0;
        }
        ASSERT(map.br_blockcount == XFS_DQUOT_CLUSTER_SIZE_FSB);
@@ -490,7 +464,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);
 
        /*
@@ -508,7 +482,7 @@ xfs_qm_dqalloc(
 
        xfs_trans_bhold(tp, bp);
 
-       if ((error = xfs_bmap_finish(tpp, &flist, firstblock, &committed))) {
+       if ((error = xfs_bmap_finish(tpp, &flist, &committed))) {
                goto error1;
        }
 
@@ -554,7 +528,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;
 
@@ -581,7 +555,7 @@ xfs_qm_dqtobp(
                error = xfs_bmapi(NULL, quotip, dqp->q_fileoffset,
                                  XFS_DQUOT_CLUSTER_SIZE_FSB,
                                  XFS_BMAPI_METADATA,
-                                 NULL, 0, &map, &nmaps, NULL);
+                                 NULL, 0, &map, &nmaps, NULL, NULL);
 
                xfs_iunlock(quotip, XFS_ILOCK_SHARED);
                if (error)
@@ -693,16 +667,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);
@@ -779,8 +753,7 @@ xfs_qm_idtodq(
                goto error0;
        }
        if (tp) {
-               if ((error = xfs_trans_commit(tp, XFS_TRANS_RELEASE_LOG_RES,
-                                            NULL)))
+               if ((error = xfs_trans_commit(tp, XFS_TRANS_RELEASE_LOG_RES)))
                        goto error1;
        }
 
@@ -828,7 +801,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
@@ -859,7 +832,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) {
@@ -1236,7 +1209,6 @@ xfs_qm_dqflush(
        xfs_buf_t               *bp;
        xfs_disk_dquot_t        *ddqp;
        int                     error;
-       SPLDECL(s);
 
        ASSERT(XFS_DQ_IS_LOCKED(dqp));
        ASSERT(XFS_DQ_IS_FLUSH_LOCKED(dqp));
@@ -1281,9 +1253,9 @@ 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);
+               xfs_force_shutdown(dqp->q_mount, SHUTDOWN_CORRUPT_INCORE);
                return XFS_ERROR(EIO);
        }
 
@@ -1297,9 +1269,9 @@ xfs_qm_dqflush(
        mp = dqp->q_mount;
 
        /* lsn is 64 bits */
-       AIL_LOCK(mp, s);
+       spin_lock(&mp->m_ail_lock);
        dqp->q_logitem.qli_flush_lsn = dqp->q_logitem.qli_item.li_lsn;
-       AIL_UNLOCK(mp, s);
+       spin_unlock(&mp->m_ail_lock);
 
        /*
         * Attach an iodone routine so that we can remove this dquot from the
@@ -1345,7 +1317,6 @@ xfs_qm_dqflush_done(
        xfs_dq_logitem_t        *qip)
 {
        xfs_dquot_t             *dqp;
-       SPLDECL(s);
 
        dqp = qip->qli_dquot;
 
@@ -1360,15 +1331,15 @@ xfs_qm_dqflush_done(
        if ((qip->qli_item.li_flags & XFS_LI_IN_AIL) &&
            qip->qli_item.li_lsn == qip->qli_flush_lsn) {
 
-               AIL_LOCK(dqp->q_mount, s);
+               spin_lock(&dqp->q_mount->m_ail_lock);
                /*
                 * xfs_trans_delete_ail() drops the AIL lock.
                 */
                if (qip->qli_item.li_lsn == qip->qli_flush_lsn)
                        xfs_trans_delete_ail(dqp->q_mount,
-                                            (xfs_log_item_t*)qip, s);
+                                            (xfs_log_item_t*)qip);
                else
-                       AIL_UNLOCK(dqp->q_mount, s);
+                       spin_unlock(&dqp->q_mount->m_ail_lock);
        }
 
        /*
@@ -1404,7 +1375,7 @@ void
 xfs_dqlock(
        xfs_dquot_t *dqp)
 {
-       mutex_lock(&(dqp->q_qlock), PINOD);
+       mutex_lock(&(dqp->q_qlock));
 }
 
 void
@@ -1434,8 +1405,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 {
@@ -1468,9 +1439,7 @@ xfs_qm_dqpurge(
        uint            flags)
 {
        xfs_dqhash_t    *thishash;
-       xfs_mount_t     *mp;
-
-       mp = dqp->q_mount;
+       xfs_mount_t     *mp = dqp->q_mount;
 
        ASSERT(XFS_QM_IS_MPLIST_LOCKED(mp));
        ASSERT(XFS_DQ_IS_HASH_LOCKED(dqp->q_hash));
@@ -1514,6 +1483,7 @@ xfs_qm_dqpurge(
         * we're unmounting, we do care, so we flush it and wait.
         */
        if (XFS_DQ_IS_DIRTY(dqp)) {
+               int     error;
                xfs_dqtrace_entry(dqp, "DQPURGE ->DQFLUSH: DQDIRTY");
                /* dqflush unlocks dqflock */
                /*
@@ -1524,7 +1494,10 @@ xfs_qm_dqpurge(
                 * We don't care about getting disk errors here. We need
                 * to purge this dquot anyway, so we go ahead regardless.
                 */
-               (void) xfs_qm_dqflush(dqp, XFS_QMOPT_SYNC);
+               error = xfs_qm_dqflush(dqp, XFS_QMOPT_SYNC);
+               if (error)
+                       xfs_fs_cmn_err(CE_WARN, mp,
+                               "xfs_qm_dqpurge: dquot %p flush failed", dqp);
                xfs_dqflock(dqp);
        }
        ASSERT(dqp->q_pincount == 0);
@@ -1557,33 +1530,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