diff options
author | Nathan Scott <nathans@sgi.com> | 2006-03-17 01:29:46 -0500 |
---|---|---|
committer | Nathan Scott <nathans@sgi.com> | 2006-03-17 01:29:46 -0500 |
commit | 403432dcb5daa03c1f1c961adb7d2a5daebea94b (patch) | |
tree | 0298d12d14f777d06e3588dade78efbde2e5bb88 /fs/xfs | |
parent | d7929ff670c802dc68d6149d3d0cc5667e18daec (diff) |
[XFS] endianess annotations for xfs_da_node_entry_t
SGI-PV: 943272
SGI-Modid: xfs-linux-melb:xfs-kern:25504a
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Nathan Scott <nathans@sgi.com>
Diffstat (limited to 'fs/xfs')
-rw-r--r-- | fs/xfs/xfs_attr.c | 13 | ||||
-rw-r--r-- | fs/xfs/xfs_attr_leaf.c | 6 | ||||
-rw-r--r-- | fs/xfs/xfs_da_btree.c | 86 | ||||
-rw-r--r-- | fs/xfs/xfs_da_btree.h | 4 | ||||
-rw-r--r-- | fs/xfs/xfs_dir.c | 8 | ||||
-rw-r--r-- | fs/xfs/xfs_dir_leaf.c | 2 |
6 files changed, 59 insertions, 60 deletions
diff --git a/fs/xfs/xfs_attr.c b/fs/xfs/xfs_attr.c index 98d0f4d10602..5d61c628d0db 100644 --- a/fs/xfs/xfs_attr.c +++ b/fs/xfs/xfs_attr.c | |||
@@ -1829,9 +1829,8 @@ xfs_attr_node_list(xfs_attr_list_context_t *context) | |||
1829 | i < INT_GET(node->hdr.count, ARCH_CONVERT); | 1829 | i < INT_GET(node->hdr.count, ARCH_CONVERT); |
1830 | btree++, i++) { | 1830 | btree++, i++) { |
1831 | if (cursor->hashval | 1831 | if (cursor->hashval |
1832 | <= INT_GET(btree->hashval, | 1832 | <= be32_to_cpu(btree->hashval)) { |
1833 | ARCH_CONVERT)) { | 1833 | cursor->blkno = be32_to_cpu(btree->before); |
1834 | cursor->blkno = INT_GET(btree->before, ARCH_CONVERT); | ||
1835 | xfs_attr_trace_l_cb("descending", | 1834 | xfs_attr_trace_l_cb("descending", |
1836 | context, btree); | 1835 | context, btree); |
1837 | break; | 1836 | break; |
@@ -2228,8 +2227,8 @@ xfs_attr_trace_l_cn(char *where, struct xfs_attr_list_context *context, | |||
2228 | (__psunsigned_t)context->dupcnt, | 2227 | (__psunsigned_t)context->dupcnt, |
2229 | (__psunsigned_t)context->flags, | 2228 | (__psunsigned_t)context->flags, |
2230 | (__psunsigned_t)INT_GET(node->hdr.count, ARCH_CONVERT), | 2229 | (__psunsigned_t)INT_GET(node->hdr.count, ARCH_CONVERT), |
2231 | (__psunsigned_t)INT_GET(node->btree[0].hashval, ARCH_CONVERT), | 2230 | (__psunsigned_t)be32_to_cpu(node->btree[0].hashval), |
2232 | (__psunsigned_t)INT_GET(node->btree[INT_GET(node->hdr.count, ARCH_CONVERT)-1].hashval, ARCH_CONVERT)); | 2231 | (__psunsigned_t)be32_to_cpu(node->btree[INT_GET(node->hdr.count, ARCH_CONVERT)-1].hashval)); |
2233 | } | 2232 | } |
2234 | 2233 | ||
2235 | /* | 2234 | /* |
@@ -2256,8 +2255,8 @@ xfs_attr_trace_l_cb(char *where, struct xfs_attr_list_context *context, | |||
2256 | : 0, | 2255 | : 0, |
2257 | (__psunsigned_t)context->dupcnt, | 2256 | (__psunsigned_t)context->dupcnt, |
2258 | (__psunsigned_t)context->flags, | 2257 | (__psunsigned_t)context->flags, |
2259 | (__psunsigned_t)INT_GET(btree->hashval, ARCH_CONVERT), | 2258 | (__psunsigned_t)be32_to_cpu(btree->hashval), |
2260 | (__psunsigned_t)INT_GET(btree->before, ARCH_CONVERT), | 2259 | (__psunsigned_t)be32_to_cpu(btree->before), |
2261 | (__psunsigned_t)NULL); | 2260 | (__psunsigned_t)NULL); |
2262 | } | 2261 | } |
2263 | 2262 | ||
diff --git a/fs/xfs/xfs_attr_leaf.c b/fs/xfs/xfs_attr_leaf.c index b3d5c35b6047..70594bceffec 100644 --- a/fs/xfs/xfs_attr_leaf.c +++ b/fs/xfs/xfs_attr_leaf.c | |||
@@ -869,7 +869,7 @@ xfs_attr_leaf_to_node(xfs_da_args_t *args) | |||
869 | /* both on-disk, don't endian-flip twice */ | 869 | /* both on-disk, don't endian-flip twice */ |
870 | node->btree[0].hashval = | 870 | node->btree[0].hashval = |
871 | leaf->entries[be16_to_cpu(leaf->hdr.count)-1 ].hashval; | 871 | leaf->entries[be16_to_cpu(leaf->hdr.count)-1 ].hashval; |
872 | INT_SET(node->btree[0].before, ARCH_CONVERT, blkno); | 872 | node->btree[0].before = cpu_to_be32(blkno); |
873 | INT_SET(node->hdr.count, ARCH_CONVERT, 1); | 873 | INT_SET(node->hdr.count, ARCH_CONVERT, 1); |
874 | xfs_da_log_buf(args->trans, bp1, 0, XFS_LBSIZE(dp->i_mount) - 1); | 874 | xfs_da_log_buf(args->trans, bp1, 0, XFS_LBSIZE(dp->i_mount) - 1); |
875 | error = 0; | 875 | error = 0; |
@@ -2809,7 +2809,7 @@ xfs_attr_node_inactive(xfs_trans_t **trans, xfs_inode_t *dp, xfs_dabuf_t *bp, | |||
2809 | xfs_da_brelse(*trans, bp); | 2809 | xfs_da_brelse(*trans, bp); |
2810 | return(0); | 2810 | return(0); |
2811 | } | 2811 | } |
2812 | child_fsb = INT_GET(node->btree[0].before, ARCH_CONVERT); | 2812 | child_fsb = be32_to_cpu(node->btree[0].before); |
2813 | xfs_da_brelse(*trans, bp); /* no locks for later trans */ | 2813 | xfs_da_brelse(*trans, bp); /* no locks for later trans */ |
2814 | 2814 | ||
2815 | /* | 2815 | /* |
@@ -2869,7 +2869,7 @@ xfs_attr_node_inactive(xfs_trans_t **trans, xfs_inode_t *dp, xfs_dabuf_t *bp, | |||
2869 | &bp, XFS_ATTR_FORK); | 2869 | &bp, XFS_ATTR_FORK); |
2870 | if (error) | 2870 | if (error) |
2871 | return(error); | 2871 | return(error); |
2872 | child_fsb = INT_GET(node->btree[i+1].before, ARCH_CONVERT); | 2872 | child_fsb = be32_to_cpu(node->btree[i+1].before); |
2873 | xfs_da_brelse(*trans, bp); | 2873 | xfs_da_brelse(*trans, bp); |
2874 | } | 2874 | } |
2875 | /* | 2875 | /* |
diff --git a/fs/xfs/xfs_da_btree.c b/fs/xfs/xfs_da_btree.c index 4f3bb1cb9615..d32670c09f39 100644 --- a/fs/xfs/xfs_da_btree.c +++ b/fs/xfs/xfs_da_btree.c | |||
@@ -385,10 +385,10 @@ xfs_da_root_split(xfs_da_state_t *state, xfs_da_state_blk_t *blk1, | |||
385 | if (error) | 385 | if (error) |
386 | return(error); | 386 | return(error); |
387 | node = bp->data; | 387 | node = bp->data; |
388 | INT_SET(node->btree[0].hashval, ARCH_CONVERT, blk1->hashval); | 388 | node->btree[0].hashval = cpu_to_be32(blk1->hashval); |
389 | INT_SET(node->btree[0].before, ARCH_CONVERT, blk1->blkno); | 389 | node->btree[0].before = cpu_to_be32(blk1->blkno); |
390 | INT_SET(node->btree[1].hashval, ARCH_CONVERT, blk2->hashval); | 390 | node->btree[1].hashval = cpu_to_be32(blk2->hashval); |
391 | INT_SET(node->btree[1].before, ARCH_CONVERT, blk2->blkno); | 391 | node->btree[1].before = cpu_to_be32(blk2->blkno); |
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 |
@@ -517,9 +517,9 @@ xfs_da_node_rebalance(xfs_da_state_t *state, xfs_da_state_blk_t *blk1, | |||
517 | * Swap the nodes around if that makes it simpler. | 517 | * Swap the nodes around if that makes it simpler. |
518 | */ | 518 | */ |
519 | if ((INT_GET(node1->hdr.count, ARCH_CONVERT) > 0) && (INT_GET(node2->hdr.count, ARCH_CONVERT) > 0) && | 519 | if ((INT_GET(node1->hdr.count, ARCH_CONVERT) > 0) && (INT_GET(node2->hdr.count, ARCH_CONVERT) > 0) && |
520 | ((INT_GET(node2->btree[ 0 ].hashval, ARCH_CONVERT) < INT_GET(node1->btree[ 0 ].hashval, ARCH_CONVERT)) || | 520 | ((be32_to_cpu(node2->btree[0].hashval) < be32_to_cpu(node1->btree[0].hashval)) || |
521 | (INT_GET(node2->btree[ INT_GET(node2->hdr.count, ARCH_CONVERT)-1 ].hashval, ARCH_CONVERT) < | 521 | (be32_to_cpu(node2->btree[INT_GET(node2->hdr.count, ARCH_CONVERT)-1].hashval) < |
522 | INT_GET(node1->btree[ INT_GET(node1->hdr.count, ARCH_CONVERT)-1 ].hashval, ARCH_CONVERT)))) { | 522 | be32_to_cpu(node1->btree[INT_GET(node1->hdr.count, ARCH_CONVERT)-1].hashval)))) { |
523 | tmpnode = node1; | 523 | tmpnode = node1; |
524 | node1 = node2; | 524 | node1 = node2; |
525 | node2 = tmpnode; | 525 | node2 = tmpnode; |
@@ -596,8 +596,8 @@ xfs_da_node_rebalance(xfs_da_state_t *state, xfs_da_state_blk_t *blk1, | |||
596 | */ | 596 | */ |
597 | node1 = blk1->bp->data; | 597 | node1 = blk1->bp->data; |
598 | node2 = blk2->bp->data; | 598 | node2 = blk2->bp->data; |
599 | blk1->hashval = INT_GET(node1->btree[ INT_GET(node1->hdr.count, ARCH_CONVERT)-1 ].hashval, ARCH_CONVERT); | 599 | blk1->hashval = be32_to_cpu(node1->btree[ INT_GET(node1->hdr.count, ARCH_CONVERT)-1 ].hashval); |
600 | blk2->hashval = INT_GET(node2->btree[ INT_GET(node2->hdr.count, ARCH_CONVERT)-1 ].hashval, ARCH_CONVERT); | 600 | blk2->hashval = be32_to_cpu(node2->btree[ INT_GET(node2->hdr.count, ARCH_CONVERT)-1 ].hashval); |
601 | 601 | ||
602 | /* | 602 | /* |
603 | * Adjust the expected index for insertion. | 603 | * Adjust the expected index for insertion. |
@@ -638,8 +638,8 @@ xfs_da_node_add(xfs_da_state_t *state, xfs_da_state_blk_t *oldblk, | |||
638 | tmp = (INT_GET(node->hdr.count, ARCH_CONVERT) - oldblk->index) * (uint)sizeof(*btree); | 638 | tmp = (INT_GET(node->hdr.count, ARCH_CONVERT) - oldblk->index) * (uint)sizeof(*btree); |
639 | memmove(btree + 1, btree, tmp); | 639 | memmove(btree + 1, btree, tmp); |
640 | } | 640 | } |
641 | INT_SET(btree->hashval, ARCH_CONVERT, newblk->hashval); | 641 | btree->hashval = cpu_to_be32(newblk->hashval); |
642 | INT_SET(btree->before, ARCH_CONVERT, newblk->blkno); | 642 | btree->before = cpu_to_be32(newblk->blkno); |
643 | xfs_da_log_buf(state->args->trans, oldblk->bp, | 643 | xfs_da_log_buf(state->args->trans, oldblk->bp, |
644 | XFS_DA_LOGRANGE(node, btree, tmp + sizeof(*btree))); | 644 | XFS_DA_LOGRANGE(node, btree, tmp + sizeof(*btree))); |
645 | INT_MOD(node->hdr.count, ARCH_CONVERT, +1); | 645 | INT_MOD(node->hdr.count, ARCH_CONVERT, +1); |
@@ -649,7 +649,7 @@ xfs_da_node_add(xfs_da_state_t *state, xfs_da_state_blk_t *oldblk, | |||
649 | /* | 649 | /* |
650 | * Copy the last hash value from the oldblk to propagate upwards. | 650 | * Copy the last hash value from the oldblk to propagate upwards. |
651 | */ | 651 | */ |
652 | oldblk->hashval = INT_GET(node->btree[ INT_GET(node->hdr.count, ARCH_CONVERT)-1 ].hashval, ARCH_CONVERT); | 652 | oldblk->hashval = be32_to_cpu(node->btree[ INT_GET(node->hdr.count, ARCH_CONVERT)-1 ].hashval); |
653 | } | 653 | } |
654 | 654 | ||
655 | /*======================================================================== | 655 | /*======================================================================== |
@@ -782,7 +782,7 @@ xfs_da_root_join(xfs_da_state_t *state, xfs_da_state_blk_t *root_blk) | |||
782 | * Read in the (only) child block, then copy those bytes into | 782 | * Read in the (only) child block, then copy those bytes into |
783 | * the root block's buffer and free the original child block. | 783 | * the root block's buffer and free the original child block. |
784 | */ | 784 | */ |
785 | child = INT_GET(oldroot->btree[ 0 ].before, ARCH_CONVERT); | 785 | child = be32_to_cpu(oldroot->btree[0].before); |
786 | ASSERT(child != 0); | 786 | ASSERT(child != 0); |
787 | error = xfs_da_read_buf(args->trans, args->dp, child, -1, &bp, | 787 | error = xfs_da_read_buf(args->trans, args->dp, child, -1, &bp, |
788 | args->whichfork); | 788 | args->whichfork); |
@@ -974,14 +974,14 @@ xfs_da_fixhashpath(xfs_da_state_t *state, xfs_da_state_path_t *path) | |||
974 | node = blk->bp->data; | 974 | node = blk->bp->data; |
975 | ASSERT(be16_to_cpu(node->hdr.info.magic) == XFS_DA_NODE_MAGIC); | 975 | ASSERT(be16_to_cpu(node->hdr.info.magic) == XFS_DA_NODE_MAGIC); |
976 | btree = &node->btree[ blk->index ]; | 976 | btree = &node->btree[ blk->index ]; |
977 | if (INT_GET(btree->hashval, ARCH_CONVERT) == lasthash) | 977 | if (be32_to_cpu(btree->hashval) == lasthash) |
978 | break; | 978 | break; |
979 | blk->hashval = lasthash; | 979 | blk->hashval = lasthash; |
980 | INT_SET(btree->hashval, ARCH_CONVERT, lasthash); | 980 | btree->hashval = cpu_to_be32(lasthash); |
981 | xfs_da_log_buf(state->args->trans, blk->bp, | 981 | xfs_da_log_buf(state->args->trans, blk->bp, |
982 | XFS_DA_LOGRANGE(node, btree, sizeof(*btree))); | 982 | XFS_DA_LOGRANGE(node, btree, sizeof(*btree))); |
983 | 983 | ||
984 | lasthash = INT_GET(node->btree[ INT_GET(node->hdr.count, ARCH_CONVERT)-1 ].hashval, ARCH_CONVERT); | 984 | lasthash = be32_to_cpu(node->btree[ INT_GET(node->hdr.count, ARCH_CONVERT)-1 ].hashval); |
985 | } | 985 | } |
986 | } | 986 | } |
987 | 987 | ||
@@ -1022,7 +1022,7 @@ xfs_da_node_remove(xfs_da_state_t *state, xfs_da_state_blk_t *drop_blk) | |||
1022 | * Copy the last hash value from the block to propagate upwards. | 1022 | * Copy the last hash value from the block to propagate upwards. |
1023 | */ | 1023 | */ |
1024 | btree--; | 1024 | btree--; |
1025 | drop_blk->hashval = INT_GET(btree->hashval, ARCH_CONVERT); | 1025 | drop_blk->hashval = be32_to_cpu(btree->hashval); |
1026 | } | 1026 | } |
1027 | 1027 | ||
1028 | /* | 1028 | /* |
@@ -1048,9 +1048,9 @@ xfs_da_node_unbalance(xfs_da_state_t *state, xfs_da_state_blk_t *drop_blk, | |||
1048 | * If the dying block has lower hashvals, then move all the | 1048 | * If the dying block has lower hashvals, then move all the |
1049 | * elements in the remaining block up to make a hole. | 1049 | * elements in the remaining block up to make a hole. |
1050 | */ | 1050 | */ |
1051 | if ((INT_GET(drop_node->btree[ 0 ].hashval, ARCH_CONVERT) < INT_GET(save_node->btree[ 0 ].hashval, ARCH_CONVERT)) || | 1051 | if ((be32_to_cpu(drop_node->btree[0].hashval) < be32_to_cpu(save_node->btree[ 0 ].hashval)) || |
1052 | (INT_GET(drop_node->btree[ INT_GET(drop_node->hdr.count, ARCH_CONVERT)-1 ].hashval, ARCH_CONVERT) < | 1052 | (be32_to_cpu(drop_node->btree[INT_GET(drop_node->hdr.count, ARCH_CONVERT)-1].hashval) < |
1053 | INT_GET(save_node->btree[ INT_GET(save_node->hdr.count, ARCH_CONVERT)-1 ].hashval, ARCH_CONVERT))) | 1053 | be32_to_cpu(save_node->btree[INT_GET(save_node->hdr.count, ARCH_CONVERT)-1 ].hashval))) |
1054 | { | 1054 | { |
1055 | btree = &save_node->btree[ INT_GET(drop_node->hdr.count, ARCH_CONVERT) ]; | 1055 | btree = &save_node->btree[ INT_GET(drop_node->hdr.count, ARCH_CONVERT) ]; |
1056 | tmp = INT_GET(save_node->hdr.count, ARCH_CONVERT) * (uint)sizeof(xfs_da_node_entry_t); | 1056 | tmp = INT_GET(save_node->hdr.count, ARCH_CONVERT) * (uint)sizeof(xfs_da_node_entry_t); |
@@ -1082,7 +1082,7 @@ xfs_da_node_unbalance(xfs_da_state_t *state, xfs_da_state_blk_t *drop_blk, | |||
1082 | /* | 1082 | /* |
1083 | * Save the last hashval in the remaining block for upward propagation. | 1083 | * Save the last hashval in the remaining block for upward propagation. |
1084 | */ | 1084 | */ |
1085 | save_blk->hashval = INT_GET(save_node->btree[ INT_GET(save_node->hdr.count, ARCH_CONVERT)-1 ].hashval, ARCH_CONVERT); | 1085 | save_blk->hashval = be32_to_cpu(save_node->btree[ INT_GET(save_node->hdr.count, ARCH_CONVERT)-1 ].hashval); |
1086 | } | 1086 | } |
1087 | 1087 | ||
1088 | /*======================================================================== | 1088 | /*======================================================================== |
@@ -1147,7 +1147,7 @@ xfs_da_node_lookup_int(xfs_da_state_t *state, int *result) | |||
1147 | blk->magic = be16_to_cpu(curr->magic); | 1147 | blk->magic = be16_to_cpu(curr->magic); |
1148 | if (blk->magic == XFS_DA_NODE_MAGIC) { | 1148 | if (blk->magic == XFS_DA_NODE_MAGIC) { |
1149 | node = blk->bp->data; | 1149 | node = blk->bp->data; |
1150 | blk->hashval = INT_GET(node->btree[ INT_GET(node->hdr.count, ARCH_CONVERT)-1 ].hashval, ARCH_CONVERT); | 1150 | blk->hashval = be32_to_cpu(node->btree[INT_GET(node->hdr.count, ARCH_CONVERT)-1].hashval); |
1151 | 1151 | ||
1152 | /* | 1152 | /* |
1153 | * Binary search. (note: small blocks will skip loop) | 1153 | * Binary search. (note: small blocks will skip loop) |
@@ -1158,25 +1158,25 @@ xfs_da_node_lookup_int(xfs_da_state_t *state, int *result) | |||
1158 | for (btree = &node->btree[probe]; span > 4; | 1158 | for (btree = &node->btree[probe]; span > 4; |
1159 | btree = &node->btree[probe]) { | 1159 | btree = &node->btree[probe]) { |
1160 | span /= 2; | 1160 | span /= 2; |
1161 | if (INT_GET(btree->hashval, ARCH_CONVERT) < hashval) | 1161 | if (be32_to_cpu(btree->hashval) < hashval) |
1162 | probe += span; | 1162 | probe += span; |
1163 | else if (INT_GET(btree->hashval, ARCH_CONVERT) > hashval) | 1163 | else if (be32_to_cpu(btree->hashval) > hashval) |
1164 | probe -= span; | 1164 | probe -= span; |
1165 | else | 1165 | else |
1166 | break; | 1166 | break; |
1167 | } | 1167 | } |
1168 | ASSERT((probe >= 0) && (probe < max)); | 1168 | ASSERT((probe >= 0) && (probe < max)); |
1169 | ASSERT((span <= 4) || (INT_GET(btree->hashval, ARCH_CONVERT) == hashval)); | 1169 | ASSERT((span <= 4) || (be32_to_cpu(btree->hashval) == hashval)); |
1170 | 1170 | ||
1171 | /* | 1171 | /* |
1172 | * Since we may have duplicate hashval's, find the first | 1172 | * Since we may have duplicate hashval's, find the first |
1173 | * matching hashval in the node. | 1173 | * matching hashval in the node. |
1174 | */ | 1174 | */ |
1175 | while ((probe > 0) && (INT_GET(btree->hashval, ARCH_CONVERT) >= hashval)) { | 1175 | while ((probe > 0) && (be32_to_cpu(btree->hashval) >= hashval)) { |
1176 | btree--; | 1176 | btree--; |
1177 | probe--; | 1177 | probe--; |
1178 | } | 1178 | } |
1179 | while ((probe < max) && (INT_GET(btree->hashval, ARCH_CONVERT) < hashval)) { | 1179 | while ((probe < max) && (be32_to_cpu(btree->hashval) < hashval)) { |
1180 | btree++; | 1180 | btree++; |
1181 | probe++; | 1181 | probe++; |
1182 | } | 1182 | } |
@@ -1186,10 +1186,10 @@ xfs_da_node_lookup_int(xfs_da_state_t *state, int *result) | |||
1186 | */ | 1186 | */ |
1187 | if (probe == max) { | 1187 | if (probe == max) { |
1188 | blk->index = max-1; | 1188 | blk->index = max-1; |
1189 | blkno = INT_GET(node->btree[ max-1 ].before, ARCH_CONVERT); | 1189 | blkno = be32_to_cpu(node->btree[max-1].before); |
1190 | } else { | 1190 | } else { |
1191 | blk->index = probe; | 1191 | blk->index = probe; |
1192 | blkno = INT_GET(btree->before, ARCH_CONVERT); | 1192 | blkno = be32_to_cpu(btree->before); |
1193 | } | 1193 | } |
1194 | } | 1194 | } |
1195 | else if (be16_to_cpu(curr->magic) == XFS_ATTR_LEAF_MAGIC) { | 1195 | else if (be16_to_cpu(curr->magic) == XFS_ATTR_LEAF_MAGIC) { |
@@ -1359,10 +1359,10 @@ xfs_da_node_order(xfs_dabuf_t *node1_bp, xfs_dabuf_t *node2_bp) | |||
1359 | ASSERT((be16_to_cpu(node1->hdr.info.magic) == XFS_DA_NODE_MAGIC) && | 1359 | ASSERT((be16_to_cpu(node1->hdr.info.magic) == XFS_DA_NODE_MAGIC) && |
1360 | (be16_to_cpu(node2->hdr.info.magic) == XFS_DA_NODE_MAGIC)); | 1360 | (be16_to_cpu(node2->hdr.info.magic) == XFS_DA_NODE_MAGIC)); |
1361 | 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) && |
1362 | ((INT_GET(node2->btree[ 0 ].hashval, ARCH_CONVERT) < | 1362 | ((be32_to_cpu(node2->btree[0].hashval) < |
1363 | INT_GET(node1->btree[ 0 ].hashval, ARCH_CONVERT)) || | 1363 | be32_to_cpu(node1->btree[0].hashval)) || |
1364 | (INT_GET(node2->btree[ INT_GET(node2->hdr.count, ARCH_CONVERT)-1 ].hashval, ARCH_CONVERT) < | 1364 | (be32_to_cpu(node2->btree[INT_GET(node2->hdr.count, ARCH_CONVERT)-1].hashval) < |
1365 | INT_GET(node1->btree[ INT_GET(node1->hdr.count, ARCH_CONVERT)-1 ].hashval, ARCH_CONVERT)))) { | 1365 | be32_to_cpu(node1->btree[INT_GET(node1->hdr.count, ARCH_CONVERT)-1].hashval)))) { |
1366 | return(1); | 1366 | return(1); |
1367 | } | 1367 | } |
1368 | return(0); | 1368 | return(0); |
@@ -1382,7 +1382,7 @@ xfs_da_node_lasthash(xfs_dabuf_t *bp, int *count) | |||
1382 | *count = INT_GET(node->hdr.count, ARCH_CONVERT); | 1382 | *count = INT_GET(node->hdr.count, ARCH_CONVERT); |
1383 | if (!node->hdr.count) | 1383 | if (!node->hdr.count) |
1384 | return(0); | 1384 | return(0); |
1385 | return(INT_GET(node->btree[ INT_GET(node->hdr.count, ARCH_CONVERT)-1 ].hashval, ARCH_CONVERT)); | 1385 | return be32_to_cpu(node->btree[INT_GET(node->hdr.count, ARCH_CONVERT)-1].hashval); |
1386 | } | 1386 | } |
1387 | 1387 | ||
1388 | /* | 1388 | /* |
@@ -1493,11 +1493,11 @@ xfs_da_path_shift(xfs_da_state_t *state, xfs_da_state_path_t *path, | |||
1493 | ASSERT(be16_to_cpu(node->hdr.info.magic) == XFS_DA_NODE_MAGIC); | 1493 | ASSERT(be16_to_cpu(node->hdr.info.magic) == XFS_DA_NODE_MAGIC); |
1494 | 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)) { |
1495 | blk->index++; | 1495 | blk->index++; |
1496 | blkno = INT_GET(node->btree[ blk->index ].before, ARCH_CONVERT); | 1496 | blkno = be32_to_cpu(node->btree[blk->index].before); |
1497 | break; | 1497 | break; |
1498 | } else if (!forward && (blk->index > 0)) { | 1498 | } else if (!forward && (blk->index > 0)) { |
1499 | blk->index--; | 1499 | blk->index--; |
1500 | blkno = INT_GET(node->btree[ blk->index ].before, ARCH_CONVERT); | 1500 | blkno = be32_to_cpu(node->btree[blk->index].before); |
1501 | break; | 1501 | break; |
1502 | } | 1502 | } |
1503 | } | 1503 | } |
@@ -1535,12 +1535,12 @@ xfs_da_path_shift(xfs_da_state_t *state, xfs_da_state_path_t *path, | |||
1535 | blk->magic = be16_to_cpu(info->magic); | 1535 | blk->magic = be16_to_cpu(info->magic); |
1536 | if (blk->magic == XFS_DA_NODE_MAGIC) { | 1536 | if (blk->magic == XFS_DA_NODE_MAGIC) { |
1537 | node = (xfs_da_intnode_t *)info; | 1537 | node = (xfs_da_intnode_t *)info; |
1538 | blk->hashval = INT_GET(node->btree[ INT_GET(node->hdr.count, ARCH_CONVERT)-1 ].hashval, ARCH_CONVERT); | 1538 | blk->hashval = be32_to_cpu(node->btree[INT_GET(node->hdr.count, ARCH_CONVERT)-1].hashval); |
1539 | if (forward) | 1539 | if (forward) |
1540 | blk->index = 0; | 1540 | blk->index = 0; |
1541 | else | 1541 | else |
1542 | blk->index = INT_GET(node->hdr.count, ARCH_CONVERT)-1; | 1542 | blk->index = INT_GET(node->hdr.count, ARCH_CONVERT)-1; |
1543 | blkno = INT_GET(node->btree[ blk->index ].before, ARCH_CONVERT); | 1543 | blkno = be32_to_cpu(node->btree[blk->index].before); |
1544 | } else { | 1544 | } else { |
1545 | ASSERT(level == path->active-1); | 1545 | ASSERT(level == path->active-1); |
1546 | blk->index = 0; | 1546 | blk->index = 0; |
@@ -1796,7 +1796,7 @@ xfs_da_swap_lastblock(xfs_da_args_t *args, xfs_dablk_t *dead_blknop, | |||
1796 | ASSERT(be16_to_cpu(dead_info->magic) == XFS_DA_NODE_MAGIC); | 1796 | ASSERT(be16_to_cpu(dead_info->magic) == XFS_DA_NODE_MAGIC); |
1797 | dead_node = (xfs_da_intnode_t *)dead_info; | 1797 | dead_node = (xfs_da_intnode_t *)dead_info; |
1798 | dead_level = INT_GET(dead_node->hdr.level, ARCH_CONVERT); | 1798 | dead_level = INT_GET(dead_node->hdr.level, ARCH_CONVERT); |
1799 | dead_hash = INT_GET(dead_node->btree[INT_GET(dead_node->hdr.count, ARCH_CONVERT) - 1].hashval, ARCH_CONVERT); | 1799 | dead_hash = be32_to_cpu(dead_node->btree[INT_GET(dead_node->hdr.count, ARCH_CONVERT) - 1].hashval); |
1800 | } | 1800 | } |
1801 | sib_buf = par_buf = NULL; | 1801 | sib_buf = par_buf = NULL; |
1802 | /* | 1802 | /* |
@@ -1863,7 +1863,7 @@ xfs_da_swap_lastblock(xfs_da_args_t *args, xfs_dablk_t *dead_blknop, | |||
1863 | level = INT_GET(par_node->hdr.level, ARCH_CONVERT); | 1863 | level = INT_GET(par_node->hdr.level, ARCH_CONVERT); |
1864 | for (entno = 0; | 1864 | for (entno = 0; |
1865 | entno < INT_GET(par_node->hdr.count, ARCH_CONVERT) && | 1865 | entno < INT_GET(par_node->hdr.count, ARCH_CONVERT) && |
1866 | INT_GET(par_node->btree[entno].hashval, ARCH_CONVERT) < dead_hash; | 1866 | be32_to_cpu(par_node->btree[entno].hashval) < dead_hash; |
1867 | entno++) | 1867 | entno++) |
1868 | continue; | 1868 | continue; |
1869 | if (unlikely(entno == INT_GET(par_node->hdr.count, ARCH_CONVERT))) { | 1869 | if (unlikely(entno == INT_GET(par_node->hdr.count, ARCH_CONVERT))) { |
@@ -1872,7 +1872,7 @@ xfs_da_swap_lastblock(xfs_da_args_t *args, xfs_dablk_t *dead_blknop, | |||
1872 | error = XFS_ERROR(EFSCORRUPTED); | 1872 | error = XFS_ERROR(EFSCORRUPTED); |
1873 | goto done; | 1873 | goto done; |
1874 | } | 1874 | } |
1875 | par_blkno = INT_GET(par_node->btree[entno].before, ARCH_CONVERT); | 1875 | par_blkno = be32_to_cpu(par_node->btree[entno].before); |
1876 | if (level == dead_level + 1) | 1876 | if (level == dead_level + 1) |
1877 | break; | 1877 | break; |
1878 | xfs_da_brelse(tp, par_buf); | 1878 | xfs_da_brelse(tp, par_buf); |
@@ -1885,7 +1885,7 @@ xfs_da_swap_lastblock(xfs_da_args_t *args, xfs_dablk_t *dead_blknop, | |||
1885 | for (;;) { | 1885 | for (;;) { |
1886 | for (; | 1886 | for (; |
1887 | entno < INT_GET(par_node->hdr.count, ARCH_CONVERT) && | 1887 | entno < INT_GET(par_node->hdr.count, ARCH_CONVERT) && |
1888 | INT_GET(par_node->btree[entno].before, ARCH_CONVERT) != last_blkno; | 1888 | be32_to_cpu(par_node->btree[entno].before) != last_blkno; |
1889 | entno++) | 1889 | entno++) |
1890 | continue; | 1890 | continue; |
1891 | if (entno < INT_GET(par_node->hdr.count, ARCH_CONVERT)) | 1891 | if (entno < INT_GET(par_node->hdr.count, ARCH_CONVERT)) |
@@ -1915,7 +1915,7 @@ xfs_da_swap_lastblock(xfs_da_args_t *args, xfs_dablk_t *dead_blknop, | |||
1915 | /* | 1915 | /* |
1916 | * Update the parent entry pointing to the moved block. | 1916 | * Update the parent entry pointing to the moved block. |
1917 | */ | 1917 | */ |
1918 | INT_SET(par_node->btree[entno].before, ARCH_CONVERT, dead_blkno); | 1918 | par_node->btree[entno].before = cpu_to_be32(dead_blkno); |
1919 | xfs_da_log_buf(tp, par_buf, | 1919 | xfs_da_log_buf(tp, par_buf, |
1920 | XFS_DA_LOGRANGE(par_node, &par_node->btree[entno].before, | 1920 | XFS_DA_LOGRANGE(par_node, &par_node->btree[entno].before, |
1921 | sizeof(par_node->btree[entno].before))); | 1921 | sizeof(par_node->btree[entno].before))); |
diff --git a/fs/xfs/xfs_da_btree.h b/fs/xfs/xfs_da_btree.h index e727bf456a12..6343c3a4dbae 100644 --- a/fs/xfs/xfs_da_btree.h +++ b/fs/xfs/xfs_da_btree.h | |||
@@ -69,8 +69,8 @@ typedef struct xfs_da_intnode { | |||
69 | __uint16_t level; /* level above leaves (leaf == 0) */ | 69 | __uint16_t level; /* level above leaves (leaf == 0) */ |
70 | } hdr; | 70 | } hdr; |
71 | struct xfs_da_node_entry { | 71 | struct xfs_da_node_entry { |
72 | xfs_dahash_t hashval; /* hash value for this descendant */ | 72 | __be32 hashval; /* hash value for this descendant */ |
73 | xfs_dablk_t before; /* Btree block before this key */ | 73 | __be32 before; /* Btree block before this key */ |
74 | } btree[1]; /* variable sized array of keys */ | 74 | } btree[1]; /* variable sized array of keys */ |
75 | } xfs_da_intnode_t; | 75 | } xfs_da_intnode_t; |
76 | typedef struct xfs_da_node_hdr xfs_da_node_hdr_t; | 76 | typedef struct xfs_da_node_hdr xfs_da_node_hdr_t; |
diff --git a/fs/xfs/xfs_dir.c b/fs/xfs/xfs_dir.c index 7a708e993db6..8d1975a541b1 100644 --- a/fs/xfs/xfs_dir.c +++ b/fs/xfs/xfs_dir.c | |||
@@ -954,8 +954,8 @@ xfs_dir_node_getdents(xfs_trans_t *trans, xfs_inode_t *dp, uio_t *uio, | |||
954 | btree = &node->btree[0]; | 954 | btree = &node->btree[0]; |
955 | xfs_dir_trace_g_dun("node: node detail", dp, uio, node); | 955 | xfs_dir_trace_g_dun("node: node detail", dp, uio, node); |
956 | for (i = 0; i < INT_GET(node->hdr.count, ARCH_CONVERT); btree++, i++) { | 956 | for (i = 0; i < INT_GET(node->hdr.count, ARCH_CONVERT); btree++, i++) { |
957 | if (INT_GET(btree->hashval, ARCH_CONVERT) >= cookhash) { | 957 | if (be32_to_cpu(btree->hashval) >= cookhash) { |
958 | bno = INT_GET(btree->before, ARCH_CONVERT); | 958 | bno = be32_to_cpu(btree->before); |
959 | break; | 959 | break; |
960 | } | 960 | } |
961 | } | 961 | } |
@@ -1129,9 +1129,9 @@ xfs_dir_trace_g_dun(char *where, xfs_inode_t *dp, uio_t *uio, | |||
1129 | (void *)(unsigned long) | 1129 | (void *)(unsigned long) |
1130 | INT_GET(node->hdr.count, ARCH_CONVERT), | 1130 | INT_GET(node->hdr.count, ARCH_CONVERT), |
1131 | (void *)(unsigned long) | 1131 | (void *)(unsigned long) |
1132 | INT_GET(node->btree[0].hashval, ARCH_CONVERT), | 1132 | be32_to_cpu(node->btree[0].hashval), |
1133 | (void *)(unsigned long) | 1133 | (void *)(unsigned long) |
1134 | INT_GET(node->btree[last].hashval, ARCH_CONVERT), | 1134 | be32_to_cpu(node->btree[last].hashval), |
1135 | NULL, NULL, NULL); | 1135 | NULL, NULL, NULL); |
1136 | } | 1136 | } |
1137 | 1137 | ||
diff --git a/fs/xfs/xfs_dir_leaf.c b/fs/xfs/xfs_dir_leaf.c index 0b2eca590b36..3c58834fa6a7 100644 --- a/fs/xfs/xfs_dir_leaf.c +++ b/fs/xfs/xfs_dir_leaf.c | |||
@@ -745,7 +745,7 @@ xfs_dir_leaf_to_node(xfs_da_args_t *args) | |||
745 | ASSERT(be16_to_cpu(leaf->hdr.info.magic) == XFS_DIR_LEAF_MAGIC); | 745 | ASSERT(be16_to_cpu(leaf->hdr.info.magic) == XFS_DIR_LEAF_MAGIC); |
746 | INT_SET(node->btree[0].hashval, ARCH_CONVERT, INT_GET(leaf->entries[ INT_GET(leaf->hdr.count, ARCH_CONVERT)-1 ].hashval, ARCH_CONVERT)); | 746 | INT_SET(node->btree[0].hashval, ARCH_CONVERT, INT_GET(leaf->entries[ INT_GET(leaf->hdr.count, ARCH_CONVERT)-1 ].hashval, ARCH_CONVERT)); |
747 | xfs_da_buf_done(bp2); | 747 | xfs_da_buf_done(bp2); |
748 | INT_SET(node->btree[0].before, ARCH_CONVERT, blkno); | 748 | node->btree[0].before = cpu_to_be32(blkno); |
749 | INT_SET(node->hdr.count, ARCH_CONVERT, 1); | 749 | INT_SET(node->hdr.count, ARCH_CONVERT, 1); |
750 | xfs_da_log_buf(args->trans, bp1, | 750 | xfs_da_log_buf(args->trans, bp1, |
751 | XFS_DA_LOGRANGE(node, &node->btree[0], sizeof(node->btree[0]))); | 751 | XFS_DA_LOGRANGE(node, &node->btree[0], sizeof(node->btree[0]))); |