aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_ialloc_btree.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/xfs/xfs_ialloc_btree.c')
-rw-r--r--fs/xfs/xfs_ialloc_btree.c236
1 files changed, 118 insertions, 118 deletions
diff --git a/fs/xfs/xfs_ialloc_btree.c b/fs/xfs/xfs_ialloc_btree.c
index 6912143f6ffe..60c65683462d 100644
--- a/fs/xfs/xfs_ialloc_btree.c
+++ b/fs/xfs/xfs_ialloc_btree.c
@@ -118,7 +118,7 @@ xfs_inobt_delrec(
118 * Fail if we're off the end of the block. 118 * Fail if we're off the end of the block.
119 */ 119 */
120 120
121 numrecs = INT_GET(block->bb_numrecs, ARCH_CONVERT); 121 numrecs = be16_to_cpu(block->bb_numrecs);
122 if (ptr > numrecs) { 122 if (ptr > numrecs) {
123 *stat = 0; 123 *stat = 0;
124 return 0; 124 return 0;
@@ -133,7 +133,7 @@ xfs_inobt_delrec(
133 pp = XFS_INOBT_PTR_ADDR(block, 1, cur); 133 pp = XFS_INOBT_PTR_ADDR(block, 1, cur);
134#ifdef DEBUG 134#ifdef DEBUG
135 for (i = ptr; i < numrecs; i++) { 135 for (i = ptr; i < numrecs; i++) {
136 if ((error = xfs_btree_check_sptr(cur, INT_GET(pp[i], ARCH_CONVERT), level))) 136 if ((error = xfs_btree_check_sptr(cur, be32_to_cpu(pp[i]), level)))
137 return error; 137 return error;
138 } 138 }
139#endif 139#endif
@@ -170,7 +170,7 @@ xfs_inobt_delrec(
170 * Decrement and log the number of entries in the block. 170 * Decrement and log the number of entries in the block.
171 */ 171 */
172 numrecs--; 172 numrecs--;
173 INT_SET(block->bb_numrecs, ARCH_CONVERT, numrecs); 173 block->bb_numrecs = cpu_to_be16(numrecs);
174 xfs_inobt_log_block(cur->bc_tp, bp, XFS_BB_NUMRECS); 174 xfs_inobt_log_block(cur->bc_tp, bp, XFS_BB_NUMRECS);
175 /* 175 /*
176 * Is this the root level? If so, we're almost done. 176 * Is this the root level? If so, we're almost done.
@@ -189,9 +189,9 @@ xfs_inobt_delrec(
189 * pp is still set to the first pointer in the block. 189 * pp is still set to the first pointer in the block.
190 * Make it the new root of the btree. 190 * Make it the new root of the btree.
191 */ 191 */
192 bno = INT_GET(agi->agi_root, ARCH_CONVERT); 192 bno = be32_to_cpu(agi->agi_root);
193 agi->agi_root = *pp; 193 agi->agi_root = *pp;
194 INT_MOD(agi->agi_level, ARCH_CONVERT, -1); 194 be32_add(&agi->agi_level, -1);
195 /* 195 /*
196 * Free the block. 196 * Free the block.
197 */ 197 */
@@ -234,8 +234,8 @@ xfs_inobt_delrec(
234 * tree balanced. Look at the left and right sibling blocks to 234 * tree balanced. Look at the left and right sibling blocks to
235 * see if we can re-balance by moving only one record. 235 * see if we can re-balance by moving only one record.
236 */ 236 */
237 rbno = INT_GET(block->bb_rightsib, ARCH_CONVERT); 237 rbno = be32_to_cpu(block->bb_rightsib);
238 lbno = INT_GET(block->bb_leftsib, ARCH_CONVERT); 238 lbno = be32_to_cpu(block->bb_leftsib);
239 bno = NULLAGBLOCK; 239 bno = NULLAGBLOCK;
240 ASSERT(rbno != NULLAGBLOCK || lbno != NULLAGBLOCK); 240 ASSERT(rbno != NULLAGBLOCK || lbno != NULLAGBLOCK);
241 /* 241 /*
@@ -272,18 +272,18 @@ xfs_inobt_delrec(
272 /* 272 /*
273 * Grab the current block number, for future use. 273 * Grab the current block number, for future use.
274 */ 274 */
275 bno = INT_GET(right->bb_leftsib, ARCH_CONVERT); 275 bno = be32_to_cpu(right->bb_leftsib);
276 /* 276 /*
277 * If right block is full enough so that removing one entry 277 * If right block is full enough so that removing one entry
278 * won't make it too empty, and left-shifting an entry out 278 * won't make it too empty, and left-shifting an entry out
279 * of right to us works, we're done. 279 * of right to us works, we're done.
280 */ 280 */
281 if (INT_GET(right->bb_numrecs, ARCH_CONVERT) - 1 >= 281 if (be16_to_cpu(right->bb_numrecs) - 1 >=
282 XFS_INOBT_BLOCK_MINRECS(level, cur)) { 282 XFS_INOBT_BLOCK_MINRECS(level, cur)) {
283 if ((error = xfs_inobt_lshift(tcur, level, &i))) 283 if ((error = xfs_inobt_lshift(tcur, level, &i)))
284 goto error0; 284 goto error0;
285 if (i) { 285 if (i) {
286 ASSERT(INT_GET(block->bb_numrecs, ARCH_CONVERT) >= 286 ASSERT(be16_to_cpu(block->bb_numrecs) >=
287 XFS_INOBT_BLOCK_MINRECS(level, cur)); 287 XFS_INOBT_BLOCK_MINRECS(level, cur));
288 xfs_btree_del_cursor(tcur, 288 xfs_btree_del_cursor(tcur,
289 XFS_BTREE_NOERROR); 289 XFS_BTREE_NOERROR);
@@ -300,7 +300,7 @@ xfs_inobt_delrec(
300 * future reference, and fix up the temp cursor to point 300 * future reference, and fix up the temp cursor to point
301 * to our block again (last record). 301 * to our block again (last record).
302 */ 302 */
303 rrecs = INT_GET(right->bb_numrecs, ARCH_CONVERT); 303 rrecs = be16_to_cpu(right->bb_numrecs);
304 if (lbno != NULLAGBLOCK) { 304 if (lbno != NULLAGBLOCK) {
305 xfs_btree_firstrec(tcur, level); 305 xfs_btree_firstrec(tcur, level);
306 if ((error = xfs_inobt_decrement(tcur, level, &i))) 306 if ((error = xfs_inobt_decrement(tcur, level, &i)))
@@ -332,18 +332,18 @@ xfs_inobt_delrec(
332 /* 332 /*
333 * Grab the current block number, for future use. 333 * Grab the current block number, for future use.
334 */ 334 */
335 bno = INT_GET(left->bb_rightsib, ARCH_CONVERT); 335 bno = be32_to_cpu(left->bb_rightsib);
336 /* 336 /*
337 * If left block is full enough so that removing one entry 337 * If left block is full enough so that removing one entry
338 * won't make it too empty, and right-shifting an entry out 338 * won't make it too empty, and right-shifting an entry out
339 * of left to us works, we're done. 339 * of left to us works, we're done.
340 */ 340 */
341 if (INT_GET(left->bb_numrecs, ARCH_CONVERT) - 1 >= 341 if (be16_to_cpu(left->bb_numrecs) - 1 >=
342 XFS_INOBT_BLOCK_MINRECS(level, cur)) { 342 XFS_INOBT_BLOCK_MINRECS(level, cur)) {
343 if ((error = xfs_inobt_rshift(tcur, level, &i))) 343 if ((error = xfs_inobt_rshift(tcur, level, &i)))
344 goto error0; 344 goto error0;
345 if (i) { 345 if (i) {
346 ASSERT(INT_GET(block->bb_numrecs, ARCH_CONVERT) >= 346 ASSERT(be16_to_cpu(block->bb_numrecs) >=
347 XFS_INOBT_BLOCK_MINRECS(level, cur)); 347 XFS_INOBT_BLOCK_MINRECS(level, cur));
348 xfs_btree_del_cursor(tcur, 348 xfs_btree_del_cursor(tcur,
349 XFS_BTREE_NOERROR); 349 XFS_BTREE_NOERROR);
@@ -357,7 +357,7 @@ xfs_inobt_delrec(
357 * Otherwise, grab the number of records in right for 357 * Otherwise, grab the number of records in right for
358 * future reference. 358 * future reference.
359 */ 359 */
360 lrecs = INT_GET(left->bb_numrecs, ARCH_CONVERT); 360 lrecs = be16_to_cpu(left->bb_numrecs);
361 } 361 }
362 /* 362 /*
363 * Delete the temp cursor, we're done with it. 363 * Delete the temp cursor, we're done with it.
@@ -378,14 +378,14 @@ xfs_inobt_delrec(
378 */ 378 */
379 rbno = bno; 379 rbno = bno;
380 right = block; 380 right = block;
381 rrecs = INT_GET(right->bb_numrecs, ARCH_CONVERT); 381 rrecs = be16_to_cpu(right->bb_numrecs);
382 rbp = bp; 382 rbp = bp;
383 if ((error = xfs_btree_read_bufs(mp, cur->bc_tp, 383 if ((error = xfs_btree_read_bufs(mp, cur->bc_tp,
384 cur->bc_private.i.agno, lbno, 0, &lbp, 384 cur->bc_private.i.agno, lbno, 0, &lbp,
385 XFS_INO_BTREE_REF))) 385 XFS_INO_BTREE_REF)))
386 return error; 386 return error;
387 left = XFS_BUF_TO_INOBT_BLOCK(lbp); 387 left = XFS_BUF_TO_INOBT_BLOCK(lbp);
388 lrecs = INT_GET(left->bb_numrecs, ARCH_CONVERT); 388 lrecs = be16_to_cpu(left->bb_numrecs);
389 if ((error = xfs_btree_check_sblock(cur, left, level, lbp))) 389 if ((error = xfs_btree_check_sblock(cur, left, level, lbp)))
390 return error; 390 return error;
391 } 391 }
@@ -400,14 +400,14 @@ xfs_inobt_delrec(
400 */ 400 */
401 lbno = bno; 401 lbno = bno;
402 left = block; 402 left = block;
403 lrecs = INT_GET(left->bb_numrecs, ARCH_CONVERT); 403 lrecs = be16_to_cpu(left->bb_numrecs);
404 lbp = bp; 404 lbp = bp;
405 if ((error = xfs_btree_read_bufs(mp, cur->bc_tp, 405 if ((error = xfs_btree_read_bufs(mp, cur->bc_tp,
406 cur->bc_private.i.agno, rbno, 0, &rbp, 406 cur->bc_private.i.agno, rbno, 0, &rbp,
407 XFS_INO_BTREE_REF))) 407 XFS_INO_BTREE_REF)))
408 return error; 408 return error;
409 right = XFS_BUF_TO_INOBT_BLOCK(rbp); 409 right = XFS_BUF_TO_INOBT_BLOCK(rbp);
410 rrecs = INT_GET(right->bb_numrecs, ARCH_CONVERT); 410 rrecs = be16_to_cpu(right->bb_numrecs);
411 if ((error = xfs_btree_check_sblock(cur, right, level, rbp))) 411 if ((error = xfs_btree_check_sblock(cur, right, level, rbp)))
412 return error; 412 return error;
413 } 413 }
@@ -435,7 +435,7 @@ xfs_inobt_delrec(
435 rpp = XFS_INOBT_PTR_ADDR(right, 1, cur); 435 rpp = XFS_INOBT_PTR_ADDR(right, 1, cur);
436#ifdef DEBUG 436#ifdef DEBUG
437 for (i = 0; i < rrecs; i++) { 437 for (i = 0; i < rrecs; i++) {
438 if ((error = xfs_btree_check_sptr(cur, INT_GET(rpp[i], ARCH_CONVERT), level))) 438 if ((error = xfs_btree_check_sptr(cur, be32_to_cpu(rpp[i]), level)))
439 return error; 439 return error;
440 } 440 }
441#endif 441#endif
@@ -471,7 +471,7 @@ xfs_inobt_delrec(
471 * Fix up the number of records in the surviving block. 471 * Fix up the number of records in the surviving block.
472 */ 472 */
473 lrecs += rrecs; 473 lrecs += rrecs;
474 INT_SET(left->bb_numrecs, ARCH_CONVERT, lrecs); 474 left->bb_numrecs = cpu_to_be16(lrecs);
475 /* 475 /*
476 * Fix up the right block pointer in the surviving block, and log it. 476 * Fix up the right block pointer in the surviving block, and log it.
477 */ 477 */
@@ -481,18 +481,18 @@ xfs_inobt_delrec(
481 * If there is a right sibling now, make it point to the 481 * If there is a right sibling now, make it point to the
482 * remaining block. 482 * remaining block.
483 */ 483 */
484 if (INT_GET(left->bb_rightsib, ARCH_CONVERT) != NULLAGBLOCK) { 484 if (be32_to_cpu(left->bb_rightsib) != NULLAGBLOCK) {
485 xfs_inobt_block_t *rrblock; 485 xfs_inobt_block_t *rrblock;
486 xfs_buf_t *rrbp; 486 xfs_buf_t *rrbp;
487 487
488 if ((error = xfs_btree_read_bufs(mp, cur->bc_tp, 488 if ((error = xfs_btree_read_bufs(mp, cur->bc_tp,
489 cur->bc_private.i.agno, INT_GET(left->bb_rightsib, ARCH_CONVERT), 0, 489 cur->bc_private.i.agno, be32_to_cpu(left->bb_rightsib), 0,
490 &rrbp, XFS_INO_BTREE_REF))) 490 &rrbp, XFS_INO_BTREE_REF)))
491 return error; 491 return error;
492 rrblock = XFS_BUF_TO_INOBT_BLOCK(rrbp); 492 rrblock = XFS_BUF_TO_INOBT_BLOCK(rrbp);
493 if ((error = xfs_btree_check_sblock(cur, rrblock, level, rrbp))) 493 if ((error = xfs_btree_check_sblock(cur, rrblock, level, rrbp)))
494 return error; 494 return error;
495 INT_SET(rrblock->bb_leftsib, ARCH_CONVERT, lbno); 495 rrblock->bb_leftsib = cpu_to_be32(lbno);
496 xfs_inobt_log_block(cur->bc_tp, rrbp, XFS_BB_LEFTSIB); 496 xfs_inobt_log_block(cur->bc_tp, rrbp, XFS_BB_LEFTSIB);
497 } 497 }
498 /* 498 /*
@@ -584,7 +584,7 @@ xfs_inobt_insrec(
584 */ 584 */
585 bp = cur->bc_bufs[level]; 585 bp = cur->bc_bufs[level];
586 block = XFS_BUF_TO_INOBT_BLOCK(bp); 586 block = XFS_BUF_TO_INOBT_BLOCK(bp);
587 numrecs = INT_GET(block->bb_numrecs, ARCH_CONVERT); 587 numrecs = be16_to_cpu(block->bb_numrecs);
588#ifdef DEBUG 588#ifdef DEBUG
589 if ((error = xfs_btree_check_sblock(cur, block, level, bp))) 589 if ((error = xfs_btree_check_sblock(cur, block, level, bp)))
590 return error; 590 return error;
@@ -658,7 +658,7 @@ xfs_inobt_insrec(
658 * At this point we know there's room for our new entry in the block 658 * At this point we know there's room for our new entry in the block
659 * we're pointing at. 659 * we're pointing at.
660 */ 660 */
661 numrecs = INT_GET(block->bb_numrecs, ARCH_CONVERT); 661 numrecs = be16_to_cpu(block->bb_numrecs);
662 if (level > 0) { 662 if (level > 0) {
663 /* 663 /*
664 * It's a non-leaf entry. Make a hole for the new data 664 * It's a non-leaf entry. Make a hole for the new data
@@ -668,7 +668,7 @@ xfs_inobt_insrec(
668 pp = XFS_INOBT_PTR_ADDR(block, 1, cur); 668 pp = XFS_INOBT_PTR_ADDR(block, 1, cur);
669#ifdef DEBUG 669#ifdef DEBUG
670 for (i = numrecs; i >= ptr; i--) { 670 for (i = numrecs; i >= ptr; i--) {
671 if ((error = xfs_btree_check_sptr(cur, INT_GET(pp[i - 1], ARCH_CONVERT), level))) 671 if ((error = xfs_btree_check_sptr(cur, be32_to_cpu(pp[i - 1]), level)))
672 return error; 672 return error;
673 } 673 }
674#endif 674#endif
@@ -684,9 +684,9 @@ xfs_inobt_insrec(
684 return error; 684 return error;
685#endif 685#endif
686 kp[ptr - 1] = key; /* INT_: struct copy */ 686 kp[ptr - 1] = key; /* INT_: struct copy */
687 INT_SET(pp[ptr - 1], ARCH_CONVERT, *bnop); 687 pp[ptr - 1] = cpu_to_be32(*bnop);
688 numrecs++; 688 numrecs++;
689 INT_SET(block->bb_numrecs, ARCH_CONVERT, numrecs); 689 block->bb_numrecs = cpu_to_be16(numrecs);
690 xfs_inobt_log_keys(cur, bp, ptr, numrecs); 690 xfs_inobt_log_keys(cur, bp, ptr, numrecs);
691 xfs_inobt_log_ptrs(cur, bp, ptr, numrecs); 691 xfs_inobt_log_ptrs(cur, bp, ptr, numrecs);
692 } else { 692 } else {
@@ -702,7 +702,7 @@ xfs_inobt_insrec(
702 */ 702 */
703 rp[ptr - 1] = *recp; /* INT_: struct copy */ 703 rp[ptr - 1] = *recp; /* INT_: struct copy */
704 numrecs++; 704 numrecs++;
705 INT_SET(block->bb_numrecs, ARCH_CONVERT, numrecs); 705 block->bb_numrecs = cpu_to_be16(numrecs);
706 xfs_inobt_log_recs(cur, bp, ptr, numrecs); 706 xfs_inobt_log_recs(cur, bp, ptr, numrecs);
707 } 707 }
708 /* 708 /*
@@ -857,8 +857,8 @@ xfs_inobt_lookup(
857 xfs_agi_t *agi; /* a.g. inode header */ 857 xfs_agi_t *agi; /* a.g. inode header */
858 858
859 agi = XFS_BUF_TO_AGI(cur->bc_private.i.agbp); 859 agi = XFS_BUF_TO_AGI(cur->bc_private.i.agbp);
860 agno = INT_GET(agi->agi_seqno, ARCH_CONVERT); 860 agno = be32_to_cpu(agi->agi_seqno);
861 agbno = INT_GET(agi->agi_root, ARCH_CONVERT); 861 agbno = be32_to_cpu(agi->agi_root);
862 } 862 }
863 /* 863 /*
864 * Iterate over each level in the btree, starting at the root. 864 * Iterate over each level in the btree, starting at the root.
@@ -925,7 +925,7 @@ xfs_inobt_lookup(
925 * Set low and high entry numbers, 1-based. 925 * Set low and high entry numbers, 1-based.
926 */ 926 */
927 low = 1; 927 low = 1;
928 if (!(high = INT_GET(block->bb_numrecs, ARCH_CONVERT))) { 928 if (!(high = be16_to_cpu(block->bb_numrecs))) {
929 /* 929 /*
930 * If the block is empty, the tree must 930 * If the block is empty, the tree must
931 * be an empty leaf. 931 * be an empty leaf.
@@ -992,7 +992,7 @@ xfs_inobt_lookup(
992 */ 992 */
993 if (diff > 0 && --keyno < 1) 993 if (diff > 0 && --keyno < 1)
994 keyno = 1; 994 keyno = 1;
995 agbno = INT_GET(*XFS_INOBT_PTR_ADDR(block, keyno, cur), ARCH_CONVERT); 995 agbno = be32_to_cpu(*XFS_INOBT_PTR_ADDR(block, keyno, cur));
996#ifdef DEBUG 996#ifdef DEBUG
997 if ((error = xfs_btree_check_sptr(cur, agbno, level))) 997 if ((error = xfs_btree_check_sptr(cur, agbno, level)))
998 return error; 998 return error;
@@ -1011,8 +1011,8 @@ xfs_inobt_lookup(
1011 * not the last block, we're in the wrong block. 1011 * not the last block, we're in the wrong block.
1012 */ 1012 */
1013 if (dir == XFS_LOOKUP_GE && 1013 if (dir == XFS_LOOKUP_GE &&
1014 keyno > INT_GET(block->bb_numrecs, ARCH_CONVERT) && 1014 keyno > be16_to_cpu(block->bb_numrecs) &&
1015 INT_GET(block->bb_rightsib, ARCH_CONVERT) != NULLAGBLOCK) { 1015 be32_to_cpu(block->bb_rightsib) != NULLAGBLOCK) {
1016 int i; 1016 int i;
1017 1017
1018 cur->bc_ptrs[0] = keyno; 1018 cur->bc_ptrs[0] = keyno;
@@ -1029,7 +1029,7 @@ xfs_inobt_lookup(
1029 /* 1029 /*
1030 * Return if we succeeded or not. 1030 * Return if we succeeded or not.
1031 */ 1031 */
1032 if (keyno == 0 || keyno > INT_GET(block->bb_numrecs, ARCH_CONVERT)) 1032 if (keyno == 0 || keyno > be16_to_cpu(block->bb_numrecs))
1033 *stat = 0; 1033 *stat = 0;
1034 else 1034 else
1035 *stat = ((dir != XFS_LOOKUP_EQ) || (diff == 0)); 1035 *stat = ((dir != XFS_LOOKUP_EQ) || (diff == 0));
@@ -1075,7 +1075,7 @@ xfs_inobt_lshift(
1075 /* 1075 /*
1076 * If we've got no left sibling then we can't shift an entry left. 1076 * If we've got no left sibling then we can't shift an entry left.
1077 */ 1077 */
1078 if (INT_GET(right->bb_leftsib, ARCH_CONVERT) == NULLAGBLOCK) { 1078 if (be32_to_cpu(right->bb_leftsib) == NULLAGBLOCK) {
1079 *stat = 0; 1079 *stat = 0;
1080 return 0; 1080 return 0;
1081 } 1081 }
@@ -1091,8 +1091,8 @@ xfs_inobt_lshift(
1091 * Set up the left neighbor as "left". 1091 * Set up the left neighbor as "left".
1092 */ 1092 */
1093 if ((error = xfs_btree_read_bufs(cur->bc_mp, cur->bc_tp, 1093 if ((error = xfs_btree_read_bufs(cur->bc_mp, cur->bc_tp,
1094 cur->bc_private.i.agno, INT_GET(right->bb_leftsib, ARCH_CONVERT), 0, &lbp, 1094 cur->bc_private.i.agno, be32_to_cpu(right->bb_leftsib),
1095 XFS_INO_BTREE_REF))) 1095 0, &lbp, XFS_INO_BTREE_REF)))
1096 return error; 1096 return error;
1097 left = XFS_BUF_TO_INOBT_BLOCK(lbp); 1097 left = XFS_BUF_TO_INOBT_BLOCK(lbp);
1098 if ((error = xfs_btree_check_sblock(cur, left, level, lbp))) 1098 if ((error = xfs_btree_check_sblock(cur, left, level, lbp)))
@@ -1100,11 +1100,11 @@ xfs_inobt_lshift(
1100 /* 1100 /*
1101 * If it's full, it can't take another entry. 1101 * If it's full, it can't take another entry.
1102 */ 1102 */
1103 if (INT_GET(left->bb_numrecs, ARCH_CONVERT) == XFS_INOBT_BLOCK_MAXRECS(level, cur)) { 1103 if (be16_to_cpu(left->bb_numrecs) == XFS_INOBT_BLOCK_MAXRECS(level, cur)) {
1104 *stat = 0; 1104 *stat = 0;
1105 return 0; 1105 return 0;
1106 } 1106 }
1107 nrec = INT_GET(left->bb_numrecs, ARCH_CONVERT) + 1; 1107 nrec = be16_to_cpu(left->bb_numrecs) + 1;
1108 /* 1108 /*
1109 * If non-leaf, copy a key and a ptr to the left block. 1109 * If non-leaf, copy a key and a ptr to the left block.
1110 */ 1110 */
@@ -1116,7 +1116,7 @@ xfs_inobt_lshift(
1116 lpp = XFS_INOBT_PTR_ADDR(left, nrec, cur); 1116 lpp = XFS_INOBT_PTR_ADDR(left, nrec, cur);
1117 rpp = XFS_INOBT_PTR_ADDR(right, 1, cur); 1117 rpp = XFS_INOBT_PTR_ADDR(right, 1, cur);
1118#ifdef DEBUG 1118#ifdef DEBUG
1119 if ((error = xfs_btree_check_sptr(cur, INT_GET(*rpp, ARCH_CONVERT), level))) 1119 if ((error = xfs_btree_check_sptr(cur, be32_to_cpu(*rpp), level)))
1120 return error; 1120 return error;
1121#endif 1121#endif
1122 *lpp = *rpp; /* INT_: no-change copy */ 1122 *lpp = *rpp; /* INT_: no-change copy */
@@ -1134,7 +1134,7 @@ xfs_inobt_lshift(
1134 /* 1134 /*
1135 * Bump and log left's numrecs, decrement and log right's numrecs. 1135 * Bump and log left's numrecs, decrement and log right's numrecs.
1136 */ 1136 */
1137 INT_MOD(left->bb_numrecs, ARCH_CONVERT, +1); 1137 be16_add(&left->bb_numrecs, 1);
1138 xfs_inobt_log_block(cur->bc_tp, lbp, XFS_BB_NUMRECS); 1138 xfs_inobt_log_block(cur->bc_tp, lbp, XFS_BB_NUMRECS);
1139#ifdef DEBUG 1139#ifdef DEBUG
1140 if (level > 0) 1140 if (level > 0)
@@ -1142,26 +1142,26 @@ xfs_inobt_lshift(
1142 else 1142 else
1143 xfs_btree_check_rec(cur->bc_btnum, lrp - 1, lrp); 1143 xfs_btree_check_rec(cur->bc_btnum, lrp - 1, lrp);
1144#endif 1144#endif
1145 INT_MOD(right->bb_numrecs, ARCH_CONVERT, -1); 1145 be16_add(&right->bb_numrecs, -1);
1146 xfs_inobt_log_block(cur->bc_tp, rbp, XFS_BB_NUMRECS); 1146 xfs_inobt_log_block(cur->bc_tp, rbp, XFS_BB_NUMRECS);
1147 /* 1147 /*
1148 * Slide the contents of right down one entry. 1148 * Slide the contents of right down one entry.
1149 */ 1149 */
1150 if (level > 0) { 1150 if (level > 0) {
1151#ifdef DEBUG 1151#ifdef DEBUG
1152 for (i = 0; i < INT_GET(right->bb_numrecs, ARCH_CONVERT); i++) { 1152 for (i = 0; i < be16_to_cpu(right->bb_numrecs); i++) {
1153 if ((error = xfs_btree_check_sptr(cur, INT_GET(rpp[i + 1], ARCH_CONVERT), 1153 if ((error = xfs_btree_check_sptr(cur, be32_to_cpu(rpp[i + 1]),
1154 level))) 1154 level)))
1155 return error; 1155 return error;
1156 } 1156 }
1157#endif 1157#endif
1158 memmove(rkp, rkp + 1, INT_GET(right->bb_numrecs, ARCH_CONVERT) * sizeof(*rkp)); 1158 memmove(rkp, rkp + 1, be16_to_cpu(right->bb_numrecs) * sizeof(*rkp));
1159 memmove(rpp, rpp + 1, INT_GET(right->bb_numrecs, ARCH_CONVERT) * sizeof(*rpp)); 1159 memmove(rpp, rpp + 1, be16_to_cpu(right->bb_numrecs) * sizeof(*rpp));
1160 xfs_inobt_log_keys(cur, rbp, 1, INT_GET(right->bb_numrecs, ARCH_CONVERT)); 1160 xfs_inobt_log_keys(cur, rbp, 1, be16_to_cpu(right->bb_numrecs));
1161 xfs_inobt_log_ptrs(cur, rbp, 1, INT_GET(right->bb_numrecs, ARCH_CONVERT)); 1161 xfs_inobt_log_ptrs(cur, rbp, 1, be16_to_cpu(right->bb_numrecs));
1162 } else { 1162 } else {
1163 memmove(rrp, rrp + 1, INT_GET(right->bb_numrecs, ARCH_CONVERT) * sizeof(*rrp)); 1163 memmove(rrp, rrp + 1, be16_to_cpu(right->bb_numrecs) * sizeof(*rrp));
1164 xfs_inobt_log_recs(cur, rbp, 1, INT_GET(right->bb_numrecs, ARCH_CONVERT)); 1164 xfs_inobt_log_recs(cur, rbp, 1, be16_to_cpu(right->bb_numrecs));
1165 key.ir_startino = rrp->ir_startino; /* INT_: direct copy */ 1165 key.ir_startino = rrp->ir_startino; /* INT_: direct copy */
1166 rkp = &key; 1166 rkp = &key;
1167 } 1167 }
@@ -1213,7 +1213,7 @@ xfs_inobt_newroot(
1213 args.tp = cur->bc_tp; 1213 args.tp = cur->bc_tp;
1214 args.mp = cur->bc_mp; 1214 args.mp = cur->bc_mp;
1215 args.fsbno = XFS_AGB_TO_FSB(args.mp, cur->bc_private.i.agno, 1215 args.fsbno = XFS_AGB_TO_FSB(args.mp, cur->bc_private.i.agno,
1216 INT_GET(agi->agi_root, ARCH_CONVERT)); 1216 be32_to_cpu(agi->agi_root));
1217 args.mod = args.minleft = args.alignment = args.total = args.wasdel = 1217 args.mod = args.minleft = args.alignment = args.total = args.wasdel =
1218 args.isfl = args.userdata = args.minalignslop = 0; 1218 args.isfl = args.userdata = args.minalignslop = 0;
1219 args.minlen = args.maxlen = args.prod = 1; 1219 args.minlen = args.maxlen = args.prod = 1;
@@ -1233,8 +1233,8 @@ xfs_inobt_newroot(
1233 /* 1233 /*
1234 * Set the root data in the a.g. inode structure. 1234 * Set the root data in the a.g. inode structure.
1235 */ 1235 */
1236 INT_SET(agi->agi_root, ARCH_CONVERT, args.agbno); 1236 agi->agi_root = cpu_to_be32(args.agbno);
1237 INT_MOD(agi->agi_level, ARCH_CONVERT, 1); 1237 be32_add(&agi->agi_level, 1);
1238 xfs_ialloc_log_agi(args.tp, cur->bc_private.i.agbp, 1238 xfs_ialloc_log_agi(args.tp, cur->bc_private.i.agbp,
1239 XFS_AGI_ROOT | XFS_AGI_LEVEL); 1239 XFS_AGI_ROOT | XFS_AGI_LEVEL);
1240 /* 1240 /*
@@ -1249,14 +1249,14 @@ xfs_inobt_newroot(
1249 if ((error = xfs_btree_check_sblock(cur, block, cur->bc_nlevels - 1, bp))) 1249 if ((error = xfs_btree_check_sblock(cur, block, cur->bc_nlevels - 1, bp)))
1250 return error; 1250 return error;
1251#endif 1251#endif
1252 if (INT_GET(block->bb_rightsib, ARCH_CONVERT) != NULLAGBLOCK) { 1252 if (be32_to_cpu(block->bb_rightsib) != NULLAGBLOCK) {
1253 /* 1253 /*
1254 * Our block is left, pick up the right block. 1254 * Our block is left, pick up the right block.
1255 */ 1255 */
1256 lbp = bp; 1256 lbp = bp;
1257 lbno = XFS_DADDR_TO_AGBNO(args.mp, XFS_BUF_ADDR(lbp)); 1257 lbno = XFS_DADDR_TO_AGBNO(args.mp, XFS_BUF_ADDR(lbp));
1258 left = block; 1258 left = block;
1259 rbno = INT_GET(left->bb_rightsib, ARCH_CONVERT); 1259 rbno = be32_to_cpu(left->bb_rightsib);
1260 if ((error = xfs_btree_read_bufs(args.mp, args.tp, args.agno, 1260 if ((error = xfs_btree_read_bufs(args.mp, args.tp, args.agno,
1261 rbno, 0, &rbp, XFS_INO_BTREE_REF))) 1261 rbno, 0, &rbp, XFS_INO_BTREE_REF)))
1262 return error; 1262 return error;
@@ -1273,7 +1273,7 @@ xfs_inobt_newroot(
1273 rbp = bp; 1273 rbp = bp;
1274 rbno = XFS_DADDR_TO_AGBNO(args.mp, XFS_BUF_ADDR(rbp)); 1274 rbno = XFS_DADDR_TO_AGBNO(args.mp, XFS_BUF_ADDR(rbp));
1275 right = block; 1275 right = block;
1276 lbno = INT_GET(right->bb_leftsib, ARCH_CONVERT); 1276 lbno = be32_to_cpu(right->bb_leftsib);
1277 if ((error = xfs_btree_read_bufs(args.mp, args.tp, args.agno, 1277 if ((error = xfs_btree_read_bufs(args.mp, args.tp, args.agno,
1278 lbno, 0, &lbp, XFS_INO_BTREE_REF))) 1278 lbno, 0, &lbp, XFS_INO_BTREE_REF)))
1279 return error; 1279 return error;
@@ -1287,18 +1287,18 @@ xfs_inobt_newroot(
1287 /* 1287 /*
1288 * Fill in the new block's btree header and log it. 1288 * Fill in the new block's btree header and log it.
1289 */ 1289 */
1290 INT_SET(new->bb_magic, ARCH_CONVERT, xfs_magics[cur->bc_btnum]); 1290 new->bb_magic = cpu_to_be32(xfs_magics[cur->bc_btnum]);
1291 INT_SET(new->bb_level, ARCH_CONVERT, (__uint16_t)cur->bc_nlevels); 1291 new->bb_level = cpu_to_be16(cur->bc_nlevels);
1292 INT_SET(new->bb_numrecs, ARCH_CONVERT, 2); 1292 new->bb_numrecs = cpu_to_be16(2);
1293 INT_SET(new->bb_leftsib, ARCH_CONVERT, NULLAGBLOCK); 1293 new->bb_leftsib = cpu_to_be32(NULLAGBLOCK);
1294 INT_SET(new->bb_rightsib, ARCH_CONVERT, NULLAGBLOCK); 1294 new->bb_rightsib = cpu_to_be32(NULLAGBLOCK);
1295 xfs_inobt_log_block(args.tp, nbp, XFS_BB_ALL_BITS); 1295 xfs_inobt_log_block(args.tp, nbp, XFS_BB_ALL_BITS);
1296 ASSERT(lbno != NULLAGBLOCK && rbno != NULLAGBLOCK); 1296 ASSERT(lbno != NULLAGBLOCK && rbno != NULLAGBLOCK);
1297 /* 1297 /*
1298 * Fill in the key data in the new root. 1298 * Fill in the key data in the new root.
1299 */ 1299 */
1300 kp = XFS_INOBT_KEY_ADDR(new, 1, cur); 1300 kp = XFS_INOBT_KEY_ADDR(new, 1, cur);
1301 if (INT_GET(left->bb_level, ARCH_CONVERT) > 0) { 1301 if (be16_to_cpu(left->bb_level) > 0) {
1302 kp[0] = *XFS_INOBT_KEY_ADDR(left, 1, cur); /* INT_: struct copy */ 1302 kp[0] = *XFS_INOBT_KEY_ADDR(left, 1, cur); /* INT_: struct copy */
1303 kp[1] = *XFS_INOBT_KEY_ADDR(right, 1, cur); /* INT_: struct copy */ 1303 kp[1] = *XFS_INOBT_KEY_ADDR(right, 1, cur); /* INT_: struct copy */
1304 } else { 1304 } else {
@@ -1312,8 +1312,8 @@ xfs_inobt_newroot(
1312 * Fill in the pointer data in the new root. 1312 * Fill in the pointer data in the new root.
1313 */ 1313 */
1314 pp = XFS_INOBT_PTR_ADDR(new, 1, cur); 1314 pp = XFS_INOBT_PTR_ADDR(new, 1, cur);
1315 INT_SET(pp[0], ARCH_CONVERT, lbno); 1315 pp[0] = cpu_to_be32(lbno);
1316 INT_SET(pp[1], ARCH_CONVERT, rbno); 1316 pp[1] = cpu_to_be32(rbno);
1317 xfs_inobt_log_ptrs(cur, nbp, 1, 2); 1317 xfs_inobt_log_ptrs(cur, nbp, 1, 2);
1318 /* 1318 /*
1319 * Fix up the cursor. 1319 * Fix up the cursor.
@@ -1362,7 +1362,7 @@ xfs_inobt_rshift(
1362 /* 1362 /*
1363 * If we've got no right sibling then we can't shift an entry right. 1363 * If we've got no right sibling then we can't shift an entry right.
1364 */ 1364 */
1365 if (INT_GET(left->bb_rightsib, ARCH_CONVERT) == NULLAGBLOCK) { 1365 if (be32_to_cpu(left->bb_rightsib) == NULLAGBLOCK) {
1366 *stat = 0; 1366 *stat = 0;
1367 return 0; 1367 return 0;
1368 } 1368 }
@@ -1370,7 +1370,7 @@ xfs_inobt_rshift(
1370 * If the cursor entry is the one that would be moved, don't 1370 * If the cursor entry is the one that would be moved, don't
1371 * do it... it's too complicated. 1371 * do it... it's too complicated.
1372 */ 1372 */
1373 if (cur->bc_ptrs[level] >= INT_GET(left->bb_numrecs, ARCH_CONVERT)) { 1373 if (cur->bc_ptrs[level] >= be16_to_cpu(left->bb_numrecs)) {
1374 *stat = 0; 1374 *stat = 0;
1375 return 0; 1375 return 0;
1376 } 1376 }
@@ -1378,8 +1378,8 @@ xfs_inobt_rshift(
1378 * Set up the right neighbor as "right". 1378 * Set up the right neighbor as "right".
1379 */ 1379 */
1380 if ((error = xfs_btree_read_bufs(cur->bc_mp, cur->bc_tp, 1380 if ((error = xfs_btree_read_bufs(cur->bc_mp, cur->bc_tp,
1381 cur->bc_private.i.agno, INT_GET(left->bb_rightsib, ARCH_CONVERT), 0, &rbp, 1381 cur->bc_private.i.agno, be32_to_cpu(left->bb_rightsib),
1382 XFS_INO_BTREE_REF))) 1382 0, &rbp, XFS_INO_BTREE_REF)))
1383 return error; 1383 return error;
1384 right = XFS_BUF_TO_INOBT_BLOCK(rbp); 1384 right = XFS_BUF_TO_INOBT_BLOCK(rbp);
1385 if ((error = xfs_btree_check_sblock(cur, right, level, rbp))) 1385 if ((error = xfs_btree_check_sblock(cur, right, level, rbp)))
@@ -1387,7 +1387,7 @@ xfs_inobt_rshift(
1387 /* 1387 /*
1388 * If it's full, it can't take another entry. 1388 * If it's full, it can't take another entry.
1389 */ 1389 */
1390 if (INT_GET(right->bb_numrecs, ARCH_CONVERT) == XFS_INOBT_BLOCK_MAXRECS(level, cur)) { 1390 if (be16_to_cpu(right->bb_numrecs) == XFS_INOBT_BLOCK_MAXRECS(level, cur)) {
1391 *stat = 0; 1391 *stat = 0;
1392 return 0; 1392 return 0;
1393 } 1393 }
@@ -1396,41 +1396,41 @@ xfs_inobt_rshift(
1396 * copy the last left block entry to the hole. 1396 * copy the last left block entry to the hole.
1397 */ 1397 */
1398 if (level > 0) { 1398 if (level > 0) {
1399 lkp = XFS_INOBT_KEY_ADDR(left, INT_GET(left->bb_numrecs, ARCH_CONVERT), cur); 1399 lkp = XFS_INOBT_KEY_ADDR(left, be16_to_cpu(left->bb_numrecs), cur);
1400 lpp = XFS_INOBT_PTR_ADDR(left, INT_GET(left->bb_numrecs, ARCH_CONVERT), cur); 1400 lpp = XFS_INOBT_PTR_ADDR(left, be16_to_cpu(left->bb_numrecs), cur);
1401 rkp = XFS_INOBT_KEY_ADDR(right, 1, cur); 1401 rkp = XFS_INOBT_KEY_ADDR(right, 1, cur);
1402 rpp = XFS_INOBT_PTR_ADDR(right, 1, cur); 1402 rpp = XFS_INOBT_PTR_ADDR(right, 1, cur);
1403#ifdef DEBUG 1403#ifdef DEBUG
1404 for (i = INT_GET(right->bb_numrecs, ARCH_CONVERT) - 1; i >= 0; i--) { 1404 for (i = be16_to_cpu(right->bb_numrecs) - 1; i >= 0; i--) {
1405 if ((error = xfs_btree_check_sptr(cur, INT_GET(rpp[i], ARCH_CONVERT), level))) 1405 if ((error = xfs_btree_check_sptr(cur, be32_to_cpu(rpp[i]), level)))
1406 return error; 1406 return error;
1407 } 1407 }
1408#endif 1408#endif
1409 memmove(rkp + 1, rkp, INT_GET(right->bb_numrecs, ARCH_CONVERT) * sizeof(*rkp)); 1409 memmove(rkp + 1, rkp, be16_to_cpu(right->bb_numrecs) * sizeof(*rkp));
1410 memmove(rpp + 1, rpp, INT_GET(right->bb_numrecs, ARCH_CONVERT) * sizeof(*rpp)); 1410 memmove(rpp + 1, rpp, be16_to_cpu(right->bb_numrecs) * sizeof(*rpp));
1411#ifdef DEBUG 1411#ifdef DEBUG
1412 if ((error = xfs_btree_check_sptr(cur, INT_GET(*lpp, ARCH_CONVERT), level))) 1412 if ((error = xfs_btree_check_sptr(cur, be32_to_cpu(*lpp), level)))
1413 return error; 1413 return error;
1414#endif 1414#endif
1415 *rkp = *lkp; /* INT_: no change copy */ 1415 *rkp = *lkp; /* INT_: no change copy */
1416 *rpp = *lpp; /* INT_: no change copy */ 1416 *rpp = *lpp; /* INT_: no change copy */
1417 xfs_inobt_log_keys(cur, rbp, 1, INT_GET(right->bb_numrecs, ARCH_CONVERT) + 1); 1417 xfs_inobt_log_keys(cur, rbp, 1, be16_to_cpu(right->bb_numrecs) + 1);
1418 xfs_inobt_log_ptrs(cur, rbp, 1, INT_GET(right->bb_numrecs, ARCH_CONVERT) + 1); 1418 xfs_inobt_log_ptrs(cur, rbp, 1, be16_to_cpu(right->bb_numrecs) + 1);
1419 } else { 1419 } else {
1420 lrp = XFS_INOBT_REC_ADDR(left, INT_GET(left->bb_numrecs, ARCH_CONVERT), cur); 1420 lrp = XFS_INOBT_REC_ADDR(left, be16_to_cpu(left->bb_numrecs), cur);
1421 rrp = XFS_INOBT_REC_ADDR(right, 1, cur); 1421 rrp = XFS_INOBT_REC_ADDR(right, 1, cur);
1422 memmove(rrp + 1, rrp, INT_GET(right->bb_numrecs, ARCH_CONVERT) * sizeof(*rrp)); 1422 memmove(rrp + 1, rrp, be16_to_cpu(right->bb_numrecs) * sizeof(*rrp));
1423 *rrp = *lrp; 1423 *rrp = *lrp;
1424 xfs_inobt_log_recs(cur, rbp, 1, INT_GET(right->bb_numrecs, ARCH_CONVERT) + 1); 1424 xfs_inobt_log_recs(cur, rbp, 1, be16_to_cpu(right->bb_numrecs) + 1);
1425 key.ir_startino = rrp->ir_startino; /* INT_: direct copy */ 1425 key.ir_startino = rrp->ir_startino; /* INT_: direct copy */
1426 rkp = &key; 1426 rkp = &key;
1427 } 1427 }
1428 /* 1428 /*
1429 * Decrement and log left's numrecs, bump and log right's numrecs. 1429 * Decrement and log left's numrecs, bump and log right's numrecs.
1430 */ 1430 */
1431 INT_MOD(left->bb_numrecs, ARCH_CONVERT, -1); 1431 be16_add(&left->bb_numrecs, -1);
1432 xfs_inobt_log_block(cur->bc_tp, lbp, XFS_BB_NUMRECS); 1432 xfs_inobt_log_block(cur->bc_tp, lbp, XFS_BB_NUMRECS);
1433 INT_MOD(right->bb_numrecs, ARCH_CONVERT, +1); 1433 be16_add(&right->bb_numrecs, 1);
1434#ifdef DEBUG 1434#ifdef DEBUG
1435 if (level > 0) 1435 if (level > 0)
1436 xfs_btree_check_key(cur->bc_btnum, rkp, rkp + 1); 1436 xfs_btree_check_key(cur->bc_btnum, rkp, rkp + 1);
@@ -1522,17 +1522,17 @@ xfs_inobt_split(
1522 /* 1522 /*
1523 * Fill in the btree header for the new block. 1523 * Fill in the btree header for the new block.
1524 */ 1524 */
1525 INT_SET(right->bb_magic, ARCH_CONVERT, xfs_magics[cur->bc_btnum]); 1525 right->bb_magic = cpu_to_be32(xfs_magics[cur->bc_btnum]);
1526 right->bb_level = left->bb_level; /* INT_: direct copy */ 1526 right->bb_level = left->bb_level;
1527 INT_SET(right->bb_numrecs, ARCH_CONVERT, (__uint16_t)(INT_GET(left->bb_numrecs, ARCH_CONVERT) / 2)); 1527 right->bb_numrecs = cpu_to_be16(be16_to_cpu(left->bb_numrecs) / 2);
1528 /* 1528 /*
1529 * Make sure that if there's an odd number of entries now, that 1529 * Make sure that if there's an odd number of entries now, that
1530 * each new block will have the same number of entries. 1530 * each new block will have the same number of entries.
1531 */ 1531 */
1532 if ((INT_GET(left->bb_numrecs, ARCH_CONVERT) & 1) && 1532 if ((be16_to_cpu(left->bb_numrecs) & 1) &&
1533 cur->bc_ptrs[level] <= INT_GET(right->bb_numrecs, ARCH_CONVERT) + 1) 1533 cur->bc_ptrs[level] <= be16_to_cpu(right->bb_numrecs) + 1)
1534 INT_MOD(right->bb_numrecs, ARCH_CONVERT, +1); 1534 be16_add(&right->bb_numrecs, 1);
1535 i = INT_GET(left->bb_numrecs, ARCH_CONVERT) - INT_GET(right->bb_numrecs, ARCH_CONVERT) + 1; 1535 i = be16_to_cpu(left->bb_numrecs) - be16_to_cpu(right->bb_numrecs) + 1;
1536 /* 1536 /*
1537 * For non-leaf blocks, copy keys and addresses over to the new block. 1537 * For non-leaf blocks, copy keys and addresses over to the new block.
1538 */ 1538 */
@@ -1542,15 +1542,15 @@ xfs_inobt_split(
1542 rkp = XFS_INOBT_KEY_ADDR(right, 1, cur); 1542 rkp = XFS_INOBT_KEY_ADDR(right, 1, cur);
1543 rpp = XFS_INOBT_PTR_ADDR(right, 1, cur); 1543 rpp = XFS_INOBT_PTR_ADDR(right, 1, cur);
1544#ifdef DEBUG 1544#ifdef DEBUG
1545 for (i = 0; i < INT_GET(right->bb_numrecs, ARCH_CONVERT); i++) { 1545 for (i = 0; i < be16_to_cpu(right->bb_numrecs); i++) {
1546 if ((error = xfs_btree_check_sptr(cur, INT_GET(lpp[i], ARCH_CONVERT), level))) 1546 if ((error = xfs_btree_check_sptr(cur, be32_to_cpu(lpp[i]), level)))
1547 return error; 1547 return error;
1548 } 1548 }
1549#endif 1549#endif
1550 memcpy(rkp, lkp, INT_GET(right->bb_numrecs, ARCH_CONVERT) * sizeof(*rkp)); 1550 memcpy(rkp, lkp, be16_to_cpu(right->bb_numrecs) * sizeof(*rkp));
1551 memcpy(rpp, lpp, INT_GET(right->bb_numrecs, ARCH_CONVERT) * sizeof(*rpp)); 1551 memcpy(rpp, lpp, be16_to_cpu(right->bb_numrecs) * sizeof(*rpp));
1552 xfs_inobt_log_keys(cur, rbp, 1, INT_GET(right->bb_numrecs, ARCH_CONVERT)); 1552 xfs_inobt_log_keys(cur, rbp, 1, be16_to_cpu(right->bb_numrecs));
1553 xfs_inobt_log_ptrs(cur, rbp, 1, INT_GET(right->bb_numrecs, ARCH_CONVERT)); 1553 xfs_inobt_log_ptrs(cur, rbp, 1, be16_to_cpu(right->bb_numrecs));
1554 *keyp = *rkp; 1554 *keyp = *rkp;
1555 } 1555 }
1556 /* 1556 /*
@@ -1559,36 +1559,36 @@ xfs_inobt_split(
1559 else { 1559 else {
1560 lrp = XFS_INOBT_REC_ADDR(left, i, cur); 1560 lrp = XFS_INOBT_REC_ADDR(left, i, cur);
1561 rrp = XFS_INOBT_REC_ADDR(right, 1, cur); 1561 rrp = XFS_INOBT_REC_ADDR(right, 1, cur);
1562 memcpy(rrp, lrp, INT_GET(right->bb_numrecs, ARCH_CONVERT) * sizeof(*rrp)); 1562 memcpy(rrp, lrp, be16_to_cpu(right->bb_numrecs) * sizeof(*rrp));
1563 xfs_inobt_log_recs(cur, rbp, 1, INT_GET(right->bb_numrecs, ARCH_CONVERT)); 1563 xfs_inobt_log_recs(cur, rbp, 1, be16_to_cpu(right->bb_numrecs));
1564 keyp->ir_startino = rrp->ir_startino; /* INT_: direct copy */ 1564 keyp->ir_startino = rrp->ir_startino; /* INT_: direct copy */
1565 } 1565 }
1566 /* 1566 /*
1567 * Find the left block number by looking in the buffer. 1567 * Find the left block number by looking in the buffer.
1568 * Adjust numrecs, sibling pointers. 1568 * Adjust numrecs, sibling pointers.
1569 */ 1569 */
1570 INT_MOD(left->bb_numrecs, ARCH_CONVERT, -(INT_GET(right->bb_numrecs, ARCH_CONVERT))); 1570 be16_add(&left->bb_numrecs, -(be16_to_cpu(right->bb_numrecs)));
1571 right->bb_rightsib = left->bb_rightsib; /* INT_: direct copy */ 1571 right->bb_rightsib = left->bb_rightsib;
1572 INT_SET(left->bb_rightsib, ARCH_CONVERT, args.agbno); 1572 left->bb_rightsib = cpu_to_be32(args.agbno);
1573 INT_SET(right->bb_leftsib, ARCH_CONVERT, lbno); 1573 right->bb_leftsib = cpu_to_be32(lbno);
1574 xfs_inobt_log_block(args.tp, rbp, XFS_BB_ALL_BITS); 1574 xfs_inobt_log_block(args.tp, rbp, XFS_BB_ALL_BITS);
1575 xfs_inobt_log_block(args.tp, lbp, XFS_BB_NUMRECS | XFS_BB_RIGHTSIB); 1575 xfs_inobt_log_block(args.tp, lbp, XFS_BB_NUMRECS | XFS_BB_RIGHTSIB);
1576 /* 1576 /*
1577 * If there's a block to the new block's right, make that block 1577 * If there's a block to the new block's right, make that block
1578 * point back to right instead of to left. 1578 * point back to right instead of to left.
1579 */ 1579 */
1580 if (INT_GET(right->bb_rightsib, ARCH_CONVERT) != NULLAGBLOCK) { 1580 if (be32_to_cpu(right->bb_rightsib) != NULLAGBLOCK) {
1581 xfs_inobt_block_t *rrblock; /* rr btree block */ 1581 xfs_inobt_block_t *rrblock; /* rr btree block */
1582 xfs_buf_t *rrbp; /* buffer for rrblock */ 1582 xfs_buf_t *rrbp; /* buffer for rrblock */
1583 1583
1584 if ((error = xfs_btree_read_bufs(args.mp, args.tp, args.agno, 1584 if ((error = xfs_btree_read_bufs(args.mp, args.tp, args.agno,
1585 INT_GET(right->bb_rightsib, ARCH_CONVERT), 0, &rrbp, 1585 be32_to_cpu(right->bb_rightsib), 0, &rrbp,
1586 XFS_INO_BTREE_REF))) 1586 XFS_INO_BTREE_REF)))
1587 return error; 1587 return error;
1588 rrblock = XFS_BUF_TO_INOBT_BLOCK(rrbp); 1588 rrblock = XFS_BUF_TO_INOBT_BLOCK(rrbp);
1589 if ((error = xfs_btree_check_sblock(cur, rrblock, level, rrbp))) 1589 if ((error = xfs_btree_check_sblock(cur, rrblock, level, rrbp)))
1590 return error; 1590 return error;
1591 INT_SET(rrblock->bb_leftsib, ARCH_CONVERT, args.agbno); 1591 rrblock->bb_leftsib = cpu_to_be32(args.agbno);
1592 xfs_inobt_log_block(args.tp, rrbp, XFS_BB_LEFTSIB); 1592 xfs_inobt_log_block(args.tp, rrbp, XFS_BB_LEFTSIB);
1593 } 1593 }
1594 /* 1594 /*
@@ -1596,9 +1596,9 @@ xfs_inobt_split(
1596 * If it's just pointing past the last entry in left, then we'll 1596 * If it's just pointing past the last entry in left, then we'll
1597 * insert there, so don't change anything in that case. 1597 * insert there, so don't change anything in that case.
1598 */ 1598 */
1599 if (cur->bc_ptrs[level] > INT_GET(left->bb_numrecs, ARCH_CONVERT) + 1) { 1599 if (cur->bc_ptrs[level] > be16_to_cpu(left->bb_numrecs) + 1) {
1600 xfs_btree_setbuf(cur, level, rbp); 1600 xfs_btree_setbuf(cur, level, rbp);
1601 cur->bc_ptrs[level] -= INT_GET(left->bb_numrecs, ARCH_CONVERT); 1601 cur->bc_ptrs[level] -= be16_to_cpu(left->bb_numrecs);
1602 } 1602 }
1603 /* 1603 /*
1604 * If there are more levels, we'll need another cursor which refers 1604 * If there are more levels, we'll need another cursor which refers
@@ -1696,7 +1696,7 @@ xfs_inobt_decrement(
1696 /* 1696 /*
1697 * If we just went off the left edge of the tree, return failure. 1697 * If we just went off the left edge of the tree, return failure.
1698 */ 1698 */
1699 if (INT_GET(block->bb_leftsib, ARCH_CONVERT) == NULLAGBLOCK) { 1699 if (be32_to_cpu(block->bb_leftsib) == NULLAGBLOCK) {
1700 *stat = 0; 1700 *stat = 0;
1701 return 0; 1701 return 0;
1702 } 1702 }
@@ -1725,7 +1725,7 @@ xfs_inobt_decrement(
1725 xfs_agblock_t agbno; /* block number of btree block */ 1725 xfs_agblock_t agbno; /* block number of btree block */
1726 xfs_buf_t *bp; /* buffer containing btree block */ 1726 xfs_buf_t *bp; /* buffer containing btree block */
1727 1727
1728 agbno = INT_GET(*XFS_INOBT_PTR_ADDR(block, cur->bc_ptrs[lev], cur), ARCH_CONVERT); 1728 agbno = be32_to_cpu(*XFS_INOBT_PTR_ADDR(block, cur->bc_ptrs[lev], cur));
1729 if ((error = xfs_btree_read_bufs(cur->bc_mp, cur->bc_tp, 1729 if ((error = xfs_btree_read_bufs(cur->bc_mp, cur->bc_tp,
1730 cur->bc_private.i.agno, agbno, 0, &bp, 1730 cur->bc_private.i.agno, agbno, 0, &bp,
1731 XFS_INO_BTREE_REF))) 1731 XFS_INO_BTREE_REF)))
@@ -1735,7 +1735,7 @@ xfs_inobt_decrement(
1735 block = XFS_BUF_TO_INOBT_BLOCK(bp); 1735 block = XFS_BUF_TO_INOBT_BLOCK(bp);
1736 if ((error = xfs_btree_check_sblock(cur, block, lev, bp))) 1736 if ((error = xfs_btree_check_sblock(cur, block, lev, bp)))
1737 return error; 1737 return error;
1738 cur->bc_ptrs[lev] = INT_GET(block->bb_numrecs, ARCH_CONVERT); 1738 cur->bc_ptrs[lev] = be16_to_cpu(block->bb_numrecs);
1739 } 1739 }
1740 *stat = 1; 1740 *stat = 1;
1741 return 0; 1741 return 0;
@@ -1807,7 +1807,7 @@ xfs_inobt_get_rec(
1807 /* 1807 /*
1808 * Off the right end or left end, return failure. 1808 * Off the right end or left end, return failure.
1809 */ 1809 */
1810 if (ptr > INT_GET(block->bb_numrecs, ARCH_CONVERT) || ptr <= 0) { 1810 if (ptr > be16_to_cpu(block->bb_numrecs) || ptr <= 0) {
1811 *stat = 0; 1811 *stat = 0;
1812 return 0; 1812 return 0;
1813 } 1813 }
@@ -1855,14 +1855,14 @@ xfs_inobt_increment(
1855 * Increment the ptr at this level. If we're still in the block 1855 * Increment the ptr at this level. If we're still in the block
1856 * then we're done. 1856 * then we're done.
1857 */ 1857 */
1858 if (++cur->bc_ptrs[level] <= INT_GET(block->bb_numrecs, ARCH_CONVERT)) { 1858 if (++cur->bc_ptrs[level] <= be16_to_cpu(block->bb_numrecs)) {
1859 *stat = 1; 1859 *stat = 1;
1860 return 0; 1860 return 0;
1861 } 1861 }
1862 /* 1862 /*
1863 * If we just went off the right edge of the tree, return failure. 1863 * If we just went off the right edge of the tree, return failure.
1864 */ 1864 */
1865 if (INT_GET(block->bb_rightsib, ARCH_CONVERT) == NULLAGBLOCK) { 1865 if (be32_to_cpu(block->bb_rightsib) == NULLAGBLOCK) {
1866 *stat = 0; 1866 *stat = 0;
1867 return 0; 1867 return 0;
1868 } 1868 }
@@ -1877,7 +1877,7 @@ xfs_inobt_increment(
1877 if ((error = xfs_btree_check_sblock(cur, block, lev, bp))) 1877 if ((error = xfs_btree_check_sblock(cur, block, lev, bp)))
1878 return error; 1878 return error;
1879#endif 1879#endif
1880 if (++cur->bc_ptrs[lev] <= INT_GET(block->bb_numrecs, ARCH_CONVERT)) 1880 if (++cur->bc_ptrs[lev] <= be16_to_cpu(block->bb_numrecs))
1881 break; 1881 break;
1882 /* 1882 /*
1883 * Read-ahead the right block, we're going to read it 1883 * Read-ahead the right block, we're going to read it
@@ -1897,7 +1897,7 @@ xfs_inobt_increment(
1897 lev > level; ) { 1897 lev > level; ) {
1898 xfs_agblock_t agbno; /* block number of btree block */ 1898 xfs_agblock_t agbno; /* block number of btree block */
1899 1899
1900 agbno = INT_GET(*XFS_INOBT_PTR_ADDR(block, cur->bc_ptrs[lev], cur), ARCH_CONVERT); 1900 agbno = be32_to_cpu(*XFS_INOBT_PTR_ADDR(block, cur->bc_ptrs[lev], cur));
1901 if ((error = xfs_btree_read_bufs(cur->bc_mp, cur->bc_tp, 1901 if ((error = xfs_btree_read_bufs(cur->bc_mp, cur->bc_tp,
1902 cur->bc_private.i.agno, agbno, 0, &bp, 1902 cur->bc_private.i.agno, agbno, 0, &bp,
1903 XFS_INO_BTREE_REF))) 1903 XFS_INO_BTREE_REF)))