aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_bmap.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@sgi.com>2005-11-01 23:11:25 -0500
committerNathan Scott <nathans@sgi.com>2005-11-01 23:11:25 -0500
commit16259e7d952e26e949cc2c8c68b74f34b293935d (patch)
treea016791ecb67761236d32b9915efa9a92f6f3767 /fs/xfs/xfs_bmap.c
parente2ed81fbbb7c76e0a1b3e2f1b5a7414f4d66a559 (diff)
[XFS] Endianess annotations for various allocator data structures
SGI-PV: 943272 SGI-Modid: xfs-linux:xfs-kern:201006a Signed-off-by: Christoph Hellwig <hch@sgi.com> Signed-off-by: Nathan Scott <nathans@sgi.com>
Diffstat (limited to 'fs/xfs/xfs_bmap.c')
-rw-r--r--fs/xfs/xfs_bmap.c62
1 files changed, 31 insertions, 31 deletions
diff --git a/fs/xfs/xfs_bmap.c b/fs/xfs/xfs_bmap.c
index 9f635f0ccf08..e415a4698e9c 100644
--- a/fs/xfs/xfs_bmap.c
+++ b/fs/xfs/xfs_bmap.c
@@ -2763,8 +2763,8 @@ xfs_bmap_btree_to_extents(
2763 ASSERT(ifp->if_flags & XFS_IFEXTENTS); 2763 ASSERT(ifp->if_flags & XFS_IFEXTENTS);
2764 ASSERT(XFS_IFORK_FORMAT(ip, whichfork) == XFS_DINODE_FMT_BTREE); 2764 ASSERT(XFS_IFORK_FORMAT(ip, whichfork) == XFS_DINODE_FMT_BTREE);
2765 rblock = ifp->if_broot; 2765 rblock = ifp->if_broot;
2766 ASSERT(INT_GET(rblock->bb_level, ARCH_CONVERT) == 1); 2766 ASSERT(be16_to_cpu(rblock->bb_level) == 1);
2767 ASSERT(INT_GET(rblock->bb_numrecs, ARCH_CONVERT) == 1); 2767 ASSERT(be16_to_cpu(rblock->bb_numrecs) == 1);
2768 ASSERT(XFS_BMAP_BROOT_MAXRECS(ifp->if_broot_bytes) == 1); 2768 ASSERT(XFS_BMAP_BROOT_MAXRECS(ifp->if_broot_bytes) == 1);
2769 mp = ip->i_mount; 2769 mp = ip->i_mount;
2770 pp = XFS_BMAP_BROOT_PTR_ADDR(rblock, 1, ifp->if_broot_bytes); 2770 pp = XFS_BMAP_BROOT_PTR_ADDR(rblock, 1, ifp->if_broot_bytes);
@@ -3207,11 +3207,11 @@ xfs_bmap_extents_to_btree(
3207 * Fill in the root. 3207 * Fill in the root.
3208 */ 3208 */
3209 block = ifp->if_broot; 3209 block = ifp->if_broot;
3210 INT_SET(block->bb_magic, ARCH_CONVERT, XFS_BMAP_MAGIC); 3210 block->bb_magic = cpu_to_be32(XFS_BMAP_MAGIC);
3211 INT_SET(block->bb_level, ARCH_CONVERT, 1); 3211 block->bb_level = cpu_to_be16(1);
3212 INT_SET(block->bb_numrecs, ARCH_CONVERT, 1); 3212 block->bb_numrecs = cpu_to_be16(1);
3213 INT_SET(block->bb_leftsib, ARCH_CONVERT, NULLDFSBNO); 3213 block->bb_leftsib = cpu_to_be64(NULLDFSBNO);
3214 INT_SET(block->bb_rightsib, ARCH_CONVERT, NULLDFSBNO); 3214 block->bb_rightsib = cpu_to_be64(NULLDFSBNO);
3215 /* 3215 /*
3216 * Need a cursor. Can't allocate until bb_level is filled in. 3216 * Need a cursor. Can't allocate until bb_level is filled in.
3217 */ 3217 */
@@ -3264,10 +3264,10 @@ xfs_bmap_extents_to_btree(
3264 * Fill in the child block. 3264 * Fill in the child block.
3265 */ 3265 */
3266 ablock = XFS_BUF_TO_BMBT_BLOCK(abp); 3266 ablock = XFS_BUF_TO_BMBT_BLOCK(abp);
3267 INT_SET(ablock->bb_magic, ARCH_CONVERT, XFS_BMAP_MAGIC); 3267 ablock->bb_magic = cpu_to_be32(XFS_BMAP_MAGIC);
3268 ablock->bb_level = 0; 3268 ablock->bb_level = 0;
3269 INT_SET(ablock->bb_leftsib, ARCH_CONVERT, NULLDFSBNO); 3269 ablock->bb_leftsib = cpu_to_be64(NULLDFSBNO);
3270 INT_SET(ablock->bb_rightsib, ARCH_CONVERT, NULLDFSBNO); 3270 ablock->bb_rightsib = cpu_to_be64(NULLDFSBNO);
3271 arp = XFS_BMAP_REC_IADDR(ablock, 1, cur); 3271 arp = XFS_BMAP_REC_IADDR(ablock, 1, cur);
3272 nextents = ifp->if_bytes / (uint)sizeof(xfs_bmbt_rec_t); 3272 nextents = ifp->if_bytes / (uint)sizeof(xfs_bmbt_rec_t);
3273 for (ep = ifp->if_u1.if_extents, cnt = i = 0; i < nextents; i++, ep++) { 3273 for (ep = ifp->if_u1.if_extents, cnt = i = 0; i < nextents; i++, ep++) {
@@ -3277,8 +3277,8 @@ xfs_bmap_extents_to_btree(
3277 arp++; cnt++; 3277 arp++; cnt++;
3278 } 3278 }
3279 } 3279 }
3280 INT_SET(ablock->bb_numrecs, ARCH_CONVERT, cnt); 3280 ASSERT(cnt == XFS_IFORK_NEXTENTS(ip, whichfork));
3281 ASSERT(INT_GET(ablock->bb_numrecs, ARCH_CONVERT) == XFS_IFORK_NEXTENTS(ip, whichfork)); 3281 ablock->bb_numrecs = cpu_to_be16(cnt);
3282 /* 3282 /*
3283 * Fill in the root key and pointer. 3283 * Fill in the root key and pointer.
3284 */ 3284 */
@@ -3292,7 +3292,7 @@ xfs_bmap_extents_to_btree(
3292 * the root is at the right level. 3292 * the root is at the right level.
3293 */ 3293 */
3294 xfs_bmbt_log_block(cur, abp, XFS_BB_ALL_BITS); 3294 xfs_bmbt_log_block(cur, abp, XFS_BB_ALL_BITS);
3295 xfs_bmbt_log_recs(cur, abp, 1, INT_GET(ablock->bb_numrecs, ARCH_CONVERT)); 3295 xfs_bmbt_log_recs(cur, abp, 1, be16_to_cpu(ablock->bb_numrecs));
3296 ASSERT(*curp == NULL); 3296 ASSERT(*curp == NULL);
3297 *curp = cur; 3297 *curp = cur;
3298 *logflagsp = XFS_ILOG_CORE | XFS_ILOG_FBROOT(whichfork); 3298 *logflagsp = XFS_ILOG_CORE | XFS_ILOG_FBROOT(whichfork);
@@ -4371,8 +4371,8 @@ xfs_bmap_read_extents(
4371 /* 4371 /*
4372 * Root level must use BMAP_BROOT_PTR_ADDR macro to get ptr out. 4372 * Root level must use BMAP_BROOT_PTR_ADDR macro to get ptr out.
4373 */ 4373 */
4374 ASSERT(INT_GET(block->bb_level, ARCH_CONVERT) > 0); 4374 level = be16_to_cpu(block->bb_level);
4375 level = INT_GET(block->bb_level, ARCH_CONVERT); 4375 ASSERT(level > 0);
4376 pp = XFS_BMAP_BROOT_PTR_ADDR(block, 1, ifp->if_broot_bytes); 4376 pp = XFS_BMAP_BROOT_PTR_ADDR(block, 1, ifp->if_broot_bytes);
4377 ASSERT(INT_GET(*pp, ARCH_CONVERT) != NULLDFSBNO); 4377 ASSERT(INT_GET(*pp, ARCH_CONVERT) != NULLDFSBNO);
4378 ASSERT(XFS_FSB_TO_AGNO(mp, INT_GET(*pp, ARCH_CONVERT)) < mp->m_sb.sb_agcount); 4378 ASSERT(XFS_FSB_TO_AGNO(mp, INT_GET(*pp, ARCH_CONVERT)) < mp->m_sb.sb_agcount);
@@ -4415,7 +4415,7 @@ xfs_bmap_read_extents(
4415 xfs_extnum_t num_recs; 4415 xfs_extnum_t num_recs;
4416 4416
4417 4417
4418 num_recs = INT_GET(block->bb_numrecs, ARCH_CONVERT); 4418 num_recs = be16_to_cpu(block->bb_numrecs);
4419 if (unlikely(i + num_recs > room)) { 4419 if (unlikely(i + num_recs > room)) {
4420 ASSERT(i + num_recs <= room); 4420 ASSERT(i + num_recs <= room);
4421 xfs_fs_cmn_err(CE_WARN, ip->i_mount, 4421 xfs_fs_cmn_err(CE_WARN, ip->i_mount,
@@ -4432,7 +4432,7 @@ xfs_bmap_read_extents(
4432 /* 4432 /*
4433 * Read-ahead the next leaf block, if any. 4433 * Read-ahead the next leaf block, if any.
4434 */ 4434 */
4435 nextbno = INT_GET(block->bb_rightsib, ARCH_CONVERT); 4435 nextbno = be64_to_cpu(block->bb_rightsib);
4436 if (nextbno != NULLFSBLOCK) 4436 if (nextbno != NULLFSBLOCK)
4437 xfs_btree_reada_bufl(mp, nextbno, 1); 4437 xfs_btree_reada_bufl(mp, nextbno, 1);
4438 /* 4438 /*
@@ -4689,7 +4689,7 @@ xfs_bmapi(
4689 } 4689 }
4690 if (wr && *firstblock == NULLFSBLOCK) { 4690 if (wr && *firstblock == NULLFSBLOCK) {
4691 if (XFS_IFORK_FORMAT(ip, whichfork) == XFS_DINODE_FMT_BTREE) 4691 if (XFS_IFORK_FORMAT(ip, whichfork) == XFS_DINODE_FMT_BTREE)
4692 minleft = INT_GET(ifp->if_broot->bb_level, ARCH_CONVERT) + 1; 4692 minleft = be16_to_cpu(ifp->if_broot->bb_level) + 1;
4693 else 4693 else
4694 minleft = 1; 4694 minleft = 1;
4695 } else 4695 } else
@@ -5967,10 +5967,10 @@ xfs_check_block(
5967 xfs_bmbt_ptr_t *pp, *thispa; /* pointer to block address */ 5967 xfs_bmbt_ptr_t *pp, *thispa; /* pointer to block address */
5968 xfs_bmbt_key_t *prevp, *keyp; 5968 xfs_bmbt_key_t *prevp, *keyp;
5969 5969
5970 ASSERT(INT_GET(block->bb_level, ARCH_CONVERT) > 0); 5970 ASSERT(be16_to_cpu(block->bb_level) > 0);
5971 5971
5972 prevp = NULL; 5972 prevp = NULL;
5973 for( i = 1; i <= INT_GET(block->bb_numrecs, ARCH_CONVERT);i++) { 5973 for( i = 1; i <= be16_to_cpu(block->bb_numrecs); i++) {
5974 dmxr = mp->m_bmap_dmxr[0]; 5974 dmxr = mp->m_bmap_dmxr[0];
5975 5975
5976 if (root) { 5976 if (root) {
@@ -5995,7 +5995,7 @@ xfs_check_block(
5995 pp = XFS_BTREE_PTR_ADDR(mp->m_sb.sb_blocksize, 5995 pp = XFS_BTREE_PTR_ADDR(mp->m_sb.sb_blocksize,
5996 xfs_bmbt, block, i, dmxr); 5996 xfs_bmbt, block, i, dmxr);
5997 } 5997 }
5998 for (j = i+1; j <= INT_GET(block->bb_numrecs, ARCH_CONVERT); j++) { 5998 for (j = i+1; j <= be16_to_cpu(block->bb_numrecs); j++) {
5999 if (root) { 5999 if (root) {
6000 thispa = XFS_BMAP_BROOT_PTR_ADDR(block, j, sz); 6000 thispa = XFS_BMAP_BROOT_PTR_ADDR(block, j, sz);
6001 } else { 6001 } else {
@@ -6048,8 +6048,8 @@ xfs_bmap_check_leaf_extents(
6048 /* 6048 /*
6049 * Root level must use BMAP_BROOT_PTR_ADDR macro to get ptr out. 6049 * Root level must use BMAP_BROOT_PTR_ADDR macro to get ptr out.
6050 */ 6050 */
6051 ASSERT(INT_GET(block->bb_level, ARCH_CONVERT) > 0); 6051 level = be16_to_cpu(block->bb_level);
6052 level = INT_GET(block->bb_level, ARCH_CONVERT); 6052 ASSERT(level > 0);
6053 xfs_check_block(block, mp, 1, ifp->if_broot_bytes); 6053 xfs_check_block(block, mp, 1, ifp->if_broot_bytes);
6054 pp = XFS_BMAP_BROOT_PTR_ADDR(block, 1, ifp->if_broot_bytes); 6054 pp = XFS_BMAP_BROOT_PTR_ADDR(block, 1, ifp->if_broot_bytes);
6055 ASSERT(INT_GET(*pp, ARCH_CONVERT) != NULLDFSBNO); 6055 ASSERT(INT_GET(*pp, ARCH_CONVERT) != NULLDFSBNO);
@@ -6109,13 +6109,13 @@ xfs_bmap_check_leaf_extents(
6109 xfs_extnum_t num_recs; 6109 xfs_extnum_t num_recs;
6110 6110
6111 6111
6112 num_recs = INT_GET(block->bb_numrecs, ARCH_CONVERT); 6112 num_recs = be16_to_cpu(block->bb_numrecs);
6113 6113
6114 /* 6114 /*
6115 * Read-ahead the next leaf block, if any. 6115 * Read-ahead the next leaf block, if any.
6116 */ 6116 */
6117 6117
6118 nextbno = INT_GET(block->bb_rightsib, ARCH_CONVERT); 6118 nextbno = be64_to_cpu(block->bb_rightsib);
6119 6119
6120 /* 6120 /*
6121 * Check all the extents to make sure they are OK. 6121 * Check all the extents to make sure they are OK.
@@ -6212,8 +6212,8 @@ xfs_bmap_count_blocks(
6212 * Root level must use BMAP_BROOT_PTR_ADDR macro to get ptr out. 6212 * Root level must use BMAP_BROOT_PTR_ADDR macro to get ptr out.
6213 */ 6213 */
6214 block = ifp->if_broot; 6214 block = ifp->if_broot;
6215 ASSERT(INT_GET(block->bb_level, ARCH_CONVERT) > 0); 6215 level = be16_to_cpu(block->bb_level);
6216 level = INT_GET(block->bb_level, ARCH_CONVERT); 6216 ASSERT(level > 0);
6217 pp = XFS_BMAP_BROOT_PTR_ADDR(block, 1, ifp->if_broot_bytes); 6217 pp = XFS_BMAP_BROOT_PTR_ADDR(block, 1, ifp->if_broot_bytes);
6218 ASSERT(INT_GET(*pp, ARCH_CONVERT) != NULLDFSBNO); 6218 ASSERT(INT_GET(*pp, ARCH_CONVERT) != NULLDFSBNO);
6219 ASSERT(XFS_FSB_TO_AGNO(mp, INT_GET(*pp, ARCH_CONVERT)) < mp->m_sb.sb_agcount); 6219 ASSERT(XFS_FSB_TO_AGNO(mp, INT_GET(*pp, ARCH_CONVERT)) < mp->m_sb.sb_agcount);
@@ -6258,14 +6258,14 @@ xfs_bmap_count_tree(
6258 6258
6259 if (--level) { 6259 if (--level) {
6260 /* Not at node above leafs, count this level of nodes */ 6260 /* Not at node above leafs, count this level of nodes */
6261 nextbno = INT_GET(block->bb_rightsib, ARCH_CONVERT); 6261 nextbno = be64_to_cpu(block->bb_rightsib);
6262 while (nextbno != NULLFSBLOCK) { 6262 while (nextbno != NULLFSBLOCK) {
6263 if ((error = xfs_btree_read_bufl(mp, tp, nextbno, 6263 if ((error = xfs_btree_read_bufl(mp, tp, nextbno,
6264 0, &nbp, XFS_BMAP_BTREE_REF))) 6264 0, &nbp, XFS_BMAP_BTREE_REF)))
6265 return error; 6265 return error;
6266 *count += 1; 6266 *count += 1;
6267 nextblock = XFS_BUF_TO_BMBT_BLOCK(nbp); 6267 nextblock = XFS_BUF_TO_BMBT_BLOCK(nbp);
6268 nextbno = INT_GET(nextblock->bb_rightsib, ARCH_CONVERT); 6268 nextbno = be64_to_cpu(nextblock->bb_rightsib);
6269 xfs_trans_brelse(tp, nbp); 6269 xfs_trans_brelse(tp, nbp);
6270 } 6270 }
6271 6271
@@ -6284,8 +6284,8 @@ xfs_bmap_count_tree(
6284 } else { 6284 } else {
6285 /* count all level 1 nodes and their leaves */ 6285 /* count all level 1 nodes and their leaves */
6286 for (;;) { 6286 for (;;) {
6287 nextbno = INT_GET(block->bb_rightsib, ARCH_CONVERT); 6287 nextbno = be64_to_cpu(block->bb_rightsib);
6288 numrecs = INT_GET(block->bb_numrecs, ARCH_CONVERT); 6288 numrecs = be16_to_cpu(block->bb_numrecs);
6289 frp = XFS_BTREE_REC_ADDR(mp->m_sb.sb_blocksize, 6289 frp = XFS_BTREE_REC_ADDR(mp->m_sb.sb_blocksize,
6290 xfs_bmbt, block, 1, mp->m_bmap_dmxr[0]); 6290 xfs_bmbt, block, 1, mp->m_bmap_dmxr[0]);
6291 if (unlikely(xfs_bmap_disk_count_leaves(frp, numrecs, count) < 0)) { 6291 if (unlikely(xfs_bmap_disk_count_leaves(frp, numrecs, count) < 0)) {