diff options
author | Nathan Scott <nathans@sgi.com> | 2006-03-17 01:28:40 -0500 |
---|---|---|
committer | Nathan Scott <nathans@sgi.com> | 2006-03-17 01:28:40 -0500 |
commit | 89da054424a775b4b257556eda8a300be1134d7c (patch) | |
tree | b7a6d19ee5baaebf2794271dabaf0f59d44f9fa6 /fs/xfs/xfs_da_btree.c | |
parent | 3d693c6ed7892d066e8fb3311c6b74f7699326f9 (diff) |
[XFS] endianess annotations for xfs_da_blkinfo_t
SGI-PV: 943272
SGI-Modid: xfs-linux-melb:xfs-kern:25495a
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Nathan Scott <nathans@sgi.com>
Diffstat (limited to 'fs/xfs/xfs_da_btree.c')
-rw-r--r-- | fs/xfs/xfs_da_btree.c | 206 |
1 files changed, 99 insertions, 107 deletions
diff --git a/fs/xfs/xfs_da_btree.c b/fs/xfs/xfs_da_btree.c index 31796c7faba0..4f3bb1cb9615 100644 --- a/fs/xfs/xfs_da_btree.c +++ b/fs/xfs/xfs_da_btree.c | |||
@@ -126,7 +126,7 @@ xfs_da_node_create(xfs_da_args_t *args, xfs_dablk_t blkno, int level, | |||
126 | node = bp->data; | 126 | node = bp->data; |
127 | node->hdr.info.forw = 0; | 127 | node->hdr.info.forw = 0; |
128 | node->hdr.info.back = 0; | 128 | node->hdr.info.back = 0; |
129 | INT_SET(node->hdr.info.magic, ARCH_CONVERT, XFS_DA_NODE_MAGIC); | 129 | node->hdr.info.magic = cpu_to_be16(XFS_DA_NODE_MAGIC); |
130 | node->hdr.info.pad = 0; | 130 | node->hdr.info.pad = 0; |
131 | node->hdr.count = 0; | 131 | node->hdr.count = 0; |
132 | INT_SET(node->hdr.level, ARCH_CONVERT, level); | 132 | INT_SET(node->hdr.level, ARCH_CONVERT, level); |
@@ -290,28 +290,28 @@ xfs_da_split(xfs_da_state_t *state) | |||
290 | 290 | ||
291 | node = oldblk->bp->data; | 291 | node = oldblk->bp->data; |
292 | if (node->hdr.info.forw) { | 292 | if (node->hdr.info.forw) { |
293 | if (INT_GET(node->hdr.info.forw, ARCH_CONVERT) == addblk->blkno) { | 293 | if (be32_to_cpu(node->hdr.info.forw) == addblk->blkno) { |
294 | bp = addblk->bp; | 294 | bp = addblk->bp; |
295 | } else { | 295 | } else { |
296 | ASSERT(state->extravalid); | 296 | ASSERT(state->extravalid); |
297 | bp = state->extrablk.bp; | 297 | bp = state->extrablk.bp; |
298 | } | 298 | } |
299 | node = bp->data; | 299 | node = bp->data; |
300 | INT_SET(node->hdr.info.back, ARCH_CONVERT, oldblk->blkno); | 300 | node->hdr.info.back = cpu_to_be32(oldblk->blkno); |
301 | xfs_da_log_buf(state->args->trans, bp, | 301 | xfs_da_log_buf(state->args->trans, bp, |
302 | XFS_DA_LOGRANGE(node, &node->hdr.info, | 302 | XFS_DA_LOGRANGE(node, &node->hdr.info, |
303 | sizeof(node->hdr.info))); | 303 | sizeof(node->hdr.info))); |
304 | } | 304 | } |
305 | node = oldblk->bp->data; | 305 | node = oldblk->bp->data; |
306 | if (INT_GET(node->hdr.info.back, ARCH_CONVERT)) { | 306 | if (node->hdr.info.back) { |
307 | if (INT_GET(node->hdr.info.back, ARCH_CONVERT) == addblk->blkno) { | 307 | if (be32_to_cpu(node->hdr.info.back) == addblk->blkno) { |
308 | bp = addblk->bp; | 308 | bp = addblk->bp; |
309 | } else { | 309 | } else { |
310 | ASSERT(state->extravalid); | 310 | ASSERT(state->extravalid); |
311 | bp = state->extrablk.bp; | 311 | bp = state->extrablk.bp; |
312 | } | 312 | } |
313 | node = bp->data; | 313 | node = bp->data; |
314 | INT_SET(node->hdr.info.forw, ARCH_CONVERT, oldblk->blkno); | 314 | node->hdr.info.forw = cpu_to_be32(oldblk->blkno); |
315 | xfs_da_log_buf(state->args->trans, bp, | 315 | xfs_da_log_buf(state->args->trans, bp, |
316 | XFS_DA_LOGRANGE(node, &node->hdr.info, | 316 | XFS_DA_LOGRANGE(node, &node->hdr.info, |
317 | sizeof(node->hdr.info))); | 317 | sizeof(node->hdr.info))); |
@@ -359,12 +359,12 @@ xfs_da_root_split(xfs_da_state_t *state, xfs_da_state_blk_t *blk1, | |||
359 | ASSERT(bp != NULL); | 359 | ASSERT(bp != NULL); |
360 | node = bp->data; | 360 | node = bp->data; |
361 | oldroot = blk1->bp->data; | 361 | oldroot = blk1->bp->data; |
362 | if (INT_GET(oldroot->hdr.info.magic, ARCH_CONVERT) == XFS_DA_NODE_MAGIC) { | 362 | if (be16_to_cpu(oldroot->hdr.info.magic) == XFS_DA_NODE_MAGIC) { |
363 | size = (int)((char *)&oldroot->btree[INT_GET(oldroot->hdr.count, ARCH_CONVERT)] - | 363 | size = (int)((char *)&oldroot->btree[INT_GET(oldroot->hdr.count, ARCH_CONVERT)] - |
364 | (char *)oldroot); | 364 | (char *)oldroot); |
365 | } else { | 365 | } else { |
366 | ASSERT(XFS_DIR_IS_V2(mp)); | 366 | ASSERT(XFS_DIR_IS_V2(mp)); |
367 | ASSERT(INT_GET(oldroot->hdr.info.magic, ARCH_CONVERT) == XFS_DIR2_LEAFN_MAGIC); | 367 | ASSERT(be16_to_cpu(oldroot->hdr.info.magic) == XFS_DIR2_LEAFN_MAGIC); |
368 | leaf = (xfs_dir2_leaf_t *)oldroot; | 368 | leaf = (xfs_dir2_leaf_t *)oldroot; |
369 | size = (int)((char *)&leaf->ents[be16_to_cpu(leaf->hdr.count)] - | 369 | size = (int)((char *)&leaf->ents[be16_to_cpu(leaf->hdr.count)] - |
370 | (char *)leaf); | 370 | (char *)leaf); |
@@ -392,7 +392,7 @@ xfs_da_root_split(xfs_da_state_t *state, xfs_da_state_blk_t *blk1, | |||
392 | INT_SET(node->hdr.count, ARCH_CONVERT, 2); | 392 | INT_SET(node->hdr.count, ARCH_CONVERT, 2); |
393 | 393 | ||
394 | #ifdef DEBUG | 394 | #ifdef DEBUG |
395 | if (INT_GET(oldroot->hdr.info.magic, ARCH_CONVERT) == XFS_DIR2_LEAFN_MAGIC) { | 395 | if (be16_to_cpu(oldroot->hdr.info.magic) == XFS_DIR2_LEAFN_MAGIC) { |
396 | ASSERT(blk1->blkno >= mp->m_dirleafblk && | 396 | ASSERT(blk1->blkno >= mp->m_dirleafblk && |
397 | blk1->blkno < mp->m_dirfreeblk); | 397 | blk1->blkno < mp->m_dirfreeblk); |
398 | ASSERT(blk2->blkno >= mp->m_dirleafblk && | 398 | ASSERT(blk2->blkno >= mp->m_dirleafblk && |
@@ -424,7 +424,7 @@ xfs_da_node_split(xfs_da_state_t *state, xfs_da_state_blk_t *oldblk, | |||
424 | int useextra; | 424 | int useextra; |
425 | 425 | ||
426 | node = oldblk->bp->data; | 426 | node = oldblk->bp->data; |
427 | ASSERT(INT_GET(node->hdr.info.magic, ARCH_CONVERT) == XFS_DA_NODE_MAGIC); | 427 | ASSERT(be16_to_cpu(node->hdr.info.magic) == XFS_DA_NODE_MAGIC); |
428 | 428 | ||
429 | /* | 429 | /* |
430 | * With V2 the extra block is data or freespace. | 430 | * With V2 the extra block is data or freespace. |
@@ -524,8 +524,8 @@ xfs_da_node_rebalance(xfs_da_state_t *state, xfs_da_state_blk_t *blk1, | |||
524 | node1 = node2; | 524 | node1 = node2; |
525 | node2 = tmpnode; | 525 | node2 = tmpnode; |
526 | } | 526 | } |
527 | ASSERT(INT_GET(node1->hdr.info.magic, ARCH_CONVERT) == XFS_DA_NODE_MAGIC); | 527 | ASSERT(be16_to_cpu(node1->hdr.info.magic) == XFS_DA_NODE_MAGIC); |
528 | ASSERT(INT_GET(node2->hdr.info.magic, ARCH_CONVERT) == XFS_DA_NODE_MAGIC); | 528 | ASSERT(be16_to_cpu(node2->hdr.info.magic) == XFS_DA_NODE_MAGIC); |
529 | count = (INT_GET(node1->hdr.count, ARCH_CONVERT) - INT_GET(node2->hdr.count, ARCH_CONVERT)) / 2; | 529 | count = (INT_GET(node1->hdr.count, ARCH_CONVERT) - INT_GET(node2->hdr.count, ARCH_CONVERT)) / 2; |
530 | if (count == 0) | 530 | if (count == 0) |
531 | return; | 531 | return; |
@@ -622,7 +622,7 @@ xfs_da_node_add(xfs_da_state_t *state, xfs_da_state_blk_t *oldblk, | |||
622 | 622 | ||
623 | node = oldblk->bp->data; | 623 | node = oldblk->bp->data; |
624 | mp = state->mp; | 624 | mp = state->mp; |
625 | ASSERT(INT_GET(node->hdr.info.magic, ARCH_CONVERT) == XFS_DA_NODE_MAGIC); | 625 | ASSERT(be16_to_cpu(node->hdr.info.magic) == XFS_DA_NODE_MAGIC); |
626 | ASSERT((oldblk->index >= 0) && (oldblk->index <= INT_GET(node->hdr.count, ARCH_CONVERT))); | 626 | ASSERT((oldblk->index >= 0) && (oldblk->index <= INT_GET(node->hdr.count, ARCH_CONVERT))); |
627 | ASSERT(newblk->blkno != 0); | 627 | ASSERT(newblk->blkno != 0); |
628 | if (state->args->whichfork == XFS_DATA_FORK && XFS_DIR_IS_V2(mp)) | 628 | if (state->args->whichfork == XFS_DATA_FORK && XFS_DIR_IS_V2(mp)) |
@@ -768,7 +768,7 @@ xfs_da_root_join(xfs_da_state_t *state, xfs_da_state_blk_t *root_blk) | |||
768 | ASSERT(args != NULL); | 768 | ASSERT(args != NULL); |
769 | ASSERT(root_blk->magic == XFS_DA_NODE_MAGIC); | 769 | ASSERT(root_blk->magic == XFS_DA_NODE_MAGIC); |
770 | oldroot = root_blk->bp->data; | 770 | oldroot = root_blk->bp->data; |
771 | ASSERT(INT_GET(oldroot->hdr.info.magic, ARCH_CONVERT) == XFS_DA_NODE_MAGIC); | 771 | ASSERT(be16_to_cpu(oldroot->hdr.info.magic) == XFS_DA_NODE_MAGIC); |
772 | ASSERT(!oldroot->hdr.info.forw); | 772 | ASSERT(!oldroot->hdr.info.forw); |
773 | ASSERT(!oldroot->hdr.info.back); | 773 | ASSERT(!oldroot->hdr.info.back); |
774 | 774 | ||
@@ -791,10 +791,10 @@ xfs_da_root_join(xfs_da_state_t *state, xfs_da_state_blk_t *root_blk) | |||
791 | ASSERT(bp != NULL); | 791 | ASSERT(bp != NULL); |
792 | blkinfo = bp->data; | 792 | blkinfo = bp->data; |
793 | if (INT_GET(oldroot->hdr.level, ARCH_CONVERT) == 1) { | 793 | if (INT_GET(oldroot->hdr.level, ARCH_CONVERT) == 1) { |
794 | ASSERT(INT_GET(blkinfo->magic, ARCH_CONVERT) == XFS_DIRX_LEAF_MAGIC(state->mp) || | 794 | ASSERT(be16_to_cpu(blkinfo->magic) == XFS_DIRX_LEAF_MAGIC(state->mp) || |
795 | INT_GET(blkinfo->magic, ARCH_CONVERT) == XFS_ATTR_LEAF_MAGIC); | 795 | be16_to_cpu(blkinfo->magic) == XFS_ATTR_LEAF_MAGIC); |
796 | } else { | 796 | } else { |
797 | ASSERT(INT_GET(blkinfo->magic, ARCH_CONVERT) == XFS_DA_NODE_MAGIC); | 797 | ASSERT(be16_to_cpu(blkinfo->magic) == XFS_DA_NODE_MAGIC); |
798 | } | 798 | } |
799 | ASSERT(!blkinfo->forw); | 799 | ASSERT(!blkinfo->forw); |
800 | ASSERT(!blkinfo->back); | 800 | ASSERT(!blkinfo->back); |
@@ -830,7 +830,7 @@ xfs_da_node_toosmall(xfs_da_state_t *state, int *action) | |||
830 | */ | 830 | */ |
831 | blk = &state->path.blk[ state->path.active-1 ]; | 831 | blk = &state->path.blk[ state->path.active-1 ]; |
832 | info = blk->bp->data; | 832 | info = blk->bp->data; |
833 | ASSERT(INT_GET(info->magic, ARCH_CONVERT) == XFS_DA_NODE_MAGIC); | 833 | ASSERT(be16_to_cpu(info->magic) == XFS_DA_NODE_MAGIC); |
834 | node = (xfs_da_intnode_t *)info; | 834 | node = (xfs_da_intnode_t *)info; |
835 | count = INT_GET(node->hdr.count, ARCH_CONVERT); | 835 | count = INT_GET(node->hdr.count, ARCH_CONVERT); |
836 | if (count > (state->node_ents >> 1)) { | 836 | if (count > (state->node_ents >> 1)) { |
@@ -849,7 +849,7 @@ xfs_da_node_toosmall(xfs_da_state_t *state, int *action) | |||
849 | * Make altpath point to the block we want to keep and | 849 | * Make altpath point to the block we want to keep and |
850 | * path point to the block we want to drop (this one). | 850 | * path point to the block we want to drop (this one). |
851 | */ | 851 | */ |
852 | forward = info->forw; | 852 | forward = (info->forw != 0); |
853 | memcpy(&state->altpath, &state->path, sizeof(state->path)); | 853 | memcpy(&state->altpath, &state->path, sizeof(state->path)); |
854 | error = xfs_da_path_shift(state, &state->altpath, forward, | 854 | error = xfs_da_path_shift(state, &state->altpath, forward, |
855 | 0, &retval); | 855 | 0, &retval); |
@@ -871,13 +871,12 @@ xfs_da_node_toosmall(xfs_da_state_t *state, int *action) | |||
871 | * to shrink a directory over time. | 871 | * to shrink a directory over time. |
872 | */ | 872 | */ |
873 | /* start with smaller blk num */ | 873 | /* start with smaller blk num */ |
874 | forward = (INT_GET(info->forw, ARCH_CONVERT) | 874 | forward = (be32_to_cpu(info->forw) < be32_to_cpu(info->back)); |
875 | < INT_GET(info->back, ARCH_CONVERT)); | ||
876 | for (i = 0; i < 2; forward = !forward, i++) { | 875 | for (i = 0; i < 2; forward = !forward, i++) { |
877 | if (forward) | 876 | if (forward) |
878 | blkno = INT_GET(info->forw, ARCH_CONVERT); | 877 | blkno = be32_to_cpu(info->forw); |
879 | else | 878 | else |
880 | blkno = INT_GET(info->back, ARCH_CONVERT); | 879 | blkno = be32_to_cpu(info->back); |
881 | if (blkno == 0) | 880 | if (blkno == 0) |
882 | continue; | 881 | continue; |
883 | error = xfs_da_read_buf(state->args->trans, state->args->dp, | 882 | error = xfs_da_read_buf(state->args->trans, state->args->dp, |
@@ -891,7 +890,7 @@ xfs_da_node_toosmall(xfs_da_state_t *state, int *action) | |||
891 | count -= state->node_ents >> 2; | 890 | count -= state->node_ents >> 2; |
892 | count -= INT_GET(node->hdr.count, ARCH_CONVERT); | 891 | count -= INT_GET(node->hdr.count, ARCH_CONVERT); |
893 | node = bp->data; | 892 | node = bp->data; |
894 | ASSERT(INT_GET(node->hdr.info.magic, ARCH_CONVERT) == XFS_DA_NODE_MAGIC); | 893 | ASSERT(be16_to_cpu(node->hdr.info.magic) == XFS_DA_NODE_MAGIC); |
895 | count -= INT_GET(node->hdr.count, ARCH_CONVERT); | 894 | count -= INT_GET(node->hdr.count, ARCH_CONVERT); |
896 | xfs_da_brelse(state->args->trans, bp); | 895 | xfs_da_brelse(state->args->trans, bp); |
897 | if (count >= 0) | 896 | if (count >= 0) |
@@ -973,7 +972,7 @@ xfs_da_fixhashpath(xfs_da_state_t *state, xfs_da_state_path_t *path) | |||
973 | } | 972 | } |
974 | for (blk--, level--; level >= 0; blk--, level--) { | 973 | for (blk--, level--; level >= 0; blk--, level--) { |
975 | node = blk->bp->data; | 974 | node = blk->bp->data; |
976 | ASSERT(INT_GET(node->hdr.info.magic, ARCH_CONVERT) == XFS_DA_NODE_MAGIC); | 975 | ASSERT(be16_to_cpu(node->hdr.info.magic) == XFS_DA_NODE_MAGIC); |
977 | btree = &node->btree[ blk->index ]; | 976 | btree = &node->btree[ blk->index ]; |
978 | if (INT_GET(btree->hashval, ARCH_CONVERT) == lasthash) | 977 | if (INT_GET(btree->hashval, ARCH_CONVERT) == lasthash) |
979 | break; | 978 | break; |
@@ -1041,8 +1040,8 @@ xfs_da_node_unbalance(xfs_da_state_t *state, xfs_da_state_blk_t *drop_blk, | |||
1041 | 1040 | ||
1042 | drop_node = drop_blk->bp->data; | 1041 | drop_node = drop_blk->bp->data; |
1043 | save_node = save_blk->bp->data; | 1042 | save_node = save_blk->bp->data; |
1044 | ASSERT(INT_GET(drop_node->hdr.info.magic, ARCH_CONVERT) == XFS_DA_NODE_MAGIC); | 1043 | ASSERT(be16_to_cpu(drop_node->hdr.info.magic) == XFS_DA_NODE_MAGIC); |
1045 | ASSERT(INT_GET(save_node->hdr.info.magic, ARCH_CONVERT) == XFS_DA_NODE_MAGIC); | 1044 | ASSERT(be16_to_cpu(save_node->hdr.info.magic) == XFS_DA_NODE_MAGIC); |
1046 | tp = state->args->trans; | 1045 | tp = state->args->trans; |
1047 | 1046 | ||
1048 | /* | 1047 | /* |
@@ -1138,15 +1137,15 @@ xfs_da_node_lookup_int(xfs_da_state_t *state, int *result) | |||
1138 | return(error); | 1137 | return(error); |
1139 | } | 1138 | } |
1140 | curr = blk->bp->data; | 1139 | curr = blk->bp->data; |
1141 | ASSERT(INT_GET(curr->magic, ARCH_CONVERT) == XFS_DA_NODE_MAGIC || | 1140 | ASSERT(be16_to_cpu(curr->magic) == XFS_DA_NODE_MAGIC || |
1142 | INT_GET(curr->magic, ARCH_CONVERT) == XFS_DIRX_LEAF_MAGIC(state->mp) || | 1141 | be16_to_cpu(curr->magic) == XFS_DIRX_LEAF_MAGIC(state->mp) || |
1143 | INT_GET(curr->magic, ARCH_CONVERT) == XFS_ATTR_LEAF_MAGIC); | 1142 | be16_to_cpu(curr->magic) == XFS_ATTR_LEAF_MAGIC); |
1144 | 1143 | ||
1145 | /* | 1144 | /* |
1146 | * Search an intermediate node for a match. | 1145 | * Search an intermediate node for a match. |
1147 | */ | 1146 | */ |
1148 | blk->magic = INT_GET(curr->magic, ARCH_CONVERT); | 1147 | blk->magic = be16_to_cpu(curr->magic); |
1149 | if (INT_GET(curr->magic, ARCH_CONVERT) == XFS_DA_NODE_MAGIC) { | 1148 | if (blk->magic == XFS_DA_NODE_MAGIC) { |
1150 | node = blk->bp->data; | 1149 | node = blk->bp->data; |
1151 | blk->hashval = INT_GET(node->btree[ INT_GET(node->hdr.count, ARCH_CONVERT)-1 ].hashval, ARCH_CONVERT); | 1150 | blk->hashval = INT_GET(node->btree[ INT_GET(node->hdr.count, ARCH_CONVERT)-1 ].hashval, ARCH_CONVERT); |
1152 | 1151 | ||
@@ -1193,15 +1192,15 @@ xfs_da_node_lookup_int(xfs_da_state_t *state, int *result) | |||
1193 | blkno = INT_GET(btree->before, ARCH_CONVERT); | 1192 | blkno = INT_GET(btree->before, ARCH_CONVERT); |
1194 | } | 1193 | } |
1195 | } | 1194 | } |
1196 | else if (INT_GET(curr->magic, ARCH_CONVERT) == XFS_ATTR_LEAF_MAGIC) { | 1195 | else if (be16_to_cpu(curr->magic) == XFS_ATTR_LEAF_MAGIC) { |
1197 | blk->hashval = xfs_attr_leaf_lasthash(blk->bp, NULL); | 1196 | blk->hashval = xfs_attr_leaf_lasthash(blk->bp, NULL); |
1198 | break; | 1197 | break; |
1199 | } | 1198 | } |
1200 | else if (INT_GET(curr->magic, ARCH_CONVERT) == XFS_DIR_LEAF_MAGIC) { | 1199 | else if (be16_to_cpu(curr->magic) == XFS_DIR_LEAF_MAGIC) { |
1201 | blk->hashval = xfs_dir_leaf_lasthash(blk->bp, NULL); | 1200 | blk->hashval = xfs_dir_leaf_lasthash(blk->bp, NULL); |
1202 | break; | 1201 | break; |
1203 | } | 1202 | } |
1204 | else if (INT_GET(curr->magic, ARCH_CONVERT) == XFS_DIR2_LEAFN_MAGIC) { | 1203 | else if (be16_to_cpu(curr->magic) == XFS_DIR2_LEAFN_MAGIC) { |
1205 | blk->hashval = xfs_dir2_leafn_lasthash(blk->bp, NULL); | 1204 | blk->hashval = xfs_dir2_leafn_lasthash(blk->bp, NULL); |
1206 | break; | 1205 | break; |
1207 | } | 1206 | } |
@@ -1274,8 +1273,8 @@ xfs_da_blk_link(xfs_da_state_t *state, xfs_da_state_blk_t *old_blk, | |||
1274 | ASSERT(old_blk->magic == XFS_DA_NODE_MAGIC || | 1273 | ASSERT(old_blk->magic == XFS_DA_NODE_MAGIC || |
1275 | old_blk->magic == XFS_DIRX_LEAF_MAGIC(state->mp) || | 1274 | old_blk->magic == XFS_DIRX_LEAF_MAGIC(state->mp) || |
1276 | old_blk->magic == XFS_ATTR_LEAF_MAGIC); | 1275 | old_blk->magic == XFS_ATTR_LEAF_MAGIC); |
1277 | ASSERT(old_blk->magic == INT_GET(old_info->magic, ARCH_CONVERT)); | 1276 | ASSERT(old_blk->magic == be16_to_cpu(old_info->magic)); |
1278 | ASSERT(new_blk->magic == INT_GET(new_info->magic, ARCH_CONVERT)); | 1277 | ASSERT(new_blk->magic == be16_to_cpu(new_info->magic)); |
1279 | ASSERT(old_blk->magic == new_blk->magic); | 1278 | ASSERT(old_blk->magic == new_blk->magic); |
1280 | 1279 | ||
1281 | switch (old_blk->magic) { | 1280 | switch (old_blk->magic) { |
@@ -1302,47 +1301,44 @@ xfs_da_blk_link(xfs_da_state_t *state, xfs_da_state_blk_t *old_blk, | |||
1302 | /* | 1301 | /* |
1303 | * Link new block in before existing block. | 1302 | * Link new block in before existing block. |
1304 | */ | 1303 | */ |
1305 | INT_SET(new_info->forw, ARCH_CONVERT, old_blk->blkno); | 1304 | new_info->forw = cpu_to_be32(old_blk->blkno); |
1306 | new_info->back = old_info->back; /* INT_: direct copy */ | 1305 | new_info->back = old_info->back; |
1307 | if (INT_GET(old_info->back, ARCH_CONVERT)) { | 1306 | if (old_info->back) { |
1308 | error = xfs_da_read_buf(args->trans, args->dp, | 1307 | error = xfs_da_read_buf(args->trans, args->dp, |
1309 | INT_GET(old_info->back, | 1308 | be32_to_cpu(old_info->back), |
1310 | ARCH_CONVERT), -1, &bp, | 1309 | -1, &bp, args->whichfork); |
1311 | args->whichfork); | ||
1312 | if (error) | 1310 | if (error) |
1313 | return(error); | 1311 | return(error); |
1314 | ASSERT(bp != NULL); | 1312 | ASSERT(bp != NULL); |
1315 | tmp_info = bp->data; | 1313 | tmp_info = bp->data; |
1316 | ASSERT(INT_GET(tmp_info->magic, ARCH_CONVERT) == INT_GET(old_info->magic, ARCH_CONVERT)); | 1314 | ASSERT(be16_to_cpu(tmp_info->magic) == be16_to_cpu(old_info->magic)); |
1317 | ASSERT(INT_GET(tmp_info->forw, ARCH_CONVERT) == old_blk->blkno); | 1315 | ASSERT(be32_to_cpu(tmp_info->forw) == old_blk->blkno); |
1318 | INT_SET(tmp_info->forw, ARCH_CONVERT, new_blk->blkno); | 1316 | tmp_info->forw = cpu_to_be32(new_blk->blkno); |
1319 | xfs_da_log_buf(args->trans, bp, 0, sizeof(*tmp_info)-1); | 1317 | xfs_da_log_buf(args->trans, bp, 0, sizeof(*tmp_info)-1); |
1320 | xfs_da_buf_done(bp); | 1318 | xfs_da_buf_done(bp); |
1321 | } | 1319 | } |
1322 | INT_SET(old_info->back, ARCH_CONVERT, new_blk->blkno); | 1320 | old_info->back = cpu_to_be32(new_blk->blkno); |
1323 | } else { | 1321 | } else { |
1324 | /* | 1322 | /* |
1325 | * Link new block in after existing block. | 1323 | * Link new block in after existing block. |
1326 | */ | 1324 | */ |
1327 | new_info->forw = old_info->forw; /* INT_: direct copy */ | 1325 | new_info->forw = old_info->forw; |
1328 | INT_SET(new_info->back, ARCH_CONVERT, old_blk->blkno); | 1326 | new_info->back = cpu_to_be32(old_blk->blkno); |
1329 | if (INT_GET(old_info->forw, ARCH_CONVERT)) { | 1327 | if (old_info->forw) { |
1330 | error = xfs_da_read_buf(args->trans, args->dp, | 1328 | error = xfs_da_read_buf(args->trans, args->dp, |
1331 | INT_GET(old_info->forw, ARCH_CONVERT), -1, &bp, | 1329 | be32_to_cpu(old_info->forw), |
1332 | args->whichfork); | 1330 | -1, &bp, args->whichfork); |
1333 | if (error) | 1331 | if (error) |
1334 | return(error); | 1332 | return(error); |
1335 | ASSERT(bp != NULL); | 1333 | ASSERT(bp != NULL); |
1336 | tmp_info = bp->data; | 1334 | tmp_info = bp->data; |
1337 | ASSERT(INT_GET(tmp_info->magic, ARCH_CONVERT) | 1335 | ASSERT(tmp_info->magic == old_info->magic); |
1338 | == INT_GET(old_info->magic, ARCH_CONVERT)); | 1336 | ASSERT(be32_to_cpu(tmp_info->back) == old_blk->blkno); |
1339 | ASSERT(INT_GET(tmp_info->back, ARCH_CONVERT) | 1337 | tmp_info->back = cpu_to_be32(new_blk->blkno); |
1340 | == old_blk->blkno); | ||
1341 | INT_SET(tmp_info->back, ARCH_CONVERT, new_blk->blkno); | ||
1342 | xfs_da_log_buf(args->trans, bp, 0, sizeof(*tmp_info)-1); | 1338 | xfs_da_log_buf(args->trans, bp, 0, sizeof(*tmp_info)-1); |
1343 | xfs_da_buf_done(bp); | 1339 | xfs_da_buf_done(bp); |
1344 | } | 1340 | } |
1345 | INT_SET(old_info->forw, ARCH_CONVERT, new_blk->blkno); | 1341 | old_info->forw = cpu_to_be32(new_blk->blkno); |
1346 | } | 1342 | } |
1347 | 1343 | ||
1348 | xfs_da_log_buf(args->trans, old_blk->bp, 0, sizeof(*tmp_info) - 1); | 1344 | xfs_da_log_buf(args->trans, old_blk->bp, 0, sizeof(*tmp_info) - 1); |
@@ -1360,8 +1356,8 @@ xfs_da_node_order(xfs_dabuf_t *node1_bp, xfs_dabuf_t *node2_bp) | |||
1360 | 1356 | ||
1361 | node1 = node1_bp->data; | 1357 | node1 = node1_bp->data; |
1362 | node2 = node2_bp->data; | 1358 | node2 = node2_bp->data; |
1363 | ASSERT((INT_GET(node1->hdr.info.magic, ARCH_CONVERT) == XFS_DA_NODE_MAGIC) && | 1359 | ASSERT((be16_to_cpu(node1->hdr.info.magic) == XFS_DA_NODE_MAGIC) && |
1364 | (INT_GET(node2->hdr.info.magic, ARCH_CONVERT) == XFS_DA_NODE_MAGIC)); | 1360 | (be16_to_cpu(node2->hdr.info.magic) == XFS_DA_NODE_MAGIC)); |
1365 | if ((INT_GET(node1->hdr.count, ARCH_CONVERT) > 0) && (INT_GET(node2->hdr.count, ARCH_CONVERT) > 0) && | 1361 | if ((INT_GET(node1->hdr.count, ARCH_CONVERT) > 0) && (INT_GET(node2->hdr.count, ARCH_CONVERT) > 0) && |
1366 | ((INT_GET(node2->btree[ 0 ].hashval, ARCH_CONVERT) < | 1362 | ((INT_GET(node2->btree[ 0 ].hashval, ARCH_CONVERT) < |
1367 | INT_GET(node1->btree[ 0 ].hashval, ARCH_CONVERT)) || | 1363 | INT_GET(node1->btree[ 0 ].hashval, ARCH_CONVERT)) || |
@@ -1381,7 +1377,7 @@ xfs_da_node_lasthash(xfs_dabuf_t *bp, int *count) | |||
1381 | xfs_da_intnode_t *node; | 1377 | xfs_da_intnode_t *node; |
1382 | 1378 | ||
1383 | node = bp->data; | 1379 | node = bp->data; |
1384 | ASSERT(INT_GET(node->hdr.info.magic, ARCH_CONVERT) == XFS_DA_NODE_MAGIC); | 1380 | ASSERT(be16_to_cpu(node->hdr.info.magic) == XFS_DA_NODE_MAGIC); |
1385 | if (count) | 1381 | if (count) |
1386 | *count = INT_GET(node->hdr.count, ARCH_CONVERT); | 1382 | *count = INT_GET(node->hdr.count, ARCH_CONVERT); |
1387 | if (!node->hdr.count) | 1383 | if (!node->hdr.count) |
@@ -1411,50 +1407,47 @@ xfs_da_blk_unlink(xfs_da_state_t *state, xfs_da_state_blk_t *drop_blk, | |||
1411 | ASSERT(save_blk->magic == XFS_DA_NODE_MAGIC || | 1407 | ASSERT(save_blk->magic == XFS_DA_NODE_MAGIC || |
1412 | save_blk->magic == XFS_DIRX_LEAF_MAGIC(state->mp) || | 1408 | save_blk->magic == XFS_DIRX_LEAF_MAGIC(state->mp) || |
1413 | save_blk->magic == XFS_ATTR_LEAF_MAGIC); | 1409 | save_blk->magic == XFS_ATTR_LEAF_MAGIC); |
1414 | ASSERT(save_blk->magic == INT_GET(save_info->magic, ARCH_CONVERT)); | 1410 | ASSERT(save_blk->magic == be16_to_cpu(save_info->magic)); |
1415 | ASSERT(drop_blk->magic == INT_GET(drop_info->magic, ARCH_CONVERT)); | 1411 | ASSERT(drop_blk->magic == be16_to_cpu(drop_info->magic)); |
1416 | ASSERT(save_blk->magic == drop_blk->magic); | 1412 | ASSERT(save_blk->magic == drop_blk->magic); |
1417 | ASSERT((INT_GET(save_info->forw, ARCH_CONVERT) == drop_blk->blkno) || | 1413 | ASSERT((be32_to_cpu(save_info->forw) == drop_blk->blkno) || |
1418 | (INT_GET(save_info->back, ARCH_CONVERT) == drop_blk->blkno)); | 1414 | (be32_to_cpu(save_info->back) == drop_blk->blkno)); |
1419 | ASSERT((INT_GET(drop_info->forw, ARCH_CONVERT) == save_blk->blkno) || | 1415 | ASSERT((be32_to_cpu(drop_info->forw) == save_blk->blkno) || |
1420 | (INT_GET(drop_info->back, ARCH_CONVERT) == save_blk->blkno)); | 1416 | (be32_to_cpu(drop_info->back) == save_blk->blkno)); |
1421 | 1417 | ||
1422 | /* | 1418 | /* |
1423 | * Unlink the leaf block from the doubly linked chain of leaves. | 1419 | * Unlink the leaf block from the doubly linked chain of leaves. |
1424 | */ | 1420 | */ |
1425 | if (INT_GET(save_info->back, ARCH_CONVERT) == drop_blk->blkno) { | 1421 | if (be32_to_cpu(save_info->back) == drop_blk->blkno) { |
1426 | save_info->back = drop_info->back; /* INT_: direct copy */ | 1422 | save_info->back = drop_info->back; |
1427 | if (INT_GET(drop_info->back, ARCH_CONVERT)) { | 1423 | if (drop_info->back) { |
1428 | error = xfs_da_read_buf(args->trans, args->dp, | 1424 | error = xfs_da_read_buf(args->trans, args->dp, |
1429 | INT_GET(drop_info->back, | 1425 | be32_to_cpu(drop_info->back), |
1430 | ARCH_CONVERT), -1, &bp, | 1426 | -1, &bp, args->whichfork); |
1431 | args->whichfork); | ||
1432 | if (error) | 1427 | if (error) |
1433 | return(error); | 1428 | return(error); |
1434 | ASSERT(bp != NULL); | 1429 | ASSERT(bp != NULL); |
1435 | tmp_info = bp->data; | 1430 | tmp_info = bp->data; |
1436 | ASSERT(INT_GET(tmp_info->magic, ARCH_CONVERT) == INT_GET(save_info->magic, ARCH_CONVERT)); | 1431 | ASSERT(tmp_info->magic == save_info->magic); |
1437 | ASSERT(INT_GET(tmp_info->forw, ARCH_CONVERT) == drop_blk->blkno); | 1432 | ASSERT(be32_to_cpu(tmp_info->forw) == drop_blk->blkno); |
1438 | INT_SET(tmp_info->forw, ARCH_CONVERT, save_blk->blkno); | 1433 | tmp_info->forw = cpu_to_be32(save_blk->blkno); |
1439 | xfs_da_log_buf(args->trans, bp, 0, | 1434 | xfs_da_log_buf(args->trans, bp, 0, |
1440 | sizeof(*tmp_info) - 1); | 1435 | sizeof(*tmp_info) - 1); |
1441 | xfs_da_buf_done(bp); | 1436 | xfs_da_buf_done(bp); |
1442 | } | 1437 | } |
1443 | } else { | 1438 | } else { |
1444 | save_info->forw = drop_info->forw; /* INT_: direct copy */ | 1439 | save_info->forw = drop_info->forw; |
1445 | if (INT_GET(drop_info->forw, ARCH_CONVERT)) { | 1440 | if (drop_info->forw) { |
1446 | error = xfs_da_read_buf(args->trans, args->dp, | 1441 | error = xfs_da_read_buf(args->trans, args->dp, |
1447 | INT_GET(drop_info->forw, ARCH_CONVERT), -1, &bp, | 1442 | be32_to_cpu(drop_info->forw), |
1448 | args->whichfork); | 1443 | -1, &bp, args->whichfork); |
1449 | if (error) | 1444 | if (error) |
1450 | return(error); | 1445 | return(error); |
1451 | ASSERT(bp != NULL); | 1446 | ASSERT(bp != NULL); |
1452 | tmp_info = bp->data; | 1447 | tmp_info = bp->data; |
1453 | ASSERT(INT_GET(tmp_info->magic, ARCH_CONVERT) | 1448 | ASSERT(tmp_info->magic == save_info->magic); |
1454 | == INT_GET(save_info->magic, ARCH_CONVERT)); | 1449 | ASSERT(be32_to_cpu(tmp_info->back) == drop_blk->blkno); |
1455 | ASSERT(INT_GET(tmp_info->back, ARCH_CONVERT) | 1450 | tmp_info->back = cpu_to_be32(save_blk->blkno); |
1456 | == drop_blk->blkno); | ||
1457 | INT_SET(tmp_info->back, ARCH_CONVERT, save_blk->blkno); | ||
1458 | xfs_da_log_buf(args->trans, bp, 0, | 1451 | xfs_da_log_buf(args->trans, bp, 0, |
1459 | sizeof(*tmp_info) - 1); | 1452 | sizeof(*tmp_info) - 1); |
1460 | xfs_da_buf_done(bp); | 1453 | xfs_da_buf_done(bp); |
@@ -1497,7 +1490,7 @@ xfs_da_path_shift(xfs_da_state_t *state, xfs_da_state_path_t *path, | |||
1497 | for (blk = &path->blk[level]; level >= 0; blk--, level--) { | 1490 | for (blk = &path->blk[level]; level >= 0; blk--, level--) { |
1498 | ASSERT(blk->bp != NULL); | 1491 | ASSERT(blk->bp != NULL); |
1499 | node = blk->bp->data; | 1492 | node = blk->bp->data; |
1500 | ASSERT(INT_GET(node->hdr.info.magic, ARCH_CONVERT) == XFS_DA_NODE_MAGIC); | 1493 | ASSERT(be16_to_cpu(node->hdr.info.magic) == XFS_DA_NODE_MAGIC); |
1501 | if (forward && (blk->index < INT_GET(node->hdr.count, ARCH_CONVERT)-1)) { | 1494 | if (forward && (blk->index < INT_GET(node->hdr.count, ARCH_CONVERT)-1)) { |
1502 | blk->index++; | 1495 | blk->index++; |
1503 | blkno = INT_GET(node->btree[ blk->index ].before, ARCH_CONVERT); | 1496 | blkno = INT_GET(node->btree[ blk->index ].before, ARCH_CONVERT); |
@@ -1536,11 +1529,11 @@ xfs_da_path_shift(xfs_da_state_t *state, xfs_da_state_path_t *path, | |||
1536 | return(error); | 1529 | return(error); |
1537 | ASSERT(blk->bp != NULL); | 1530 | ASSERT(blk->bp != NULL); |
1538 | info = blk->bp->data; | 1531 | info = blk->bp->data; |
1539 | ASSERT(INT_GET(info->magic, ARCH_CONVERT) == XFS_DA_NODE_MAGIC || | 1532 | ASSERT(be16_to_cpu(info->magic) == XFS_DA_NODE_MAGIC || |
1540 | INT_GET(info->magic, ARCH_CONVERT) == XFS_DIRX_LEAF_MAGIC(state->mp) || | 1533 | be16_to_cpu(info->magic) == XFS_DIRX_LEAF_MAGIC(state->mp) || |
1541 | INT_GET(info->magic, ARCH_CONVERT) == XFS_ATTR_LEAF_MAGIC); | 1534 | be16_to_cpu(info->magic) == XFS_ATTR_LEAF_MAGIC); |
1542 | blk->magic = INT_GET(info->magic, ARCH_CONVERT); | 1535 | blk->magic = be16_to_cpu(info->magic); |
1543 | if (INT_GET(info->magic, ARCH_CONVERT) == XFS_DA_NODE_MAGIC) { | 1536 | if (blk->magic == XFS_DA_NODE_MAGIC) { |
1544 | node = (xfs_da_intnode_t *)info; | 1537 | node = (xfs_da_intnode_t *)info; |
1545 | blk->hashval = INT_GET(node->btree[ INT_GET(node->hdr.count, ARCH_CONVERT)-1 ].hashval, ARCH_CONVERT); | 1538 | blk->hashval = INT_GET(node->btree[ INT_GET(node->hdr.count, ARCH_CONVERT)-1 ].hashval, ARCH_CONVERT); |
1546 | if (forward) | 1539 | if (forward) |
@@ -1788,19 +1781,19 @@ xfs_da_swap_lastblock(xfs_da_args_t *args, xfs_dablk_t *dead_blknop, | |||
1788 | /* | 1781 | /* |
1789 | * Get values from the moved block. | 1782 | * Get values from the moved block. |
1790 | */ | 1783 | */ |
1791 | if (INT_GET(dead_info->magic, ARCH_CONVERT) == XFS_DIR_LEAF_MAGIC) { | 1784 | if (be16_to_cpu(dead_info->magic) == XFS_DIR_LEAF_MAGIC) { |
1792 | ASSERT(XFS_DIR_IS_V1(mp)); | 1785 | ASSERT(XFS_DIR_IS_V1(mp)); |
1793 | dead_leaf = (xfs_dir_leafblock_t *)dead_info; | 1786 | dead_leaf = (xfs_dir_leafblock_t *)dead_info; |
1794 | dead_level = 0; | 1787 | dead_level = 0; |
1795 | dead_hash = | 1788 | dead_hash = |
1796 | INT_GET(dead_leaf->entries[INT_GET(dead_leaf->hdr.count, ARCH_CONVERT) - 1].hashval, ARCH_CONVERT); | 1789 | INT_GET(dead_leaf->entries[INT_GET(dead_leaf->hdr.count, ARCH_CONVERT) - 1].hashval, ARCH_CONVERT); |
1797 | } else if (INT_GET(dead_info->magic, ARCH_CONVERT) == XFS_DIR2_LEAFN_MAGIC) { | 1790 | } else if (be16_to_cpu(dead_info->magic) == XFS_DIR2_LEAFN_MAGIC) { |
1798 | ASSERT(XFS_DIR_IS_V2(mp)); | 1791 | ASSERT(XFS_DIR_IS_V2(mp)); |
1799 | dead_leaf2 = (xfs_dir2_leaf_t *)dead_info; | 1792 | dead_leaf2 = (xfs_dir2_leaf_t *)dead_info; |
1800 | dead_level = 0; | 1793 | dead_level = 0; |
1801 | dead_hash = be32_to_cpu(dead_leaf2->ents[be16_to_cpu(dead_leaf2->hdr.count) - 1].hashval); | 1794 | dead_hash = be32_to_cpu(dead_leaf2->ents[be16_to_cpu(dead_leaf2->hdr.count) - 1].hashval); |
1802 | } else { | 1795 | } else { |
1803 | ASSERT(INT_GET(dead_info->magic, ARCH_CONVERT) == XFS_DA_NODE_MAGIC); | 1796 | ASSERT(be16_to_cpu(dead_info->magic) == XFS_DA_NODE_MAGIC); |
1804 | dead_node = (xfs_da_intnode_t *)dead_info; | 1797 | dead_node = (xfs_da_intnode_t *)dead_info; |
1805 | dead_level = INT_GET(dead_node->hdr.level, ARCH_CONVERT); | 1798 | dead_level = INT_GET(dead_node->hdr.level, ARCH_CONVERT); |
1806 | dead_hash = INT_GET(dead_node->btree[INT_GET(dead_node->hdr.count, ARCH_CONVERT) - 1].hashval, ARCH_CONVERT); | 1799 | dead_hash = INT_GET(dead_node->btree[INT_GET(dead_node->hdr.count, ARCH_CONVERT) - 1].hashval, ARCH_CONVERT); |
@@ -1809,19 +1802,19 @@ xfs_da_swap_lastblock(xfs_da_args_t *args, xfs_dablk_t *dead_blknop, | |||
1809 | /* | 1802 | /* |
1810 | * If the moved block has a left sibling, fix up the pointers. | 1803 | * If the moved block has a left sibling, fix up the pointers. |
1811 | */ | 1804 | */ |
1812 | if ((sib_blkno = INT_GET(dead_info->back, ARCH_CONVERT))) { | 1805 | if ((sib_blkno = be32_to_cpu(dead_info->back))) { |
1813 | if ((error = xfs_da_read_buf(tp, ip, sib_blkno, -1, &sib_buf, w))) | 1806 | if ((error = xfs_da_read_buf(tp, ip, sib_blkno, -1, &sib_buf, w))) |
1814 | goto done; | 1807 | goto done; |
1815 | sib_info = sib_buf->data; | 1808 | sib_info = sib_buf->data; |
1816 | if (unlikely( | 1809 | if (unlikely( |
1817 | INT_GET(sib_info->forw, ARCH_CONVERT) != last_blkno || | 1810 | be32_to_cpu(sib_info->forw) != last_blkno || |
1818 | INT_GET(sib_info->magic, ARCH_CONVERT) != INT_GET(dead_info->magic, ARCH_CONVERT))) { | 1811 | sib_info->magic != dead_info->magic)) { |
1819 | XFS_ERROR_REPORT("xfs_da_swap_lastblock(2)", | 1812 | XFS_ERROR_REPORT("xfs_da_swap_lastblock(2)", |
1820 | XFS_ERRLEVEL_LOW, mp); | 1813 | XFS_ERRLEVEL_LOW, mp); |
1821 | error = XFS_ERROR(EFSCORRUPTED); | 1814 | error = XFS_ERROR(EFSCORRUPTED); |
1822 | goto done; | 1815 | goto done; |
1823 | } | 1816 | } |
1824 | INT_SET(sib_info->forw, ARCH_CONVERT, dead_blkno); | 1817 | sib_info->forw = cpu_to_be32(dead_blkno); |
1825 | xfs_da_log_buf(tp, sib_buf, | 1818 | xfs_da_log_buf(tp, sib_buf, |
1826 | XFS_DA_LOGRANGE(sib_info, &sib_info->forw, | 1819 | XFS_DA_LOGRANGE(sib_info, &sib_info->forw, |
1827 | sizeof(sib_info->forw))); | 1820 | sizeof(sib_info->forw))); |
@@ -1831,20 +1824,19 @@ xfs_da_swap_lastblock(xfs_da_args_t *args, xfs_dablk_t *dead_blknop, | |||
1831 | /* | 1824 | /* |
1832 | * If the moved block has a right sibling, fix up the pointers. | 1825 | * If the moved block has a right sibling, fix up the pointers. |
1833 | */ | 1826 | */ |
1834 | if ((sib_blkno = INT_GET(dead_info->forw, ARCH_CONVERT))) { | 1827 | if ((sib_blkno = be32_to_cpu(dead_info->forw))) { |
1835 | if ((error = xfs_da_read_buf(tp, ip, sib_blkno, -1, &sib_buf, w))) | 1828 | if ((error = xfs_da_read_buf(tp, ip, sib_blkno, -1, &sib_buf, w))) |
1836 | goto done; | 1829 | goto done; |
1837 | sib_info = sib_buf->data; | 1830 | sib_info = sib_buf->data; |
1838 | if (unlikely( | 1831 | if (unlikely( |
1839 | INT_GET(sib_info->back, ARCH_CONVERT) != last_blkno | 1832 | be32_to_cpu(sib_info->back) != last_blkno || |
1840 | || INT_GET(sib_info->magic, ARCH_CONVERT) | 1833 | sib_info->magic != dead_info->magic)) { |
1841 | != INT_GET(dead_info->magic, ARCH_CONVERT))) { | ||
1842 | XFS_ERROR_REPORT("xfs_da_swap_lastblock(3)", | 1834 | XFS_ERROR_REPORT("xfs_da_swap_lastblock(3)", |
1843 | XFS_ERRLEVEL_LOW, mp); | 1835 | XFS_ERRLEVEL_LOW, mp); |
1844 | error = XFS_ERROR(EFSCORRUPTED); | 1836 | error = XFS_ERROR(EFSCORRUPTED); |
1845 | goto done; | 1837 | goto done; |
1846 | } | 1838 | } |
1847 | INT_SET(sib_info->back, ARCH_CONVERT, dead_blkno); | 1839 | sib_info->back = cpu_to_be32(dead_blkno); |
1848 | xfs_da_log_buf(tp, sib_buf, | 1840 | xfs_da_log_buf(tp, sib_buf, |
1849 | XFS_DA_LOGRANGE(sib_info, &sib_info->back, | 1841 | XFS_DA_LOGRANGE(sib_info, &sib_info->back, |
1850 | sizeof(sib_info->back))); | 1842 | sizeof(sib_info->back))); |
@@ -1861,7 +1853,7 @@ xfs_da_swap_lastblock(xfs_da_args_t *args, xfs_dablk_t *dead_blknop, | |||
1861 | goto done; | 1853 | goto done; |
1862 | par_node = par_buf->data; | 1854 | par_node = par_buf->data; |
1863 | if (unlikely( | 1855 | if (unlikely( |
1864 | INT_GET(par_node->hdr.info.magic, ARCH_CONVERT) != XFS_DA_NODE_MAGIC || | 1856 | be16_to_cpu(par_node->hdr.info.magic) != XFS_DA_NODE_MAGIC || |
1865 | (level >= 0 && level != INT_GET(par_node->hdr.level, ARCH_CONVERT) + 1))) { | 1857 | (level >= 0 && level != INT_GET(par_node->hdr.level, ARCH_CONVERT) + 1))) { |
1866 | XFS_ERROR_REPORT("xfs_da_swap_lastblock(4)", | 1858 | XFS_ERROR_REPORT("xfs_da_swap_lastblock(4)", |
1867 | XFS_ERRLEVEL_LOW, mp); | 1859 | XFS_ERRLEVEL_LOW, mp); |
@@ -1898,7 +1890,7 @@ xfs_da_swap_lastblock(xfs_da_args_t *args, xfs_dablk_t *dead_blknop, | |||
1898 | continue; | 1890 | continue; |
1899 | if (entno < INT_GET(par_node->hdr.count, ARCH_CONVERT)) | 1891 | if (entno < INT_GET(par_node->hdr.count, ARCH_CONVERT)) |
1900 | break; | 1892 | break; |
1901 | par_blkno = INT_GET(par_node->hdr.info.forw, ARCH_CONVERT); | 1893 | par_blkno = be32_to_cpu(par_node->hdr.info.forw); |
1902 | xfs_da_brelse(tp, par_buf); | 1894 | xfs_da_brelse(tp, par_buf); |
1903 | par_buf = NULL; | 1895 | par_buf = NULL; |
1904 | if (unlikely(par_blkno == 0)) { | 1896 | if (unlikely(par_blkno == 0)) { |
@@ -1912,7 +1904,7 @@ xfs_da_swap_lastblock(xfs_da_args_t *args, xfs_dablk_t *dead_blknop, | |||
1912 | par_node = par_buf->data; | 1904 | par_node = par_buf->data; |
1913 | if (unlikely( | 1905 | if (unlikely( |
1914 | INT_GET(par_node->hdr.level, ARCH_CONVERT) != level || | 1906 | INT_GET(par_node->hdr.level, ARCH_CONVERT) != level || |
1915 | INT_GET(par_node->hdr.info.magic, ARCH_CONVERT) != XFS_DA_NODE_MAGIC)) { | 1907 | be16_to_cpu(par_node->hdr.info.magic) != XFS_DA_NODE_MAGIC)) { |
1916 | XFS_ERROR_REPORT("xfs_da_swap_lastblock(7)", | 1908 | XFS_ERROR_REPORT("xfs_da_swap_lastblock(7)", |
1917 | XFS_ERRLEVEL_LOW, mp); | 1909 | XFS_ERRLEVEL_LOW, mp); |
1918 | error = XFS_ERROR(EFSCORRUPTED); | 1910 | error = XFS_ERROR(EFSCORRUPTED); |
@@ -2203,7 +2195,7 @@ xfs_da_do_buf( | |||
2203 | info = rbp->data; | 2195 | info = rbp->data; |
2204 | data = rbp->data; | 2196 | data = rbp->data; |
2205 | free = rbp->data; | 2197 | free = rbp->data; |
2206 | magic = INT_GET(info->magic, ARCH_CONVERT); | 2198 | magic = be16_to_cpu(info->magic); |
2207 | magic1 = be32_to_cpu(data->hdr.magic); | 2199 | magic1 = be32_to_cpu(data->hdr.magic); |
2208 | if (unlikely( | 2200 | if (unlikely( |
2209 | XFS_TEST_ERROR((magic != XFS_DA_NODE_MAGIC) && | 2201 | XFS_TEST_ERROR((magic != XFS_DA_NODE_MAGIC) && |