aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/quota/xfs_qm.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/xfs/quota/xfs_qm.c')
-rw-r--r--fs/xfs/quota/xfs_qm.c211
1 files changed, 80 insertions, 131 deletions
diff --git a/fs/xfs/quota/xfs_qm.c b/fs/xfs/quota/xfs_qm.c
index f665ca8f9e96..1aea42d71a64 100644
--- a/fs/xfs/quota/xfs_qm.c
+++ b/fs/xfs/quota/xfs_qm.c
@@ -1,39 +1,25 @@
1/* 1/*
2 * Copyright (c) 2000-2004 Silicon Graphics, Inc. All Rights Reserved. 2 * Copyright (c) 2000-2005 Silicon Graphics, Inc.
3 * All Rights Reserved.
3 * 4 *
4 * This program is free software; you can redistribute it and/or modify it 5 * This program is free software; you can redistribute it and/or
5 * under the terms of version 2 of the GNU General Public License as 6 * modify it under the terms of the GNU General Public License as
6 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
7 * 8 *
8 * This program is distributed in the hope that it would be useful, but 9 * This program is distributed in the hope that it would be useful,
9 * WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
11 * 13 *
12 * Further, this software is distributed without any warranty that it is 14 * You should have received a copy of the GNU General Public License
13 * free of the rightful claim of any third person regarding infringement 15 * along with this program; if not, write the Free Software Foundation,
14 * or the like. Any license provided herein, whether implied or 16 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
15 * otherwise, applies only to this software file. Patent licenses, if
16 * any, provided herein do not apply to combinations of this program with
17 * other software, or any other product whatsoever.
18 *
19 * You should have received a copy of the GNU General Public License along
20 * with this program; if not, write the Free Software Foundation, Inc., 59
21 * Temple Place - Suite 330, Boston MA 02111-1307, USA.
22 *
23 * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
24 * Mountain View, CA 94043, or:
25 *
26 * http://www.sgi.com
27 *
28 * For further information regarding this notice, see:
29 *
30 * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
31 */ 17 */
32
33#include "xfs.h" 18#include "xfs.h"
34#include "xfs_fs.h" 19#include "xfs_fs.h"
35#include "xfs_inum.h" 20#include "xfs_bit.h"
36#include "xfs_log.h" 21#include "xfs_log.h"
22#include "xfs_inum.h"
37#include "xfs_clnt.h" 23#include "xfs_clnt.h"
38#include "xfs_trans.h" 24#include "xfs_trans.h"
39#include "xfs_sb.h" 25#include "xfs_sb.h"
@@ -44,21 +30,20 @@
44#include "xfs_dmapi.h" 30#include "xfs_dmapi.h"
45#include "xfs_quota.h" 31#include "xfs_quota.h"
46#include "xfs_mount.h" 32#include "xfs_mount.h"
47#include "xfs_alloc_btree.h"
48#include "xfs_bmap_btree.h" 33#include "xfs_bmap_btree.h"
34#include "xfs_alloc_btree.h"
49#include "xfs_ialloc_btree.h" 35#include "xfs_ialloc_btree.h"
50#include "xfs_btree.h"
51#include "xfs_ialloc.h"
52#include "xfs_attr_sf.h"
53#include "xfs_dir_sf.h" 36#include "xfs_dir_sf.h"
54#include "xfs_dir2_sf.h" 37#include "xfs_dir2_sf.h"
38#include "xfs_attr_sf.h"
55#include "xfs_dinode.h" 39#include "xfs_dinode.h"
56#include "xfs_inode.h" 40#include "xfs_inode.h"
57#include "xfs_bmap.h" 41#include "xfs_btree.h"
58#include "xfs_bit.h" 42#include "xfs_ialloc.h"
43#include "xfs_itable.h"
59#include "xfs_rtalloc.h" 44#include "xfs_rtalloc.h"
60#include "xfs_error.h" 45#include "xfs_error.h"
61#include "xfs_itable.h" 46#include "xfs_bmap.h"
62#include "xfs_rw.h" 47#include "xfs_rw.h"
63#include "xfs_acl.h" 48#include "xfs_acl.h"
64#include "xfs_cap.h" 49#include "xfs_cap.h"
@@ -67,7 +52,6 @@
67#include "xfs_buf_item.h" 52#include "xfs_buf_item.h"
68#include "xfs_trans_space.h" 53#include "xfs_trans_space.h"
69#include "xfs_utils.h" 54#include "xfs_utils.h"
70
71#include "xfs_qm.h" 55#include "xfs_qm.h"
72 56
73/* 57/*
@@ -76,8 +60,9 @@
76 * quota functionality, including maintaining the freelist and hash 60 * quota functionality, including maintaining the freelist and hash
77 * tables of dquots. 61 * tables of dquots.
78 */ 62 */
79mutex_t xfs_Gqm_lock; 63mutex_t xfs_Gqm_lock;
80struct xfs_qm *xfs_Gqm; 64struct xfs_qm *xfs_Gqm;
65uint ndquot;
81 66
82kmem_zone_t *qm_dqzone; 67kmem_zone_t *qm_dqzone;
83kmem_zone_t *qm_dqtrxzone; 68kmem_zone_t *qm_dqtrxzone;
@@ -107,10 +92,10 @@ extern mutex_t qcheck_lock;
107 for (dqp = (l)->qh_next; dqp != NULL; dqp = dqp->NXT) { \ 92 for (dqp = (l)->qh_next; dqp != NULL; dqp = dqp->NXT) { \
108 cmn_err(CE_DEBUG, " %d. \"%d (%s)\" " \ 93 cmn_err(CE_DEBUG, " %d. \"%d (%s)\" " \
109 "bcnt = %d, icnt = %d, refs = %d", \ 94 "bcnt = %d, icnt = %d, refs = %d", \
110 ++i, (int) INT_GET(dqp->q_core.d_id, ARCH_CONVERT), \ 95 ++i, (int) be32_to_cpu(dqp->q_core.d_id), \
111 DQFLAGTO_TYPESTR(dqp), \ 96 DQFLAGTO_TYPESTR(dqp), \
112 (int) INT_GET(dqp->q_core.d_bcount, ARCH_CONVERT), \ 97 (int) be64_to_cpu(dqp->q_core.d_bcount), \
113 (int) INT_GET(dqp->q_core.d_icount, ARCH_CONVERT), \ 98 (int) be64_to_cpu(dqp->q_core.d_icount), \
114 (int) dqp->q_nrefs); } \ 99 (int) dqp->q_nrefs); } \
115} 100}
116#else 101#else
@@ -124,25 +109,25 @@ extern mutex_t qcheck_lock;
124STATIC struct xfs_qm * 109STATIC struct xfs_qm *
125xfs_Gqm_init(void) 110xfs_Gqm_init(void)
126{ 111{
127 xfs_qm_t *xqm; 112 xfs_dqhash_t *udqhash, *gdqhash;
128 int hsize, i; 113 xfs_qm_t *xqm;
129 114 uint i, hsize, flags = KM_SLEEP | KM_MAYFAIL;
130 xqm = kmem_zalloc(sizeof(xfs_qm_t), KM_SLEEP);
131 ASSERT(xqm);
132 115
133 /* 116 /*
134 * Initialize the dquot hash tables. 117 * Initialize the dquot hash tables.
135 */ 118 */
136 hsize = (DQUOT_HASH_HEURISTIC < XFS_QM_NCSIZE_THRESHOLD) ? 119 hsize = XFS_QM_HASHSIZE_HIGH;
137 XFS_QM_HASHSIZE_LOW : XFS_QM_HASHSIZE_HIGH; 120 while (!(udqhash = kmem_zalloc(hsize * sizeof(xfs_dqhash_t), flags))) {
138 xqm->qm_dqhashmask = hsize - 1; 121 if ((hsize >>= 1) <= XFS_QM_HASHSIZE_LOW)
122 flags = KM_SLEEP;
123 }
124 gdqhash = kmem_zalloc(hsize * sizeof(xfs_dqhash_t), KM_SLEEP);
125 ndquot = hsize << 8;
139 126
140 xqm->qm_usr_dqhtable = (xfs_dqhash_t *)kmem_zalloc(hsize * 127 xqm = kmem_zalloc(sizeof(xfs_qm_t), KM_SLEEP);
141 sizeof(xfs_dqhash_t), 128 xqm->qm_dqhashmask = hsize - 1;
142 KM_SLEEP); 129 xqm->qm_usr_dqhtable = udqhash;
143 xqm->qm_grp_dqhtable = (xfs_dqhash_t *)kmem_zalloc(hsize * 130 xqm->qm_grp_dqhtable = gdqhash;
144 sizeof(xfs_dqhash_t),
145 KM_SLEEP);
146 ASSERT(xqm->qm_usr_dqhtable != NULL); 131 ASSERT(xqm->qm_usr_dqhtable != NULL);
147 ASSERT(xqm->qm_grp_dqhtable != NULL); 132 ASSERT(xqm->qm_grp_dqhtable != NULL);
148 133
@@ -365,16 +350,6 @@ xfs_qm_mount_quotas(
365 int error = 0; 350 int error = 0;
366 uint sbf; 351 uint sbf;
367 352
368 /*
369 * If a file system had quotas running earlier, but decided to
370 * mount without -o uquota/pquota/gquota options, revoke the
371 * quotachecked license, and bail out.
372 */
373 if (! XFS_IS_QUOTA_ON(mp) &&
374 (mp->m_sb.sb_qflags & XFS_ALL_QUOTA_ACCT)) {
375 mp->m_qflags = 0;
376 goto write_changes;
377 }
378 353
379 /* 354 /*
380 * If quotas on realtime volumes is not supported, we disable 355 * If quotas on realtime volumes is not supported, we disable
@@ -388,11 +363,8 @@ xfs_qm_mount_quotas(
388 goto write_changes; 363 goto write_changes;
389 } 364 }
390 365
391#if defined(DEBUG) && defined(XFS_LOUD_RECOVERY)
392 cmn_err(CE_NOTE, "Attempting to turn on disk quotas.");
393#endif
394
395 ASSERT(XFS_IS_QUOTA_RUNNING(mp)); 366 ASSERT(XFS_IS_QUOTA_RUNNING(mp));
367
396 /* 368 /*
397 * Allocate the quotainfo structure inside the mount struct, and 369 * Allocate the quotainfo structure inside the mount struct, and
398 * create quotainode(s), and change/rev superblock if necessary. 370 * create quotainode(s), and change/rev superblock if necessary.
@@ -410,19 +382,14 @@ xfs_qm_mount_quotas(
410 */ 382 */
411 if (XFS_QM_NEED_QUOTACHECK(mp) && 383 if (XFS_QM_NEED_QUOTACHECK(mp) &&
412 !(mfsi_flags & XFS_MFSI_NO_QUOTACHECK)) { 384 !(mfsi_flags & XFS_MFSI_NO_QUOTACHECK)) {
413#ifdef DEBUG
414 cmn_err(CE_NOTE, "Doing a quotacheck. Please wait.");
415#endif
416 if ((error = xfs_qm_quotacheck(mp))) { 385 if ((error = xfs_qm_quotacheck(mp))) {
417 /* Quotacheck has failed and quotas have 386 /* Quotacheck has failed and quotas have
418 * been disabled. 387 * been disabled.
419 */ 388 */
420 return XFS_ERROR(error); 389 return XFS_ERROR(error);
421 } 390 }
422#ifdef DEBUG
423 cmn_err(CE_NOTE, "Done quotacheck.");
424#endif
425 } 391 }
392
426 write_changes: 393 write_changes:
427 /* 394 /*
428 * We actually don't have to acquire the SB_LOCK at all. 395 * We actually don't have to acquire the SB_LOCK at all.
@@ -761,7 +728,7 @@ xfs_qm_dqattach_one(
761 */ 728 */
762 if (udqhint && 729 if (udqhint &&
763 (dqp = udqhint->q_gdquot) && 730 (dqp = udqhint->q_gdquot) &&
764 (INT_GET(dqp->q_core.d_id, ARCH_CONVERT) == id)) { 731 (be32_to_cpu(dqp->q_core.d_id) == id)) {
765 ASSERT(XFS_DQ_IS_LOCKED(udqhint)); 732 ASSERT(XFS_DQ_IS_LOCKED(udqhint));
766 xfs_dqlock(dqp); 733 xfs_dqlock(dqp);
767 XFS_DQHOLD(dqp); 734 XFS_DQHOLD(dqp);
@@ -1231,42 +1198,24 @@ xfs_qm_init_quotainfo(
1231 * a user or group before he or she can not perform any 1198 * a user or group before he or she can not perform any
1232 * more writing. If it is zero, a default is used. 1199 * more writing. If it is zero, a default is used.
1233 */ 1200 */
1234 qinf->qi_btimelimit = 1201 qinf->qi_btimelimit = ddqp->d_btimer ?
1235 INT_GET(ddqp->d_btimer, ARCH_CONVERT) ? 1202 be32_to_cpu(ddqp->d_btimer) : XFS_QM_BTIMELIMIT;
1236 INT_GET(ddqp->d_btimer, ARCH_CONVERT) : 1203 qinf->qi_itimelimit = ddqp->d_itimer ?
1237 XFS_QM_BTIMELIMIT; 1204 be32_to_cpu(ddqp->d_itimer) : XFS_QM_ITIMELIMIT;
1238 qinf->qi_itimelimit = 1205 qinf->qi_rtbtimelimit = ddqp->d_rtbtimer ?
1239 INT_GET(ddqp->d_itimer, ARCH_CONVERT) ? 1206 be32_to_cpu(ddqp->d_rtbtimer) : XFS_QM_RTBTIMELIMIT;
1240 INT_GET(ddqp->d_itimer, ARCH_CONVERT) : 1207 qinf->qi_bwarnlimit = ddqp->d_bwarns ?
1241 XFS_QM_ITIMELIMIT; 1208 be16_to_cpu(ddqp->d_bwarns) : XFS_QM_BWARNLIMIT;
1242 qinf->qi_rtbtimelimit = 1209 qinf->qi_iwarnlimit = ddqp->d_iwarns ?
1243 INT_GET(ddqp->d_rtbtimer, ARCH_CONVERT) ? 1210 be16_to_cpu(ddqp->d_iwarns) : XFS_QM_IWARNLIMIT;
1244 INT_GET(ddqp->d_rtbtimer, ARCH_CONVERT) : 1211 qinf->qi_rtbwarnlimit = ddqp->d_rtbwarns ?
1245 XFS_QM_RTBTIMELIMIT; 1212 be16_to_cpu(ddqp->d_rtbwarns) : XFS_QM_RTBWARNLIMIT;
1246 qinf->qi_bwarnlimit = 1213 qinf->qi_bhardlimit = be64_to_cpu(ddqp->d_blk_hardlimit);
1247 INT_GET(ddqp->d_bwarns, ARCH_CONVERT) ? 1214 qinf->qi_bsoftlimit = be64_to_cpu(ddqp->d_blk_softlimit);
1248 INT_GET(ddqp->d_bwarns, ARCH_CONVERT) : 1215 qinf->qi_ihardlimit = be64_to_cpu(ddqp->d_ino_hardlimit);
1249 XFS_QM_BWARNLIMIT; 1216 qinf->qi_isoftlimit = be64_to_cpu(ddqp->d_ino_softlimit);
1250 qinf->qi_iwarnlimit = 1217 qinf->qi_rtbhardlimit = be64_to_cpu(ddqp->d_rtb_hardlimit);
1251 INT_GET(ddqp->d_iwarns, ARCH_CONVERT) ? 1218 qinf->qi_rtbsoftlimit = be64_to_cpu(ddqp->d_rtb_softlimit);
1252 INT_GET(ddqp->d_iwarns, ARCH_CONVERT) :
1253 XFS_QM_IWARNLIMIT;
1254 qinf->qi_rtbwarnlimit =
1255 INT_GET(ddqp->d_rtbwarns, ARCH_CONVERT) ?
1256 INT_GET(ddqp->d_rtbwarns, ARCH_CONVERT) :
1257 XFS_QM_RTBWARNLIMIT;
1258 qinf->qi_bhardlimit =
1259 INT_GET(ddqp->d_blk_hardlimit, ARCH_CONVERT);
1260 qinf->qi_bsoftlimit =
1261 INT_GET(ddqp->d_blk_softlimit, ARCH_CONVERT);
1262 qinf->qi_ihardlimit =
1263 INT_GET(ddqp->d_ino_hardlimit, ARCH_CONVERT);
1264 qinf->qi_isoftlimit =
1265 INT_GET(ddqp->d_ino_softlimit, ARCH_CONVERT);
1266 qinf->qi_rtbhardlimit =
1267 INT_GET(ddqp->d_rtb_hardlimit, ARCH_CONVERT);
1268 qinf->qi_rtbsoftlimit =
1269 INT_GET(ddqp->d_rtb_softlimit, ARCH_CONVERT);
1270 1219
1271 /* 1220 /*
1272 * We sent the XFS_QMOPT_DQSUSER flag to dqget because 1221 * We sent the XFS_QMOPT_DQSUSER flag to dqget because
@@ -1545,15 +1494,15 @@ xfs_qm_reset_dqcounts(
1545 */ 1494 */
1546 (void) xfs_qm_dqcheck(ddq, id+j, type, XFS_QMOPT_DQREPAIR, 1495 (void) xfs_qm_dqcheck(ddq, id+j, type, XFS_QMOPT_DQREPAIR,
1547 "xfs_quotacheck"); 1496 "xfs_quotacheck");
1548 INT_SET(ddq->d_bcount, ARCH_CONVERT, 0ULL); 1497 ddq->d_bcount = 0;
1549 INT_SET(ddq->d_icount, ARCH_CONVERT, 0ULL); 1498 ddq->d_icount = 0;
1550 INT_SET(ddq->d_rtbcount, ARCH_CONVERT, 0ULL); 1499 ddq->d_rtbcount = 0;
1551 INT_SET(ddq->d_btimer, ARCH_CONVERT, (time_t)0); 1500 ddq->d_btimer = 0;
1552 INT_SET(ddq->d_itimer, ARCH_CONVERT, (time_t)0); 1501 ddq->d_itimer = 0;
1553 INT_SET(ddq->d_rtbtimer, ARCH_CONVERT, (time_t)0); 1502 ddq->d_rtbtimer = 0;
1554 INT_SET(ddq->d_bwarns, ARCH_CONVERT, 0UL); 1503 ddq->d_bwarns = 0;
1555 INT_SET(ddq->d_iwarns, ARCH_CONVERT, 0UL); 1504 ddq->d_iwarns = 0;
1556 INT_SET(ddq->d_rtbwarns, ARCH_CONVERT, 0UL); 1505 ddq->d_rtbwarns = 0;
1557 ddq = (xfs_disk_dquot_t *) ((xfs_dqblk_t *)ddq + 1); 1506 ddq = (xfs_disk_dquot_t *) ((xfs_dqblk_t *)ddq + 1);
1558 } 1507 }
1559 1508
@@ -1726,14 +1675,14 @@ xfs_qm_quotacheck_dqadjust(
1726 * Adjust the inode count and the block count to reflect this inode's 1675 * Adjust the inode count and the block count to reflect this inode's
1727 * resource usage. 1676 * resource usage.
1728 */ 1677 */
1729 INT_MOD(dqp->q_core.d_icount, ARCH_CONVERT, +1); 1678 be64_add(&dqp->q_core.d_icount, 1);
1730 dqp->q_res_icount++; 1679 dqp->q_res_icount++;
1731 if (nblks) { 1680 if (nblks) {
1732 INT_MOD(dqp->q_core.d_bcount, ARCH_CONVERT, nblks); 1681 be64_add(&dqp->q_core.d_bcount, nblks);
1733 dqp->q_res_bcount += nblks; 1682 dqp->q_res_bcount += nblks;
1734 } 1683 }
1735 if (rtblks) { 1684 if (rtblks) {
1736 INT_MOD(dqp->q_core.d_rtbcount, ARCH_CONVERT, rtblks); 1685 be64_add(&dqp->q_core.d_rtbcount, rtblks);
1737 dqp->q_res_rtbcount += rtblks; 1686 dqp->q_res_rtbcount += rtblks;
1738 } 1687 }
1739 1688
@@ -2010,7 +1959,7 @@ xfs_qm_quotacheck(
2010 ASSERT(mp->m_quotainfo != NULL); 1959 ASSERT(mp->m_quotainfo != NULL);
2011 ASSERT(xfs_Gqm != NULL); 1960 ASSERT(xfs_Gqm != NULL);
2012 xfs_qm_destroy_quotainfo(mp); 1961 xfs_qm_destroy_quotainfo(mp);
2013 xfs_mount_reset_sbqflags(mp); 1962 (void)xfs_mount_reset_sbqflags(mp);
2014 } else { 1963 } else {
2015 cmn_err(CE_NOTE, "XFS quotacheck %s: Done.", mp->m_fsname); 1964 cmn_err(CE_NOTE, "XFS quotacheck %s: Done.", mp->m_fsname);
2016 } 1965 }
@@ -2220,7 +2169,7 @@ xfs_qm_shake_freelist(
2220 xfs_dqtrace_entry(dqp, "DQSHAKE: UNLINKING"); 2169 xfs_dqtrace_entry(dqp, "DQSHAKE: UNLINKING");
2221#ifdef QUOTADEBUG 2170#ifdef QUOTADEBUG
2222 cmn_err(CE_DEBUG, "Shake 0x%p, ID 0x%x\n", 2171 cmn_err(CE_DEBUG, "Shake 0x%p, ID 0x%x\n",
2223 dqp, INT_GET(dqp->q_core.d_id, ARCH_CONVERT)); 2172 dqp, be32_to_cpu(dqp->q_core.d_id));
2224#endif 2173#endif
2225 ASSERT(dqp->q_nrefs == 0); 2174 ASSERT(dqp->q_nrefs == 0);
2226 nextdqp = dqp->dq_flnext; 2175 nextdqp = dqp->dq_flnext;
@@ -2688,7 +2637,7 @@ xfs_qm_vop_chown_reserve(
2688 XFS_QMOPT_RES_RTBLKS : XFS_QMOPT_RES_REGBLKS; 2637 XFS_QMOPT_RES_RTBLKS : XFS_QMOPT_RES_REGBLKS;
2689 2638
2690 if (XFS_IS_UQUOTA_ON(mp) && udqp && 2639 if (XFS_IS_UQUOTA_ON(mp) && udqp &&
2691 ip->i_d.di_uid != (uid_t)INT_GET(udqp->q_core.d_id, ARCH_CONVERT)) { 2640 ip->i_d.di_uid != (uid_t)be32_to_cpu(udqp->q_core.d_id)) {
2692 delblksudq = udqp; 2641 delblksudq = udqp;
2693 /* 2642 /*
2694 * If there are delayed allocation blocks, then we have to 2643 * If there are delayed allocation blocks, then we have to
@@ -2701,10 +2650,10 @@ xfs_qm_vop_chown_reserve(
2701 } 2650 }
2702 } 2651 }
2703 if (XFS_IS_OQUOTA_ON(ip->i_mount) && gdqp) { 2652 if (XFS_IS_OQUOTA_ON(ip->i_mount) && gdqp) {
2704 if ((XFS_IS_GQUOTA_ON(ip->i_mount) && ip->i_d.di_gid != 2653 if ((XFS_IS_GQUOTA_ON(ip->i_mount) &&
2705 INT_GET(gdqp->q_core.d_id, ARCH_CONVERT)) || 2654 ip->i_d.di_gid != be32_to_cpu(gdqp->q_core.d_id)) ||
2706 (XFS_IS_PQUOTA_ON(ip->i_mount) && ip->i_d.di_projid != 2655 (XFS_IS_PQUOTA_ON(ip->i_mount) &&
2707 INT_GET(gdqp->q_core.d_id, ARCH_CONVERT))) { 2656 ip->i_d.di_projid != be32_to_cpu(gdqp->q_core.d_id))) {
2708 delblksgdq = gdqp; 2657 delblksgdq = gdqp;
2709 if (delblks) { 2658 if (delblks) {
2710 ASSERT(ip->i_gdquot); 2659 ASSERT(ip->i_gdquot);
@@ -2794,7 +2743,7 @@ xfs_qm_vop_dqattach_and_dqmod_newinode(
2794 xfs_dqunlock(udqp); 2743 xfs_dqunlock(udqp);
2795 ASSERT(ip->i_udquot == NULL); 2744 ASSERT(ip->i_udquot == NULL);
2796 ip->i_udquot = udqp; 2745 ip->i_udquot = udqp;
2797 ASSERT(ip->i_d.di_uid == INT_GET(udqp->q_core.d_id, ARCH_CONVERT)); 2746 ASSERT(ip->i_d.di_uid == be32_to_cpu(udqp->q_core.d_id));
2798 xfs_trans_mod_dquot(tp, udqp, XFS_TRANS_DQ_ICOUNT, 1); 2747 xfs_trans_mod_dquot(tp, udqp, XFS_TRANS_DQ_ICOUNT, 1);
2799 } 2748 }
2800 if (gdqp) { 2749 if (gdqp) {
@@ -2803,7 +2752,7 @@ xfs_qm_vop_dqattach_and_dqmod_newinode(
2803 xfs_dqunlock(gdqp); 2752 xfs_dqunlock(gdqp);
2804 ASSERT(ip->i_gdquot == NULL); 2753 ASSERT(ip->i_gdquot == NULL);
2805 ip->i_gdquot = gdqp; 2754 ip->i_gdquot = gdqp;
2806 ASSERT(ip->i_d.di_gid == INT_GET(gdqp->q_core.d_id, ARCH_CONVERT)); 2755 ASSERT(ip->i_d.di_gid == be32_to_cpu(gdqp->q_core.d_id));
2807 xfs_trans_mod_dquot(tp, gdqp, XFS_TRANS_DQ_ICOUNT, 1); 2756 xfs_trans_mod_dquot(tp, gdqp, XFS_TRANS_DQ_ICOUNT, 1);
2808 } 2757 }
2809} 2758}