diff options
Diffstat (limited to 'fs/xfs/xfs_dir.c')
-rw-r--r-- | fs/xfs/xfs_dir.c | 32 |
1 files changed, 15 insertions, 17 deletions
diff --git a/fs/xfs/xfs_dir.c b/fs/xfs/xfs_dir.c index bb87d2a700a9..9cc702a839a3 100644 --- a/fs/xfs/xfs_dir.c +++ b/fs/xfs/xfs_dir.c | |||
@@ -634,7 +634,7 @@ xfs_dir_leaf_removename(xfs_da_args_t *args, int *count, int *totallen) | |||
634 | return(retval); | 634 | return(retval); |
635 | ASSERT(bp != NULL); | 635 | ASSERT(bp != NULL); |
636 | leaf = bp->data; | 636 | leaf = bp->data; |
637 | ASSERT(INT_GET(leaf->hdr.info.magic, ARCH_CONVERT) == XFS_DIR_LEAF_MAGIC); | 637 | ASSERT(be16_to_cpu(leaf->hdr.info.magic) == XFS_DIR_LEAF_MAGIC); |
638 | retval = xfs_dir_leaf_lookup_int(bp, args, &index); | 638 | retval = xfs_dir_leaf_lookup_int(bp, args, &index); |
639 | if (retval == EEXIST) { | 639 | if (retval == EEXIST) { |
640 | (void)xfs_dir_leaf_remove(args->trans, bp, index); | 640 | (void)xfs_dir_leaf_remove(args->trans, bp, index); |
@@ -912,7 +912,7 @@ xfs_dir_node_getdents(xfs_trans_t *trans, xfs_inode_t *dp, uio_t *uio, | |||
912 | return(error); | 912 | return(error); |
913 | if (bp) | 913 | if (bp) |
914 | leaf = bp->data; | 914 | leaf = bp->data; |
915 | if (bp && INT_GET(leaf->hdr.info.magic, ARCH_CONVERT) != XFS_DIR_LEAF_MAGIC) { | 915 | if (bp && be16_to_cpu(leaf->hdr.info.magic) != XFS_DIR_LEAF_MAGIC) { |
916 | xfs_dir_trace_g_dub("node: block not a leaf", | 916 | xfs_dir_trace_g_dub("node: block not a leaf", |
917 | dp, uio, bno); | 917 | dp, uio, bno); |
918 | xfs_da_brelse(trans, bp); | 918 | xfs_da_brelse(trans, bp); |
@@ -949,17 +949,17 @@ xfs_dir_node_getdents(xfs_trans_t *trans, xfs_inode_t *dp, uio_t *uio, | |||
949 | if (bp == NULL) | 949 | if (bp == NULL) |
950 | return(XFS_ERROR(EFSCORRUPTED)); | 950 | return(XFS_ERROR(EFSCORRUPTED)); |
951 | node = bp->data; | 951 | node = bp->data; |
952 | if (INT_GET(node->hdr.info.magic, ARCH_CONVERT) != XFS_DA_NODE_MAGIC) | 952 | if (be16_to_cpu(node->hdr.info.magic) != XFS_DA_NODE_MAGIC) |
953 | break; | 953 | break; |
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 < be16_to_cpu(node->hdr.count); 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 | } |
962 | if (i == INT_GET(node->hdr.count, ARCH_CONVERT)) { | 962 | if (i == be16_to_cpu(node->hdr.count)) { |
963 | xfs_da_brelse(trans, bp); | 963 | xfs_da_brelse(trans, bp); |
964 | xfs_dir_trace_g_du("node: hash beyond EOF", | 964 | xfs_dir_trace_g_du("node: hash beyond EOF", |
965 | dp, uio); | 965 | dp, uio); |
@@ -982,7 +982,7 @@ xfs_dir_node_getdents(xfs_trans_t *trans, xfs_inode_t *dp, uio_t *uio, | |||
982 | */ | 982 | */ |
983 | for (;;) { | 983 | for (;;) { |
984 | leaf = bp->data; | 984 | leaf = bp->data; |
985 | if (unlikely(INT_GET(leaf->hdr.info.magic, ARCH_CONVERT) != XFS_DIR_LEAF_MAGIC)) { | 985 | if (unlikely(be16_to_cpu(leaf->hdr.info.magic) != XFS_DIR_LEAF_MAGIC)) { |
986 | xfs_dir_trace_g_dul("node: not a leaf", dp, uio, leaf); | 986 | xfs_dir_trace_g_dul("node: not a leaf", dp, uio, leaf); |
987 | xfs_da_brelse(trans, bp); | 987 | xfs_da_brelse(trans, bp); |
988 | XFS_CORRUPTION_ERROR("xfs_dir_node_getdents(1)", | 988 | XFS_CORRUPTION_ERROR("xfs_dir_node_getdents(1)", |
@@ -990,7 +990,7 @@ xfs_dir_node_getdents(xfs_trans_t *trans, xfs_inode_t *dp, uio_t *uio, | |||
990 | return XFS_ERROR(EFSCORRUPTED); | 990 | return XFS_ERROR(EFSCORRUPTED); |
991 | } | 991 | } |
992 | xfs_dir_trace_g_dul("node: leaf detail", dp, uio, leaf); | 992 | xfs_dir_trace_g_dul("node: leaf detail", dp, uio, leaf); |
993 | if ((nextbno = INT_GET(leaf->hdr.info.forw, ARCH_CONVERT))) { | 993 | if ((nextbno = be32_to_cpu(leaf->hdr.info.forw))) { |
994 | nextda = xfs_da_reada_buf(trans, dp, nextbno, | 994 | nextda = xfs_da_reada_buf(trans, dp, nextbno, |
995 | XFS_DATA_FORK); | 995 | XFS_DATA_FORK); |
996 | } else | 996 | } else |
@@ -1118,21 +1118,20 @@ void | |||
1118 | xfs_dir_trace_g_dun(char *where, xfs_inode_t *dp, uio_t *uio, | 1118 | xfs_dir_trace_g_dun(char *where, xfs_inode_t *dp, uio_t *uio, |
1119 | xfs_da_intnode_t *node) | 1119 | xfs_da_intnode_t *node) |
1120 | { | 1120 | { |
1121 | int last = INT_GET(node->hdr.count, ARCH_CONVERT) - 1; | 1121 | int last = be16_to_cpu(node->hdr.count) - 1; |
1122 | 1122 | ||
1123 | xfs_dir_trace_enter(XFS_DIR_KTRACE_G_DUN, where, | 1123 | xfs_dir_trace_enter(XFS_DIR_KTRACE_G_DUN, where, |
1124 | (void *)dp, (void *)dp->i_mount, | 1124 | (void *)dp, (void *)dp->i_mount, |
1125 | (void *)((unsigned long)(uio->uio_offset >> 32)), | 1125 | (void *)((unsigned long)(uio->uio_offset >> 32)), |
1126 | (void *)((unsigned long)(uio->uio_offset & 0xFFFFFFFF)), | 1126 | (void *)((unsigned long)(uio->uio_offset & 0xFFFFFFFF)), |
1127 | (void *)(unsigned long)uio->uio_resid, | 1127 | (void *)(unsigned long)uio->uio_resid, |
1128 | (void *)(unsigned long)be32_to_cpu(node->hdr.info.forw), | ||
1128 | (void *)(unsigned long) | 1129 | (void *)(unsigned long) |
1129 | INT_GET(node->hdr.info.forw, ARCH_CONVERT), | 1130 | be16_to_cpu(node->hdr.count), |
1130 | (void *)(unsigned long) | 1131 | (void *)(unsigned long) |
1131 | INT_GET(node->hdr.count, ARCH_CONVERT), | 1132 | be32_to_cpu(node->btree[0].hashval), |
1132 | (void *)(unsigned long) | 1133 | (void *)(unsigned long) |
1133 | INT_GET(node->btree[0].hashval, ARCH_CONVERT), | 1134 | be32_to_cpu(node->btree[last].hashval), |
1134 | (void *)(unsigned long) | ||
1135 | INT_GET(node->btree[last].hashval, ARCH_CONVERT), | ||
1136 | NULL, NULL, NULL); | 1135 | NULL, NULL, NULL); |
1137 | } | 1136 | } |
1138 | 1137 | ||
@@ -1150,8 +1149,7 @@ xfs_dir_trace_g_dul(char *where, xfs_inode_t *dp, uio_t *uio, | |||
1150 | (void *)((unsigned long)(uio->uio_offset >> 32)), | 1149 | (void *)((unsigned long)(uio->uio_offset >> 32)), |
1151 | (void *)((unsigned long)(uio->uio_offset & 0xFFFFFFFF)), | 1150 | (void *)((unsigned long)(uio->uio_offset & 0xFFFFFFFF)), |
1152 | (void *)(unsigned long)uio->uio_resid, | 1151 | (void *)(unsigned long)uio->uio_resid, |
1153 | (void *)(unsigned long) | 1152 | (void *)(unsigned long)be32_to_cpu(leaf->hdr.info.forw), |
1154 | INT_GET(leaf->hdr.info.forw, ARCH_CONVERT), | ||
1155 | (void *)(unsigned long) | 1153 | (void *)(unsigned long) |
1156 | INT_GET(leaf->hdr.count, ARCH_CONVERT), | 1154 | INT_GET(leaf->hdr.count, ARCH_CONVERT), |
1157 | (void *)(unsigned long) | 1155 | (void *)(unsigned long) |