aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2006-09-27 20:58:06 -0400
committerTim Shimmin <tes@sgi.com>2006-09-27 20:58:06 -0400
commit576039cf3c668d5f8d97dff8a0a5817e8b3a761b (patch)
treeb6d28b6fc2d8fc24759ab8732b9db978b709aa3a /fs/xfs
parent397b5208d5609e2f01b171a34ab690f325253492 (diff)
[XFS] endianess annotate XFS_BMAP_BROOT_PTR_ADDR Make sure it returns a
__be64 and let the callers use the proper macros. SGI-PV: 954580 SGI-Modid: xfs-linux-melb:xfs-kern:26560a Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Nathan Scott <nathans@sgi.com> Signed-off-by: Tim Shimmin <tes@sgi.com>
Diffstat (limited to 'fs/xfs')
-rw-r--r--fs/xfs/xfs_bmap.c61
-rw-r--r--fs/xfs/xfs_bmap_btree.c34
-rw-r--r--fs/xfs/xfs_btree.h2
3 files changed, 47 insertions, 50 deletions
diff --git a/fs/xfs/xfs_bmap.c b/fs/xfs/xfs_bmap.c
index b1efb906dbbd..76fe9ffb218e 100644
--- a/fs/xfs/xfs_bmap.c
+++ b/fs/xfs/xfs_bmap.c
@@ -2999,7 +2999,7 @@ xfs_bmap_btree_to_extents(
2999 int error; /* error return value */ 2999 int error; /* error return value */
3000 xfs_ifork_t *ifp; /* inode fork data */ 3000 xfs_ifork_t *ifp; /* inode fork data */
3001 xfs_mount_t *mp; /* mount point structure */ 3001 xfs_mount_t *mp; /* mount point structure */
3002 xfs_bmbt_ptr_t *pp; /* ptr to block address */ 3002 __be64 *pp; /* ptr to block address */
3003 xfs_bmbt_block_t *rblock;/* root btree block */ 3003 xfs_bmbt_block_t *rblock;/* root btree block */
3004 3004
3005 ifp = XFS_IFORK_PTR(ip, whichfork); 3005 ifp = XFS_IFORK_PTR(ip, whichfork);
@@ -3011,12 +3011,12 @@ xfs_bmap_btree_to_extents(
3011 ASSERT(XFS_BMAP_BROOT_MAXRECS(ifp->if_broot_bytes) == 1); 3011 ASSERT(XFS_BMAP_BROOT_MAXRECS(ifp->if_broot_bytes) == 1);
3012 mp = ip->i_mount; 3012 mp = ip->i_mount;
3013 pp = XFS_BMAP_BROOT_PTR_ADDR(rblock, 1, ifp->if_broot_bytes); 3013 pp = XFS_BMAP_BROOT_PTR_ADDR(rblock, 1, ifp->if_broot_bytes);
3014 cbno = be64_to_cpu(*pp);
3014 *logflagsp = 0; 3015 *logflagsp = 0;
3015#ifdef DEBUG 3016#ifdef DEBUG
3016 if ((error = xfs_btree_check_lptr_disk(cur, *pp, 1))) 3017 if ((error = xfs_btree_check_lptr(cur, cbno, 1)))
3017 return error; 3018 return error;
3018#endif 3019#endif
3019 cbno = INT_GET(*pp, ARCH_CONVERT);
3020 if ((error = xfs_btree_read_bufl(mp, tp, cbno, 0, &cbp, 3020 if ((error = xfs_btree_read_bufl(mp, tp, cbno, 0, &cbp,
3021 XFS_BMAP_BTREE_REF))) 3021 XFS_BMAP_BTREE_REF)))
3022 return error; 3022 return error;
@@ -3514,7 +3514,7 @@ xfs_bmap_extents_to_btree(
3514 arp = XFS_BMAP_REC_IADDR(ablock, 1, cur); 3514 arp = XFS_BMAP_REC_IADDR(ablock, 1, cur);
3515 INT_SET(kp->br_startoff, ARCH_CONVERT, xfs_bmbt_disk_get_startoff(arp)); 3515 INT_SET(kp->br_startoff, ARCH_CONVERT, xfs_bmbt_disk_get_startoff(arp));
3516 pp = XFS_BMAP_PTR_IADDR(block, 1, cur); 3516 pp = XFS_BMAP_PTR_IADDR(block, 1, cur);
3517 INT_SET(*pp, ARCH_CONVERT, args.fsbno); 3517 *pp = cpu_to_be64(args.fsbno);
3518 /* 3518 /*
3519 * Do all this logging at the end so that 3519 * Do all this logging at the end so that
3520 * the root is at the right level. 3520 * the root is at the right level.
@@ -4494,7 +4494,7 @@ xfs_bmap_read_extents(
4494 xfs_ifork_t *ifp; /* fork structure */ 4494 xfs_ifork_t *ifp; /* fork structure */
4495 int level; /* btree level, for checking */ 4495 int level; /* btree level, for checking */
4496 xfs_mount_t *mp; /* file system mount structure */ 4496 xfs_mount_t *mp; /* file system mount structure */
4497 xfs_bmbt_ptr_t *pp; /* pointer to block address */ 4497 __be64 *pp; /* pointer to block address */
4498 /* REFERENCED */ 4498 /* REFERENCED */
4499 xfs_extnum_t room; /* number of entries there's room for */ 4499 xfs_extnum_t room; /* number of entries there's room for */
4500 4500
@@ -4510,10 +4510,10 @@ xfs_bmap_read_extents(
4510 level = be16_to_cpu(block->bb_level); 4510 level = be16_to_cpu(block->bb_level);
4511 ASSERT(level > 0); 4511 ASSERT(level > 0);
4512 pp = XFS_BMAP_BROOT_PTR_ADDR(block, 1, ifp->if_broot_bytes); 4512 pp = XFS_BMAP_BROOT_PTR_ADDR(block, 1, ifp->if_broot_bytes);
4513 ASSERT(INT_GET(*pp, ARCH_CONVERT) != NULLDFSBNO); 4513 bno = be64_to_cpu(*pp);
4514 ASSERT(XFS_FSB_TO_AGNO(mp, INT_GET(*pp, ARCH_CONVERT)) < mp->m_sb.sb_agcount); 4514 ASSERT(bno != NULLDFSBNO);
4515 ASSERT(XFS_FSB_TO_AGBNO(mp, INT_GET(*pp, ARCH_CONVERT)) < mp->m_sb.sb_agblocks); 4515 ASSERT(XFS_FSB_TO_AGNO(mp, bno) < mp->m_sb.sb_agcount);
4516 bno = INT_GET(*pp, ARCH_CONVERT); 4516 ASSERT(XFS_FSB_TO_AGBNO(mp, bno) < mp->m_sb.sb_agblocks);
4517 /* 4517 /*
4518 * Go down the tree until leaf level is reached, following the first 4518 * Go down the tree until leaf level is reached, following the first
4519 * pointer (leftmost) at each level. 4519 * pointer (leftmost) at each level.
@@ -4530,10 +4530,8 @@ xfs_bmap_read_extents(
4530 break; 4530 break;
4531 pp = XFS_BTREE_PTR_ADDR(mp->m_sb.sb_blocksize, xfs_bmbt, block, 4531 pp = XFS_BTREE_PTR_ADDR(mp->m_sb.sb_blocksize, xfs_bmbt, block,
4532 1, mp->m_bmap_dmxr[1]); 4532 1, mp->m_bmap_dmxr[1]);
4533 XFS_WANT_CORRUPTED_GOTO( 4533 bno = be64_to_cpu(*pp);
4534 XFS_FSB_SANITY_CHECK(mp, INT_GET(*pp, ARCH_CONVERT)), 4534 XFS_WANT_CORRUPTED_GOTO(XFS_FSB_SANITY_CHECK(mp, bno), error0);
4535 error0);
4536 bno = INT_GET(*pp, ARCH_CONVERT);
4537 xfs_trans_brelse(tp, bp); 4535 xfs_trans_brelse(tp, bp);
4538 } 4536 }
4539 /* 4537 /*
@@ -6141,7 +6139,7 @@ xfs_check_block(
6141 short sz) 6139 short sz)
6142{ 6140{
6143 int i, j, dmxr; 6141 int i, j, dmxr;
6144 xfs_bmbt_ptr_t *pp, *thispa; /* pointer to block address */ 6142 __be64 *pp, *thispa; /* pointer to block address */
6145 xfs_bmbt_key_t *prevp, *keyp; 6143 xfs_bmbt_key_t *prevp, *keyp;
6146 6144
6147 ASSERT(be16_to_cpu(block->bb_level) > 0); 6145 ASSERT(be16_to_cpu(block->bb_level) > 0);
@@ -6179,11 +6177,10 @@ xfs_check_block(
6179 thispa = XFS_BTREE_PTR_ADDR(mp->m_sb.sb_blocksize, 6177 thispa = XFS_BTREE_PTR_ADDR(mp->m_sb.sb_blocksize,
6180 xfs_bmbt, block, j, dmxr); 6178 xfs_bmbt, block, j, dmxr);
6181 } 6179 }
6182 if (INT_GET(*thispa, ARCH_CONVERT) == 6180 if (*thispa == *pp) {
6183 INT_GET(*pp, ARCH_CONVERT)) {
6184 cmn_err(CE_WARN, "%s: thispa(%d) == pp(%d) %Ld", 6181 cmn_err(CE_WARN, "%s: thispa(%d) == pp(%d) %Ld",
6185 __FUNCTION__, j, i, 6182 __FUNCTION__, j, i,
6186 INT_GET(*thispa, ARCH_CONVERT)); 6183 (unsigned long long)be64_to_cpu(*thispa));
6187 panic("%s: ptrs are equal in node\n", 6184 panic("%s: ptrs are equal in node\n",
6188 __FUNCTION__); 6185 __FUNCTION__);
6189 } 6186 }
@@ -6210,7 +6207,7 @@ xfs_bmap_check_leaf_extents(
6210 xfs_ifork_t *ifp; /* fork structure */ 6207 xfs_ifork_t *ifp; /* fork structure */
6211 int level; /* btree level, for checking */ 6208 int level; /* btree level, for checking */
6212 xfs_mount_t *mp; /* file system mount structure */ 6209 xfs_mount_t *mp; /* file system mount structure */
6213 xfs_bmbt_ptr_t *pp; /* pointer to block address */ 6210 __be64 *pp; /* pointer to block address */
6214 xfs_bmbt_rec_t *ep; /* pointer to current extent */ 6211 xfs_bmbt_rec_t *ep; /* pointer to current extent */
6215 xfs_bmbt_rec_t *lastp; /* pointer to previous extent */ 6212 xfs_bmbt_rec_t *lastp; /* pointer to previous extent */
6216 xfs_bmbt_rec_t *nextp; /* pointer to next extent */ 6213 xfs_bmbt_rec_t *nextp; /* pointer to next extent */
@@ -6231,10 +6228,12 @@ xfs_bmap_check_leaf_extents(
6231 ASSERT(level > 0); 6228 ASSERT(level > 0);
6232 xfs_check_block(block, mp, 1, ifp->if_broot_bytes); 6229 xfs_check_block(block, mp, 1, ifp->if_broot_bytes);
6233 pp = XFS_BMAP_BROOT_PTR_ADDR(block, 1, ifp->if_broot_bytes); 6230 pp = XFS_BMAP_BROOT_PTR_ADDR(block, 1, ifp->if_broot_bytes);
6234 ASSERT(INT_GET(*pp, ARCH_CONVERT) != NULLDFSBNO); 6231 bno = be64_to_cpu(*pp);
6235 ASSERT(XFS_FSB_TO_AGNO(mp, INT_GET(*pp, ARCH_CONVERT)) < mp->m_sb.sb_agcount); 6232
6236 ASSERT(XFS_FSB_TO_AGBNO(mp, INT_GET(*pp, ARCH_CONVERT)) < mp->m_sb.sb_agblocks); 6233 ASSERT(bno != NULLDFSBNO);
6237 bno = INT_GET(*pp, ARCH_CONVERT); 6234 ASSERT(XFS_FSB_TO_AGNO(mp, bno) < mp->m_sb.sb_agcount);
6235 ASSERT(XFS_FSB_TO_AGBNO(mp, bno) < mp->m_sb.sb_agblocks);
6236
6238 /* 6237 /*
6239 * Go down the tree until leaf level is reached, following the first 6238 * Go down the tree until leaf level is reached, following the first
6240 * pointer (leftmost) at each level. 6239 * pointer (leftmost) at each level.
@@ -6265,8 +6264,8 @@ xfs_bmap_check_leaf_extents(
6265 xfs_check_block(block, mp, 0, 0); 6264 xfs_check_block(block, mp, 0, 0);
6266 pp = XFS_BTREE_PTR_ADDR(mp->m_sb.sb_blocksize, xfs_bmbt, block, 6265 pp = XFS_BTREE_PTR_ADDR(mp->m_sb.sb_blocksize, xfs_bmbt, block,
6267 1, mp->m_bmap_dmxr[1]); 6266 1, mp->m_bmap_dmxr[1]);
6268 XFS_WANT_CORRUPTED_GOTO(XFS_FSB_SANITY_CHECK(mp, INT_GET(*pp, ARCH_CONVERT)), error0); 6267 bno = be64_to_cpu(*pp);
6269 bno = INT_GET(*pp, ARCH_CONVERT); 6268 XFS_WANT_CORRUPTED_GOTO(XFS_FSB_SANITY_CHECK(mp, bno), error0);
6270 if (bp_release) { 6269 if (bp_release) {
6271 bp_release = 0; 6270 bp_release = 0;
6272 xfs_trans_brelse(NULL, bp); 6271 xfs_trans_brelse(NULL, bp);
@@ -6372,7 +6371,7 @@ xfs_bmap_count_blocks(
6372 xfs_ifork_t *ifp; /* fork structure */ 6371 xfs_ifork_t *ifp; /* fork structure */
6373 int level; /* btree level, for checking */ 6372 int level; /* btree level, for checking */
6374 xfs_mount_t *mp; /* file system mount structure */ 6373 xfs_mount_t *mp; /* file system mount structure */
6375 xfs_bmbt_ptr_t *pp; /* pointer to block address */ 6374 __be64 *pp; /* pointer to block address */
6376 6375
6377 bno = NULLFSBLOCK; 6376 bno = NULLFSBLOCK;
6378 mp = ip->i_mount; 6377 mp = ip->i_mount;
@@ -6395,10 +6394,10 @@ xfs_bmap_count_blocks(
6395 level = be16_to_cpu(block->bb_level); 6394 level = be16_to_cpu(block->bb_level);
6396 ASSERT(level > 0); 6395 ASSERT(level > 0);
6397 pp = XFS_BMAP_BROOT_PTR_ADDR(block, 1, ifp->if_broot_bytes); 6396 pp = XFS_BMAP_BROOT_PTR_ADDR(block, 1, ifp->if_broot_bytes);
6398 ASSERT(INT_GET(*pp, ARCH_CONVERT) != NULLDFSBNO); 6397 bno = be64_to_cpu(*pp);
6399 ASSERT(XFS_FSB_TO_AGNO(mp, INT_GET(*pp, ARCH_CONVERT)) < mp->m_sb.sb_agcount); 6398 ASSERT(bno != NULLDFSBNO);
6400 ASSERT(XFS_FSB_TO_AGBNO(mp, INT_GET(*pp, ARCH_CONVERT)) < mp->m_sb.sb_agblocks); 6399 ASSERT(XFS_FSB_TO_AGNO(mp, bno) < mp->m_sb.sb_agcount);
6401 bno = INT_GET(*pp, ARCH_CONVERT); 6400 ASSERT(XFS_FSB_TO_AGBNO(mp, bno) < mp->m_sb.sb_agblocks);
6402 6401
6403 if (unlikely(xfs_bmap_count_tree(mp, tp, ifp, bno, level, count) < 0)) { 6402 if (unlikely(xfs_bmap_count_tree(mp, tp, ifp, bno, level, count) < 0)) {
6404 XFS_ERROR_REPORT("xfs_bmap_count_blocks(2)", XFS_ERRLEVEL_LOW, 6403 XFS_ERROR_REPORT("xfs_bmap_count_blocks(2)", XFS_ERRLEVEL_LOW,
@@ -6425,7 +6424,7 @@ xfs_bmap_count_tree(
6425 int error; 6424 int error;
6426 xfs_buf_t *bp, *nbp; 6425 xfs_buf_t *bp, *nbp;
6427 int level = levelin; 6426 int level = levelin;
6428 xfs_bmbt_ptr_t *pp; 6427 __be64 *pp;
6429 xfs_fsblock_t bno = blockno; 6428 xfs_fsblock_t bno = blockno;
6430 xfs_fsblock_t nextbno; 6429 xfs_fsblock_t nextbno;
6431 xfs_bmbt_block_t *block, *nextblock; 6430 xfs_bmbt_block_t *block, *nextblock;
@@ -6452,7 +6451,7 @@ xfs_bmap_count_tree(
6452 /* Dive to the next level */ 6451 /* Dive to the next level */
6453 pp = XFS_BTREE_PTR_ADDR(mp->m_sb.sb_blocksize, 6452 pp = XFS_BTREE_PTR_ADDR(mp->m_sb.sb_blocksize,
6454 xfs_bmbt, block, 1, mp->m_bmap_dmxr[1]); 6453 xfs_bmbt, block, 1, mp->m_bmap_dmxr[1]);
6455 bno = INT_GET(*pp, ARCH_CONVERT); 6454 bno = be64_to_cpu(*pp);
6456 if (unlikely((error = 6455 if (unlikely((error =
6457 xfs_bmap_count_tree(mp, tp, ifp, bno, level, count)) < 0)) { 6456 xfs_bmap_count_tree(mp, tp, ifp, bno, level, count)) < 0)) {
6458 xfs_trans_brelse(tp, bp); 6457 xfs_trans_brelse(tp, bp);
diff --git a/fs/xfs/xfs_bmap_btree.c b/fs/xfs/xfs_bmap_btree.c
index 270cfe380504..f424cae96850 100644
--- a/fs/xfs/xfs_bmap_btree.c
+++ b/fs/xfs/xfs_bmap_btree.c
@@ -870,14 +870,13 @@ xfs_bmbt_insrec(
870 memmove(&pp[ptr], &pp[ptr - 1], /* INT_: direct copy */ 870 memmove(&pp[ptr], &pp[ptr - 1], /* INT_: direct copy */
871 (numrecs - ptr + 1) * sizeof(*pp)); 871 (numrecs - ptr + 1) * sizeof(*pp));
872#ifdef DEBUG 872#ifdef DEBUG
873 if ((error = xfs_btree_check_lptr(cur, (xfs_bmbt_ptr_t)*bnop, 873 if ((error = xfs_btree_check_lptr(cur, *bnop, level))) {
874 level))) {
875 XFS_BMBT_TRACE_CURSOR(cur, ERROR); 874 XFS_BMBT_TRACE_CURSOR(cur, ERROR);
876 return error; 875 return error;
877 } 876 }
878#endif 877#endif
879 kp[ptr - 1] = key; 878 kp[ptr - 1] = key;
880 INT_SET(pp[ptr - 1], ARCH_CONVERT, *bnop); 879 pp[ptr - 1] = cpu_to_be64(*bnop);
881 numrecs++; 880 numrecs++;
882 block->bb_numrecs = cpu_to_be16(numrecs); 881 block->bb_numrecs = cpu_to_be16(numrecs);
883 xfs_bmbt_log_keys(cur, bp, ptr, numrecs); 882 xfs_bmbt_log_keys(cur, bp, ptr, numrecs);
@@ -1189,13 +1188,13 @@ xfs_bmbt_lookup(
1189 if (diff > 0 && --keyno < 1) 1188 if (diff > 0 && --keyno < 1)
1190 keyno = 1; 1189 keyno = 1;
1191 pp = XFS_BMAP_PTR_IADDR(block, keyno, cur); 1190 pp = XFS_BMAP_PTR_IADDR(block, keyno, cur);
1191 fsbno = be64_to_cpu(*pp);
1192#ifdef DEBUG 1192#ifdef DEBUG
1193 if ((error = xfs_btree_check_lptr_disk(cur, *pp, level))) { 1193 if ((error = xfs_btree_check_lptr(cur, fsbno, level))) {
1194 XFS_BMBT_TRACE_CURSOR(cur, ERROR); 1194 XFS_BMBT_TRACE_CURSOR(cur, ERROR);
1195 return error; 1195 return error;
1196 } 1196 }
1197#endif 1197#endif
1198 fsbno = INT_GET(*pp, ARCH_CONVERT);
1199 cur->bc_ptrs[level] = keyno; 1198 cur->bc_ptrs[level] = keyno;
1200 } 1199 }
1201 } 1200 }
@@ -1445,7 +1444,7 @@ xfs_bmbt_rshift(
1445 rpp = XFS_BMAP_PTR_IADDR(right, 1, cur); 1444 rpp = XFS_BMAP_PTR_IADDR(right, 1, cur);
1446#ifdef DEBUG 1445#ifdef DEBUG
1447 for (i = be16_to_cpu(right->bb_numrecs) - 1; i >= 0; i--) { 1446 for (i = be16_to_cpu(right->bb_numrecs) - 1; i >= 0; i--) {
1448 if ((error = xfs_btree_check_lptr_disk(cur, rpp[i] level))) { 1447 if ((error = xfs_btree_check_lptr_disk(cur, rpp[i], level))) {
1449 XFS_BMBT_TRACE_CURSOR(cur, ERROR); 1448 XFS_BMBT_TRACE_CURSOR(cur, ERROR);
1450 return error; 1449 return error;
1451 } 1450 }
@@ -1728,9 +1727,9 @@ xfs_bmdr_to_bmbt(
1728{ 1727{
1729 int dmxr; 1728 int dmxr;
1730 xfs_bmbt_key_t *fkp; 1729 xfs_bmbt_key_t *fkp;
1731 xfs_bmbt_ptr_t *fpp; 1730 __be64 *fpp;
1732 xfs_bmbt_key_t *tkp; 1731 xfs_bmbt_key_t *tkp;
1733 xfs_bmbt_ptr_t *tpp; 1732 __be64 *tpp;
1734 1733
1735 rblock->bb_magic = cpu_to_be32(XFS_BMAP_MAGIC); 1734 rblock->bb_magic = cpu_to_be32(XFS_BMAP_MAGIC);
1736 rblock->bb_level = dblock->bb_level; 1735 rblock->bb_level = dblock->bb_level;
@@ -1745,7 +1744,7 @@ xfs_bmdr_to_bmbt(
1745 tpp = XFS_BMAP_BROOT_PTR_ADDR(rblock, 1, rblocklen); 1744 tpp = XFS_BMAP_BROOT_PTR_ADDR(rblock, 1, rblocklen);
1746 dmxr = be16_to_cpu(dblock->bb_numrecs); 1745 dmxr = be16_to_cpu(dblock->bb_numrecs);
1747 memcpy(tkp, fkp, sizeof(*fkp) * dmxr); 1746 memcpy(tkp, fkp, sizeof(*fkp) * dmxr);
1748 memcpy(tpp, fpp, sizeof(*fpp) * dmxr); /* INT_: direct copy */ 1747 memcpy(tpp, fpp, sizeof(*fpp) * dmxr);
1749} 1748}
1750 1749
1751/* 1750/*
@@ -1805,7 +1804,7 @@ xfs_bmbt_decrement(
1805 tp = cur->bc_tp; 1804 tp = cur->bc_tp;
1806 mp = cur->bc_mp; 1805 mp = cur->bc_mp;
1807 for (block = xfs_bmbt_get_block(cur, lev, &bp); lev > level; ) { 1806 for (block = xfs_bmbt_get_block(cur, lev, &bp); lev > level; ) {
1808 fsbno = INT_GET(*XFS_BMAP_PTR_IADDR(block, cur->bc_ptrs[lev], cur), ARCH_CONVERT); 1807 fsbno = be64_to_cpu(*XFS_BMAP_PTR_IADDR(block, cur->bc_ptrs[lev], cur));
1809 if ((error = xfs_btree_read_bufl(mp, tp, fsbno, 0, &bp, 1808 if ((error = xfs_btree_read_bufl(mp, tp, fsbno, 0, &bp,
1810 XFS_BMAP_BTREE_REF))) { 1809 XFS_BMAP_BTREE_REF))) {
1811 XFS_BMBT_TRACE_CURSOR(cur, ERROR); 1810 XFS_BMBT_TRACE_CURSOR(cur, ERROR);
@@ -2135,7 +2134,7 @@ xfs_bmbt_increment(
2135 tp = cur->bc_tp; 2134 tp = cur->bc_tp;
2136 mp = cur->bc_mp; 2135 mp = cur->bc_mp;
2137 for (block = xfs_bmbt_get_block(cur, lev, &bp); lev > level; ) { 2136 for (block = xfs_bmbt_get_block(cur, lev, &bp); lev > level; ) {
2138 fsbno = INT_GET(*XFS_BMAP_PTR_IADDR(block, cur->bc_ptrs[lev], cur), ARCH_CONVERT); 2137 fsbno = be64_to_cpu(*XFS_BMAP_PTR_IADDR(block, cur->bc_ptrs[lev], cur));
2139 if ((error = xfs_btree_read_bufl(mp, tp, fsbno, 0, &bp, 2138 if ((error = xfs_btree_read_bufl(mp, tp, fsbno, 0, &bp,
2140 XFS_BMAP_BTREE_REF))) { 2139 XFS_BMAP_BTREE_REF))) {
2141 XFS_BMBT_TRACE_CURSOR(cur, ERROR); 2140 XFS_BMBT_TRACE_CURSOR(cur, ERROR);
@@ -2361,7 +2360,7 @@ xfs_bmbt_newroot(
2361 return error; 2360 return error;
2362 } 2361 }
2363#endif 2362#endif
2364 args.fsbno = INT_GET(*pp, ARCH_CONVERT); 2363 args.fsbno = be64_to_cpu(*pp);
2365 args.type = XFS_ALLOCTYPE_START_BNO; 2364 args.type = XFS_ALLOCTYPE_START_BNO;
2366 } else 2365 } else
2367 args.type = XFS_ALLOCTYPE_NEAR_BNO; 2366 args.type = XFS_ALLOCTYPE_NEAR_BNO;
@@ -2401,13 +2400,12 @@ xfs_bmbt_newroot(
2401#endif 2400#endif
2402 memcpy(cpp, pp, be16_to_cpu(cblock->bb_numrecs) * sizeof(*pp)); 2401 memcpy(cpp, pp, be16_to_cpu(cblock->bb_numrecs) * sizeof(*pp));
2403#ifdef DEBUG 2402#ifdef DEBUG
2404 if ((error = xfs_btree_check_lptr(cur, (xfs_bmbt_ptr_t)args.fsbno, 2403 if ((error = xfs_btree_check_lptr(cur, args.fsbno, level))) {
2405 level))) {
2406 XFS_BMBT_TRACE_CURSOR(cur, ERROR); 2404 XFS_BMBT_TRACE_CURSOR(cur, ERROR);
2407 return error; 2405 return error;
2408 } 2406 }
2409#endif 2407#endif
2410 INT_SET(*pp, ARCH_CONVERT, args.fsbno); 2408 *pp = cpu_to_be64(args.fsbno);
2411 xfs_iroot_realloc(cur->bc_private.b.ip, 1 - be16_to_cpu(cblock->bb_numrecs), 2409 xfs_iroot_realloc(cur->bc_private.b.ip, 1 - be16_to_cpu(cblock->bb_numrecs),
2412 cur->bc_private.b.whichfork); 2410 cur->bc_private.b.whichfork);
2413 xfs_btree_setbuf(cur, level, bp); 2411 xfs_btree_setbuf(cur, level, bp);
@@ -2681,9 +2679,9 @@ xfs_bmbt_to_bmdr(
2681{ 2679{
2682 int dmxr; 2680 int dmxr;
2683 xfs_bmbt_key_t *fkp; 2681 xfs_bmbt_key_t *fkp;
2684 xfs_bmbt_ptr_t *fpp; 2682 __be64 *fpp;
2685 xfs_bmbt_key_t *tkp; 2683 xfs_bmbt_key_t *tkp;
2686 xfs_bmbt_ptr_t *tpp; 2684 __be64 *tpp;
2687 2685
2688 ASSERT(be32_to_cpu(rblock->bb_magic) == XFS_BMAP_MAGIC); 2686 ASSERT(be32_to_cpu(rblock->bb_magic) == XFS_BMAP_MAGIC);
2689 ASSERT(be64_to_cpu(rblock->bb_leftsib) == NULLDFSBNO); 2687 ASSERT(be64_to_cpu(rblock->bb_leftsib) == NULLDFSBNO);
@@ -2698,7 +2696,7 @@ xfs_bmbt_to_bmdr(
2698 tpp = XFS_BTREE_PTR_ADDR(dblocklen, xfs_bmdr, dblock, 1, dmxr); 2696 tpp = XFS_BTREE_PTR_ADDR(dblocklen, xfs_bmdr, dblock, 1, dmxr);
2699 dmxr = be16_to_cpu(dblock->bb_numrecs); 2697 dmxr = be16_to_cpu(dblock->bb_numrecs);
2700 memcpy(tkp, fkp, sizeof(*fkp) * dmxr); 2698 memcpy(tkp, fkp, sizeof(*fkp) * dmxr);
2701 memcpy(tpp, fpp, sizeof(*fpp) * dmxr); /* INT_: direct copy */ 2699 memcpy(tpp, fpp, sizeof(*fpp) * dmxr);
2702} 2700}
2703 2701
2704/* 2702/*
diff --git a/fs/xfs/xfs_btree.h b/fs/xfs/xfs_btree.h
index 8bbcfeba1a9e..892b06c54263 100644
--- a/fs/xfs/xfs_btree.h
+++ b/fs/xfs/xfs_btree.h
@@ -244,7 +244,7 @@ xfs_btree_check_lptr(
244 int level); /* btree block level */ 244 int level); /* btree block level */
245 245
246#define xfs_btree_check_lptr_disk(cur, ptr, level) \ 246#define xfs_btree_check_lptr_disk(cur, ptr, level) \
247 xfs_btree_check_lptr(cur, INT_GET(ptr, ARCH_CONVERT), level) 247 xfs_btree_check_lptr(cur, be64_to_cpu(ptr), level)
248 248
249/* 249/*
250 * Checking routine: check that short form block header is ok. 250 * Checking routine: check that short form block header is ok.