aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_bmap_btree.c
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/xfs_bmap_btree.c
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/xfs_bmap_btree.c')
-rw-r--r--fs/xfs/xfs_bmap_btree.c34
1 files changed, 16 insertions, 18 deletions
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/*