aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/xfs/quota/xfs_dquot.c184
-rw-r--r--fs/xfs/quota/xfs_dquot_item.c2
-rw-r--r--fs/xfs/quota/xfs_qm.c102
-rw-r--r--fs/xfs/quota/xfs_qm_syscalls.c108
-rw-r--r--fs/xfs/quota/xfs_trans_dquot.c52
-rw-r--r--fs/xfs/xfs_arch.h15
-rw-r--r--fs/xfs/xfs_log_recover.c58
-rw-r--r--fs/xfs/xfs_quota.h42
8 files changed, 271 insertions, 292 deletions
diff --git a/fs/xfs/quota/xfs_dquot.c b/fs/xfs/quota/xfs_dquot.c
index d3c23accfa19..00b5043dfa5a 100644
--- a/fs/xfs/quota/xfs_dquot.c
+++ b/fs/xfs/quota/xfs_dquot.c
@@ -96,7 +96,7 @@ xfs_qm_dqinit(
96 96
97 brandnewdquot = xfs_qm_dqalloc_incore(&dqp); 97 brandnewdquot = xfs_qm_dqalloc_incore(&dqp);
98 dqp->dq_flags = type; 98 dqp->dq_flags = type;
99 INT_SET(dqp->q_core.d_id, ARCH_CONVERT, id); 99 dqp->q_core.d_id = cpu_to_be32(id);
100 dqp->q_mount = mp; 100 dqp->q_mount = mp;
101 101
102 /* 102 /*
@@ -178,10 +178,10 @@ xfs_qm_dqinit_core(
178 /* 178 /*
179 * Caller has zero'd the entire dquot 'chunk' already. 179 * Caller has zero'd the entire dquot 'chunk' already.
180 */ 180 */
181 INT_SET(d->dd_diskdq.d_magic, ARCH_CONVERT, XFS_DQUOT_MAGIC); 181 d->dd_diskdq.d_magic = cpu_to_be16(XFS_DQUOT_MAGIC);
182 INT_SET(d->dd_diskdq.d_version, ARCH_CONVERT, XFS_DQUOT_VERSION); 182 d->dd_diskdq.d_version = XFS_DQUOT_VERSION;
183 INT_SET(d->dd_diskdq.d_id, ARCH_CONVERT, id); 183 d->dd_diskdq.d_id = cpu_to_be32(id);
184 INT_SET(d->dd_diskdq.d_flags, ARCH_CONVERT, type); 184 d->dd_diskdq.d_flags = type;
185} 185}
186 186
187 187
@@ -211,19 +211,13 @@ __xfs_dqtrace_entry(
211 (void *)(__psint_t)dqp->q_nrefs, 211 (void *)(__psint_t)dqp->q_nrefs,
212 (void *)(__psint_t)dqp->dq_flags, 212 (void *)(__psint_t)dqp->dq_flags,
213 (void *)(__psint_t)dqp->q_res_bcount, 213 (void *)(__psint_t)dqp->q_res_bcount,
214 (void *)(__psint_t)INT_GET(dqp->q_core.d_bcount, 214 (void *)(__psint_t)be64_to_cpu(dqp->q_core.d_bcount),
215 ARCH_CONVERT), 215 (void *)(__psint_t)be64_to_cpu(dqp->q_core.d_icount),
216 (void *)(__psint_t)INT_GET(dqp->q_core.d_icount, 216 (void *)(__psint_t)be64_to_cpu(dqp->q_core.d_blk_hardlimit),
217 ARCH_CONVERT), 217 (void *)(__psint_t)be64_to_cpu(dqp->q_core.d_blk_softlimit),
218 (void *)(__psint_t)INT_GET(dqp->q_core.d_blk_hardlimit, 218 (void *)(__psint_t)be64_to_cpu(dqp->q_core.d_ino_hardlimit),
219 ARCH_CONVERT), 219 (void *)(__psint_t)be64_to_cpu(dqp->q_core.d_ino_softlimit),
220 (void *)(__psint_t)INT_GET(dqp->q_core.d_blk_softlimit, 220 (void *)(__psint_t)be32_to_cpu(dqp->q_core.d_id),
221 ARCH_CONVERT),
222 (void *)(__psint_t)INT_GET(dqp->q_core.d_ino_hardlimit,
223 ARCH_CONVERT),
224 (void *)(__psint_t)INT_GET(dqp->q_core.d_ino_softlimit,
225 ARCH_CONVERT),
226 (void *)(__psint_t)INT_GET(dqp->q_core.d_id, ARCH_CONVERT),
227 (void *)(__psint_t)current_pid(), 221 (void *)(__psint_t)current_pid(),
228 (void *)(__psint_t)ino, 222 (void *)(__psint_t)ino,
229 (void *)(__psint_t)retaddr, 223 (void *)(__psint_t)retaddr,
@@ -248,17 +242,17 @@ xfs_qm_adjust_dqlimits(
248 ASSERT(d->d_id); 242 ASSERT(d->d_id);
249 243
250 if (q->qi_bsoftlimit && !d->d_blk_softlimit) 244 if (q->qi_bsoftlimit && !d->d_blk_softlimit)
251 INT_SET(d->d_blk_softlimit, ARCH_CONVERT, q->qi_bsoftlimit); 245 d->d_blk_softlimit = cpu_to_be64(q->qi_bsoftlimit);
252 if (q->qi_bhardlimit && !d->d_blk_hardlimit) 246 if (q->qi_bhardlimit && !d->d_blk_hardlimit)
253 INT_SET(d->d_blk_hardlimit, ARCH_CONVERT, q->qi_bhardlimit); 247 d->d_blk_hardlimit = cpu_to_be64(q->qi_bhardlimit);
254 if (q->qi_isoftlimit && !d->d_ino_softlimit) 248 if (q->qi_isoftlimit && !d->d_ino_softlimit)
255 INT_SET(d->d_ino_softlimit, ARCH_CONVERT, q->qi_isoftlimit); 249 d->d_ino_softlimit = cpu_to_be64(q->qi_isoftlimit);
256 if (q->qi_ihardlimit && !d->d_ino_hardlimit) 250 if (q->qi_ihardlimit && !d->d_ino_hardlimit)
257 INT_SET(d->d_ino_hardlimit, ARCH_CONVERT, q->qi_ihardlimit); 251 d->d_ino_hardlimit = cpu_to_be64(q->qi_ihardlimit);
258 if (q->qi_rtbsoftlimit && !d->d_rtb_softlimit) 252 if (q->qi_rtbsoftlimit && !d->d_rtb_softlimit)
259 INT_SET(d->d_rtb_softlimit, ARCH_CONVERT, q->qi_rtbsoftlimit); 253 d->d_rtb_softlimit = cpu_to_be64(q->qi_rtbsoftlimit);
260 if (q->qi_rtbhardlimit && !d->d_rtb_hardlimit) 254 if (q->qi_rtbhardlimit && !d->d_rtb_hardlimit)
261 INT_SET(d->d_rtb_hardlimit, ARCH_CONVERT, q->qi_rtbhardlimit); 255 d->d_rtb_hardlimit = cpu_to_be64(q->qi_rtbhardlimit);
262} 256}
263 257
264/* 258/*
@@ -282,81 +276,81 @@ xfs_qm_adjust_dqtimers(
282 ASSERT(d->d_id); 276 ASSERT(d->d_id);
283 277
284#ifdef QUOTADEBUG 278#ifdef QUOTADEBUG
285 if (INT_GET(d->d_blk_hardlimit, ARCH_CONVERT)) 279 if (d->d_blk_hardlimit)
286 ASSERT(INT_GET(d->d_blk_softlimit, ARCH_CONVERT) <= 280 ASSERT(be64_to_cpu(d->d_blk_softlimit) <=
287 INT_GET(d->d_blk_hardlimit, ARCH_CONVERT)); 281 be64_to_cpu(d->d_blk_hardlimit));
288 if (INT_GET(d->d_ino_hardlimit, ARCH_CONVERT)) 282 if (d->d_ino_hardlimit)
289 ASSERT(INT_GET(d->d_ino_softlimit, ARCH_CONVERT) <= 283 ASSERT(be64_to_cpu(d->d_ino_softlimit) <=
290 INT_GET(d->d_ino_hardlimit, ARCH_CONVERT)); 284 be64_to_cpu(d->d_ino_hardlimit));
291 if (INT_GET(d->d_rtb_hardlimit, ARCH_CONVERT)) 285 if (d->d_rtb_hardlimit)
292 ASSERT(INT_GET(d->d_rtb_softlimit, ARCH_CONVERT) <= 286 ASSERT(be64_to_cpu(d->d_rtb_softlimit) <=
293 INT_GET(d->d_rtb_hardlimit, ARCH_CONVERT)); 287 be64_to_cpu(d->d_rtb_hardlimit));
294#endif 288#endif
295 if (!d->d_btimer) { 289 if (!d->d_btimer) {
296 if ((INT_GET(d->d_blk_softlimit, ARCH_CONVERT) && 290 if ((d->d_blk_softlimit &&
297 (INT_GET(d->d_bcount, ARCH_CONVERT) >= 291 (be64_to_cpu(d->d_bcount) >=
298 INT_GET(d->d_blk_softlimit, ARCH_CONVERT))) || 292 be64_to_cpu(d->d_blk_softlimit))) ||
299 (INT_GET(d->d_blk_hardlimit, ARCH_CONVERT) && 293 (d->d_blk_hardlimit &&
300 (INT_GET(d->d_bcount, ARCH_CONVERT) >= 294 (be64_to_cpu(d->d_bcount) >=
301 INT_GET(d->d_blk_hardlimit, ARCH_CONVERT)))) { 295 be64_to_cpu(d->d_blk_hardlimit)))) {
302 INT_SET(d->d_btimer, ARCH_CONVERT, 296 d->d_btimer = cpu_to_be32(get_seconds() +
303 get_seconds() + XFS_QI_BTIMELIMIT(mp)); 297 XFS_QI_BTIMELIMIT(mp));
304 } else { 298 } else {
305 d->d_bwarns = 0; 299 d->d_bwarns = 0;
306 } 300 }
307 } else { 301 } else {
308 if ((!d->d_blk_softlimit || 302 if ((!d->d_blk_softlimit ||
309 (INT_GET(d->d_bcount, ARCH_CONVERT) < 303 (be64_to_cpu(d->d_bcount) <
310 INT_GET(d->d_blk_softlimit, ARCH_CONVERT))) && 304 be64_to_cpu(d->d_blk_softlimit))) &&
311 (!d->d_blk_hardlimit || 305 (!d->d_blk_hardlimit ||
312 (INT_GET(d->d_bcount, ARCH_CONVERT) < 306 (be64_to_cpu(d->d_bcount) <
313 INT_GET(d->d_blk_hardlimit, ARCH_CONVERT)))) { 307 be64_to_cpu(d->d_blk_hardlimit)))) {
314 d->d_btimer = 0; 308 d->d_btimer = 0;
315 } 309 }
316 } 310 }
317 311
318 if (!d->d_itimer) { 312 if (!d->d_itimer) {
319 if ((INT_GET(d->d_ino_softlimit, ARCH_CONVERT) && 313 if ((d->d_ino_softlimit &&
320 (INT_GET(d->d_icount, ARCH_CONVERT) >= 314 (be64_to_cpu(d->d_icount) >=
321 INT_GET(d->d_ino_softlimit, ARCH_CONVERT))) || 315 be64_to_cpu(d->d_ino_softlimit))) ||
322 (INT_GET(d->d_ino_hardlimit, ARCH_CONVERT) && 316 (d->d_ino_hardlimit &&
323 (INT_GET(d->d_icount, ARCH_CONVERT) >= 317 (be64_to_cpu(d->d_icount) >=
324 INT_GET(d->d_ino_hardlimit, ARCH_CONVERT)))) { 318 be64_to_cpu(d->d_ino_hardlimit)))) {
325 INT_SET(d->d_itimer, ARCH_CONVERT, 319 d->d_itimer = cpu_to_be32(get_seconds() +
326 get_seconds() + XFS_QI_ITIMELIMIT(mp)); 320 XFS_QI_ITIMELIMIT(mp));
327 } else { 321 } else {
328 d->d_iwarns = 0; 322 d->d_iwarns = 0;
329 } 323 }
330 } else { 324 } else {
331 if ((!d->d_ino_softlimit || 325 if ((!d->d_ino_softlimit ||
332 (INT_GET(d->d_icount, ARCH_CONVERT) < 326 (be64_to_cpu(d->d_icount) <
333 INT_GET(d->d_ino_softlimit, ARCH_CONVERT))) && 327 be64_to_cpu(d->d_ino_softlimit))) &&
334 (!d->d_ino_hardlimit || 328 (!d->d_ino_hardlimit ||
335 (INT_GET(d->d_icount, ARCH_CONVERT) < 329 (be64_to_cpu(d->d_icount) <
336 INT_GET(d->d_ino_hardlimit, ARCH_CONVERT)))) { 330 be64_to_cpu(d->d_ino_hardlimit)))) {
337 d->d_itimer = 0; 331 d->d_itimer = 0;
338 } 332 }
339 } 333 }
340 334
341 if (!d->d_rtbtimer) { 335 if (!d->d_rtbtimer) {
342 if ((INT_GET(d->d_rtb_softlimit, ARCH_CONVERT) && 336 if ((d->d_rtb_softlimit &&
343 (INT_GET(d->d_rtbcount, ARCH_CONVERT) >= 337 (be64_to_cpu(d->d_rtbcount) >=
344 INT_GET(d->d_rtb_softlimit, ARCH_CONVERT))) || 338 be64_to_cpu(d->d_rtb_softlimit))) ||
345 (INT_GET(d->d_rtb_hardlimit, ARCH_CONVERT) && 339 (d->d_rtb_hardlimit &&
346 (INT_GET(d->d_rtbcount, ARCH_CONVERT) >= 340 (be64_to_cpu(d->d_rtbcount) >=
347 INT_GET(d->d_rtb_hardlimit, ARCH_CONVERT)))) { 341 be64_to_cpu(d->d_rtb_hardlimit)))) {
348 INT_SET(d->d_rtbtimer, ARCH_CONVERT, 342 d->d_rtbtimer = cpu_to_be32(get_seconds() +
349 get_seconds() + XFS_QI_RTBTIMELIMIT(mp)); 343 XFS_QI_RTBTIMELIMIT(mp));
350 } else { 344 } else {
351 d->d_rtbwarns = 0; 345 d->d_rtbwarns = 0;
352 } 346 }
353 } else { 347 } else {
354 if ((!d->d_rtb_softlimit || 348 if ((!d->d_rtb_softlimit ||
355 (INT_GET(d->d_rtbcount, ARCH_CONVERT) < 349 (be64_to_cpu(d->d_rtbcount) <
356 INT_GET(d->d_rtb_softlimit, ARCH_CONVERT))) && 350 be64_to_cpu(d->d_rtb_softlimit))) &&
357 (!d->d_rtb_hardlimit || 351 (!d->d_rtb_hardlimit ||
358 (INT_GET(d->d_rtbcount, ARCH_CONVERT) < 352 (be64_to_cpu(d->d_rtbcount) <
359 INT_GET(d->d_rtb_hardlimit, ARCH_CONVERT)))) { 353 be64_to_cpu(d->d_rtb_hardlimit)))) {
360 d->d_rtbtimer = 0; 354 d->d_rtbtimer = 0;
361 } 355 }
362 } 356 }
@@ -474,7 +468,7 @@ xfs_qm_dqalloc(
474 * Make a chunk of dquots out of this buffer and log 468 * Make a chunk of dquots out of this buffer and log
475 * the entire thing. 469 * the entire thing.
476 */ 470 */
477 xfs_qm_init_dquot_blk(tp, mp, INT_GET(dqp->q_core.d_id, ARCH_CONVERT), 471 xfs_qm_init_dquot_blk(tp, mp, be32_to_cpu(dqp->q_core.d_id),
478 dqp->dq_flags & XFS_DQ_ALLTYPES, bp); 472 dqp->dq_flags & XFS_DQ_ALLTYPES, bp);
479 473
480 /* 474 /*
@@ -538,7 +532,7 @@ xfs_qm_dqtobp(
538 xfs_trans_t *tp = (tpp ? *tpp : NULL); 532 xfs_trans_t *tp = (tpp ? *tpp : NULL);
539 533
540 mp = dqp->q_mount; 534 mp = dqp->q_mount;
541 id = INT_GET(dqp->q_core.d_id, ARCH_CONVERT); 535 id = be32_to_cpu(dqp->q_core.d_id);
542 nmaps = 1; 536 nmaps = 1;
543 newdquot = B_FALSE; 537 newdquot = B_FALSE;
544 538
@@ -677,16 +671,16 @@ xfs_qm_dqread(
677 671
678 /* copy everything from disk dquot to the incore dquot */ 672 /* copy everything from disk dquot to the incore dquot */
679 memcpy(&dqp->q_core, ddqp, sizeof(xfs_disk_dquot_t)); 673 memcpy(&dqp->q_core, ddqp, sizeof(xfs_disk_dquot_t));
680 ASSERT(INT_GET(dqp->q_core.d_id, ARCH_CONVERT) == id); 674 ASSERT(be32_to_cpu(dqp->q_core.d_id) == id);
681 xfs_qm_dquot_logitem_init(dqp); 675 xfs_qm_dquot_logitem_init(dqp);
682 676
683 /* 677 /*
684 * Reservation counters are defined as reservation plus current usage 678 * Reservation counters are defined as reservation plus current usage
685 * to avoid having to add everytime. 679 * to avoid having to add everytime.
686 */ 680 */
687 dqp->q_res_bcount = INT_GET(ddqp->d_bcount, ARCH_CONVERT); 681 dqp->q_res_bcount = be64_to_cpu(ddqp->d_bcount);
688 dqp->q_res_icount = INT_GET(ddqp->d_icount, ARCH_CONVERT); 682 dqp->q_res_icount = be64_to_cpu(ddqp->d_icount);
689 dqp->q_res_rtbcount = INT_GET(ddqp->d_rtbcount, ARCH_CONVERT); 683 dqp->q_res_rtbcount = be64_to_cpu(ddqp->d_rtbcount);
690 684
691 /* Mark the buf so that this will stay incore a little longer */ 685 /* Mark the buf so that this will stay incore a little longer */
692 XFS_BUF_SET_VTYPE_REF(bp, B_FS_DQUOT, XFS_DQUOT_REF); 686 XFS_BUF_SET_VTYPE_REF(bp, B_FS_DQUOT, XFS_DQUOT_REF);
@@ -812,7 +806,7 @@ xfs_qm_dqlookup(
812 * dqlock to look at the id field of the dquot, since the 806 * dqlock to look at the id field of the dquot, since the
813 * id can't be modified without the hashlock anyway. 807 * id can't be modified without the hashlock anyway.
814 */ 808 */
815 if (INT_GET(dqp->q_core.d_id, ARCH_CONVERT) == id && dqp->q_mount == mp) { 809 if (be32_to_cpu(dqp->q_core.d_id) == id && dqp->q_mount == mp) {
816 xfs_dqtrace_entry(dqp, "DQFOUND BY LOOKUP"); 810 xfs_dqtrace_entry(dqp, "DQFOUND BY LOOKUP");
817 /* 811 /*
818 * All in core dquots must be on the dqlist of mp 812 * All in core dquots must be on the dqlist of mp
@@ -843,7 +837,7 @@ xfs_qm_dqlookup(
843 * id couldn't have changed; we had the hashlock all 837 * id couldn't have changed; we had the hashlock all
844 * along 838 * along
845 */ 839 */
846 ASSERT(INT_GET(dqp->q_core.d_id, ARCH_CONVERT) == id); 840 ASSERT(be32_to_cpu(dqp->q_core.d_id) == id);
847 841
848 if (flist_locked) { 842 if (flist_locked) {
849 if (dqp->q_nrefs != 0) { 843 if (dqp->q_nrefs != 0) {
@@ -1265,7 +1259,7 @@ xfs_qm_dqflush(
1265 return (error); 1259 return (error);
1266 } 1260 }
1267 1261
1268 if (xfs_qm_dqcheck(&dqp->q_core, INT_GET(ddqp->d_id, ARCH_CONVERT), 1262 if (xfs_qm_dqcheck(&dqp->q_core, be32_to_cpu(ddqp->d_id),
1269 0, XFS_QMOPT_DOWARN, "dqflush (incore copy)")) { 1263 0, XFS_QMOPT_DOWARN, "dqflush (incore copy)")) {
1270 xfs_force_shutdown(dqp->q_mount, XFS_CORRUPT_INCORE); 1264 xfs_force_shutdown(dqp->q_mount, XFS_CORRUPT_INCORE);
1271 return XFS_ERROR(EIO); 1265 return XFS_ERROR(EIO);
@@ -1418,8 +1412,8 @@ xfs_dqlock2(
1418{ 1412{
1419 if (d1 && d2) { 1413 if (d1 && d2) {
1420 ASSERT(d1 != d2); 1414 ASSERT(d1 != d2);
1421 if (INT_GET(d1->q_core.d_id, ARCH_CONVERT) > 1415 if (be32_to_cpu(d1->q_core.d_id) >
1422 INT_GET(d2->q_core.d_id, ARCH_CONVERT)) { 1416 be32_to_cpu(d2->q_core.d_id)) {
1423 xfs_dqlock(d2); 1417 xfs_dqlock(d2);
1424 xfs_dqlock(d1); 1418 xfs_dqlock(d1);
1425 } else { 1419 } else {
@@ -1541,33 +1535,33 @@ xfs_qm_dqprint(xfs_dquot_t *dqp)
1541{ 1535{
1542 cmn_err(CE_DEBUG, "-----------KERNEL DQUOT----------------"); 1536 cmn_err(CE_DEBUG, "-----------KERNEL DQUOT----------------");
1543 cmn_err(CE_DEBUG, "---- dquotID = %d", 1537 cmn_err(CE_DEBUG, "---- dquotID = %d",
1544 (int)INT_GET(dqp->q_core.d_id, ARCH_CONVERT)); 1538 (int)be32_to_cpu(dqp->q_core.d_id));
1545 cmn_err(CE_DEBUG, "---- type = %s", DQFLAGTO_TYPESTR(dqp)); 1539 cmn_err(CE_DEBUG, "---- type = %s", DQFLAGTO_TYPESTR(dqp));
1546 cmn_err(CE_DEBUG, "---- fs = 0x%p", dqp->q_mount); 1540 cmn_err(CE_DEBUG, "---- fs = 0x%p", dqp->q_mount);
1547 cmn_err(CE_DEBUG, "---- blkno = 0x%x", (int) dqp->q_blkno); 1541 cmn_err(CE_DEBUG, "---- blkno = 0x%x", (int) dqp->q_blkno);
1548 cmn_err(CE_DEBUG, "---- boffset = 0x%x", (int) dqp->q_bufoffset); 1542 cmn_err(CE_DEBUG, "---- boffset = 0x%x", (int) dqp->q_bufoffset);
1549 cmn_err(CE_DEBUG, "---- blkhlimit = %Lu (0x%x)", 1543 cmn_err(CE_DEBUG, "---- blkhlimit = %Lu (0x%x)",
1550 INT_GET(dqp->q_core.d_blk_hardlimit, ARCH_CONVERT), 1544 be64_to_cpu(dqp->q_core.d_blk_hardlimit),
1551 (int) INT_GET(dqp->q_core.d_blk_hardlimit, ARCH_CONVERT)); 1545 (int)be64_to_cpu(dqp->q_core.d_blk_hardlimit));
1552 cmn_err(CE_DEBUG, "---- blkslimit = %Lu (0x%x)", 1546 cmn_err(CE_DEBUG, "---- blkslimit = %Lu (0x%x)",
1553 INT_GET(dqp->q_core.d_blk_softlimit, ARCH_CONVERT), 1547 be64_to_cpu(dqp->q_core.d_blk_softlimit),
1554 (int)INT_GET(dqp->q_core.d_blk_softlimit, ARCH_CONVERT)); 1548 (int)be64_to_cpu(dqp->q_core.d_blk_softlimit));
1555 cmn_err(CE_DEBUG, "---- inohlimit = %Lu (0x%x)", 1549 cmn_err(CE_DEBUG, "---- inohlimit = %Lu (0x%x)",
1556 INT_GET(dqp->q_core.d_ino_hardlimit, ARCH_CONVERT), 1550 be64_to_cpu(dqp->q_core.d_ino_hardlimit),
1557 (int)INT_GET(dqp->q_core.d_ino_hardlimit, ARCH_CONVERT)); 1551 (int)be64_to_cpu(dqp->q_core.d_ino_hardlimit));
1558 cmn_err(CE_DEBUG, "---- inoslimit = %Lu (0x%x)", 1552 cmn_err(CE_DEBUG, "---- inoslimit = %Lu (0x%x)",
1559 INT_GET(dqp->q_core.d_ino_softlimit, ARCH_CONVERT), 1553 be64_to_cpu(dqp->q_core.d_ino_softlimit),
1560 (int)INT_GET(dqp->q_core.d_ino_softlimit, ARCH_CONVERT)); 1554 (int)be64_to_cpu(dqp->q_core.d_ino_softlimit));
1561 cmn_err(CE_DEBUG, "---- bcount = %Lu (0x%x)", 1555 cmn_err(CE_DEBUG, "---- bcount = %Lu (0x%x)",
1562 INT_GET(dqp->q_core.d_bcount, ARCH_CONVERT), 1556 be64_to_cpu(dqp->q_core.d_bcount),
1563 (int)INT_GET(dqp->q_core.d_bcount, ARCH_CONVERT)); 1557 (int)be64_to_cpu(dqp->q_core.d_bcount));
1564 cmn_err(CE_DEBUG, "---- icount = %Lu (0x%x)", 1558 cmn_err(CE_DEBUG, "---- icount = %Lu (0x%x)",
1565 INT_GET(dqp->q_core.d_icount, ARCH_CONVERT), 1559 be64_to_cpu(dqp->q_core.d_icount),
1566 (int)INT_GET(dqp->q_core.d_icount, ARCH_CONVERT)); 1560 (int)be64_to_cpu(dqp->q_core.d_icount));
1567 cmn_err(CE_DEBUG, "---- btimer = %d", 1561 cmn_err(CE_DEBUG, "---- btimer = %d",
1568 (int)INT_GET(dqp->q_core.d_btimer, ARCH_CONVERT)); 1562 (int)be32_to_cpu(dqp->q_core.d_btimer));
1569 cmn_err(CE_DEBUG, "---- itimer = %d", 1563 cmn_err(CE_DEBUG, "---- itimer = %d",
1570 (int)INT_GET(dqp->q_core.d_itimer, ARCH_CONVERT)); 1564 (int)be32_to_cpu(dqp->q_core.d_itimer));
1571 cmn_err(CE_DEBUG, "---------------------------"); 1565 cmn_err(CE_DEBUG, "---------------------------");
1572} 1566}
1573#endif 1567#endif
diff --git a/fs/xfs/quota/xfs_dquot_item.c b/fs/xfs/quota/xfs_dquot_item.c
index ea100061a0ae..2f69822344e5 100644
--- a/fs/xfs/quota/xfs_dquot_item.c
+++ b/fs/xfs/quota/xfs_dquot_item.c
@@ -450,7 +450,7 @@ xfs_qm_dquot_logitem_init(
450 lp->qli_item.li_mountp = dqp->q_mount; 450 lp->qli_item.li_mountp = dqp->q_mount;
451 lp->qli_dquot = dqp; 451 lp->qli_dquot = dqp;
452 lp->qli_format.qlf_type = XFS_LI_DQUOT; 452 lp->qli_format.qlf_type = XFS_LI_DQUOT;
453 lp->qli_format.qlf_id = INT_GET(dqp->q_core.d_id, ARCH_CONVERT); 453 lp->qli_format.qlf_id = be32_to_cpu(dqp->q_core.d_id);
454 lp->qli_format.qlf_blkno = dqp->q_blkno; 454 lp->qli_format.qlf_blkno = dqp->q_blkno;
455 lp->qli_format.qlf_len = 1; 455 lp->qli_format.qlf_len = 1;
456 /* 456 /*
diff --git a/fs/xfs/quota/xfs_qm.c b/fs/xfs/quota/xfs_qm.c
index a545d3e142f6..79aadb1c1f44 100644
--- a/fs/xfs/quota/xfs_qm.c
+++ b/fs/xfs/quota/xfs_qm.c
@@ -91,10 +91,10 @@ extern mutex_t qcheck_lock;
91 for (dqp = (l)->qh_next; dqp != NULL; dqp = dqp->NXT) { \ 91 for (dqp = (l)->qh_next; dqp != NULL; dqp = dqp->NXT) { \
92 cmn_err(CE_DEBUG, " %d. \"%d (%s)\" " \ 92 cmn_err(CE_DEBUG, " %d. \"%d (%s)\" " \
93 "bcnt = %d, icnt = %d, refs = %d", \ 93 "bcnt = %d, icnt = %d, refs = %d", \
94 ++i, (int) INT_GET(dqp->q_core.d_id, ARCH_CONVERT), \ 94 ++i, (int) be32_to_cpu(dqp->q_core.d_id), \
95 DQFLAGTO_TYPESTR(dqp), \ 95 DQFLAGTO_TYPESTR(dqp), \
96 (int) INT_GET(dqp->q_core.d_bcount, ARCH_CONVERT), \ 96 (int) be64_to_cpu(dqp->q_core.d_bcount), \
97 (int) INT_GET(dqp->q_core.d_icount, ARCH_CONVERT), \ 97 (int) be64_to_cpu(dqp->q_core.d_icount), \
98 (int) dqp->q_nrefs); } \ 98 (int) dqp->q_nrefs); } \
99} 99}
100#else 100#else
@@ -727,7 +727,7 @@ xfs_qm_dqattach_one(
727 */ 727 */
728 if (udqhint && 728 if (udqhint &&
729 (dqp = udqhint->q_gdquot) && 729 (dqp = udqhint->q_gdquot) &&
730 (INT_GET(dqp->q_core.d_id, ARCH_CONVERT) == id)) { 730 (be32_to_cpu(dqp->q_core.d_id) == id)) {
731 ASSERT(XFS_DQ_IS_LOCKED(udqhint)); 731 ASSERT(XFS_DQ_IS_LOCKED(udqhint));
732 xfs_dqlock(dqp); 732 xfs_dqlock(dqp);
733 XFS_DQHOLD(dqp); 733 XFS_DQHOLD(dqp);
@@ -1197,42 +1197,24 @@ xfs_qm_init_quotainfo(
1197 * a user or group before he or she can not perform any 1197 * a user or group before he or she can not perform any
1198 * more writing. If it is zero, a default is used. 1198 * more writing. If it is zero, a default is used.
1199 */ 1199 */
1200 qinf->qi_btimelimit = 1200 qinf->qi_btimelimit = ddqp->d_btimer ?
1201 INT_GET(ddqp->d_btimer, ARCH_CONVERT) ? 1201 be32_to_cpu(ddqp->d_btimer) : XFS_QM_BTIMELIMIT;
1202 INT_GET(ddqp->d_btimer, ARCH_CONVERT) : 1202 qinf->qi_itimelimit = ddqp->d_itimer ?
1203 XFS_QM_BTIMELIMIT; 1203 be32_to_cpu(ddqp->d_itimer) : XFS_QM_ITIMELIMIT;
1204 qinf->qi_itimelimit = 1204 qinf->qi_rtbtimelimit = ddqp->d_rtbtimer ?
1205 INT_GET(ddqp->d_itimer, ARCH_CONVERT) ? 1205 be32_to_cpu(ddqp->d_rtbtimer) : XFS_QM_RTBTIMELIMIT;
1206 INT_GET(ddqp->d_itimer, ARCH_CONVERT) : 1206 qinf->qi_bwarnlimit = ddqp->d_bwarns ?
1207 XFS_QM_ITIMELIMIT; 1207 be16_to_cpu(ddqp->d_bwarns) : XFS_QM_BWARNLIMIT;
1208 qinf->qi_rtbtimelimit = 1208 qinf->qi_iwarnlimit = ddqp->d_iwarns ?
1209 INT_GET(ddqp->d_rtbtimer, ARCH_CONVERT) ? 1209 be16_to_cpu(ddqp->d_iwarns) : XFS_QM_IWARNLIMIT;
1210 INT_GET(ddqp->d_rtbtimer, ARCH_CONVERT) : 1210 qinf->qi_rtbwarnlimit = ddqp->d_rtbwarns ?
1211 XFS_QM_RTBTIMELIMIT; 1211 be16_to_cpu(ddqp->d_rtbwarns) : XFS_QM_RTBWARNLIMIT;
1212 qinf->qi_bwarnlimit = 1212 qinf->qi_bhardlimit = be64_to_cpu(ddqp->d_blk_hardlimit);
1213 INT_GET(ddqp->d_bwarns, ARCH_CONVERT) ? 1213 qinf->qi_bsoftlimit = be64_to_cpu(ddqp->d_blk_softlimit);
1214 INT_GET(ddqp->d_bwarns, ARCH_CONVERT) : 1214 qinf->qi_ihardlimit = be64_to_cpu(ddqp->d_ino_hardlimit);
1215 XFS_QM_BWARNLIMIT; 1215 qinf->qi_isoftlimit = be64_to_cpu(ddqp->d_ino_softlimit);
1216 qinf->qi_iwarnlimit = 1216 qinf->qi_rtbhardlimit = be64_to_cpu(ddqp->d_rtb_hardlimit);
1217 INT_GET(ddqp->d_iwarns, ARCH_CONVERT) ? 1217 qinf->qi_rtbsoftlimit = be64_to_cpu(ddqp->d_rtb_softlimit);
1218 INT_GET(ddqp->d_iwarns, ARCH_CONVERT) :
1219 XFS_QM_IWARNLIMIT;
1220 qinf->qi_rtbwarnlimit =
1221 INT_GET(ddqp->d_rtbwarns, ARCH_CONVERT) ?
1222 INT_GET(ddqp->d_rtbwarns, ARCH_CONVERT) :
1223 XFS_QM_RTBWARNLIMIT;
1224 qinf->qi_bhardlimit =
1225 INT_GET(ddqp->d_blk_hardlimit, ARCH_CONVERT);
1226 qinf->qi_bsoftlimit =
1227 INT_GET(ddqp->d_blk_softlimit, ARCH_CONVERT);
1228 qinf->qi_ihardlimit =
1229 INT_GET(ddqp->d_ino_hardlimit, ARCH_CONVERT);
1230 qinf->qi_isoftlimit =
1231 INT_GET(ddqp->d_ino_softlimit, ARCH_CONVERT);
1232 qinf->qi_rtbhardlimit =
1233 INT_GET(ddqp->d_rtb_hardlimit, ARCH_CONVERT);
1234 qinf->qi_rtbsoftlimit =
1235 INT_GET(ddqp->d_rtb_softlimit, ARCH_CONVERT);
1236 1218
1237 /* 1219 /*
1238 * We sent the XFS_QMOPT_DQSUSER flag to dqget because 1220 * We sent the XFS_QMOPT_DQSUSER flag to dqget because
@@ -1511,15 +1493,15 @@ xfs_qm_reset_dqcounts(
1511 */ 1493 */
1512 (void) xfs_qm_dqcheck(ddq, id+j, type, XFS_QMOPT_DQREPAIR, 1494 (void) xfs_qm_dqcheck(ddq, id+j, type, XFS_QMOPT_DQREPAIR,
1513 "xfs_quotacheck"); 1495 "xfs_quotacheck");
1514 INT_SET(ddq->d_bcount, ARCH_CONVERT, 0ULL); 1496 ddq->d_bcount = 0;
1515 INT_SET(ddq->d_icount, ARCH_CONVERT, 0ULL); 1497 ddq->d_icount = 0;
1516 INT_SET(ddq->d_rtbcount, ARCH_CONVERT, 0ULL); 1498 ddq->d_rtbcount = 0;
1517 INT_SET(ddq->d_btimer, ARCH_CONVERT, (time_t)0); 1499 ddq->d_btimer = 0;
1518 INT_SET(ddq->d_itimer, ARCH_CONVERT, (time_t)0); 1500 ddq->d_itimer = 0;
1519 INT_SET(ddq->d_rtbtimer, ARCH_CONVERT, (time_t)0); 1501 ddq->d_rtbtimer = 0;
1520 INT_SET(ddq->d_bwarns, ARCH_CONVERT, 0UL); 1502 ddq->d_bwarns = 0;
1521 INT_SET(ddq->d_iwarns, ARCH_CONVERT, 0UL); 1503 ddq->d_iwarns = 0;
1522 INT_SET(ddq->d_rtbwarns, ARCH_CONVERT, 0UL); 1504 ddq->d_rtbwarns = 0;
1523 ddq = (xfs_disk_dquot_t *) ((xfs_dqblk_t *)ddq + 1); 1505 ddq = (xfs_disk_dquot_t *) ((xfs_dqblk_t *)ddq + 1);
1524 } 1506 }
1525 1507
@@ -1692,14 +1674,14 @@ xfs_qm_quotacheck_dqadjust(
1692 * Adjust the inode count and the block count to reflect this inode's 1674 * Adjust the inode count and the block count to reflect this inode's
1693 * resource usage. 1675 * resource usage.
1694 */ 1676 */
1695 INT_MOD(dqp->q_core.d_icount, ARCH_CONVERT, +1); 1677 be64_add(&dqp->q_core.d_icount, 1);
1696 dqp->q_res_icount++; 1678 dqp->q_res_icount++;
1697 if (nblks) { 1679 if (nblks) {
1698 INT_MOD(dqp->q_core.d_bcount, ARCH_CONVERT, nblks); 1680 be64_add(&dqp->q_core.d_bcount, nblks);
1699 dqp->q_res_bcount += nblks; 1681 dqp->q_res_bcount += nblks;
1700 } 1682 }
1701 if (rtblks) { 1683 if (rtblks) {
1702 INT_MOD(dqp->q_core.d_rtbcount, ARCH_CONVERT, rtblks); 1684 be64_add(&dqp->q_core.d_rtbcount, rtblks);
1703 dqp->q_res_rtbcount += rtblks; 1685 dqp->q_res_rtbcount += rtblks;
1704 } 1686 }
1705 1687
@@ -2186,7 +2168,7 @@ xfs_qm_shake_freelist(
2186 xfs_dqtrace_entry(dqp, "DQSHAKE: UNLINKING"); 2168 xfs_dqtrace_entry(dqp, "DQSHAKE: UNLINKING");
2187#ifdef QUOTADEBUG 2169#ifdef QUOTADEBUG
2188 cmn_err(CE_DEBUG, "Shake 0x%p, ID 0x%x\n", 2170 cmn_err(CE_DEBUG, "Shake 0x%p, ID 0x%x\n",
2189 dqp, INT_GET(dqp->q_core.d_id, ARCH_CONVERT)); 2171 dqp, be32_to_cpu(dqp->q_core.d_id));
2190#endif 2172#endif
2191 ASSERT(dqp->q_nrefs == 0); 2173 ASSERT(dqp->q_nrefs == 0);
2192 nextdqp = dqp->dq_flnext; 2174 nextdqp = dqp->dq_flnext;
@@ -2654,7 +2636,7 @@ xfs_qm_vop_chown_reserve(
2654 XFS_QMOPT_RES_RTBLKS : XFS_QMOPT_RES_REGBLKS; 2636 XFS_QMOPT_RES_RTBLKS : XFS_QMOPT_RES_REGBLKS;
2655 2637
2656 if (XFS_IS_UQUOTA_ON(mp) && udqp && 2638 if (XFS_IS_UQUOTA_ON(mp) && udqp &&
2657 ip->i_d.di_uid != (uid_t)INT_GET(udqp->q_core.d_id, ARCH_CONVERT)) { 2639 ip->i_d.di_uid != (uid_t)be32_to_cpu(udqp->q_core.d_id)) {
2658 delblksudq = udqp; 2640 delblksudq = udqp;
2659 /* 2641 /*
2660 * If there are delayed allocation blocks, then we have to 2642 * If there are delayed allocation blocks, then we have to
@@ -2667,10 +2649,10 @@ xfs_qm_vop_chown_reserve(
2667 } 2649 }
2668 } 2650 }
2669 if (XFS_IS_OQUOTA_ON(ip->i_mount) && gdqp) { 2651 if (XFS_IS_OQUOTA_ON(ip->i_mount) && gdqp) {
2670 if ((XFS_IS_GQUOTA_ON(ip->i_mount) && ip->i_d.di_gid != 2652 if ((XFS_IS_GQUOTA_ON(ip->i_mount) &&
2671 INT_GET(gdqp->q_core.d_id, ARCH_CONVERT)) || 2653 ip->i_d.di_gid != be32_to_cpu(gdqp->q_core.d_id)) ||
2672 (XFS_IS_PQUOTA_ON(ip->i_mount) && ip->i_d.di_projid != 2654 (XFS_IS_PQUOTA_ON(ip->i_mount) &&
2673 INT_GET(gdqp->q_core.d_id, ARCH_CONVERT))) { 2655 ip->i_d.di_projid != be32_to_cpu(gdqp->q_core.d_id))) {
2674 delblksgdq = gdqp; 2656 delblksgdq = gdqp;
2675 if (delblks) { 2657 if (delblks) {
2676 ASSERT(ip->i_gdquot); 2658 ASSERT(ip->i_gdquot);
@@ -2760,7 +2742,7 @@ xfs_qm_vop_dqattach_and_dqmod_newinode(
2760 xfs_dqunlock(udqp); 2742 xfs_dqunlock(udqp);
2761 ASSERT(ip->i_udquot == NULL); 2743 ASSERT(ip->i_udquot == NULL);
2762 ip->i_udquot = udqp; 2744 ip->i_udquot = udqp;
2763 ASSERT(ip->i_d.di_uid == INT_GET(udqp->q_core.d_id, ARCH_CONVERT)); 2745 ASSERT(ip->i_d.di_uid == be32_to_cpu(udqp->q_core.d_id));
2764 xfs_trans_mod_dquot(tp, udqp, XFS_TRANS_DQ_ICOUNT, 1); 2746 xfs_trans_mod_dquot(tp, udqp, XFS_TRANS_DQ_ICOUNT, 1);
2765 } 2747 }
2766 if (gdqp) { 2748 if (gdqp) {
@@ -2769,7 +2751,7 @@ xfs_qm_vop_dqattach_and_dqmod_newinode(
2769 xfs_dqunlock(gdqp); 2751 xfs_dqunlock(gdqp);
2770 ASSERT(ip->i_gdquot == NULL); 2752 ASSERT(ip->i_gdquot == NULL);
2771 ip->i_gdquot = gdqp; 2753 ip->i_gdquot = gdqp;
2772 ASSERT(ip->i_d.di_gid == INT_GET(gdqp->q_core.d_id, ARCH_CONVERT)); 2754 ASSERT(ip->i_d.di_gid == be32_to_cpu(gdqp->q_core.d_id));
2773 xfs_trans_mod_dquot(tp, gdqp, XFS_TRANS_DQ_ICOUNT, 1); 2755 xfs_trans_mod_dquot(tp, gdqp, XFS_TRANS_DQ_ICOUNT, 1);
2774 } 2756 }
2775} 2757}
diff --git a/fs/xfs/quota/xfs_qm_syscalls.c b/fs/xfs/quota/xfs_qm_syscalls.c
index a9905109e4ac..24690e1af659 100644
--- a/fs/xfs/quota/xfs_qm_syscalls.c
+++ b/fs/xfs/quota/xfs_qm_syscalls.c
@@ -638,13 +638,13 @@ xfs_qm_scall_setqlim(
638 */ 638 */
639 hard = (newlim->d_fieldmask & FS_DQ_BHARD) ? 639 hard = (newlim->d_fieldmask & FS_DQ_BHARD) ?
640 (xfs_qcnt_t) XFS_BB_TO_FSB(mp, newlim->d_blk_hardlimit) : 640 (xfs_qcnt_t) XFS_BB_TO_FSB(mp, newlim->d_blk_hardlimit) :
641 INT_GET(ddq->d_blk_hardlimit, ARCH_CONVERT); 641 be64_to_cpu(ddq->d_blk_hardlimit);
642 soft = (newlim->d_fieldmask & FS_DQ_BSOFT) ? 642 soft = (newlim->d_fieldmask & FS_DQ_BSOFT) ?
643 (xfs_qcnt_t) XFS_BB_TO_FSB(mp, newlim->d_blk_softlimit) : 643 (xfs_qcnt_t) XFS_BB_TO_FSB(mp, newlim->d_blk_softlimit) :
644 INT_GET(ddq->d_blk_softlimit, ARCH_CONVERT); 644 be64_to_cpu(ddq->d_blk_softlimit);
645 if (hard == 0 || hard >= soft) { 645 if (hard == 0 || hard >= soft) {
646 INT_SET(ddq->d_blk_hardlimit, ARCH_CONVERT, hard); 646 ddq->d_blk_hardlimit = cpu_to_be64(hard);
647 INT_SET(ddq->d_blk_softlimit, ARCH_CONVERT, soft); 647 ddq->d_blk_softlimit = cpu_to_be64(soft);
648 if (id == 0) { 648 if (id == 0) {
649 mp->m_quotainfo->qi_bhardlimit = hard; 649 mp->m_quotainfo->qi_bhardlimit = hard;
650 mp->m_quotainfo->qi_bsoftlimit = soft; 650 mp->m_quotainfo->qi_bsoftlimit = soft;
@@ -654,13 +654,13 @@ xfs_qm_scall_setqlim(
654 } 654 }
655 hard = (newlim->d_fieldmask & FS_DQ_RTBHARD) ? 655 hard = (newlim->d_fieldmask & FS_DQ_RTBHARD) ?
656 (xfs_qcnt_t) XFS_BB_TO_FSB(mp, newlim->d_rtb_hardlimit) : 656 (xfs_qcnt_t) XFS_BB_TO_FSB(mp, newlim->d_rtb_hardlimit) :
657 INT_GET(ddq->d_rtb_hardlimit, ARCH_CONVERT); 657 be64_to_cpu(ddq->d_rtb_hardlimit);
658 soft = (newlim->d_fieldmask & FS_DQ_RTBSOFT) ? 658 soft = (newlim->d_fieldmask & FS_DQ_RTBSOFT) ?
659 (xfs_qcnt_t) XFS_BB_TO_FSB(mp, newlim->d_rtb_softlimit) : 659 (xfs_qcnt_t) XFS_BB_TO_FSB(mp, newlim->d_rtb_softlimit) :
660 INT_GET(ddq->d_rtb_softlimit, ARCH_CONVERT); 660 be64_to_cpu(ddq->d_rtb_softlimit);
661 if (hard == 0 || hard >= soft) { 661 if (hard == 0 || hard >= soft) {
662 INT_SET(ddq->d_rtb_hardlimit, ARCH_CONVERT, hard); 662 ddq->d_rtb_hardlimit = cpu_to_be64(hard);
663 INT_SET(ddq->d_rtb_softlimit, ARCH_CONVERT, soft); 663 ddq->d_rtb_softlimit = cpu_to_be64(soft);
664 if (id == 0) { 664 if (id == 0) {
665 mp->m_quotainfo->qi_rtbhardlimit = hard; 665 mp->m_quotainfo->qi_rtbhardlimit = hard;
666 mp->m_quotainfo->qi_rtbsoftlimit = soft; 666 mp->m_quotainfo->qi_rtbsoftlimit = soft;
@@ -671,13 +671,13 @@ xfs_qm_scall_setqlim(
671 671
672 hard = (newlim->d_fieldmask & FS_DQ_IHARD) ? 672 hard = (newlim->d_fieldmask & FS_DQ_IHARD) ?
673 (xfs_qcnt_t) newlim->d_ino_hardlimit : 673 (xfs_qcnt_t) newlim->d_ino_hardlimit :
674 INT_GET(ddq->d_ino_hardlimit, ARCH_CONVERT); 674 be64_to_cpu(ddq->d_ino_hardlimit);
675 soft = (newlim->d_fieldmask & FS_DQ_ISOFT) ? 675 soft = (newlim->d_fieldmask & FS_DQ_ISOFT) ?
676 (xfs_qcnt_t) newlim->d_ino_softlimit : 676 (xfs_qcnt_t) newlim->d_ino_softlimit :
677 INT_GET(ddq->d_ino_softlimit, ARCH_CONVERT); 677 be64_to_cpu(ddq->d_ino_softlimit);
678 if (hard == 0 || hard >= soft) { 678 if (hard == 0 || hard >= soft) {
679 INT_SET(ddq->d_ino_hardlimit, ARCH_CONVERT, hard); 679 ddq->d_ino_hardlimit = cpu_to_be64(hard);
680 INT_SET(ddq->d_ino_softlimit, ARCH_CONVERT, soft); 680 ddq->d_ino_softlimit = cpu_to_be64(soft);
681 if (id == 0) { 681 if (id == 0) {
682 mp->m_quotainfo->qi_ihardlimit = hard; 682 mp->m_quotainfo->qi_ihardlimit = hard;
683 mp->m_quotainfo->qi_isoftlimit = soft; 683 mp->m_quotainfo->qi_isoftlimit = soft;
@@ -690,11 +690,11 @@ xfs_qm_scall_setqlim(
690 * Update warnings counter(s) if requested 690 * Update warnings counter(s) if requested
691 */ 691 */
692 if (newlim->d_fieldmask & FS_DQ_BWARNS) 692 if (newlim->d_fieldmask & FS_DQ_BWARNS)
693 INT_SET(ddq->d_bwarns, ARCH_CONVERT, newlim->d_bwarns); 693 ddq->d_bwarns = cpu_to_be16(newlim->d_bwarns);
694 if (newlim->d_fieldmask & FS_DQ_IWARNS) 694 if (newlim->d_fieldmask & FS_DQ_IWARNS)
695 INT_SET(ddq->d_iwarns, ARCH_CONVERT, newlim->d_iwarns); 695 ddq->d_iwarns = cpu_to_be16(newlim->d_iwarns);
696 if (newlim->d_fieldmask & FS_DQ_RTBWARNS) 696 if (newlim->d_fieldmask & FS_DQ_RTBWARNS)
697 INT_SET(ddq->d_rtbwarns, ARCH_CONVERT, newlim->d_rtbwarns); 697 ddq->d_rtbwarns = cpu_to_be16(newlim->d_rtbwarns);
698 698
699 if (id == 0) { 699 if (id == 0) {
700 /* 700 /*
@@ -706,15 +706,15 @@ xfs_qm_scall_setqlim(
706 */ 706 */
707 if (newlim->d_fieldmask & FS_DQ_BTIMER) { 707 if (newlim->d_fieldmask & FS_DQ_BTIMER) {
708 mp->m_quotainfo->qi_btimelimit = newlim->d_btimer; 708 mp->m_quotainfo->qi_btimelimit = newlim->d_btimer;
709 INT_SET(ddq->d_btimer, ARCH_CONVERT, newlim->d_btimer); 709 ddq->d_btimer = cpu_to_be32(newlim->d_btimer);
710 } 710 }
711 if (newlim->d_fieldmask & FS_DQ_ITIMER) { 711 if (newlim->d_fieldmask & FS_DQ_ITIMER) {
712 mp->m_quotainfo->qi_itimelimit = newlim->d_itimer; 712 mp->m_quotainfo->qi_itimelimit = newlim->d_itimer;
713 INT_SET(ddq->d_itimer, ARCH_CONVERT, newlim->d_itimer); 713 ddq->d_itimer = cpu_to_be32(newlim->d_itimer);
714 } 714 }
715 if (newlim->d_fieldmask & FS_DQ_RTBTIMER) { 715 if (newlim->d_fieldmask & FS_DQ_RTBTIMER) {
716 mp->m_quotainfo->qi_rtbtimelimit = newlim->d_rtbtimer; 716 mp->m_quotainfo->qi_rtbtimelimit = newlim->d_rtbtimer;
717 INT_SET(ddq->d_rtbtimer, ARCH_CONVERT, newlim->d_rtbtimer); 717 ddq->d_rtbtimer = cpu_to_be32(newlim->d_rtbtimer);
718 } 718 }
719 if (newlim->d_fieldmask & FS_DQ_BWARNS) 719 if (newlim->d_fieldmask & FS_DQ_BWARNS)
720 mp->m_quotainfo->qi_bwarnlimit = newlim->d_bwarns; 720 mp->m_quotainfo->qi_bwarnlimit = newlim->d_bwarns;
@@ -885,33 +885,27 @@ xfs_qm_export_dquot(
885{ 885{
886 memset(dst, 0, sizeof(*dst)); 886 memset(dst, 0, sizeof(*dst));
887 dst->d_version = FS_DQUOT_VERSION; /* different from src->d_version */ 887 dst->d_version = FS_DQUOT_VERSION; /* different from src->d_version */
888 dst->d_flags = 888 dst->d_flags = xfs_qm_export_qtype_flags(src->d_flags);
889 xfs_qm_export_qtype_flags(INT_GET(src->d_flags, ARCH_CONVERT)); 889 dst->d_id = be32_to_cpu(src->d_id);
890 dst->d_id = INT_GET(src->d_id, ARCH_CONVERT); 890 dst->d_blk_hardlimit =
891 dst->d_blk_hardlimit = (__uint64_t) 891 XFS_FSB_TO_BB(mp, be64_to_cpu(src->d_blk_hardlimit));
892 XFS_FSB_TO_BB(mp, INT_GET(src->d_blk_hardlimit, ARCH_CONVERT)); 892 dst->d_blk_softlimit =
893 dst->d_blk_softlimit = (__uint64_t) 893 XFS_FSB_TO_BB(mp, be64_to_cpu(src->d_blk_softlimit));
894 XFS_FSB_TO_BB(mp, INT_GET(src->d_blk_softlimit, ARCH_CONVERT)); 894 dst->d_ino_hardlimit = be64_to_cpu(src->d_ino_hardlimit);
895 dst->d_ino_hardlimit = (__uint64_t) 895 dst->d_ino_softlimit = be64_to_cpu(src->d_ino_softlimit);
896 INT_GET(src->d_ino_hardlimit, ARCH_CONVERT); 896 dst->d_bcount = XFS_FSB_TO_BB(mp, be64_to_cpu(src->d_bcount));
897 dst->d_ino_softlimit = (__uint64_t) 897 dst->d_icount = be64_to_cpu(src->d_icount);
898 INT_GET(src->d_ino_softlimit, ARCH_CONVERT); 898 dst->d_btimer = be32_to_cpu(src->d_btimer);
899 dst->d_bcount = (__uint64_t) 899 dst->d_itimer = be32_to_cpu(src->d_itimer);
900 XFS_FSB_TO_BB(mp, INT_GET(src->d_bcount, ARCH_CONVERT)); 900 dst->d_iwarns = be16_to_cpu(src->d_iwarns);
901 dst->d_icount = (__uint64_t) INT_GET(src->d_icount, ARCH_CONVERT); 901 dst->d_bwarns = be16_to_cpu(src->d_bwarns);
902 dst->d_btimer = (__uint32_t) INT_GET(src->d_btimer, ARCH_CONVERT); 902 dst->d_rtb_hardlimit =
903 dst->d_itimer = (__uint32_t) INT_GET(src->d_itimer, ARCH_CONVERT); 903 XFS_FSB_TO_BB(mp, be64_to_cpu(src->d_rtb_hardlimit));
904 dst->d_iwarns = INT_GET(src->d_iwarns, ARCH_CONVERT); 904 dst->d_rtb_softlimit =
905 dst->d_bwarns = INT_GET(src->d_bwarns, ARCH_CONVERT); 905 XFS_FSB_TO_BB(mp, be64_to_cpu(src->d_rtb_softlimit));
906 906 dst->d_rtbcount = XFS_FSB_TO_BB(mp, be64_to_cpu(src->d_rtbcount));
907 dst->d_rtb_hardlimit = (__uint64_t) 907 dst->d_rtbtimer = be32_to_cpu(src->d_rtbtimer);
908 XFS_FSB_TO_BB(mp, INT_GET(src->d_rtb_hardlimit, ARCH_CONVERT)); 908 dst->d_rtbwarns = be16_to_cpu(src->d_rtbwarns);
909 dst->d_rtb_softlimit = (__uint64_t)
910 XFS_FSB_TO_BB(mp, INT_GET(src->d_rtb_softlimit, ARCH_CONVERT));
911 dst->d_rtbcount = (__uint64_t)
912 XFS_FSB_TO_BB(mp, INT_GET(src->d_rtbcount, ARCH_CONVERT));
913 dst->d_rtbtimer = (__uint32_t) INT_GET(src->d_rtbtimer, ARCH_CONVERT);
914 dst->d_rtbwarns = INT_GET(src->d_rtbwarns, ARCH_CONVERT);
915 909
916 /* 910 /*
917 * Internally, we don't reset all the timers when quota enforcement 911 * Internally, we don't reset all the timers when quota enforcement
@@ -1205,10 +1199,10 @@ xfs_qm_dqtest_failed(
1205 qmtest_nfails++; 1199 qmtest_nfails++;
1206 if (error) 1200 if (error)
1207 cmn_err(CE_DEBUG, "quotacheck failed id=%d, err=%d\nreason: %s", 1201 cmn_err(CE_DEBUG, "quotacheck failed id=%d, err=%d\nreason: %s",
1208 INT_GET(d->d_id, ARCH_CONVERT), error, reason); 1202 d->d_id, error, reason);
1209 else 1203 else
1210 cmn_err(CE_DEBUG, "quotacheck failed id=%d (%s) [%d != %d]", 1204 cmn_err(CE_DEBUG, "quotacheck failed id=%d (%s) [%d != %d]",
1211 INT_GET(d->d_id, ARCH_CONVERT), reason, (int)a, (int)b); 1205 d->d_id, reason, (int)a, (int)b);
1212 xfs_qm_dqtest_print(d); 1206 xfs_qm_dqtest_print(d);
1213 if (dqp) 1207 if (dqp)
1214 xfs_qm_dqprint(dqp); 1208 xfs_qm_dqprint(dqp);
@@ -1220,21 +1214,21 @@ xfs_dqtest_cmp2(
1220 xfs_dquot_t *dqp) 1214 xfs_dquot_t *dqp)
1221{ 1215{
1222 int err = 0; 1216 int err = 0;
1223 if (INT_GET(dqp->q_core.d_icount, ARCH_CONVERT) != d->d_icount) { 1217 if (be64_to_cpu(dqp->q_core.d_icount) != d->d_icount) {
1224 xfs_qm_dqtest_failed(d, dqp, "icount mismatch", 1218 xfs_qm_dqtest_failed(d, dqp, "icount mismatch",
1225 INT_GET(dqp->q_core.d_icount, ARCH_CONVERT), 1219 be64_to_cpu(dqp->q_core.d_icount),
1226 d->d_icount, 0); 1220 d->d_icount, 0);
1227 err++; 1221 err++;
1228 } 1222 }
1229 if (INT_GET(dqp->q_core.d_bcount, ARCH_CONVERT) != d->d_bcount) { 1223 if (be64_to_cpu(dqp->q_core.d_bcount) != d->d_bcount) {
1230 xfs_qm_dqtest_failed(d, dqp, "bcount mismatch", 1224 xfs_qm_dqtest_failed(d, dqp, "bcount mismatch",
1231 INT_GET(dqp->q_core.d_bcount, ARCH_CONVERT), 1225 be64_to_cpu(dqp->q_core.d_bcount),
1232 d->d_bcount, 0); 1226 d->d_bcount, 0);
1233 err++; 1227 err++;
1234 } 1228 }
1235 if (INT_GET(dqp->q_core.d_blk_softlimit, ARCH_CONVERT) && 1229 if (dqp->q_core.d_blk_softlimit &&
1236 INT_GET(dqp->q_core.d_bcount, ARCH_CONVERT) >= 1230 be64_to_cpu(dqp->q_core.d_bcount) >=
1237 INT_GET(dqp->q_core.d_blk_softlimit, ARCH_CONVERT)) { 1231 be64_to_cpu(dqp->q_core.d_blk_softlimit)) {
1238 if (!dqp->q_core.d_btimer && dqp->q_core.d_id) { 1232 if (!dqp->q_core.d_btimer && dqp->q_core.d_id) {
1239 cmn_err(CE_DEBUG, 1233 cmn_err(CE_DEBUG,
1240 "%d [%s] [0x%p] BLK TIMER NOT STARTED", 1234 "%d [%s] [0x%p] BLK TIMER NOT STARTED",
@@ -1242,9 +1236,9 @@ xfs_dqtest_cmp2(
1242 err++; 1236 err++;
1243 } 1237 }
1244 } 1238 }
1245 if (INT_GET(dqp->q_core.d_ino_softlimit, ARCH_CONVERT) && 1239 if (dqp->q_core.d_ino_softlimit &&
1246 INT_GET(dqp->q_core.d_icount, ARCH_CONVERT) >= 1240 be64_to_cpu(dqp->q_core.d_icount) >=
1247 INT_GET(dqp->q_core.d_ino_softlimit, ARCH_CONVERT)) { 1241 be64_to_cpu(dqp->q_core.d_ino_softlimit)) {
1248 if (!dqp->q_core.d_itimer && dqp->q_core.d_id) { 1242 if (!dqp->q_core.d_itimer && dqp->q_core.d_id) {
1249 cmn_err(CE_DEBUG, 1243 cmn_err(CE_DEBUG,
1250 "%d [%s] [0x%p] INO TIMER NOT STARTED", 1244 "%d [%s] [0x%p] INO TIMER NOT STARTED",
diff --git a/fs/xfs/quota/xfs_trans_dquot.c b/fs/xfs/quota/xfs_trans_dquot.c
index e94bed4e1081..3290975d31f7 100644
--- a/fs/xfs/quota/xfs_trans_dquot.c
+++ b/fs/xfs/quota/xfs_trans_dquot.c
@@ -413,25 +413,25 @@ xfs_trans_apply_dquot_deltas(
413 qtrx->qt_delrtb_delta; 413 qtrx->qt_delrtb_delta;
414#ifdef QUOTADEBUG 414#ifdef QUOTADEBUG
415 if (totalbdelta < 0) 415 if (totalbdelta < 0)
416 ASSERT(INT_GET(d->d_bcount, ARCH_CONVERT) >= 416 ASSERT(be64_to_cpu(d->d_bcount) >=
417 (xfs_qcnt_t) -totalbdelta); 417 (xfs_qcnt_t) -totalbdelta);
418 418
419 if (totalrtbdelta < 0) 419 if (totalrtbdelta < 0)
420 ASSERT(INT_GET(d->d_rtbcount, ARCH_CONVERT) >= 420 ASSERT(be64_to_cpu(d->d_rtbcount) >=
421 (xfs_qcnt_t) -totalrtbdelta); 421 (xfs_qcnt_t) -totalrtbdelta);
422 422
423 if (qtrx->qt_icount_delta < 0) 423 if (qtrx->qt_icount_delta < 0)
424 ASSERT(INT_GET(d->d_icount, ARCH_CONVERT) >= 424 ASSERT(be64_to_cpu(d->d_icount) >=
425 (xfs_qcnt_t) -qtrx->qt_icount_delta); 425 (xfs_qcnt_t) -qtrx->qt_icount_delta);
426#endif 426#endif
427 if (totalbdelta) 427 if (totalbdelta)
428 INT_MOD(d->d_bcount, ARCH_CONVERT, (xfs_qcnt_t)totalbdelta); 428 be64_add(&d->d_bcount, (xfs_qcnt_t)totalbdelta);
429 429
430 if (qtrx->qt_icount_delta) 430 if (qtrx->qt_icount_delta)
431 INT_MOD(d->d_icount, ARCH_CONVERT, (xfs_qcnt_t)qtrx->qt_icount_delta); 431 be64_add(&d->d_icount, (xfs_qcnt_t)qtrx->qt_icount_delta);
432 432
433 if (totalrtbdelta) 433 if (totalrtbdelta)
434 INT_MOD(d->d_rtbcount, ARCH_CONVERT, (xfs_qcnt_t)totalrtbdelta); 434 be64_add(&d->d_rtbcount, (xfs_qcnt_t)totalrtbdelta);
435 435
436 /* 436 /*
437 * Get any default limits in use. 437 * Get any default limits in use.
@@ -515,11 +515,11 @@ xfs_trans_apply_dquot_deltas(
515 } 515 }
516 516
517 ASSERT(dqp->q_res_bcount >= 517 ASSERT(dqp->q_res_bcount >=
518 INT_GET(dqp->q_core.d_bcount, ARCH_CONVERT)); 518 be64_to_cpu(dqp->q_core.d_bcount));
519 ASSERT(dqp->q_res_icount >= 519 ASSERT(dqp->q_res_icount >=
520 INT_GET(dqp->q_core.d_icount, ARCH_CONVERT)); 520 be64_to_cpu(dqp->q_core.d_icount));
521 ASSERT(dqp->q_res_rtbcount >= 521 ASSERT(dqp->q_res_rtbcount >=
522 INT_GET(dqp->q_core.d_rtbcount, ARCH_CONVERT)); 522 be64_to_cpu(dqp->q_core.d_rtbcount));
523 } 523 }
524 /* 524 /*
525 * Do the group quotas next 525 * Do the group quotas next
@@ -626,26 +626,26 @@ xfs_trans_dqresv(
626 } 626 }
627 ASSERT(XFS_DQ_IS_LOCKED(dqp)); 627 ASSERT(XFS_DQ_IS_LOCKED(dqp));
628 if (flags & XFS_TRANS_DQ_RES_BLKS) { 628 if (flags & XFS_TRANS_DQ_RES_BLKS) {
629 hardlimit = INT_GET(dqp->q_core.d_blk_hardlimit, ARCH_CONVERT); 629 hardlimit = be64_to_cpu(dqp->q_core.d_blk_hardlimit);
630 if (!hardlimit) 630 if (!hardlimit)
631 hardlimit = q->qi_bhardlimit; 631 hardlimit = q->qi_bhardlimit;
632 softlimit = INT_GET(dqp->q_core.d_blk_softlimit, ARCH_CONVERT); 632 softlimit = be64_to_cpu(dqp->q_core.d_blk_softlimit);
633 if (!softlimit) 633 if (!softlimit)
634 softlimit = q->qi_bsoftlimit; 634 softlimit = q->qi_bsoftlimit;
635 timer = INT_GET(dqp->q_core.d_btimer, ARCH_CONVERT); 635 timer = be32_to_cpu(dqp->q_core.d_btimer);
636 warns = INT_GET(dqp->q_core.d_bwarns, ARCH_CONVERT); 636 warns = be16_to_cpu(dqp->q_core.d_bwarns);
637 warnlimit = XFS_QI_BWARNLIMIT(dqp->q_mount); 637 warnlimit = XFS_QI_BWARNLIMIT(dqp->q_mount);
638 resbcountp = &dqp->q_res_bcount; 638 resbcountp = &dqp->q_res_bcount;
639 } else { 639 } else {
640 ASSERT(flags & XFS_TRANS_DQ_RES_RTBLKS); 640 ASSERT(flags & XFS_TRANS_DQ_RES_RTBLKS);
641 hardlimit = INT_GET(dqp->q_core.d_rtb_hardlimit, ARCH_CONVERT); 641 hardlimit = be64_to_cpu(dqp->q_core.d_rtb_hardlimit);
642 if (!hardlimit) 642 if (!hardlimit)
643 hardlimit = q->qi_rtbhardlimit; 643 hardlimit = q->qi_rtbhardlimit;
644 softlimit = INT_GET(dqp->q_core.d_rtb_softlimit, ARCH_CONVERT); 644 softlimit = be64_to_cpu(dqp->q_core.d_rtb_softlimit);
645 if (!softlimit) 645 if (!softlimit)
646 softlimit = q->qi_rtbsoftlimit; 646 softlimit = q->qi_rtbsoftlimit;
647 timer = INT_GET(dqp->q_core.d_rtbtimer, ARCH_CONVERT); 647 timer = be32_to_cpu(dqp->q_core.d_rtbtimer);
648 warns = INT_GET(dqp->q_core.d_rtbwarns, ARCH_CONVERT); 648 warns = be16_to_cpu(dqp->q_core.d_rtbwarns);
649 warnlimit = XFS_QI_RTBWARNLIMIT(dqp->q_mount); 649 warnlimit = XFS_QI_RTBWARNLIMIT(dqp->q_mount);
650 resbcountp = &dqp->q_res_rtbcount; 650 resbcountp = &dqp->q_res_rtbcount;
651 } 651 }
@@ -684,16 +684,14 @@ xfs_trans_dqresv(
684 } 684 }
685 } 685 }
686 if (ninos > 0) { 686 if (ninos > 0) {
687 count = INT_GET(dqp->q_core.d_icount, ARCH_CONVERT); 687 count = be64_to_cpu(dqp->q_core.d_icount);
688 timer = INT_GET(dqp->q_core.d_itimer, ARCH_CONVERT); 688 timer = be32_to_cpu(dqp->q_core.d_itimer);
689 warns = INT_GET(dqp->q_core.d_iwarns, ARCH_CONVERT); 689 warns = be16_to_cpu(dqp->q_core.d_iwarns);
690 warnlimit = XFS_QI_IWARNLIMIT(dqp->q_mount); 690 warnlimit = XFS_QI_IWARNLIMIT(dqp->q_mount);
691 hardlimit = INT_GET(dqp->q_core.d_ino_hardlimit, 691 hardlimit = be64_to_cpu(dqp->q_core.d_ino_hardlimit);
692 ARCH_CONVERT);
693 if (!hardlimit) 692 if (!hardlimit)
694 hardlimit = q->qi_ihardlimit; 693 hardlimit = q->qi_ihardlimit;
695 softlimit = INT_GET(dqp->q_core.d_ino_softlimit, 694 softlimit = be64_to_cpu(dqp->q_core.d_ino_softlimit);
696 ARCH_CONVERT);
697 if (!softlimit) 695 if (!softlimit)
698 softlimit = q->qi_isoftlimit; 696 softlimit = q->qi_isoftlimit;
699 if (hardlimit > 0ULL && count >= hardlimit) { 697 if (hardlimit > 0ULL && count >= hardlimit) {
@@ -740,9 +738,9 @@ xfs_trans_dqresv(
740 XFS_TRANS_DQ_RES_INOS, 738 XFS_TRANS_DQ_RES_INOS,
741 ninos); 739 ninos);
742 } 740 }
743 ASSERT(dqp->q_res_bcount >= INT_GET(dqp->q_core.d_bcount, ARCH_CONVERT)); 741 ASSERT(dqp->q_res_bcount >= be64_to_cpu(dqp->q_core.d_bcount));
744 ASSERT(dqp->q_res_rtbcount >= INT_GET(dqp->q_core.d_rtbcount, ARCH_CONVERT)); 742 ASSERT(dqp->q_res_rtbcount >= be64_to_cpu(dqp->q_core.d_rtbcount));
745 ASSERT(dqp->q_res_icount >= INT_GET(dqp->q_core.d_icount, ARCH_CONVERT)); 743 ASSERT(dqp->q_res_icount >= be64_to_cpu(dqp->q_core.d_icount));
746 744
747error_return: 745error_return:
748 if (! (flags & XFS_QMOPT_DQLOCK)) { 746 if (! (flags & XFS_QMOPT_DQLOCK)) {
diff --git a/fs/xfs/xfs_arch.h b/fs/xfs/xfs_arch.h
index 3191dc60d8db..68e5051d8e24 100644
--- a/fs/xfs/xfs_arch.h
+++ b/fs/xfs/xfs_arch.h
@@ -154,6 +154,21 @@
154 } \ 154 } \
155} 155}
156 156
157static inline void be16_add(__be16 *a, __s16 b)
158{
159 *a = cpu_to_be16(be16_to_cpu(*a) + b);
160}
161
162static inline void be32_add(__be32 *a, __s32 b)
163{
164 *a = cpu_to_be32(be32_to_cpu(*a) + b);
165}
166
167static inline void be64_add(__be64 *a, __s64 b)
168{
169 *a = cpu_to_be64(be64_to_cpu(*a) + b);
170}
171
157/* 172/*
158 * In directories inode numbers are stored as unaligned arrays of unsigned 173 * In directories inode numbers are stored as unaligned arrays of unsigned
159 * 8bit integers on disk. 174 * 8bit integers on disk.
diff --git a/fs/xfs/xfs_log_recover.c b/fs/xfs/xfs_log_recover.c
index b628c9eca420..63268984762a 100644
--- a/fs/xfs/xfs_log_recover.c
+++ b/fs/xfs/xfs_log_recover.c
@@ -1998,79 +1998,74 @@ xfs_qm_dqcheck(
1998 * This is all fine; things are still consistent, and we haven't lost 1998 * This is all fine; things are still consistent, and we haven't lost
1999 * any quota information. Just don't complain about bad dquot blks. 1999 * any quota information. Just don't complain about bad dquot blks.
2000 */ 2000 */
2001 if (INT_GET(ddq->d_magic, ARCH_CONVERT) != XFS_DQUOT_MAGIC) { 2001 if (be16_to_cpu(ddq->d_magic) != XFS_DQUOT_MAGIC) {
2002 if (flags & XFS_QMOPT_DOWARN) 2002 if (flags & XFS_QMOPT_DOWARN)
2003 cmn_err(CE_ALERT, 2003 cmn_err(CE_ALERT,
2004 "%s : XFS dquot ID 0x%x, magic 0x%x != 0x%x", 2004 "%s : XFS dquot ID 0x%x, magic 0x%x != 0x%x",
2005 str, id, 2005 str, id, be16_to_cpu(ddq->d_magic), XFS_DQUOT_MAGIC);
2006 INT_GET(ddq->d_magic, ARCH_CONVERT), XFS_DQUOT_MAGIC);
2007 errs++; 2006 errs++;
2008 } 2007 }
2009 if (INT_GET(ddq->d_version, ARCH_CONVERT) != XFS_DQUOT_VERSION) { 2008 if (ddq->d_version != XFS_DQUOT_VERSION) {
2010 if (flags & XFS_QMOPT_DOWARN) 2009 if (flags & XFS_QMOPT_DOWARN)
2011 cmn_err(CE_ALERT, 2010 cmn_err(CE_ALERT,
2012 "%s : XFS dquot ID 0x%x, version 0x%x != 0x%x", 2011 "%s : XFS dquot ID 0x%x, version 0x%x != 0x%x",
2013 str, id, 2012 str, id, ddq->d_version, XFS_DQUOT_VERSION);
2014 INT_GET(ddq->d_magic, ARCH_CONVERT), XFS_DQUOT_VERSION);
2015 errs++; 2013 errs++;
2016 } 2014 }
2017 2015
2018 if (INT_GET(ddq->d_flags, ARCH_CONVERT) != XFS_DQ_USER && 2016 if (ddq->d_flags != XFS_DQ_USER &&
2019 INT_GET(ddq->d_flags, ARCH_CONVERT) != XFS_DQ_PROJ && 2017 ddq->d_flags != XFS_DQ_PROJ &&
2020 INT_GET(ddq->d_flags, ARCH_CONVERT) != XFS_DQ_GROUP) { 2018 ddq->d_flags != XFS_DQ_GROUP) {
2021 if (flags & XFS_QMOPT_DOWARN) 2019 if (flags & XFS_QMOPT_DOWARN)
2022 cmn_err(CE_ALERT, 2020 cmn_err(CE_ALERT,
2023 "%s : XFS dquot ID 0x%x, unknown flags 0x%x", 2021 "%s : XFS dquot ID 0x%x, unknown flags 0x%x",
2024 str, id, INT_GET(ddq->d_flags, ARCH_CONVERT)); 2022 str, id, ddq->d_flags);
2025 errs++; 2023 errs++;
2026 } 2024 }
2027 2025
2028 if (id != -1 && id != INT_GET(ddq->d_id, ARCH_CONVERT)) { 2026 if (id != -1 && id != be32_to_cpu(ddq->d_id)) {
2029 if (flags & XFS_QMOPT_DOWARN) 2027 if (flags & XFS_QMOPT_DOWARN)
2030 cmn_err(CE_ALERT, 2028 cmn_err(CE_ALERT,
2031 "%s : ondisk-dquot 0x%p, ID mismatch: " 2029 "%s : ondisk-dquot 0x%p, ID mismatch: "
2032 "0x%x expected, found id 0x%x", 2030 "0x%x expected, found id 0x%x",
2033 str, ddq, id, INT_GET(ddq->d_id, ARCH_CONVERT)); 2031 str, ddq, id, be32_to_cpu(ddq->d_id));
2034 errs++; 2032 errs++;
2035 } 2033 }
2036 2034
2037 if (!errs && ddq->d_id) { 2035 if (!errs && ddq->d_id) {
2038 if (INT_GET(ddq->d_blk_softlimit, ARCH_CONVERT) && 2036 if (ddq->d_blk_softlimit &&
2039 INT_GET(ddq->d_bcount, ARCH_CONVERT) >= 2037 be64_to_cpu(ddq->d_bcount) >=
2040 INT_GET(ddq->d_blk_softlimit, ARCH_CONVERT)) { 2038 be64_to_cpu(ddq->d_blk_softlimit)) {
2041 if (!ddq->d_btimer) { 2039 if (!ddq->d_btimer) {
2042 if (flags & XFS_QMOPT_DOWARN) 2040 if (flags & XFS_QMOPT_DOWARN)
2043 cmn_err(CE_ALERT, 2041 cmn_err(CE_ALERT,
2044 "%s : Dquot ID 0x%x (0x%p) " 2042 "%s : Dquot ID 0x%x (0x%p) "
2045 "BLK TIMER NOT STARTED", 2043 "BLK TIMER NOT STARTED",
2046 str, (int) 2044 str, (int)be32_to_cpu(ddq->d_id), ddq);
2047 INT_GET(ddq->d_id, ARCH_CONVERT), ddq);
2048 errs++; 2045 errs++;
2049 } 2046 }
2050 } 2047 }
2051 if (INT_GET(ddq->d_ino_softlimit, ARCH_CONVERT) && 2048 if (ddq->d_ino_softlimit &&
2052 INT_GET(ddq->d_icount, ARCH_CONVERT) >= 2049 be64_to_cpu(ddq->d_icount) >=
2053 INT_GET(ddq->d_ino_softlimit, ARCH_CONVERT)) { 2050 be64_to_cpu(ddq->d_ino_softlimit)) {
2054 if (!ddq->d_itimer) { 2051 if (!ddq->d_itimer) {
2055 if (flags & XFS_QMOPT_DOWARN) 2052 if (flags & XFS_QMOPT_DOWARN)
2056 cmn_err(CE_ALERT, 2053 cmn_err(CE_ALERT,
2057 "%s : Dquot ID 0x%x (0x%p) " 2054 "%s : Dquot ID 0x%x (0x%p) "
2058 "INODE TIMER NOT STARTED", 2055 "INODE TIMER NOT STARTED",
2059 str, (int) 2056 str, (int)be32_to_cpu(ddq->d_id), ddq);
2060 INT_GET(ddq->d_id, ARCH_CONVERT), ddq);
2061 errs++; 2057 errs++;
2062 } 2058 }
2063 } 2059 }
2064 if (INT_GET(ddq->d_rtb_softlimit, ARCH_CONVERT) && 2060 if (ddq->d_rtb_softlimit &&
2065 INT_GET(ddq->d_rtbcount, ARCH_CONVERT) >= 2061 be64_to_cpu(ddq->d_rtbcount) >=
2066 INT_GET(ddq->d_rtb_softlimit, ARCH_CONVERT)) { 2062 be64_to_cpu(ddq->d_rtb_softlimit)) {
2067 if (!ddq->d_rtbtimer) { 2063 if (!ddq->d_rtbtimer) {
2068 if (flags & XFS_QMOPT_DOWARN) 2064 if (flags & XFS_QMOPT_DOWARN)
2069 cmn_err(CE_ALERT, 2065 cmn_err(CE_ALERT,
2070 "%s : Dquot ID 0x%x (0x%p) " 2066 "%s : Dquot ID 0x%x (0x%p) "
2071 "RTBLK TIMER NOT STARTED", 2067 "RTBLK TIMER NOT STARTED",
2072 str, (int) 2068 str, (int)be32_to_cpu(ddq->d_id), ddq);
2073 INT_GET(ddq->d_id, ARCH_CONVERT), ddq);
2074 errs++; 2069 errs++;
2075 } 2070 }
2076 } 2071 }
@@ -2088,10 +2083,11 @@ xfs_qm_dqcheck(
2088 ASSERT(id != -1); 2083 ASSERT(id != -1);
2089 ASSERT(flags & XFS_QMOPT_DQREPAIR); 2084 ASSERT(flags & XFS_QMOPT_DQREPAIR);
2090 memset(d, 0, sizeof(xfs_dqblk_t)); 2085 memset(d, 0, sizeof(xfs_dqblk_t));
2091 INT_SET(d->dd_diskdq.d_magic, ARCH_CONVERT, XFS_DQUOT_MAGIC); 2086
2092 INT_SET(d->dd_diskdq.d_version, ARCH_CONVERT, XFS_DQUOT_VERSION); 2087 d->dd_diskdq.d_magic = cpu_to_be16(XFS_DQUOT_MAGIC);
2093 INT_SET(d->dd_diskdq.d_id, ARCH_CONVERT, id); 2088 d->dd_diskdq.d_version = XFS_DQUOT_VERSION;
2094 INT_SET(d->dd_diskdq.d_flags, ARCH_CONVERT, type); 2089 d->dd_diskdq.d_flags = type;
2090 d->dd_diskdq.d_id = cpu_to_be32(id);
2095 2091
2096 return errs; 2092 return errs;
2097} 2093}
diff --git a/fs/xfs/xfs_quota.h b/fs/xfs/xfs_quota.h
index fc763a8334ac..82a08baf437b 100644
--- a/fs/xfs/xfs_quota.h
+++ b/fs/xfs/xfs_quota.h
@@ -45,28 +45,28 @@ typedef __uint16_t xfs_qwarncnt_t;
45 * to construct the on disk structure. 45 * to construct the on disk structure.
46 */ 46 */
47typedef struct xfs_disk_dquot { 47typedef struct xfs_disk_dquot {
48/*16*/ u_int16_t d_magic; /* dquot magic = XFS_DQUOT_MAGIC */ 48 __be16 d_magic; /* dquot magic = XFS_DQUOT_MAGIC */
49/*8 */ u_int8_t d_version; /* dquot version */ 49 __u8 d_version; /* dquot version */
50/*8 */ u_int8_t d_flags; /* XFS_DQ_USER/PROJ/GROUP */ 50 __u8 d_flags; /* XFS_DQ_USER/PROJ/GROUP */
51/*32*/ xfs_dqid_t d_id; /* user,project,group id */ 51 __be32 d_id; /* user,project,group id */
52/*64*/ xfs_qcnt_t d_blk_hardlimit;/* absolute limit on disk blks */ 52 __be64 d_blk_hardlimit;/* absolute limit on disk blks */
53/*64*/ xfs_qcnt_t d_blk_softlimit;/* preferred limit on disk blks */ 53 __be64 d_blk_softlimit;/* preferred limit on disk blks */
54/*64*/ xfs_qcnt_t d_ino_hardlimit;/* maximum # allocated inodes */ 54 __be64 d_ino_hardlimit;/* maximum # allocated inodes */
55/*64*/ xfs_qcnt_t d_ino_softlimit;/* preferred inode limit */ 55 __be64 d_ino_softlimit;/* preferred inode limit */
56/*64*/ xfs_qcnt_t d_bcount; /* disk blocks owned by the user */ 56 __be64 d_bcount; /* disk blocks owned by the user */
57/*64*/ xfs_qcnt_t d_icount; /* inodes owned by the user */ 57 __be64 d_icount; /* inodes owned by the user */
58/*32*/ __int32_t d_itimer; /* zero if within inode limits if not, 58 __be32 d_itimer; /* zero if within inode limits if not,
59 this is when we refuse service */ 59 this is when we refuse service */
60/*32*/ __int32_t d_btimer; /* similar to above; for disk blocks */ 60 __be32 d_btimer; /* similar to above; for disk blocks */
61/*16*/ xfs_qwarncnt_t d_iwarns; /* warnings issued wrt num inodes */ 61 __be16 d_iwarns; /* warnings issued wrt num inodes */
62/*16*/ xfs_qwarncnt_t d_bwarns; /* warnings issued wrt disk blocks */ 62 __be16 d_bwarns; /* warnings issued wrt disk blocks */
63/*32*/ __int32_t d_pad0; /* 64 bit align */ 63 __be32 d_pad0; /* 64 bit align */
64/*64*/ xfs_qcnt_t d_rtb_hardlimit;/* absolute limit on realtime blks */ 64 __be64 d_rtb_hardlimit;/* absolute limit on realtime blks */
65/*64*/ xfs_qcnt_t d_rtb_softlimit;/* preferred limit on RT disk blks */ 65 __be64 d_rtb_softlimit;/* preferred limit on RT disk blks */
66/*64*/ xfs_qcnt_t d_rtbcount; /* realtime blocks owned */ 66 __be64 d_rtbcount; /* realtime blocks owned */
67/*32*/ __int32_t d_rtbtimer; /* similar to above; for RT disk blocks */ 67 __be32 d_rtbtimer; /* similar to above; for RT disk blocks */
68/*16*/ xfs_qwarncnt_t d_rtbwarns; /* warnings issued wrt RT disk blocks */ 68 __be16 d_rtbwarns; /* warnings issued wrt RT disk blocks */
69/*16*/ __uint16_t d_pad; 69 __be16 d_pad;
70} xfs_disk_dquot_t; 70} xfs_disk_dquot_t;
71 71
72/* 72/*