diff options
-rw-r--r-- | fs/xfs/xfs_alloc.c | 2 | ||||
-rw-r--r-- | fs/xfs/xfs_attr.c | 19 | ||||
-rw-r--r-- | fs/xfs/xfs_attr_leaf.c | 60 | ||||
-rw-r--r-- | fs/xfs/xfs_bmap.c | 2 | ||||
-rw-r--r-- | fs/xfs/xfs_bmap_btree.c | 8 | ||||
-rw-r--r-- | fs/xfs/xfs_btree.c | 28 | ||||
-rw-r--r-- | fs/xfs/xfs_da_btree.c | 58 | ||||
-rw-r--r-- | fs/xfs/xfs_dir2_block.c | 18 | ||||
-rw-r--r-- | fs/xfs/xfs_dir2_data.c | 47 | ||||
-rw-r--r-- | fs/xfs/xfs_dir2_leaf.c | 59 | ||||
-rw-r--r-- | fs/xfs/xfs_dir2_node.c | 53 | ||||
-rw-r--r-- | fs/xfs/xfs_ialloc.c | 14 | ||||
-rw-r--r-- | fs/xfs/xfs_inode.c | 13 | ||||
-rw-r--r-- | fs/xfs/xfs_log.c | 4 | ||||
-rw-r--r-- | fs/xfs/xfs_log_recover.c | 20 |
15 files changed, 208 insertions, 197 deletions
diff --git a/fs/xfs/xfs_alloc.c b/fs/xfs/xfs_alloc.c index 95862bbff56b..3ad3ab9f56cb 100644 --- a/fs/xfs/xfs_alloc.c +++ b/fs/xfs/xfs_alloc.c | |||
@@ -2127,7 +2127,7 @@ xfs_read_agf( | |||
2127 | * Validate the magic number of the agf block. | 2127 | * Validate the magic number of the agf block. |
2128 | */ | 2128 | */ |
2129 | agf_ok = | 2129 | agf_ok = |
2130 | be32_to_cpu(agf->agf_magicnum) == XFS_AGF_MAGIC && | 2130 | agf->agf_magicnum == cpu_to_be32(XFS_AGF_MAGIC) && |
2131 | XFS_AGF_GOOD_VERSION(be32_to_cpu(agf->agf_versionnum)) && | 2131 | XFS_AGF_GOOD_VERSION(be32_to_cpu(agf->agf_versionnum)) && |
2132 | be32_to_cpu(agf->agf_freeblks) <= be32_to_cpu(agf->agf_length) && | 2132 | be32_to_cpu(agf->agf_freeblks) <= be32_to_cpu(agf->agf_length) && |
2133 | be32_to_cpu(agf->agf_flfirst) < XFS_AGFL_SIZE(mp) && | 2133 | be32_to_cpu(agf->agf_flfirst) < XFS_AGFL_SIZE(mp) && |
diff --git a/fs/xfs/xfs_attr.c b/fs/xfs/xfs_attr.c index 795d5aac7042..cbae424fe1ba 100644 --- a/fs/xfs/xfs_attr.c +++ b/fs/xfs/xfs_attr.c | |||
@@ -1203,7 +1203,7 @@ xfs_attr_leaf_list(xfs_attr_list_context_t *context) | |||
1203 | return XFS_ERROR(error); | 1203 | return XFS_ERROR(error); |
1204 | ASSERT(bp != NULL); | 1204 | ASSERT(bp != NULL); |
1205 | leaf = bp->data; | 1205 | leaf = bp->data; |
1206 | if (unlikely(be16_to_cpu(leaf->hdr.info.magic) != XFS_ATTR_LEAF_MAGIC)) { | 1206 | if (unlikely(leaf->hdr.info.magic != cpu_to_be16(XFS_ATTR_LEAF_MAGIC))) { |
1207 | XFS_CORRUPTION_ERROR("xfs_attr_leaf_list", XFS_ERRLEVEL_LOW, | 1207 | XFS_CORRUPTION_ERROR("xfs_attr_leaf_list", XFS_ERRLEVEL_LOW, |
1208 | context->dp->i_mount, leaf); | 1208 | context->dp->i_mount, leaf); |
1209 | xfs_da_brelse(NULL, bp); | 1209 | xfs_da_brelse(NULL, bp); |
@@ -1610,9 +1610,8 @@ xfs_attr_node_removename(xfs_da_args_t *args) | |||
1610 | XFS_ATTR_FORK); | 1610 | XFS_ATTR_FORK); |
1611 | if (error) | 1611 | if (error) |
1612 | goto out; | 1612 | goto out; |
1613 | ASSERT(be16_to_cpu(((xfs_attr_leafblock_t *) | 1613 | ASSERT((((xfs_attr_leafblock_t *)bp->data)->hdr.info.magic) == |
1614 | bp->data)->hdr.info.magic) | 1614 | cpu_to_be16(XFS_ATTR_LEAF_MAGIC)); |
1615 | == XFS_ATTR_LEAF_MAGIC); | ||
1616 | 1615 | ||
1617 | if ((forkoff = xfs_attr_shortform_allfit(bp, dp))) { | 1616 | if ((forkoff = xfs_attr_shortform_allfit(bp, dp))) { |
1618 | xfs_bmap_init(args->flist, args->firstblock); | 1617 | xfs_bmap_init(args->flist, args->firstblock); |
@@ -1877,11 +1876,11 @@ xfs_attr_node_list(xfs_attr_list_context_t *context) | |||
1877 | return(XFS_ERROR(EFSCORRUPTED)); | 1876 | return(XFS_ERROR(EFSCORRUPTED)); |
1878 | } | 1877 | } |
1879 | node = bp->data; | 1878 | node = bp->data; |
1880 | if (be16_to_cpu(node->hdr.info.magic) | 1879 | if (node->hdr.info.magic == |
1881 | == XFS_ATTR_LEAF_MAGIC) | 1880 | cpu_to_be16(XFS_ATTR_LEAF_MAGIC)) |
1882 | break; | 1881 | break; |
1883 | if (unlikely(be16_to_cpu(node->hdr.info.magic) | 1882 | if (unlikely(node->hdr.info.magic != |
1884 | != XFS_DA_NODE_MAGIC)) { | 1883 | cpu_to_be16(XFS_DA_NODE_MAGIC))) { |
1885 | XFS_CORRUPTION_ERROR("xfs_attr_node_list(3)", | 1884 | XFS_CORRUPTION_ERROR("xfs_attr_node_list(3)", |
1886 | XFS_ERRLEVEL_LOW, | 1885 | XFS_ERRLEVEL_LOW, |
1887 | context->dp->i_mount, | 1886 | context->dp->i_mount, |
@@ -1916,8 +1915,8 @@ xfs_attr_node_list(xfs_attr_list_context_t *context) | |||
1916 | */ | 1915 | */ |
1917 | for (;;) { | 1916 | for (;;) { |
1918 | leaf = bp->data; | 1917 | leaf = bp->data; |
1919 | if (unlikely(be16_to_cpu(leaf->hdr.info.magic) | 1918 | if (unlikely(leaf->hdr.info.magic != |
1920 | != XFS_ATTR_LEAF_MAGIC)) { | 1919 | cpu_to_be16(XFS_ATTR_LEAF_MAGIC))) { |
1921 | XFS_CORRUPTION_ERROR("xfs_attr_node_list(4)", | 1920 | XFS_CORRUPTION_ERROR("xfs_attr_node_list(4)", |
1922 | XFS_ERRLEVEL_LOW, | 1921 | XFS_ERRLEVEL_LOW, |
1923 | context->dp->i_mount, leaf); | 1922 | context->dp->i_mount, leaf); |
diff --git a/fs/xfs/xfs_attr_leaf.c b/fs/xfs/xfs_attr_leaf.c index 71e90dc2aeb1..8fad9602542b 100644 --- a/fs/xfs/xfs_attr_leaf.c +++ b/fs/xfs/xfs_attr_leaf.c | |||
@@ -731,7 +731,7 @@ xfs_attr_shortform_allfit(xfs_dabuf_t *bp, xfs_inode_t *dp) | |||
731 | int bytes, i; | 731 | int bytes, i; |
732 | 732 | ||
733 | leaf = bp->data; | 733 | leaf = bp->data; |
734 | ASSERT(be16_to_cpu(leaf->hdr.info.magic) == XFS_ATTR_LEAF_MAGIC); | 734 | ASSERT(leaf->hdr.info.magic == cpu_to_be16(XFS_ATTR_LEAF_MAGIC)); |
735 | 735 | ||
736 | entry = &leaf->entries[0]; | 736 | entry = &leaf->entries[0]; |
737 | bytes = sizeof(struct xfs_attr_sf_hdr); | 737 | bytes = sizeof(struct xfs_attr_sf_hdr); |
@@ -777,7 +777,7 @@ xfs_attr_leaf_to_shortform(xfs_dabuf_t *bp, xfs_da_args_t *args, int forkoff) | |||
777 | ASSERT(bp != NULL); | 777 | ASSERT(bp != NULL); |
778 | memcpy(tmpbuffer, bp->data, XFS_LBSIZE(dp->i_mount)); | 778 | memcpy(tmpbuffer, bp->data, XFS_LBSIZE(dp->i_mount)); |
779 | leaf = (xfs_attr_leafblock_t *)tmpbuffer; | 779 | leaf = (xfs_attr_leafblock_t *)tmpbuffer; |
780 | ASSERT(be16_to_cpu(leaf->hdr.info.magic) == XFS_ATTR_LEAF_MAGIC); | 780 | ASSERT(leaf->hdr.info.magic == cpu_to_be16(XFS_ATTR_LEAF_MAGIC)); |
781 | memset(bp->data, 0, XFS_LBSIZE(dp->i_mount)); | 781 | memset(bp->data, 0, XFS_LBSIZE(dp->i_mount)); |
782 | 782 | ||
783 | /* | 783 | /* |
@@ -872,7 +872,7 @@ xfs_attr_leaf_to_node(xfs_da_args_t *args) | |||
872 | goto out; | 872 | goto out; |
873 | node = bp1->data; | 873 | node = bp1->data; |
874 | leaf = bp2->data; | 874 | leaf = bp2->data; |
875 | ASSERT(be16_to_cpu(leaf->hdr.info.magic) == XFS_ATTR_LEAF_MAGIC); | 875 | ASSERT(leaf->hdr.info.magic == cpu_to_be16(XFS_ATTR_LEAF_MAGIC)); |
876 | /* both on-disk, don't endian-flip twice */ | 876 | /* both on-disk, don't endian-flip twice */ |
877 | node->btree[0].hashval = | 877 | node->btree[0].hashval = |
878 | leaf->entries[be16_to_cpu(leaf->hdr.count)-1 ].hashval; | 878 | leaf->entries[be16_to_cpu(leaf->hdr.count)-1 ].hashval; |
@@ -997,7 +997,7 @@ xfs_attr_leaf_add(xfs_dabuf_t *bp, xfs_da_args_t *args) | |||
997 | int tablesize, entsize, sum, tmp, i; | 997 | int tablesize, entsize, sum, tmp, i; |
998 | 998 | ||
999 | leaf = bp->data; | 999 | leaf = bp->data; |
1000 | ASSERT(be16_to_cpu(leaf->hdr.info.magic) == XFS_ATTR_LEAF_MAGIC); | 1000 | ASSERT(leaf->hdr.info.magic == cpu_to_be16(XFS_ATTR_LEAF_MAGIC)); |
1001 | ASSERT((args->index >= 0) | 1001 | ASSERT((args->index >= 0) |
1002 | && (args->index <= be16_to_cpu(leaf->hdr.count))); | 1002 | && (args->index <= be16_to_cpu(leaf->hdr.count))); |
1003 | hdr = &leaf->hdr; | 1003 | hdr = &leaf->hdr; |
@@ -1070,7 +1070,7 @@ xfs_attr_leaf_add_work(xfs_dabuf_t *bp, xfs_da_args_t *args, int mapindex) | |||
1070 | int tmp, i; | 1070 | int tmp, i; |
1071 | 1071 | ||
1072 | leaf = bp->data; | 1072 | leaf = bp->data; |
1073 | ASSERT(be16_to_cpu(leaf->hdr.info.magic) == XFS_ATTR_LEAF_MAGIC); | 1073 | ASSERT(leaf->hdr.info.magic == cpu_to_be16(XFS_ATTR_LEAF_MAGIC)); |
1074 | hdr = &leaf->hdr; | 1074 | hdr = &leaf->hdr; |
1075 | ASSERT((mapindex >= 0) && (mapindex < XFS_ATTR_LEAF_MAPSIZE)); | 1075 | ASSERT((mapindex >= 0) && (mapindex < XFS_ATTR_LEAF_MAPSIZE)); |
1076 | ASSERT((args->index >= 0) && (args->index <= be16_to_cpu(hdr->count))); | 1076 | ASSERT((args->index >= 0) && (args->index <= be16_to_cpu(hdr->count))); |
@@ -1256,8 +1256,8 @@ xfs_attr_leaf_rebalance(xfs_da_state_t *state, xfs_da_state_blk_t *blk1, | |||
1256 | ASSERT(blk2->magic == XFS_ATTR_LEAF_MAGIC); | 1256 | ASSERT(blk2->magic == XFS_ATTR_LEAF_MAGIC); |
1257 | leaf1 = blk1->bp->data; | 1257 | leaf1 = blk1->bp->data; |
1258 | leaf2 = blk2->bp->data; | 1258 | leaf2 = blk2->bp->data; |
1259 | ASSERT(be16_to_cpu(leaf1->hdr.info.magic) == XFS_ATTR_LEAF_MAGIC); | 1259 | ASSERT(leaf1->hdr.info.magic == cpu_to_be16(XFS_ATTR_LEAF_MAGIC)); |
1260 | ASSERT(be16_to_cpu(leaf2->hdr.info.magic) == XFS_ATTR_LEAF_MAGIC); | 1260 | ASSERT(leaf2->hdr.info.magic == cpu_to_be16(XFS_ATTR_LEAF_MAGIC)); |
1261 | args = state->args; | 1261 | args = state->args; |
1262 | 1262 | ||
1263 | /* | 1263 | /* |
@@ -1533,7 +1533,7 @@ xfs_attr_leaf_toosmall(xfs_da_state_t *state, int *action) | |||
1533 | */ | 1533 | */ |
1534 | blk = &state->path.blk[ state->path.active-1 ]; | 1534 | blk = &state->path.blk[ state->path.active-1 ]; |
1535 | info = blk->bp->data; | 1535 | info = blk->bp->data; |
1536 | ASSERT(be16_to_cpu(info->magic) == XFS_ATTR_LEAF_MAGIC); | 1536 | ASSERT(info->magic == cpu_to_be16(XFS_ATTR_LEAF_MAGIC)); |
1537 | leaf = (xfs_attr_leafblock_t *)info; | 1537 | leaf = (xfs_attr_leafblock_t *)info; |
1538 | count = be16_to_cpu(leaf->hdr.count); | 1538 | count = be16_to_cpu(leaf->hdr.count); |
1539 | bytes = sizeof(xfs_attr_leaf_hdr_t) + | 1539 | bytes = sizeof(xfs_attr_leaf_hdr_t) + |
@@ -1596,7 +1596,7 @@ xfs_attr_leaf_toosmall(xfs_da_state_t *state, int *action) | |||
1596 | bytes = state->blocksize - (state->blocksize>>2); | 1596 | bytes = state->blocksize - (state->blocksize>>2); |
1597 | bytes -= be16_to_cpu(leaf->hdr.usedbytes); | 1597 | bytes -= be16_to_cpu(leaf->hdr.usedbytes); |
1598 | leaf = bp->data; | 1598 | leaf = bp->data; |
1599 | ASSERT(be16_to_cpu(leaf->hdr.info.magic) == XFS_ATTR_LEAF_MAGIC); | 1599 | ASSERT(leaf->hdr.info.magic == cpu_to_be16(XFS_ATTR_LEAF_MAGIC)); |
1600 | count += be16_to_cpu(leaf->hdr.count); | 1600 | count += be16_to_cpu(leaf->hdr.count); |
1601 | bytes -= be16_to_cpu(leaf->hdr.usedbytes); | 1601 | bytes -= be16_to_cpu(leaf->hdr.usedbytes); |
1602 | bytes -= count * sizeof(xfs_attr_leaf_entry_t); | 1602 | bytes -= count * sizeof(xfs_attr_leaf_entry_t); |
@@ -1650,7 +1650,7 @@ xfs_attr_leaf_remove(xfs_dabuf_t *bp, xfs_da_args_t *args) | |||
1650 | xfs_mount_t *mp; | 1650 | xfs_mount_t *mp; |
1651 | 1651 | ||
1652 | leaf = bp->data; | 1652 | leaf = bp->data; |
1653 | ASSERT(be16_to_cpu(leaf->hdr.info.magic) == XFS_ATTR_LEAF_MAGIC); | 1653 | ASSERT(leaf->hdr.info.magic == cpu_to_be16(XFS_ATTR_LEAF_MAGIC)); |
1654 | hdr = &leaf->hdr; | 1654 | hdr = &leaf->hdr; |
1655 | mp = args->trans->t_mountp; | 1655 | mp = args->trans->t_mountp; |
1656 | ASSERT((be16_to_cpu(hdr->count) > 0) | 1656 | ASSERT((be16_to_cpu(hdr->count) > 0) |
@@ -1813,8 +1813,8 @@ xfs_attr_leaf_unbalance(xfs_da_state_t *state, xfs_da_state_blk_t *drop_blk, | |||
1813 | ASSERT(save_blk->magic == XFS_ATTR_LEAF_MAGIC); | 1813 | ASSERT(save_blk->magic == XFS_ATTR_LEAF_MAGIC); |
1814 | drop_leaf = drop_blk->bp->data; | 1814 | drop_leaf = drop_blk->bp->data; |
1815 | save_leaf = save_blk->bp->data; | 1815 | save_leaf = save_blk->bp->data; |
1816 | ASSERT(be16_to_cpu(drop_leaf->hdr.info.magic) == XFS_ATTR_LEAF_MAGIC); | 1816 | ASSERT(drop_leaf->hdr.info.magic == cpu_to_be16(XFS_ATTR_LEAF_MAGIC)); |
1817 | ASSERT(be16_to_cpu(save_leaf->hdr.info.magic) == XFS_ATTR_LEAF_MAGIC); | 1817 | ASSERT(save_leaf->hdr.info.magic == cpu_to_be16(XFS_ATTR_LEAF_MAGIC)); |
1818 | drop_hdr = &drop_leaf->hdr; | 1818 | drop_hdr = &drop_leaf->hdr; |
1819 | save_hdr = &save_leaf->hdr; | 1819 | save_hdr = &save_leaf->hdr; |
1820 | 1820 | ||
@@ -1915,7 +1915,7 @@ xfs_attr_leaf_lookup_int(xfs_dabuf_t *bp, xfs_da_args_t *args) | |||
1915 | xfs_dahash_t hashval; | 1915 | xfs_dahash_t hashval; |
1916 | 1916 | ||
1917 | leaf = bp->data; | 1917 | leaf = bp->data; |
1918 | ASSERT(be16_to_cpu(leaf->hdr.info.magic) == XFS_ATTR_LEAF_MAGIC); | 1918 | ASSERT(leaf->hdr.info.magic == cpu_to_be16(XFS_ATTR_LEAF_MAGIC)); |
1919 | ASSERT(be16_to_cpu(leaf->hdr.count) | 1919 | ASSERT(be16_to_cpu(leaf->hdr.count) |
1920 | < (XFS_LBSIZE(args->dp->i_mount)/8)); | 1920 | < (XFS_LBSIZE(args->dp->i_mount)/8)); |
1921 | 1921 | ||
@@ -2019,7 +2019,7 @@ xfs_attr_leaf_getvalue(xfs_dabuf_t *bp, xfs_da_args_t *args) | |||
2019 | xfs_attr_leaf_name_remote_t *name_rmt; | 2019 | xfs_attr_leaf_name_remote_t *name_rmt; |
2020 | 2020 | ||
2021 | leaf = bp->data; | 2021 | leaf = bp->data; |
2022 | ASSERT(be16_to_cpu(leaf->hdr.info.magic) == XFS_ATTR_LEAF_MAGIC); | 2022 | ASSERT(leaf->hdr.info.magic == cpu_to_be16(XFS_ATTR_LEAF_MAGIC)); |
2023 | ASSERT(be16_to_cpu(leaf->hdr.count) | 2023 | ASSERT(be16_to_cpu(leaf->hdr.count) |
2024 | < (XFS_LBSIZE(args->dp->i_mount)/8)); | 2024 | < (XFS_LBSIZE(args->dp->i_mount)/8)); |
2025 | ASSERT(args->index < be16_to_cpu(leaf->hdr.count)); | 2025 | ASSERT(args->index < be16_to_cpu(leaf->hdr.count)); |
@@ -2087,8 +2087,8 @@ xfs_attr_leaf_moveents(xfs_attr_leafblock_t *leaf_s, int start_s, | |||
2087 | /* | 2087 | /* |
2088 | * Set up environment. | 2088 | * Set up environment. |
2089 | */ | 2089 | */ |
2090 | ASSERT(be16_to_cpu(leaf_s->hdr.info.magic) == XFS_ATTR_LEAF_MAGIC); | 2090 | ASSERT(leaf_s->hdr.info.magic == cpu_to_be16(XFS_ATTR_LEAF_MAGIC)); |
2091 | ASSERT(be16_to_cpu(leaf_d->hdr.info.magic) == XFS_ATTR_LEAF_MAGIC); | 2091 | ASSERT(leaf_d->hdr.info.magic == cpu_to_be16(XFS_ATTR_LEAF_MAGIC)); |
2092 | hdr_s = &leaf_s->hdr; | 2092 | hdr_s = &leaf_s->hdr; |
2093 | hdr_d = &leaf_d->hdr; | 2093 | hdr_d = &leaf_d->hdr; |
2094 | ASSERT((be16_to_cpu(hdr_s->count) > 0) && | 2094 | ASSERT((be16_to_cpu(hdr_s->count) > 0) && |
@@ -2222,8 +2222,8 @@ xfs_attr_leaf_order(xfs_dabuf_t *leaf1_bp, xfs_dabuf_t *leaf2_bp) | |||
2222 | 2222 | ||
2223 | leaf1 = leaf1_bp->data; | 2223 | leaf1 = leaf1_bp->data; |
2224 | leaf2 = leaf2_bp->data; | 2224 | leaf2 = leaf2_bp->data; |
2225 | ASSERT((be16_to_cpu(leaf1->hdr.info.magic) == XFS_ATTR_LEAF_MAGIC) && | 2225 | ASSERT((leaf1->hdr.info.magic == cpu_to_be16(XFS_ATTR_LEAF_MAGIC)) && |
2226 | (be16_to_cpu(leaf2->hdr.info.magic) == XFS_ATTR_LEAF_MAGIC)); | 2226 | (leaf2->hdr.info.magic == cpu_to_be16(XFS_ATTR_LEAF_MAGIC))); |
2227 | if ((be16_to_cpu(leaf1->hdr.count) > 0) && | 2227 | if ((be16_to_cpu(leaf1->hdr.count) > 0) && |
2228 | (be16_to_cpu(leaf2->hdr.count) > 0) && | 2228 | (be16_to_cpu(leaf2->hdr.count) > 0) && |
2229 | ((be32_to_cpu(leaf2->entries[0].hashval) < | 2229 | ((be32_to_cpu(leaf2->entries[0].hashval) < |
@@ -2246,7 +2246,7 @@ xfs_attr_leaf_lasthash(xfs_dabuf_t *bp, int *count) | |||
2246 | xfs_attr_leafblock_t *leaf; | 2246 | xfs_attr_leafblock_t *leaf; |
2247 | 2247 | ||
2248 | leaf = bp->data; | 2248 | leaf = bp->data; |
2249 | ASSERT(be16_to_cpu(leaf->hdr.info.magic) == XFS_ATTR_LEAF_MAGIC); | 2249 | ASSERT(leaf->hdr.info.magic == cpu_to_be16(XFS_ATTR_LEAF_MAGIC)); |
2250 | if (count) | 2250 | if (count) |
2251 | *count = be16_to_cpu(leaf->hdr.count); | 2251 | *count = be16_to_cpu(leaf->hdr.count); |
2252 | if (!leaf->hdr.count) | 2252 | if (!leaf->hdr.count) |
@@ -2265,7 +2265,7 @@ xfs_attr_leaf_entsize(xfs_attr_leafblock_t *leaf, int index) | |||
2265 | xfs_attr_leaf_name_remote_t *name_rmt; | 2265 | xfs_attr_leaf_name_remote_t *name_rmt; |
2266 | int size; | 2266 | int size; |
2267 | 2267 | ||
2268 | ASSERT(be16_to_cpu(leaf->hdr.info.magic) == XFS_ATTR_LEAF_MAGIC); | 2268 | ASSERT(leaf->hdr.info.magic == cpu_to_be16(XFS_ATTR_LEAF_MAGIC)); |
2269 | if (leaf->entries[index].flags & XFS_ATTR_LOCAL) { | 2269 | if (leaf->entries[index].flags & XFS_ATTR_LOCAL) { |
2270 | name_loc = xfs_attr_leaf_name_local(leaf, index); | 2270 | name_loc = xfs_attr_leaf_name_local(leaf, index); |
2271 | size = xfs_attr_leaf_entsize_local(name_loc->namelen, | 2271 | size = xfs_attr_leaf_entsize_local(name_loc->namelen, |
@@ -2451,7 +2451,7 @@ xfs_attr_leaf_clearflag(xfs_da_args_t *args) | |||
2451 | ASSERT(bp != NULL); | 2451 | ASSERT(bp != NULL); |
2452 | 2452 | ||
2453 | leaf = bp->data; | 2453 | leaf = bp->data; |
2454 | ASSERT(be16_to_cpu(leaf->hdr.info.magic) == XFS_ATTR_LEAF_MAGIC); | 2454 | ASSERT(leaf->hdr.info.magic == cpu_to_be16(XFS_ATTR_LEAF_MAGIC)); |
2455 | ASSERT(args->index < be16_to_cpu(leaf->hdr.count)); | 2455 | ASSERT(args->index < be16_to_cpu(leaf->hdr.count)); |
2456 | ASSERT(args->index >= 0); | 2456 | ASSERT(args->index >= 0); |
2457 | entry = &leaf->entries[ args->index ]; | 2457 | entry = &leaf->entries[ args->index ]; |
@@ -2515,7 +2515,7 @@ xfs_attr_leaf_setflag(xfs_da_args_t *args) | |||
2515 | ASSERT(bp != NULL); | 2515 | ASSERT(bp != NULL); |
2516 | 2516 | ||
2517 | leaf = bp->data; | 2517 | leaf = bp->data; |
2518 | ASSERT(be16_to_cpu(leaf->hdr.info.magic) == XFS_ATTR_LEAF_MAGIC); | 2518 | ASSERT(leaf->hdr.info.magic == cpu_to_be16(XFS_ATTR_LEAF_MAGIC)); |
2519 | ASSERT(args->index < be16_to_cpu(leaf->hdr.count)); | 2519 | ASSERT(args->index < be16_to_cpu(leaf->hdr.count)); |
2520 | ASSERT(args->index >= 0); | 2520 | ASSERT(args->index >= 0); |
2521 | entry = &leaf->entries[ args->index ]; | 2521 | entry = &leaf->entries[ args->index ]; |
@@ -2585,13 +2585,13 @@ xfs_attr_leaf_flipflags(xfs_da_args_t *args) | |||
2585 | } | 2585 | } |
2586 | 2586 | ||
2587 | leaf1 = bp1->data; | 2587 | leaf1 = bp1->data; |
2588 | ASSERT(be16_to_cpu(leaf1->hdr.info.magic) == XFS_ATTR_LEAF_MAGIC); | 2588 | ASSERT(leaf1->hdr.info.magic == cpu_to_be16(XFS_ATTR_LEAF_MAGIC)); |
2589 | ASSERT(args->index < be16_to_cpu(leaf1->hdr.count)); | 2589 | ASSERT(args->index < be16_to_cpu(leaf1->hdr.count)); |
2590 | ASSERT(args->index >= 0); | 2590 | ASSERT(args->index >= 0); |
2591 | entry1 = &leaf1->entries[ args->index ]; | 2591 | entry1 = &leaf1->entries[ args->index ]; |
2592 | 2592 | ||
2593 | leaf2 = bp2->data; | 2593 | leaf2 = bp2->data; |
2594 | ASSERT(be16_to_cpu(leaf2->hdr.info.magic) == XFS_ATTR_LEAF_MAGIC); | 2594 | ASSERT(leaf2->hdr.info.magic == cpu_to_be16(XFS_ATTR_LEAF_MAGIC)); |
2595 | ASSERT(args->index2 < be16_to_cpu(leaf2->hdr.count)); | 2595 | ASSERT(args->index2 < be16_to_cpu(leaf2->hdr.count)); |
2596 | ASSERT(args->index2 >= 0); | 2596 | ASSERT(args->index2 >= 0); |
2597 | entry2 = &leaf2->entries[ args->index2 ]; | 2597 | entry2 = &leaf2->entries[ args->index2 ]; |
@@ -2689,9 +2689,9 @@ xfs_attr_root_inactive(xfs_trans_t **trans, xfs_inode_t *dp) | |||
2689 | * This is a depth-first traversal! | 2689 | * This is a depth-first traversal! |
2690 | */ | 2690 | */ |
2691 | info = bp->data; | 2691 | info = bp->data; |
2692 | if (be16_to_cpu(info->magic) == XFS_DA_NODE_MAGIC) { | 2692 | if (info->magic == cpu_to_be16(XFS_DA_NODE_MAGIC)) { |
2693 | error = xfs_attr_node_inactive(trans, dp, bp, 1); | 2693 | error = xfs_attr_node_inactive(trans, dp, bp, 1); |
2694 | } else if (be16_to_cpu(info->magic) == XFS_ATTR_LEAF_MAGIC) { | 2694 | } else if (info->magic == cpu_to_be16(XFS_ATTR_LEAF_MAGIC)) { |
2695 | error = xfs_attr_leaf_inactive(trans, dp, bp); | 2695 | error = xfs_attr_leaf_inactive(trans, dp, bp); |
2696 | } else { | 2696 | } else { |
2697 | error = XFS_ERROR(EIO); | 2697 | error = XFS_ERROR(EIO); |
@@ -2739,7 +2739,7 @@ xfs_attr_node_inactive(xfs_trans_t **trans, xfs_inode_t *dp, xfs_dabuf_t *bp, | |||
2739 | } | 2739 | } |
2740 | 2740 | ||
2741 | node = bp->data; | 2741 | node = bp->data; |
2742 | ASSERT(be16_to_cpu(node->hdr.info.magic) == XFS_DA_NODE_MAGIC); | 2742 | ASSERT(node->hdr.info.magic == cpu_to_be16(XFS_DA_NODE_MAGIC)); |
2743 | parent_blkno = xfs_da_blkno(bp); /* save for re-read later */ | 2743 | parent_blkno = xfs_da_blkno(bp); /* save for re-read later */ |
2744 | count = be16_to_cpu(node->hdr.count); | 2744 | count = be16_to_cpu(node->hdr.count); |
2745 | if (!count) { | 2745 | if (!count) { |
@@ -2773,10 +2773,10 @@ xfs_attr_node_inactive(xfs_trans_t **trans, xfs_inode_t *dp, xfs_dabuf_t *bp, | |||
2773 | * Invalidate the subtree, however we have to. | 2773 | * Invalidate the subtree, however we have to. |
2774 | */ | 2774 | */ |
2775 | info = child_bp->data; | 2775 | info = child_bp->data; |
2776 | if (be16_to_cpu(info->magic) == XFS_DA_NODE_MAGIC) { | 2776 | if (info->magic == cpu_to_be16(XFS_DA_NODE_MAGIC)) { |
2777 | error = xfs_attr_node_inactive(trans, dp, | 2777 | error = xfs_attr_node_inactive(trans, dp, |
2778 | child_bp, level+1); | 2778 | child_bp, level+1); |
2779 | } else if (be16_to_cpu(info->magic) == XFS_ATTR_LEAF_MAGIC) { | 2779 | } else if (info->magic == cpu_to_be16(XFS_ATTR_LEAF_MAGIC)) { |
2780 | error = xfs_attr_leaf_inactive(trans, dp, | 2780 | error = xfs_attr_leaf_inactive(trans, dp, |
2781 | child_bp); | 2781 | child_bp); |
2782 | } else { | 2782 | } else { |
@@ -2836,7 +2836,7 @@ xfs_attr_leaf_inactive(xfs_trans_t **trans, xfs_inode_t *dp, xfs_dabuf_t *bp) | |||
2836 | int error, count, size, tmp, i; | 2836 | int error, count, size, tmp, i; |
2837 | 2837 | ||
2838 | leaf = bp->data; | 2838 | leaf = bp->data; |
2839 | ASSERT(be16_to_cpu(leaf->hdr.info.magic) == XFS_ATTR_LEAF_MAGIC); | 2839 | ASSERT(leaf->hdr.info.magic == cpu_to_be16(XFS_ATTR_LEAF_MAGIC)); |
2840 | 2840 | ||
2841 | /* | 2841 | /* |
2842 | * Count the number of "remote" value extents. | 2842 | * Count the number of "remote" value extents. |
diff --git a/fs/xfs/xfs_bmap.c b/fs/xfs/xfs_bmap.c index 7b46b78ba3f0..2ce6aa644e7e 100644 --- a/fs/xfs/xfs_bmap.c +++ b/fs/xfs/xfs_bmap.c | |||
@@ -4083,7 +4083,7 @@ xfs_bmap_sanity_check( | |||
4083 | { | 4083 | { |
4084 | struct xfs_btree_block *block = XFS_BUF_TO_BLOCK(bp); | 4084 | struct xfs_btree_block *block = XFS_BUF_TO_BLOCK(bp); |
4085 | 4085 | ||
4086 | if (be32_to_cpu(block->bb_magic) != XFS_BMAP_MAGIC || | 4086 | if (block->bb_magic != cpu_to_be32(XFS_BMAP_MAGIC) || |
4087 | be16_to_cpu(block->bb_level) != level || | 4087 | be16_to_cpu(block->bb_level) != level || |
4088 | be16_to_cpu(block->bb_numrecs) == 0 || | 4088 | be16_to_cpu(block->bb_numrecs) == 0 || |
4089 | be16_to_cpu(block->bb_numrecs) > mp->m_bmap_dmxr[level != 0]) | 4089 | be16_to_cpu(block->bb_numrecs) > mp->m_bmap_dmxr[level != 0]) |
diff --git a/fs/xfs/xfs_bmap_btree.c b/fs/xfs/xfs_bmap_btree.c index 87d3c10b6954..50a28442a544 100644 --- a/fs/xfs/xfs_bmap_btree.c +++ b/fs/xfs/xfs_bmap_btree.c | |||
@@ -425,10 +425,10 @@ xfs_bmbt_to_bmdr( | |||
425 | xfs_bmbt_key_t *tkp; | 425 | xfs_bmbt_key_t *tkp; |
426 | __be64 *tpp; | 426 | __be64 *tpp; |
427 | 427 | ||
428 | ASSERT(be32_to_cpu(rblock->bb_magic) == XFS_BMAP_MAGIC); | 428 | ASSERT(rblock->bb_magic == cpu_to_be32(XFS_BMAP_MAGIC)); |
429 | ASSERT(be64_to_cpu(rblock->bb_u.l.bb_leftsib) == NULLDFSBNO); | 429 | ASSERT(rblock->bb_u.l.bb_leftsib == cpu_to_be64(NULLDFSBNO)); |
430 | ASSERT(be64_to_cpu(rblock->bb_u.l.bb_rightsib) == NULLDFSBNO); | 430 | ASSERT(rblock->bb_u.l.bb_rightsib == cpu_to_be64(NULLDFSBNO)); |
431 | ASSERT(be16_to_cpu(rblock->bb_level) > 0); | 431 | ASSERT(rblock->bb_level != 0); |
432 | dblock->bb_level = rblock->bb_level; | 432 | dblock->bb_level = rblock->bb_level; |
433 | dblock->bb_numrecs = rblock->bb_numrecs; | 433 | dblock->bb_numrecs = rblock->bb_numrecs; |
434 | dmxr = xfs_bmdr_maxrecs(mp, dblocklen, 0); | 434 | dmxr = xfs_bmdr_maxrecs(mp, dblocklen, 0); |
diff --git a/fs/xfs/xfs_btree.c b/fs/xfs/xfs_btree.c index 2f9e97c128a0..43125af42629 100644 --- a/fs/xfs/xfs_btree.c +++ b/fs/xfs/xfs_btree.c | |||
@@ -66,11 +66,11 @@ xfs_btree_check_lblock( | |||
66 | be16_to_cpu(block->bb_numrecs) <= | 66 | be16_to_cpu(block->bb_numrecs) <= |
67 | cur->bc_ops->get_maxrecs(cur, level) && | 67 | cur->bc_ops->get_maxrecs(cur, level) && |
68 | block->bb_u.l.bb_leftsib && | 68 | block->bb_u.l.bb_leftsib && |
69 | (be64_to_cpu(block->bb_u.l.bb_leftsib) == NULLDFSBNO || | 69 | (block->bb_u.l.bb_leftsib == cpu_to_be64(NULLDFSBNO) || |
70 | XFS_FSB_SANITY_CHECK(mp, | 70 | XFS_FSB_SANITY_CHECK(mp, |
71 | be64_to_cpu(block->bb_u.l.bb_leftsib))) && | 71 | be64_to_cpu(block->bb_u.l.bb_leftsib))) && |
72 | block->bb_u.l.bb_rightsib && | 72 | block->bb_u.l.bb_rightsib && |
73 | (be64_to_cpu(block->bb_u.l.bb_rightsib) == NULLDFSBNO || | 73 | (block->bb_u.l.bb_rightsib == cpu_to_be64(NULLDFSBNO) || |
74 | XFS_FSB_SANITY_CHECK(mp, | 74 | XFS_FSB_SANITY_CHECK(mp, |
75 | be64_to_cpu(block->bb_u.l.bb_rightsib))); | 75 | be64_to_cpu(block->bb_u.l.bb_rightsib))); |
76 | if (unlikely(XFS_TEST_ERROR(!lblock_ok, mp, | 76 | if (unlikely(XFS_TEST_ERROR(!lblock_ok, mp, |
@@ -105,10 +105,10 @@ xfs_btree_check_sblock( | |||
105 | be16_to_cpu(block->bb_level) == level && | 105 | be16_to_cpu(block->bb_level) == level && |
106 | be16_to_cpu(block->bb_numrecs) <= | 106 | be16_to_cpu(block->bb_numrecs) <= |
107 | cur->bc_ops->get_maxrecs(cur, level) && | 107 | cur->bc_ops->get_maxrecs(cur, level) && |
108 | (be32_to_cpu(block->bb_u.s.bb_leftsib) == NULLAGBLOCK || | 108 | (block->bb_u.s.bb_leftsib == cpu_to_be32(NULLAGBLOCK) || |
109 | be32_to_cpu(block->bb_u.s.bb_leftsib) < agflen) && | 109 | be32_to_cpu(block->bb_u.s.bb_leftsib) < agflen) && |
110 | block->bb_u.s.bb_leftsib && | 110 | block->bb_u.s.bb_leftsib && |
111 | (be32_to_cpu(block->bb_u.s.bb_rightsib) == NULLAGBLOCK || | 111 | (block->bb_u.s.bb_rightsib == cpu_to_be32(NULLAGBLOCK) || |
112 | be32_to_cpu(block->bb_u.s.bb_rightsib) < agflen) && | 112 | be32_to_cpu(block->bb_u.s.bb_rightsib) < agflen) && |
113 | block->bb_u.s.bb_rightsib; | 113 | block->bb_u.s.bb_rightsib; |
114 | if (unlikely(XFS_TEST_ERROR(!sblock_ok, cur->bc_mp, | 114 | if (unlikely(XFS_TEST_ERROR(!sblock_ok, cur->bc_mp, |
@@ -511,9 +511,9 @@ xfs_btree_islastblock( | |||
511 | block = xfs_btree_get_block(cur, level, &bp); | 511 | block = xfs_btree_get_block(cur, level, &bp); |
512 | xfs_btree_check_block(cur, block, level, bp); | 512 | xfs_btree_check_block(cur, block, level, bp); |
513 | if (cur->bc_flags & XFS_BTREE_LONG_PTRS) | 513 | if (cur->bc_flags & XFS_BTREE_LONG_PTRS) |
514 | return be64_to_cpu(block->bb_u.l.bb_rightsib) == NULLDFSBNO; | 514 | return block->bb_u.l.bb_rightsib == cpu_to_be64(NULLDFSBNO); |
515 | else | 515 | else |
516 | return be32_to_cpu(block->bb_u.s.bb_rightsib) == NULLAGBLOCK; | 516 | return block->bb_u.s.bb_rightsib == cpu_to_be32(NULLAGBLOCK); |
517 | } | 517 | } |
518 | 518 | ||
519 | /* | 519 | /* |
@@ -777,14 +777,14 @@ xfs_btree_setbuf( | |||
777 | 777 | ||
778 | b = XFS_BUF_TO_BLOCK(bp); | 778 | b = XFS_BUF_TO_BLOCK(bp); |
779 | if (cur->bc_flags & XFS_BTREE_LONG_PTRS) { | 779 | if (cur->bc_flags & XFS_BTREE_LONG_PTRS) { |
780 | if (be64_to_cpu(b->bb_u.l.bb_leftsib) == NULLDFSBNO) | 780 | if (b->bb_u.l.bb_leftsib == cpu_to_be64(NULLDFSBNO)) |
781 | cur->bc_ra[lev] |= XFS_BTCUR_LEFTRA; | 781 | cur->bc_ra[lev] |= XFS_BTCUR_LEFTRA; |
782 | if (be64_to_cpu(b->bb_u.l.bb_rightsib) == NULLDFSBNO) | 782 | if (b->bb_u.l.bb_rightsib == cpu_to_be64(NULLDFSBNO)) |
783 | cur->bc_ra[lev] |= XFS_BTCUR_RIGHTRA; | 783 | cur->bc_ra[lev] |= XFS_BTCUR_RIGHTRA; |
784 | } else { | 784 | } else { |
785 | if (be32_to_cpu(b->bb_u.s.bb_leftsib) == NULLAGBLOCK) | 785 | if (b->bb_u.s.bb_leftsib == cpu_to_be32(NULLAGBLOCK)) |
786 | cur->bc_ra[lev] |= XFS_BTCUR_LEFTRA; | 786 | cur->bc_ra[lev] |= XFS_BTCUR_LEFTRA; |
787 | if (be32_to_cpu(b->bb_u.s.bb_rightsib) == NULLAGBLOCK) | 787 | if (b->bb_u.s.bb_rightsib == cpu_to_be32(NULLAGBLOCK)) |
788 | cur->bc_ra[lev] |= XFS_BTCUR_RIGHTRA; | 788 | cur->bc_ra[lev] |= XFS_BTCUR_RIGHTRA; |
789 | } | 789 | } |
790 | } | 790 | } |
@@ -795,9 +795,9 @@ xfs_btree_ptr_is_null( | |||
795 | union xfs_btree_ptr *ptr) | 795 | union xfs_btree_ptr *ptr) |
796 | { | 796 | { |
797 | if (cur->bc_flags & XFS_BTREE_LONG_PTRS) | 797 | if (cur->bc_flags & XFS_BTREE_LONG_PTRS) |
798 | return be64_to_cpu(ptr->l) == NULLDFSBNO; | 798 | return ptr->l == cpu_to_be64(NULLDFSBNO); |
799 | else | 799 | else |
800 | return be32_to_cpu(ptr->s) == NULLAGBLOCK; | 800 | return ptr->s == cpu_to_be32(NULLAGBLOCK); |
801 | } | 801 | } |
802 | 802 | ||
803 | STATIC void | 803 | STATIC void |
@@ -923,12 +923,12 @@ xfs_btree_ptr_to_daddr( | |||
923 | union xfs_btree_ptr *ptr) | 923 | union xfs_btree_ptr *ptr) |
924 | { | 924 | { |
925 | if (cur->bc_flags & XFS_BTREE_LONG_PTRS) { | 925 | if (cur->bc_flags & XFS_BTREE_LONG_PTRS) { |
926 | ASSERT(be64_to_cpu(ptr->l) != NULLDFSBNO); | 926 | ASSERT(ptr->l != cpu_to_be64(NULLDFSBNO)); |
927 | 927 | ||
928 | return XFS_FSB_TO_DADDR(cur->bc_mp, be64_to_cpu(ptr->l)); | 928 | return XFS_FSB_TO_DADDR(cur->bc_mp, be64_to_cpu(ptr->l)); |
929 | } else { | 929 | } else { |
930 | ASSERT(cur->bc_private.a.agno != NULLAGNUMBER); | 930 | ASSERT(cur->bc_private.a.agno != NULLAGNUMBER); |
931 | ASSERT(be32_to_cpu(ptr->s) != NULLAGBLOCK); | 931 | ASSERT(ptr->s != cpu_to_be32(NULLAGBLOCK)); |
932 | 932 | ||
933 | return XFS_AGB_TO_DADDR(cur->bc_mp, cur->bc_private.a.agno, | 933 | return XFS_AGB_TO_DADDR(cur->bc_mp, cur->bc_private.a.agno, |
934 | be32_to_cpu(ptr->s)); | 934 | be32_to_cpu(ptr->s)); |
diff --git a/fs/xfs/xfs_da_btree.c b/fs/xfs/xfs_da_btree.c index efb906f8a9c9..18425717cbe6 100644 --- a/fs/xfs/xfs_da_btree.c +++ b/fs/xfs/xfs_da_btree.c | |||
@@ -321,11 +321,11 @@ xfs_da_root_split(xfs_da_state_t *state, xfs_da_state_blk_t *blk1, | |||
321 | ASSERT(bp != NULL); | 321 | ASSERT(bp != NULL); |
322 | node = bp->data; | 322 | node = bp->data; |
323 | oldroot = blk1->bp->data; | 323 | oldroot = blk1->bp->data; |
324 | if (be16_to_cpu(oldroot->hdr.info.magic) == XFS_DA_NODE_MAGIC) { | 324 | if (oldroot->hdr.info.magic == cpu_to_be16(XFS_DA_NODE_MAGIC)) { |
325 | size = (int)((char *)&oldroot->btree[be16_to_cpu(oldroot->hdr.count)] - | 325 | size = (int)((char *)&oldroot->btree[be16_to_cpu(oldroot->hdr.count)] - |
326 | (char *)oldroot); | 326 | (char *)oldroot); |
327 | } else { | 327 | } else { |
328 | ASSERT(be16_to_cpu(oldroot->hdr.info.magic) == XFS_DIR2_LEAFN_MAGIC); | 328 | ASSERT(oldroot->hdr.info.magic == cpu_to_be16(XFS_DIR2_LEAFN_MAGIC)); |
329 | leaf = (xfs_dir2_leaf_t *)oldroot; | 329 | leaf = (xfs_dir2_leaf_t *)oldroot; |
330 | size = (int)((char *)&leaf->ents[be16_to_cpu(leaf->hdr.count)] - | 330 | size = (int)((char *)&leaf->ents[be16_to_cpu(leaf->hdr.count)] - |
331 | (char *)leaf); | 331 | (char *)leaf); |
@@ -352,7 +352,7 @@ xfs_da_root_split(xfs_da_state_t *state, xfs_da_state_blk_t *blk1, | |||
352 | node->hdr.count = cpu_to_be16(2); | 352 | node->hdr.count = cpu_to_be16(2); |
353 | 353 | ||
354 | #ifdef DEBUG | 354 | #ifdef DEBUG |
355 | if (be16_to_cpu(oldroot->hdr.info.magic) == XFS_DIR2_LEAFN_MAGIC) { | 355 | if (oldroot->hdr.info.magic == cpu_to_be16(XFS_DIR2_LEAFN_MAGIC)) { |
356 | ASSERT(blk1->blkno >= mp->m_dirleafblk && | 356 | ASSERT(blk1->blkno >= mp->m_dirleafblk && |
357 | blk1->blkno < mp->m_dirfreeblk); | 357 | blk1->blkno < mp->m_dirfreeblk); |
358 | ASSERT(blk2->blkno >= mp->m_dirleafblk && | 358 | ASSERT(blk2->blkno >= mp->m_dirleafblk && |
@@ -384,7 +384,7 @@ xfs_da_node_split(xfs_da_state_t *state, xfs_da_state_blk_t *oldblk, | |||
384 | int useextra; | 384 | int useextra; |
385 | 385 | ||
386 | node = oldblk->bp->data; | 386 | node = oldblk->bp->data; |
387 | ASSERT(be16_to_cpu(node->hdr.info.magic) == XFS_DA_NODE_MAGIC); | 387 | ASSERT(node->hdr.info.magic == cpu_to_be16(XFS_DA_NODE_MAGIC)); |
388 | 388 | ||
389 | /* | 389 | /* |
390 | * With V2 dirs the extra block is data or freespace. | 390 | * With V2 dirs the extra block is data or freespace. |
@@ -483,8 +483,8 @@ xfs_da_node_rebalance(xfs_da_state_t *state, xfs_da_state_blk_t *blk1, | |||
483 | node1 = node2; | 483 | node1 = node2; |
484 | node2 = tmpnode; | 484 | node2 = tmpnode; |
485 | } | 485 | } |
486 | ASSERT(be16_to_cpu(node1->hdr.info.magic) == XFS_DA_NODE_MAGIC); | 486 | ASSERT(node1->hdr.info.magic == cpu_to_be16(XFS_DA_NODE_MAGIC)); |
487 | ASSERT(be16_to_cpu(node2->hdr.info.magic) == XFS_DA_NODE_MAGIC); | 487 | ASSERT(node2->hdr.info.magic == cpu_to_be16(XFS_DA_NODE_MAGIC)); |
488 | count = (be16_to_cpu(node1->hdr.count) - be16_to_cpu(node2->hdr.count)) / 2; | 488 | count = (be16_to_cpu(node1->hdr.count) - be16_to_cpu(node2->hdr.count)) / 2; |
489 | if (count == 0) | 489 | if (count == 0) |
490 | return; | 490 | return; |
@@ -578,7 +578,7 @@ xfs_da_node_add(xfs_da_state_t *state, xfs_da_state_blk_t *oldblk, | |||
578 | int tmp; | 578 | int tmp; |
579 | 579 | ||
580 | node = oldblk->bp->data; | 580 | node = oldblk->bp->data; |
581 | ASSERT(be16_to_cpu(node->hdr.info.magic) == XFS_DA_NODE_MAGIC); | 581 | ASSERT(node->hdr.info.magic == cpu_to_be16(XFS_DA_NODE_MAGIC)); |
582 | ASSERT((oldblk->index >= 0) && (oldblk->index <= be16_to_cpu(node->hdr.count))); | 582 | ASSERT((oldblk->index >= 0) && (oldblk->index <= be16_to_cpu(node->hdr.count))); |
583 | ASSERT(newblk->blkno != 0); | 583 | ASSERT(newblk->blkno != 0); |
584 | if (state->args->whichfork == XFS_DATA_FORK) | 584 | if (state->args->whichfork == XFS_DATA_FORK) |
@@ -714,7 +714,7 @@ xfs_da_root_join(xfs_da_state_t *state, xfs_da_state_blk_t *root_blk) | |||
714 | ASSERT(args != NULL); | 714 | ASSERT(args != NULL); |
715 | ASSERT(root_blk->magic == XFS_DA_NODE_MAGIC); | 715 | ASSERT(root_blk->magic == XFS_DA_NODE_MAGIC); |
716 | oldroot = root_blk->bp->data; | 716 | oldroot = root_blk->bp->data; |
717 | ASSERT(be16_to_cpu(oldroot->hdr.info.magic) == XFS_DA_NODE_MAGIC); | 717 | ASSERT(oldroot->hdr.info.magic == cpu_to_be16(XFS_DA_NODE_MAGIC)); |
718 | ASSERT(!oldroot->hdr.info.forw); | 718 | ASSERT(!oldroot->hdr.info.forw); |
719 | ASSERT(!oldroot->hdr.info.back); | 719 | ASSERT(!oldroot->hdr.info.back); |
720 | 720 | ||
@@ -737,10 +737,10 @@ xfs_da_root_join(xfs_da_state_t *state, xfs_da_state_blk_t *root_blk) | |||
737 | ASSERT(bp != NULL); | 737 | ASSERT(bp != NULL); |
738 | blkinfo = bp->data; | 738 | blkinfo = bp->data; |
739 | if (be16_to_cpu(oldroot->hdr.level) == 1) { | 739 | if (be16_to_cpu(oldroot->hdr.level) == 1) { |
740 | ASSERT(be16_to_cpu(blkinfo->magic) == XFS_DIR2_LEAFN_MAGIC || | 740 | ASSERT(blkinfo->magic == cpu_to_be16(XFS_DIR2_LEAFN_MAGIC) || |
741 | be16_to_cpu(blkinfo->magic) == XFS_ATTR_LEAF_MAGIC); | 741 | blkinfo->magic == cpu_to_be16(XFS_ATTR_LEAF_MAGIC)); |
742 | } else { | 742 | } else { |
743 | ASSERT(be16_to_cpu(blkinfo->magic) == XFS_DA_NODE_MAGIC); | 743 | ASSERT(blkinfo->magic == cpu_to_be16(XFS_DA_NODE_MAGIC)); |
744 | } | 744 | } |
745 | ASSERT(!blkinfo->forw); | 745 | ASSERT(!blkinfo->forw); |
746 | ASSERT(!blkinfo->back); | 746 | ASSERT(!blkinfo->back); |
@@ -776,7 +776,7 @@ xfs_da_node_toosmall(xfs_da_state_t *state, int *action) | |||
776 | */ | 776 | */ |
777 | blk = &state->path.blk[ state->path.active-1 ]; | 777 | blk = &state->path.blk[ state->path.active-1 ]; |
778 | info = blk->bp->data; | 778 | info = blk->bp->data; |
779 | ASSERT(be16_to_cpu(info->magic) == XFS_DA_NODE_MAGIC); | 779 | ASSERT(info->magic == cpu_to_be16(XFS_DA_NODE_MAGIC)); |
780 | node = (xfs_da_intnode_t *)info; | 780 | node = (xfs_da_intnode_t *)info; |
781 | count = be16_to_cpu(node->hdr.count); | 781 | count = be16_to_cpu(node->hdr.count); |
782 | if (count > (state->node_ents >> 1)) { | 782 | if (count > (state->node_ents >> 1)) { |
@@ -836,7 +836,7 @@ xfs_da_node_toosmall(xfs_da_state_t *state, int *action) | |||
836 | count -= state->node_ents >> 2; | 836 | count -= state->node_ents >> 2; |
837 | count -= be16_to_cpu(node->hdr.count); | 837 | count -= be16_to_cpu(node->hdr.count); |
838 | node = bp->data; | 838 | node = bp->data; |
839 | ASSERT(be16_to_cpu(node->hdr.info.magic) == XFS_DA_NODE_MAGIC); | 839 | ASSERT(node->hdr.info.magic == cpu_to_be16(XFS_DA_NODE_MAGIC)); |
840 | count -= be16_to_cpu(node->hdr.count); | 840 | count -= be16_to_cpu(node->hdr.count); |
841 | xfs_da_brelse(state->args->trans, bp); | 841 | xfs_da_brelse(state->args->trans, bp); |
842 | if (count >= 0) | 842 | if (count >= 0) |
@@ -911,7 +911,7 @@ xfs_da_fixhashpath(xfs_da_state_t *state, xfs_da_state_path_t *path) | |||
911 | } | 911 | } |
912 | for (blk--, level--; level >= 0; blk--, level--) { | 912 | for (blk--, level--; level >= 0; blk--, level--) { |
913 | node = blk->bp->data; | 913 | node = blk->bp->data; |
914 | ASSERT(be16_to_cpu(node->hdr.info.magic) == XFS_DA_NODE_MAGIC); | 914 | ASSERT(node->hdr.info.magic == cpu_to_be16(XFS_DA_NODE_MAGIC)); |
915 | btree = &node->btree[ blk->index ]; | 915 | btree = &node->btree[ blk->index ]; |
916 | if (be32_to_cpu(btree->hashval) == lasthash) | 916 | if (be32_to_cpu(btree->hashval) == lasthash) |
917 | break; | 917 | break; |
@@ -979,8 +979,8 @@ xfs_da_node_unbalance(xfs_da_state_t *state, xfs_da_state_blk_t *drop_blk, | |||
979 | 979 | ||
980 | drop_node = drop_blk->bp->data; | 980 | drop_node = drop_blk->bp->data; |
981 | save_node = save_blk->bp->data; | 981 | save_node = save_blk->bp->data; |
982 | ASSERT(be16_to_cpu(drop_node->hdr.info.magic) == XFS_DA_NODE_MAGIC); | 982 | ASSERT(drop_node->hdr.info.magic == cpu_to_be16(XFS_DA_NODE_MAGIC)); |
983 | ASSERT(be16_to_cpu(save_node->hdr.info.magic) == XFS_DA_NODE_MAGIC); | 983 | ASSERT(save_node->hdr.info.magic == cpu_to_be16(XFS_DA_NODE_MAGIC)); |
984 | tp = state->args->trans; | 984 | tp = state->args->trans; |
985 | 985 | ||
986 | /* | 986 | /* |
@@ -1278,8 +1278,8 @@ xfs_da_node_order(xfs_dabuf_t *node1_bp, xfs_dabuf_t *node2_bp) | |||
1278 | 1278 | ||
1279 | node1 = node1_bp->data; | 1279 | node1 = node1_bp->data; |
1280 | node2 = node2_bp->data; | 1280 | node2 = node2_bp->data; |
1281 | ASSERT((be16_to_cpu(node1->hdr.info.magic) == XFS_DA_NODE_MAGIC) && | 1281 | ASSERT(node1->hdr.info.magic == cpu_to_be16(XFS_DA_NODE_MAGIC) && |
1282 | (be16_to_cpu(node2->hdr.info.magic) == XFS_DA_NODE_MAGIC)); | 1282 | node2->hdr.info.magic == cpu_to_be16(XFS_DA_NODE_MAGIC)); |
1283 | if ((be16_to_cpu(node1->hdr.count) > 0) && (be16_to_cpu(node2->hdr.count) > 0) && | 1283 | if ((be16_to_cpu(node1->hdr.count) > 0) && (be16_to_cpu(node2->hdr.count) > 0) && |
1284 | ((be32_to_cpu(node2->btree[0].hashval) < | 1284 | ((be32_to_cpu(node2->btree[0].hashval) < |
1285 | be32_to_cpu(node1->btree[0].hashval)) || | 1285 | be32_to_cpu(node1->btree[0].hashval)) || |
@@ -1299,7 +1299,7 @@ xfs_da_node_lasthash(xfs_dabuf_t *bp, int *count) | |||
1299 | xfs_da_intnode_t *node; | 1299 | xfs_da_intnode_t *node; |
1300 | 1300 | ||
1301 | node = bp->data; | 1301 | node = bp->data; |
1302 | ASSERT(be16_to_cpu(node->hdr.info.magic) == XFS_DA_NODE_MAGIC); | 1302 | ASSERT(node->hdr.info.magic == cpu_to_be16(XFS_DA_NODE_MAGIC)); |
1303 | if (count) | 1303 | if (count) |
1304 | *count = be16_to_cpu(node->hdr.count); | 1304 | *count = be16_to_cpu(node->hdr.count); |
1305 | if (!node->hdr.count) | 1305 | if (!node->hdr.count) |
@@ -1412,7 +1412,7 @@ xfs_da_path_shift(xfs_da_state_t *state, xfs_da_state_path_t *path, | |||
1412 | for (blk = &path->blk[level]; level >= 0; blk--, level--) { | 1412 | for (blk = &path->blk[level]; level >= 0; blk--, level--) { |
1413 | ASSERT(blk->bp != NULL); | 1413 | ASSERT(blk->bp != NULL); |
1414 | node = blk->bp->data; | 1414 | node = blk->bp->data; |
1415 | ASSERT(be16_to_cpu(node->hdr.info.magic) == XFS_DA_NODE_MAGIC); | 1415 | ASSERT(node->hdr.info.magic == cpu_to_be16(XFS_DA_NODE_MAGIC)); |
1416 | if (forward && (blk->index < be16_to_cpu(node->hdr.count)-1)) { | 1416 | if (forward && (blk->index < be16_to_cpu(node->hdr.count)-1)) { |
1417 | blk->index++; | 1417 | blk->index++; |
1418 | blkno = be32_to_cpu(node->btree[blk->index].before); | 1418 | blkno = be32_to_cpu(node->btree[blk->index].before); |
@@ -1451,9 +1451,9 @@ xfs_da_path_shift(xfs_da_state_t *state, xfs_da_state_path_t *path, | |||
1451 | return(error); | 1451 | return(error); |
1452 | ASSERT(blk->bp != NULL); | 1452 | ASSERT(blk->bp != NULL); |
1453 | info = blk->bp->data; | 1453 | info = blk->bp->data; |
1454 | ASSERT(be16_to_cpu(info->magic) == XFS_DA_NODE_MAGIC || | 1454 | ASSERT(info->magic == cpu_to_be16(XFS_DA_NODE_MAGIC) || |
1455 | be16_to_cpu(info->magic) == XFS_DIR2_LEAFN_MAGIC || | 1455 | info->magic == cpu_to_be16(XFS_DIR2_LEAFN_MAGIC) || |
1456 | be16_to_cpu(info->magic) == XFS_ATTR_LEAF_MAGIC); | 1456 | info->magic == cpu_to_be16(XFS_ATTR_LEAF_MAGIC)); |
1457 | blk->magic = be16_to_cpu(info->magic); | 1457 | blk->magic = be16_to_cpu(info->magic); |
1458 | if (blk->magic == XFS_DA_NODE_MAGIC) { | 1458 | if (blk->magic == XFS_DA_NODE_MAGIC) { |
1459 | node = (xfs_da_intnode_t *)info; | 1459 | node = (xfs_da_intnode_t *)info; |
@@ -1704,12 +1704,12 @@ xfs_da_swap_lastblock(xfs_da_args_t *args, xfs_dablk_t *dead_blknop, | |||
1704 | /* | 1704 | /* |
1705 | * Get values from the moved block. | 1705 | * Get values from the moved block. |
1706 | */ | 1706 | */ |
1707 | if (be16_to_cpu(dead_info->magic) == XFS_DIR2_LEAFN_MAGIC) { | 1707 | if (dead_info->magic == cpu_to_be16(XFS_DIR2_LEAFN_MAGIC)) { |
1708 | dead_leaf2 = (xfs_dir2_leaf_t *)dead_info; | 1708 | dead_leaf2 = (xfs_dir2_leaf_t *)dead_info; |
1709 | dead_level = 0; | 1709 | dead_level = 0; |
1710 | dead_hash = be32_to_cpu(dead_leaf2->ents[be16_to_cpu(dead_leaf2->hdr.count) - 1].hashval); | 1710 | dead_hash = be32_to_cpu(dead_leaf2->ents[be16_to_cpu(dead_leaf2->hdr.count) - 1].hashval); |
1711 | } else { | 1711 | } else { |
1712 | ASSERT(be16_to_cpu(dead_info->magic) == XFS_DA_NODE_MAGIC); | 1712 | ASSERT(dead_info->magic == cpu_to_be16(XFS_DA_NODE_MAGIC)); |
1713 | dead_node = (xfs_da_intnode_t *)dead_info; | 1713 | dead_node = (xfs_da_intnode_t *)dead_info; |
1714 | dead_level = be16_to_cpu(dead_node->hdr.level); | 1714 | dead_level = be16_to_cpu(dead_node->hdr.level); |
1715 | dead_hash = be32_to_cpu(dead_node->btree[be16_to_cpu(dead_node->hdr.count) - 1].hashval); | 1715 | dead_hash = be32_to_cpu(dead_node->btree[be16_to_cpu(dead_node->hdr.count) - 1].hashval); |
@@ -1768,8 +1768,8 @@ xfs_da_swap_lastblock(xfs_da_args_t *args, xfs_dablk_t *dead_blknop, | |||
1768 | if ((error = xfs_da_read_buf(tp, ip, par_blkno, -1, &par_buf, w))) | 1768 | if ((error = xfs_da_read_buf(tp, ip, par_blkno, -1, &par_buf, w))) |
1769 | goto done; | 1769 | goto done; |
1770 | par_node = par_buf->data; | 1770 | par_node = par_buf->data; |
1771 | if (unlikely( | 1771 | if (unlikely(par_node->hdr.info.magic != |
1772 | be16_to_cpu(par_node->hdr.info.magic) != XFS_DA_NODE_MAGIC || | 1772 | cpu_to_be16(XFS_DA_NODE_MAGIC) || |
1773 | (level >= 0 && level != be16_to_cpu(par_node->hdr.level) + 1))) { | 1773 | (level >= 0 && level != be16_to_cpu(par_node->hdr.level) + 1))) { |
1774 | XFS_ERROR_REPORT("xfs_da_swap_lastblock(4)", | 1774 | XFS_ERROR_REPORT("xfs_da_swap_lastblock(4)", |
1775 | XFS_ERRLEVEL_LOW, mp); | 1775 | XFS_ERRLEVEL_LOW, mp); |
@@ -1820,7 +1820,7 @@ xfs_da_swap_lastblock(xfs_da_args_t *args, xfs_dablk_t *dead_blknop, | |||
1820 | par_node = par_buf->data; | 1820 | par_node = par_buf->data; |
1821 | if (unlikely( | 1821 | if (unlikely( |
1822 | be16_to_cpu(par_node->hdr.level) != level || | 1822 | be16_to_cpu(par_node->hdr.level) != level || |
1823 | be16_to_cpu(par_node->hdr.info.magic) != XFS_DA_NODE_MAGIC)) { | 1823 | par_node->hdr.info.magic != cpu_to_be16(XFS_DA_NODE_MAGIC))) { |
1824 | XFS_ERROR_REPORT("xfs_da_swap_lastblock(7)", | 1824 | XFS_ERROR_REPORT("xfs_da_swap_lastblock(7)", |
1825 | XFS_ERRLEVEL_LOW, mp); | 1825 | XFS_ERRLEVEL_LOW, mp); |
1826 | error = XFS_ERROR(EFSCORRUPTED); | 1826 | error = XFS_ERROR(EFSCORRUPTED); |
@@ -2093,7 +2093,7 @@ xfs_da_do_buf( | |||
2093 | (magic != XFS_DIR2_LEAFN_MAGIC) && | 2093 | (magic != XFS_DIR2_LEAFN_MAGIC) && |
2094 | (magic1 != XFS_DIR2_BLOCK_MAGIC) && | 2094 | (magic1 != XFS_DIR2_BLOCK_MAGIC) && |
2095 | (magic1 != XFS_DIR2_DATA_MAGIC) && | 2095 | (magic1 != XFS_DIR2_DATA_MAGIC) && |
2096 | (be32_to_cpu(free->hdr.magic) != XFS_DIR2_FREE_MAGIC), | 2096 | (free->hdr.magic != cpu_to_be32(XFS_DIR2_FREE_MAGIC)), |
2097 | mp, XFS_ERRTAG_DA_READ_BUF, | 2097 | mp, XFS_ERRTAG_DA_READ_BUF, |
2098 | XFS_RANDOM_DA_READ_BUF))) { | 2098 | XFS_RANDOM_DA_READ_BUF))) { |
2099 | trace_xfs_da_btree_corrupt(rbp->bps[0], _RET_IP_); | 2099 | trace_xfs_da_btree_corrupt(rbp->bps[0], _RET_IP_); |
diff --git a/fs/xfs/xfs_dir2_block.c b/fs/xfs/xfs_dir2_block.c index c9fdabe5e1ad..70fb0cb6bd69 100644 --- a/fs/xfs/xfs_dir2_block.c +++ b/fs/xfs/xfs_dir2_block.c | |||
@@ -109,7 +109,7 @@ xfs_dir2_block_addname( | |||
109 | /* | 109 | /* |
110 | * Check the magic number, corrupted if wrong. | 110 | * Check the magic number, corrupted if wrong. |
111 | */ | 111 | */ |
112 | if (unlikely(be32_to_cpu(hdr->magic) != XFS_DIR2_BLOCK_MAGIC)) { | 112 | if (unlikely(hdr->magic != cpu_to_be32(XFS_DIR2_BLOCK_MAGIC))) { |
113 | XFS_CORRUPTION_ERROR("xfs_dir2_block_addname", | 113 | XFS_CORRUPTION_ERROR("xfs_dir2_block_addname", |
114 | XFS_ERRLEVEL_LOW, mp, hdr); | 114 | XFS_ERRLEVEL_LOW, mp, hdr); |
115 | xfs_da_brelse(tp, bp); | 115 | xfs_da_brelse(tp, bp); |
@@ -255,7 +255,8 @@ xfs_dir2_block_addname( | |||
255 | highstale = lfloghigh = -1; | 255 | highstale = lfloghigh = -1; |
256 | fromidx >= 0; | 256 | fromidx >= 0; |
257 | fromidx--) { | 257 | fromidx--) { |
258 | if (be32_to_cpu(blp[fromidx].address) == XFS_DIR2_NULL_DATAPTR) { | 258 | if (blp[fromidx].address == |
259 | cpu_to_be32(XFS_DIR2_NULL_DATAPTR)) { | ||
259 | if (highstale == -1) | 260 | if (highstale == -1) |
260 | highstale = toidx; | 261 | highstale = toidx; |
261 | else { | 262 | else { |
@@ -352,12 +353,14 @@ xfs_dir2_block_addname( | |||
352 | else { | 353 | else { |
353 | for (lowstale = mid; | 354 | for (lowstale = mid; |
354 | lowstale >= 0 && | 355 | lowstale >= 0 && |
355 | be32_to_cpu(blp[lowstale].address) != XFS_DIR2_NULL_DATAPTR; | 356 | blp[lowstale].address != |
357 | cpu_to_be32(XFS_DIR2_NULL_DATAPTR); | ||
356 | lowstale--) | 358 | lowstale--) |
357 | continue; | 359 | continue; |
358 | for (highstale = mid + 1; | 360 | for (highstale = mid + 1; |
359 | highstale < be32_to_cpu(btp->count) && | 361 | highstale < be32_to_cpu(btp->count) && |
360 | be32_to_cpu(blp[highstale].address) != XFS_DIR2_NULL_DATAPTR && | 362 | blp[highstale].address != |
363 | cpu_to_be32(XFS_DIR2_NULL_DATAPTR) && | ||
361 | (lowstale < 0 || mid - lowstale > highstale - mid); | 364 | (lowstale < 0 || mid - lowstale > highstale - mid); |
362 | highstale++) | 365 | highstale++) |
363 | continue; | 366 | continue; |
@@ -899,7 +902,7 @@ xfs_dir2_leaf_to_block( | |||
899 | tp = args->trans; | 902 | tp = args->trans; |
900 | mp = dp->i_mount; | 903 | mp = dp->i_mount; |
901 | leaf = lbp->data; | 904 | leaf = lbp->data; |
902 | ASSERT(be16_to_cpu(leaf->hdr.info.magic) == XFS_DIR2_LEAF1_MAGIC); | 905 | ASSERT(leaf->hdr.info.magic == cpu_to_be16(XFS_DIR2_LEAF1_MAGIC)); |
903 | ltp = xfs_dir2_leaf_tail_p(mp, leaf); | 906 | ltp = xfs_dir2_leaf_tail_p(mp, leaf); |
904 | /* | 907 | /* |
905 | * If there are data blocks other than the first one, take this | 908 | * If there are data blocks other than the first one, take this |
@@ -929,7 +932,7 @@ xfs_dir2_leaf_to_block( | |||
929 | goto out; | 932 | goto out; |
930 | } | 933 | } |
931 | hdr = dbp->data; | 934 | hdr = dbp->data; |
932 | ASSERT(be32_to_cpu(hdr->magic) == XFS_DIR2_DATA_MAGIC); | 935 | ASSERT(hdr->magic == cpu_to_be32(XFS_DIR2_DATA_MAGIC)); |
933 | /* | 936 | /* |
934 | * Size of the "leaf" area in the block. | 937 | * Size of the "leaf" area in the block. |
935 | */ | 938 | */ |
@@ -971,7 +974,8 @@ xfs_dir2_leaf_to_block( | |||
971 | */ | 974 | */ |
972 | lep = xfs_dir2_block_leaf_p(btp); | 975 | lep = xfs_dir2_block_leaf_p(btp); |
973 | for (from = to = 0; from < be16_to_cpu(leaf->hdr.count); from++) { | 976 | for (from = to = 0; from < be16_to_cpu(leaf->hdr.count); from++) { |
974 | if (be32_to_cpu(leaf->ents[from].address) == XFS_DIR2_NULL_DATAPTR) | 977 | if (leaf->ents[from].address == |
978 | cpu_to_be32(XFS_DIR2_NULL_DATAPTR)) | ||
975 | continue; | 979 | continue; |
976 | lep[to++] = leaf->ents[from]; | 980 | lep[to++] = leaf->ents[from]; |
977 | } | 981 | } |
diff --git a/fs/xfs/xfs_dir2_data.c b/fs/xfs/xfs_dir2_data.c index 8e47ac3a3b9d..32dca4c531a6 100644 --- a/fs/xfs/xfs_dir2_data.c +++ b/fs/xfs/xfs_dir2_data.c | |||
@@ -73,7 +73,7 @@ xfs_dir2_data_check( | |||
73 | bf = hdr->bestfree; | 73 | bf = hdr->bestfree; |
74 | p = (char *)(hdr + 1); | 74 | p = (char *)(hdr + 1); |
75 | 75 | ||
76 | if (be32_to_cpu(hdr->magic) == XFS_DIR2_BLOCK_MAGIC) { | 76 | if (hdr->magic == cpu_to_be32(XFS_DIR2_BLOCK_MAGIC)) { |
77 | btp = xfs_dir2_block_tail_p(mp, hdr); | 77 | btp = xfs_dir2_block_tail_p(mp, hdr); |
78 | lep = xfs_dir2_block_leaf_p(btp); | 78 | lep = xfs_dir2_block_leaf_p(btp); |
79 | endp = (char *)lep; | 79 | endp = (char *)lep; |
@@ -140,7 +140,7 @@ xfs_dir2_data_check( | |||
140 | (char *)dep - (char *)hdr); | 140 | (char *)dep - (char *)hdr); |
141 | count++; | 141 | count++; |
142 | lastfree = 0; | 142 | lastfree = 0; |
143 | if (be32_to_cpu(hdr->magic) == XFS_DIR2_BLOCK_MAGIC) { | 143 | if (hdr->magic == cpu_to_be32(XFS_DIR2_BLOCK_MAGIC)) { |
144 | addr = xfs_dir2_db_off_to_dataptr(mp, mp->m_dirdatablk, | 144 | addr = xfs_dir2_db_off_to_dataptr(mp, mp->m_dirdatablk, |
145 | (xfs_dir2_data_aoff_t) | 145 | (xfs_dir2_data_aoff_t) |
146 | ((char *)dep - (char *)hdr)); | 146 | ((char *)dep - (char *)hdr)); |
@@ -160,9 +160,10 @@ xfs_dir2_data_check( | |||
160 | * Need to have seen all the entries and all the bestfree slots. | 160 | * Need to have seen all the entries and all the bestfree slots. |
161 | */ | 161 | */ |
162 | ASSERT(freeseen == 7); | 162 | ASSERT(freeseen == 7); |
163 | if (be32_to_cpu(hdr->magic) == XFS_DIR2_BLOCK_MAGIC) { | 163 | if (hdr->magic == cpu_to_be32(XFS_DIR2_BLOCK_MAGIC)) { |
164 | for (i = stale = 0; i < be32_to_cpu(btp->count); i++) { | 164 | for (i = stale = 0; i < be32_to_cpu(btp->count); i++) { |
165 | if (be32_to_cpu(lep[i].address) == XFS_DIR2_NULL_DATAPTR) | 165 | if (lep[i].address == |
166 | cpu_to_be32(XFS_DIR2_NULL_DATAPTR)) | ||
166 | stale++; | 167 | stale++; |
167 | if (i > 0) | 168 | if (i > 0) |
168 | ASSERT(be32_to_cpu(lep[i].hashval) >= be32_to_cpu(lep[i - 1].hashval)); | 169 | ASSERT(be32_to_cpu(lep[i].hashval) >= be32_to_cpu(lep[i - 1].hashval)); |
@@ -196,8 +197,8 @@ xfs_dir2_data_freefind( | |||
196 | * Check order, non-overlapping entries, and if we find the | 197 | * Check order, non-overlapping entries, and if we find the |
197 | * one we're looking for it has to be exact. | 198 | * one we're looking for it has to be exact. |
198 | */ | 199 | */ |
199 | ASSERT(be32_to_cpu(hdr->magic) == XFS_DIR2_DATA_MAGIC || | 200 | ASSERT(hdr->magic == cpu_to_be32(XFS_DIR2_DATA_MAGIC) || |
200 | be32_to_cpu(hdr->magic) == XFS_DIR2_BLOCK_MAGIC); | 201 | hdr->magic == cpu_to_be32(XFS_DIR2_BLOCK_MAGIC)); |
201 | for (dfp = &hdr->bestfree[0], seenzero = matched = 0; | 202 | for (dfp = &hdr->bestfree[0], seenzero = matched = 0; |
202 | dfp < &hdr->bestfree[XFS_DIR2_DATA_FD_COUNT]; | 203 | dfp < &hdr->bestfree[XFS_DIR2_DATA_FD_COUNT]; |
203 | dfp++) { | 204 | dfp++) { |
@@ -256,8 +257,8 @@ xfs_dir2_data_freeinsert( | |||
256 | xfs_dir2_data_free_t new; /* new bestfree entry */ | 257 | xfs_dir2_data_free_t new; /* new bestfree entry */ |
257 | 258 | ||
258 | #ifdef __KERNEL__ | 259 | #ifdef __KERNEL__ |
259 | ASSERT(be32_to_cpu(hdr->magic) == XFS_DIR2_DATA_MAGIC || | 260 | ASSERT(hdr->magic == cpu_to_be32(XFS_DIR2_DATA_MAGIC) || |
260 | be32_to_cpu(hdr->magic) == XFS_DIR2_BLOCK_MAGIC); | 261 | hdr->magic == cpu_to_be32(XFS_DIR2_BLOCK_MAGIC)); |
261 | #endif | 262 | #endif |
262 | dfp = hdr->bestfree; | 263 | dfp = hdr->bestfree; |
263 | new.length = dup->length; | 264 | new.length = dup->length; |
@@ -297,8 +298,8 @@ xfs_dir2_data_freeremove( | |||
297 | int *loghead) /* out: log data header */ | 298 | int *loghead) /* out: log data header */ |
298 | { | 299 | { |
299 | #ifdef __KERNEL__ | 300 | #ifdef __KERNEL__ |
300 | ASSERT(be32_to_cpu(hdr->magic) == XFS_DIR2_DATA_MAGIC || | 301 | ASSERT(hdr->magic == cpu_to_be32(XFS_DIR2_DATA_MAGIC) || |
301 | be32_to_cpu(hdr->magic) == XFS_DIR2_BLOCK_MAGIC); | 302 | hdr->magic == cpu_to_be32(XFS_DIR2_BLOCK_MAGIC)); |
302 | #endif | 303 | #endif |
303 | /* | 304 | /* |
304 | * It's the first entry, slide the next 2 up. | 305 | * It's the first entry, slide the next 2 up. |
@@ -341,8 +342,8 @@ xfs_dir2_data_freescan( | |||
341 | char *p; /* current entry pointer */ | 342 | char *p; /* current entry pointer */ |
342 | 343 | ||
343 | #ifdef __KERNEL__ | 344 | #ifdef __KERNEL__ |
344 | ASSERT(be32_to_cpu(hdr->magic) == XFS_DIR2_DATA_MAGIC || | 345 | ASSERT(hdr->magic == cpu_to_be32(XFS_DIR2_DATA_MAGIC) || |
345 | be32_to_cpu(hdr->magic) == XFS_DIR2_BLOCK_MAGIC); | 346 | hdr->magic == cpu_to_be32(XFS_DIR2_BLOCK_MAGIC)); |
346 | #endif | 347 | #endif |
347 | /* | 348 | /* |
348 | * Start by clearing the table. | 349 | * Start by clearing the table. |
@@ -353,7 +354,7 @@ xfs_dir2_data_freescan( | |||
353 | * Set up pointers. | 354 | * Set up pointers. |
354 | */ | 355 | */ |
355 | p = (char *)(hdr + 1); | 356 | p = (char *)(hdr + 1); |
356 | if (be32_to_cpu(hdr->magic) == XFS_DIR2_BLOCK_MAGIC) { | 357 | if (hdr->magic == cpu_to_be32(XFS_DIR2_BLOCK_MAGIC)) { |
357 | btp = xfs_dir2_block_tail_p(mp, hdr); | 358 | btp = xfs_dir2_block_tail_p(mp, hdr); |
358 | endp = (char *)xfs_dir2_block_leaf_p(btp); | 359 | endp = (char *)xfs_dir2_block_leaf_p(btp); |
359 | } else | 360 | } else |
@@ -458,8 +459,8 @@ xfs_dir2_data_log_entry( | |||
458 | { | 459 | { |
459 | xfs_dir2_data_hdr_t *hdr = bp->data; | 460 | xfs_dir2_data_hdr_t *hdr = bp->data; |
460 | 461 | ||
461 | ASSERT(be32_to_cpu(hdr->magic) == XFS_DIR2_DATA_MAGIC || | 462 | ASSERT(hdr->magic == cpu_to_be32(XFS_DIR2_DATA_MAGIC) || |
462 | be32_to_cpu(hdr->magic) == XFS_DIR2_BLOCK_MAGIC); | 463 | hdr->magic == cpu_to_be32(XFS_DIR2_BLOCK_MAGIC)); |
463 | 464 | ||
464 | xfs_da_log_buf(tp, bp, (uint)((char *)dep - (char *)hdr), | 465 | xfs_da_log_buf(tp, bp, (uint)((char *)dep - (char *)hdr), |
465 | (uint)((char *)(xfs_dir2_data_entry_tag_p(dep) + 1) - | 466 | (uint)((char *)(xfs_dir2_data_entry_tag_p(dep) + 1) - |
@@ -476,8 +477,8 @@ xfs_dir2_data_log_header( | |||
476 | { | 477 | { |
477 | xfs_dir2_data_hdr_t *hdr = bp->data; | 478 | xfs_dir2_data_hdr_t *hdr = bp->data; |
478 | 479 | ||
479 | ASSERT(be32_to_cpu(hdr->magic) == XFS_DIR2_DATA_MAGIC || | 480 | ASSERT(hdr->magic == cpu_to_be32(XFS_DIR2_DATA_MAGIC) || |
480 | be32_to_cpu(hdr->magic) == XFS_DIR2_BLOCK_MAGIC); | 481 | hdr->magic == cpu_to_be32(XFS_DIR2_BLOCK_MAGIC)); |
481 | 482 | ||
482 | xfs_da_log_buf(tp, bp, 0, sizeof(*hdr) - 1); | 483 | xfs_da_log_buf(tp, bp, 0, sizeof(*hdr) - 1); |
483 | } | 484 | } |
@@ -493,8 +494,8 @@ xfs_dir2_data_log_unused( | |||
493 | { | 494 | { |
494 | xfs_dir2_data_hdr_t *hdr = bp->data; | 495 | xfs_dir2_data_hdr_t *hdr = bp->data; |
495 | 496 | ||
496 | ASSERT(be32_to_cpu(hdr->magic) == XFS_DIR2_DATA_MAGIC || | 497 | ASSERT(hdr->magic == cpu_to_be32(XFS_DIR2_DATA_MAGIC) || |
497 | be32_to_cpu(hdr->magic) == XFS_DIR2_BLOCK_MAGIC); | 498 | hdr->magic == cpu_to_be32(XFS_DIR2_BLOCK_MAGIC)); |
498 | 499 | ||
499 | /* | 500 | /* |
500 | * Log the first part of the unused entry. | 501 | * Log the first part of the unused entry. |
@@ -539,12 +540,12 @@ xfs_dir2_data_make_free( | |||
539 | /* | 540 | /* |
540 | * Figure out where the end of the data area is. | 541 | * Figure out where the end of the data area is. |
541 | */ | 542 | */ |
542 | if (be32_to_cpu(hdr->magic) == XFS_DIR2_DATA_MAGIC) | 543 | if (hdr->magic == cpu_to_be32(XFS_DIR2_DATA_MAGIC)) |
543 | endptr = (char *)hdr + mp->m_dirblksize; | 544 | endptr = (char *)hdr + mp->m_dirblksize; |
544 | else { | 545 | else { |
545 | xfs_dir2_block_tail_t *btp; /* block tail */ | 546 | xfs_dir2_block_tail_t *btp; /* block tail */ |
546 | 547 | ||
547 | ASSERT(be32_to_cpu(hdr->magic) == XFS_DIR2_BLOCK_MAGIC); | 548 | ASSERT(hdr->magic == cpu_to_be32(XFS_DIR2_BLOCK_MAGIC)); |
548 | btp = xfs_dir2_block_tail_p(mp, hdr); | 549 | btp = xfs_dir2_block_tail_p(mp, hdr); |
549 | endptr = (char *)xfs_dir2_block_leaf_p(btp); | 550 | endptr = (char *)xfs_dir2_block_leaf_p(btp); |
550 | } | 551 | } |
@@ -717,8 +718,8 @@ xfs_dir2_data_use_free( | |||
717 | int oldlen; /* old unused entry's length */ | 718 | int oldlen; /* old unused entry's length */ |
718 | 719 | ||
719 | hdr = bp->data; | 720 | hdr = bp->data; |
720 | ASSERT(be32_to_cpu(hdr->magic) == XFS_DIR2_DATA_MAGIC || | 721 | ASSERT(hdr->magic == cpu_to_be32(XFS_DIR2_DATA_MAGIC) || |
721 | be32_to_cpu(hdr->magic) == XFS_DIR2_BLOCK_MAGIC); | 722 | hdr->magic == cpu_to_be32(XFS_DIR2_BLOCK_MAGIC)); |
722 | ASSERT(be16_to_cpu(dup->freetag) == XFS_DIR2_DATA_FREE_TAG); | 723 | ASSERT(be16_to_cpu(dup->freetag) == XFS_DIR2_DATA_FREE_TAG); |
723 | ASSERT(offset >= (char *)dup - (char *)hdr); | 724 | ASSERT(offset >= (char *)dup - (char *)hdr); |
724 | ASSERT(offset + len <= (char *)dup + be16_to_cpu(dup->length) - (char *)hdr); | 725 | ASSERT(offset + len <= (char *)dup + be16_to_cpu(dup->length) - (char *)hdr); |
diff --git a/fs/xfs/xfs_dir2_leaf.c b/fs/xfs/xfs_dir2_leaf.c index 5d2651f1c759..d629b888ca28 100644 --- a/fs/xfs/xfs_dir2_leaf.c +++ b/fs/xfs/xfs_dir2_leaf.c | |||
@@ -201,8 +201,8 @@ xfs_dir2_leaf_find_entry( | |||
201 | */ | 201 | */ |
202 | for (lowstale = index - 1; | 202 | for (lowstale = index - 1; |
203 | lowstale >= 0 && | 203 | lowstale >= 0 && |
204 | be32_to_cpu(leaf->ents[lowstale].address) != | 204 | leaf->ents[lowstale].address != |
205 | XFS_DIR2_NULL_DATAPTR; | 205 | cpu_to_be32(XFS_DIR2_NULL_DATAPTR); |
206 | lowstale--) | 206 | lowstale--) |
207 | continue; | 207 | continue; |
208 | 208 | ||
@@ -213,8 +213,8 @@ xfs_dir2_leaf_find_entry( | |||
213 | */ | 213 | */ |
214 | for (highstale = index; | 214 | for (highstale = index; |
215 | highstale < be16_to_cpu(leaf->hdr.count) && | 215 | highstale < be16_to_cpu(leaf->hdr.count) && |
216 | be32_to_cpu(leaf->ents[highstale].address) != | 216 | leaf->ents[highstale].address != |
217 | XFS_DIR2_NULL_DATAPTR && | 217 | cpu_to_be32(XFS_DIR2_NULL_DATAPTR) && |
218 | (lowstale < 0 || | 218 | (lowstale < 0 || |
219 | index - lowstale - 1 >= highstale - index); | 219 | index - lowstale - 1 >= highstale - index); |
220 | highstale++) | 220 | highstale++) |
@@ -228,8 +228,8 @@ xfs_dir2_leaf_find_entry( | |||
228 | (highstale == be16_to_cpu(leaf->hdr.count) || | 228 | (highstale == be16_to_cpu(leaf->hdr.count) || |
229 | index - lowstale - 1 < highstale - index)) { | 229 | index - lowstale - 1 < highstale - index)) { |
230 | ASSERT(index - lowstale - 1 >= 0); | 230 | ASSERT(index - lowstale - 1 >= 0); |
231 | ASSERT(be32_to_cpu(leaf->ents[lowstale].address) == | 231 | ASSERT(leaf->ents[lowstale].address == |
232 | XFS_DIR2_NULL_DATAPTR); | 232 | cpu_to_be32(XFS_DIR2_NULL_DATAPTR)); |
233 | 233 | ||
234 | /* | 234 | /* |
235 | * Copy entries up to cover the stale entry and make room | 235 | * Copy entries up to cover the stale entry and make room |
@@ -251,8 +251,8 @@ xfs_dir2_leaf_find_entry( | |||
251 | * The high one is better, so use that one. | 251 | * The high one is better, so use that one. |
252 | */ | 252 | */ |
253 | ASSERT(highstale - index >= 0); | 253 | ASSERT(highstale - index >= 0); |
254 | ASSERT(be32_to_cpu(leaf->ents[highstale].address) == | 254 | ASSERT(leaf->ents[highstale].address == |
255 | XFS_DIR2_NULL_DATAPTR); | 255 | cpu_to_be32(XFS_DIR2_NULL_DATAPTR)); |
256 | 256 | ||
257 | /* | 257 | /* |
258 | * Copy entries down to cover the stale entry and make room for the | 258 | * Copy entries down to cover the stale entry and make room for the |
@@ -342,7 +342,7 @@ xfs_dir2_leaf_addname( | |||
342 | continue; | 342 | continue; |
343 | i = xfs_dir2_dataptr_to_db(mp, be32_to_cpu(lep->address)); | 343 | i = xfs_dir2_dataptr_to_db(mp, be32_to_cpu(lep->address)); |
344 | ASSERT(i < be32_to_cpu(ltp->bestcount)); | 344 | ASSERT(i < be32_to_cpu(ltp->bestcount)); |
345 | ASSERT(be16_to_cpu(bestsp[i]) != NULLDATAOFF); | 345 | ASSERT(bestsp[i] != cpu_to_be16(NULLDATAOFF)); |
346 | if (be16_to_cpu(bestsp[i]) >= length) { | 346 | if (be16_to_cpu(bestsp[i]) >= length) { |
347 | use_block = i; | 347 | use_block = i; |
348 | break; | 348 | break; |
@@ -356,7 +356,8 @@ xfs_dir2_leaf_addname( | |||
356 | /* | 356 | /* |
357 | * Remember a block we see that's missing. | 357 | * Remember a block we see that's missing. |
358 | */ | 358 | */ |
359 | if (be16_to_cpu(bestsp[i]) == NULLDATAOFF && use_block == -1) | 359 | if (bestsp[i] == cpu_to_be16(NULLDATAOFF) && |
360 | use_block == -1) | ||
360 | use_block = i; | 361 | use_block = i; |
361 | else if (be16_to_cpu(bestsp[i]) >= length) { | 362 | else if (be16_to_cpu(bestsp[i]) >= length) { |
362 | use_block = i; | 363 | use_block = i; |
@@ -377,7 +378,7 @@ xfs_dir2_leaf_addname( | |||
377 | * Now kill use_block if it refers to a missing block, so we | 378 | * Now kill use_block if it refers to a missing block, so we |
378 | * can use it as an indication of allocation needed. | 379 | * can use it as an indication of allocation needed. |
379 | */ | 380 | */ |
380 | if (use_block != -1 && be16_to_cpu(bestsp[use_block]) == NULLDATAOFF) | 381 | if (use_block != -1 && bestsp[use_block] == cpu_to_be16(NULLDATAOFF)) |
381 | use_block = -1; | 382 | use_block = -1; |
382 | /* | 383 | /* |
383 | * If we don't have enough free bytes but we can make enough | 384 | * If we don't have enough free bytes but we can make enough |
@@ -590,7 +591,7 @@ xfs_dir2_leaf_check( | |||
590 | 591 | ||
591 | leaf = bp->data; | 592 | leaf = bp->data; |
592 | mp = dp->i_mount; | 593 | mp = dp->i_mount; |
593 | ASSERT(be16_to_cpu(leaf->hdr.info.magic) == XFS_DIR2_LEAF1_MAGIC); | 594 | ASSERT(leaf->hdr.info.magic == cpu_to_be16(XFS_DIR2_LEAF1_MAGIC)); |
594 | /* | 595 | /* |
595 | * This value is not restrictive enough. | 596 | * This value is not restrictive enough. |
596 | * Should factor in the size of the bests table as well. | 597 | * Should factor in the size of the bests table as well. |
@@ -610,7 +611,7 @@ xfs_dir2_leaf_check( | |||
610 | if (i + 1 < be16_to_cpu(leaf->hdr.count)) | 611 | if (i + 1 < be16_to_cpu(leaf->hdr.count)) |
611 | ASSERT(be32_to_cpu(leaf->ents[i].hashval) <= | 612 | ASSERT(be32_to_cpu(leaf->ents[i].hashval) <= |
612 | be32_to_cpu(leaf->ents[i + 1].hashval)); | 613 | be32_to_cpu(leaf->ents[i + 1].hashval)); |
613 | if (be32_to_cpu(leaf->ents[i].address) == XFS_DIR2_NULL_DATAPTR) | 614 | if (leaf->ents[i].address == cpu_to_be32(XFS_DIR2_NULL_DATAPTR)) |
614 | stale++; | 615 | stale++; |
615 | } | 616 | } |
616 | ASSERT(be16_to_cpu(leaf->hdr.stale) == stale); | 617 | ASSERT(be16_to_cpu(leaf->hdr.stale) == stale); |
@@ -639,7 +640,8 @@ xfs_dir2_leaf_compact( | |||
639 | * Compress out the stale entries in place. | 640 | * Compress out the stale entries in place. |
640 | */ | 641 | */ |
641 | for (from = to = 0, loglow = -1; from < be16_to_cpu(leaf->hdr.count); from++) { | 642 | for (from = to = 0, loglow = -1; from < be16_to_cpu(leaf->hdr.count); from++) { |
642 | if (be32_to_cpu(leaf->ents[from].address) == XFS_DIR2_NULL_DATAPTR) | 643 | if (leaf->ents[from].address == |
644 | cpu_to_be32(XFS_DIR2_NULL_DATAPTR)) | ||
643 | continue; | 645 | continue; |
644 | /* | 646 | /* |
645 | * Only actually copy the entries that are different. | 647 | * Only actually copy the entries that are different. |
@@ -696,7 +698,8 @@ xfs_dir2_leaf_compact_x1( | |||
696 | */ | 698 | */ |
697 | for (lowstale = index - 1; | 699 | for (lowstale = index - 1; |
698 | lowstale >= 0 && | 700 | lowstale >= 0 && |
699 | be32_to_cpu(leaf->ents[lowstale].address) != XFS_DIR2_NULL_DATAPTR; | 701 | leaf->ents[lowstale].address != |
702 | cpu_to_be32(XFS_DIR2_NULL_DATAPTR); | ||
700 | lowstale--) | 703 | lowstale--) |
701 | continue; | 704 | continue; |
702 | /* | 705 | /* |
@@ -705,7 +708,8 @@ xfs_dir2_leaf_compact_x1( | |||
705 | */ | 708 | */ |
706 | for (highstale = index; | 709 | for (highstale = index; |
707 | highstale < be16_to_cpu(leaf->hdr.count) && | 710 | highstale < be16_to_cpu(leaf->hdr.count) && |
708 | be32_to_cpu(leaf->ents[highstale].address) != XFS_DIR2_NULL_DATAPTR && | 711 | leaf->ents[highstale].address != |
712 | cpu_to_be32(XFS_DIR2_NULL_DATAPTR) && | ||
709 | (lowstale < 0 || index - lowstale > highstale - index); | 713 | (lowstale < 0 || index - lowstale > highstale - index); |
710 | highstale++) | 714 | highstale++) |
711 | continue; | 715 | continue; |
@@ -729,7 +733,8 @@ xfs_dir2_leaf_compact_x1( | |||
729 | if (index == from) | 733 | if (index == from) |
730 | newindex = to; | 734 | newindex = to; |
731 | if (from != keepstale && | 735 | if (from != keepstale && |
732 | be32_to_cpu(leaf->ents[from].address) == XFS_DIR2_NULL_DATAPTR) { | 736 | leaf->ents[from].address == |
737 | cpu_to_be32(XFS_DIR2_NULL_DATAPTR)) { | ||
733 | if (from == to) | 738 | if (from == to) |
734 | *lowlogp = to; | 739 | *lowlogp = to; |
735 | continue; | 740 | continue; |
@@ -1207,7 +1212,7 @@ xfs_dir2_leaf_log_bests( | |||
1207 | xfs_dir2_leaf_tail_t *ltp; /* leaf tail structure */ | 1212 | xfs_dir2_leaf_tail_t *ltp; /* leaf tail structure */ |
1208 | 1213 | ||
1209 | leaf = bp->data; | 1214 | leaf = bp->data; |
1210 | ASSERT(be16_to_cpu(leaf->hdr.info.magic) == XFS_DIR2_LEAF1_MAGIC); | 1215 | ASSERT(leaf->hdr.info.magic == cpu_to_be16(XFS_DIR2_LEAF1_MAGIC)); |
1211 | ltp = xfs_dir2_leaf_tail_p(tp->t_mountp, leaf); | 1216 | ltp = xfs_dir2_leaf_tail_p(tp->t_mountp, leaf); |
1212 | firstb = xfs_dir2_leaf_bests_p(ltp) + first; | 1217 | firstb = xfs_dir2_leaf_bests_p(ltp) + first; |
1213 | lastb = xfs_dir2_leaf_bests_p(ltp) + last; | 1218 | lastb = xfs_dir2_leaf_bests_p(ltp) + last; |
@@ -1230,8 +1235,8 @@ xfs_dir2_leaf_log_ents( | |||
1230 | xfs_dir2_leaf_t *leaf; /* leaf structure */ | 1235 | xfs_dir2_leaf_t *leaf; /* leaf structure */ |
1231 | 1236 | ||
1232 | leaf = bp->data; | 1237 | leaf = bp->data; |
1233 | ASSERT(be16_to_cpu(leaf->hdr.info.magic) == XFS_DIR2_LEAF1_MAGIC || | 1238 | ASSERT(leaf->hdr.info.magic == cpu_to_be16(XFS_DIR2_LEAF1_MAGIC) || |
1234 | be16_to_cpu(leaf->hdr.info.magic) == XFS_DIR2_LEAFN_MAGIC); | 1239 | leaf->hdr.info.magic == cpu_to_be16(XFS_DIR2_LEAFN_MAGIC)); |
1235 | firstlep = &leaf->ents[first]; | 1240 | firstlep = &leaf->ents[first]; |
1236 | lastlep = &leaf->ents[last]; | 1241 | lastlep = &leaf->ents[last]; |
1237 | xfs_da_log_buf(tp, bp, (uint)((char *)firstlep - (char *)leaf), | 1242 | xfs_da_log_buf(tp, bp, (uint)((char *)firstlep - (char *)leaf), |
@@ -1249,8 +1254,8 @@ xfs_dir2_leaf_log_header( | |||
1249 | xfs_dir2_leaf_t *leaf; /* leaf structure */ | 1254 | xfs_dir2_leaf_t *leaf; /* leaf structure */ |
1250 | 1255 | ||
1251 | leaf = bp->data; | 1256 | leaf = bp->data; |
1252 | ASSERT(be16_to_cpu(leaf->hdr.info.magic) == XFS_DIR2_LEAF1_MAGIC || | 1257 | ASSERT(leaf->hdr.info.magic == cpu_to_be16(XFS_DIR2_LEAF1_MAGIC) || |
1253 | be16_to_cpu(leaf->hdr.info.magic) == XFS_DIR2_LEAFN_MAGIC); | 1258 | leaf->hdr.info.magic == cpu_to_be16(XFS_DIR2_LEAFN_MAGIC)); |
1254 | xfs_da_log_buf(tp, bp, (uint)((char *)&leaf->hdr - (char *)leaf), | 1259 | xfs_da_log_buf(tp, bp, (uint)((char *)&leaf->hdr - (char *)leaf), |
1255 | (uint)(sizeof(leaf->hdr) - 1)); | 1260 | (uint)(sizeof(leaf->hdr) - 1)); |
1256 | } | 1261 | } |
@@ -1269,7 +1274,7 @@ xfs_dir2_leaf_log_tail( | |||
1269 | 1274 | ||
1270 | mp = tp->t_mountp; | 1275 | mp = tp->t_mountp; |
1271 | leaf = bp->data; | 1276 | leaf = bp->data; |
1272 | ASSERT(be16_to_cpu(leaf->hdr.info.magic) == XFS_DIR2_LEAF1_MAGIC); | 1277 | ASSERT(leaf->hdr.info.magic == cpu_to_be16(XFS_DIR2_LEAF1_MAGIC)); |
1273 | ltp = xfs_dir2_leaf_tail_p(mp, leaf); | 1278 | ltp = xfs_dir2_leaf_tail_p(mp, leaf); |
1274 | xfs_da_log_buf(tp, bp, (uint)((char *)ltp - (char *)leaf), | 1279 | xfs_da_log_buf(tp, bp, (uint)((char *)ltp - (char *)leaf), |
1275 | (uint)(mp->m_dirblksize - 1)); | 1280 | (uint)(mp->m_dirblksize - 1)); |
@@ -1570,7 +1575,7 @@ xfs_dir2_leaf_removename( | |||
1570 | * Look for the last active entry (i). | 1575 | * Look for the last active entry (i). |
1571 | */ | 1576 | */ |
1572 | for (i = db - 1; i > 0; i--) { | 1577 | for (i = db - 1; i > 0; i--) { |
1573 | if (be16_to_cpu(bestsp[i]) != NULLDATAOFF) | 1578 | if (bestsp[i] != cpu_to_be16(NULLDATAOFF)) |
1574 | break; | 1579 | break; |
1575 | } | 1580 | } |
1576 | /* | 1581 | /* |
@@ -1740,7 +1745,7 @@ xfs_dir2_leaf_trim_data( | |||
1740 | { | 1745 | { |
1741 | struct xfs_dir2_data_hdr *hdr = dbp->data; | 1746 | struct xfs_dir2_data_hdr *hdr = dbp->data; |
1742 | 1747 | ||
1743 | ASSERT(be32_to_cpu(hdr->magic) == XFS_DIR2_DATA_MAGIC); | 1748 | ASSERT(hdr->magic == cpu_to_be32(XFS_DIR2_DATA_MAGIC)); |
1744 | ASSERT(be16_to_cpu(hdr->bestfree[0].length) == | 1749 | ASSERT(be16_to_cpu(hdr->bestfree[0].length) == |
1745 | mp->m_dirblksize - (uint)sizeof(*hdr)); | 1750 | mp->m_dirblksize - (uint)sizeof(*hdr)); |
1746 | ASSERT(db == be32_to_cpu(ltp->bestcount) - 1); | 1751 | ASSERT(db == be32_to_cpu(ltp->bestcount) - 1); |
@@ -1850,7 +1855,7 @@ xfs_dir2_node_to_leaf( | |||
1850 | return 0; | 1855 | return 0; |
1851 | lbp = state->path.blk[0].bp; | 1856 | lbp = state->path.blk[0].bp; |
1852 | leaf = lbp->data; | 1857 | leaf = lbp->data; |
1853 | ASSERT(be16_to_cpu(leaf->hdr.info.magic) == XFS_DIR2_LEAFN_MAGIC); | 1858 | ASSERT(leaf->hdr.info.magic == cpu_to_be16(XFS_DIR2_LEAFN_MAGIC)); |
1854 | /* | 1859 | /* |
1855 | * Read the freespace block. | 1860 | * Read the freespace block. |
1856 | */ | 1861 | */ |
@@ -1859,7 +1864,7 @@ xfs_dir2_node_to_leaf( | |||
1859 | return error; | 1864 | return error; |
1860 | } | 1865 | } |
1861 | free = fbp->data; | 1866 | free = fbp->data; |
1862 | ASSERT(be32_to_cpu(free->hdr.magic) == XFS_DIR2_FREE_MAGIC); | 1867 | ASSERT(free->hdr.magic == cpu_to_be32(XFS_DIR2_FREE_MAGIC)); |
1863 | ASSERT(!free->hdr.firstdb); | 1868 | ASSERT(!free->hdr.firstdb); |
1864 | 1869 | ||
1865 | /* | 1870 | /* |
diff --git a/fs/xfs/xfs_dir2_node.c b/fs/xfs/xfs_dir2_node.c index 8d4b54c1bedb..14571cdeb33f 100644 --- a/fs/xfs/xfs_dir2_node.c +++ b/fs/xfs/xfs_dir2_node.c | |||
@@ -73,7 +73,7 @@ xfs_dir2_free_log_bests( | |||
73 | xfs_dir2_free_t *free; /* freespace structure */ | 73 | xfs_dir2_free_t *free; /* freespace structure */ |
74 | 74 | ||
75 | free = bp->data; | 75 | free = bp->data; |
76 | ASSERT(be32_to_cpu(free->hdr.magic) == XFS_DIR2_FREE_MAGIC); | 76 | ASSERT(free->hdr.magic == cpu_to_be32(XFS_DIR2_FREE_MAGIC)); |
77 | xfs_da_log_buf(tp, bp, | 77 | xfs_da_log_buf(tp, bp, |
78 | (uint)((char *)&free->bests[first] - (char *)free), | 78 | (uint)((char *)&free->bests[first] - (char *)free), |
79 | (uint)((char *)&free->bests[last] - (char *)free + | 79 | (uint)((char *)&free->bests[last] - (char *)free + |
@@ -91,7 +91,7 @@ xfs_dir2_free_log_header( | |||
91 | xfs_dir2_free_t *free; /* freespace structure */ | 91 | xfs_dir2_free_t *free; /* freespace structure */ |
92 | 92 | ||
93 | free = bp->data; | 93 | free = bp->data; |
94 | ASSERT(be32_to_cpu(free->hdr.magic) == XFS_DIR2_FREE_MAGIC); | 94 | ASSERT(free->hdr.magic == cpu_to_be32(XFS_DIR2_FREE_MAGIC)); |
95 | xfs_da_log_buf(tp, bp, (uint)((char *)&free->hdr - (char *)free), | 95 | xfs_da_log_buf(tp, bp, (uint)((char *)&free->hdr - (char *)free), |
96 | (uint)(sizeof(xfs_dir2_free_hdr_t) - 1)); | 96 | (uint)(sizeof(xfs_dir2_free_hdr_t) - 1)); |
97 | } | 97 | } |
@@ -276,14 +276,14 @@ xfs_dir2_leafn_check( | |||
276 | 276 | ||
277 | leaf = bp->data; | 277 | leaf = bp->data; |
278 | mp = dp->i_mount; | 278 | mp = dp->i_mount; |
279 | ASSERT(be16_to_cpu(leaf->hdr.info.magic) == XFS_DIR2_LEAFN_MAGIC); | 279 | ASSERT(leaf->hdr.info.magic == cpu_to_be16(XFS_DIR2_LEAFN_MAGIC)); |
280 | ASSERT(be16_to_cpu(leaf->hdr.count) <= xfs_dir2_max_leaf_ents(mp)); | 280 | ASSERT(be16_to_cpu(leaf->hdr.count) <= xfs_dir2_max_leaf_ents(mp)); |
281 | for (i = stale = 0; i < be16_to_cpu(leaf->hdr.count); i++) { | 281 | for (i = stale = 0; i < be16_to_cpu(leaf->hdr.count); i++) { |
282 | if (i + 1 < be16_to_cpu(leaf->hdr.count)) { | 282 | if (i + 1 < be16_to_cpu(leaf->hdr.count)) { |
283 | ASSERT(be32_to_cpu(leaf->ents[i].hashval) <= | 283 | ASSERT(be32_to_cpu(leaf->ents[i].hashval) <= |
284 | be32_to_cpu(leaf->ents[i + 1].hashval)); | 284 | be32_to_cpu(leaf->ents[i + 1].hashval)); |
285 | } | 285 | } |
286 | if (be32_to_cpu(leaf->ents[i].address) == XFS_DIR2_NULL_DATAPTR) | 286 | if (leaf->ents[i].address == cpu_to_be32(XFS_DIR2_NULL_DATAPTR)) |
287 | stale++; | 287 | stale++; |
288 | } | 288 | } |
289 | ASSERT(be16_to_cpu(leaf->hdr.stale) == stale); | 289 | ASSERT(be16_to_cpu(leaf->hdr.stale) == stale); |
@@ -302,7 +302,7 @@ xfs_dir2_leafn_lasthash( | |||
302 | xfs_dir2_leaf_t *leaf; /* leaf structure */ | 302 | xfs_dir2_leaf_t *leaf; /* leaf structure */ |
303 | 303 | ||
304 | leaf = bp->data; | 304 | leaf = bp->data; |
305 | ASSERT(be16_to_cpu(leaf->hdr.info.magic) == XFS_DIR2_LEAFN_MAGIC); | 305 | ASSERT(leaf->hdr.info.magic == cpu_to_be16(XFS_DIR2_LEAFN_MAGIC)); |
306 | if (count) | 306 | if (count) |
307 | *count = be16_to_cpu(leaf->hdr.count); | 307 | *count = be16_to_cpu(leaf->hdr.count); |
308 | if (!leaf->hdr.count) | 308 | if (!leaf->hdr.count) |
@@ -341,7 +341,7 @@ xfs_dir2_leafn_lookup_for_addname( | |||
341 | tp = args->trans; | 341 | tp = args->trans; |
342 | mp = dp->i_mount; | 342 | mp = dp->i_mount; |
343 | leaf = bp->data; | 343 | leaf = bp->data; |
344 | ASSERT(be16_to_cpu(leaf->hdr.info.magic) == XFS_DIR2_LEAFN_MAGIC); | 344 | ASSERT(leaf->hdr.info.magic == cpu_to_be16(XFS_DIR2_LEAFN_MAGIC)); |
345 | #ifdef __KERNEL__ | 345 | #ifdef __KERNEL__ |
346 | ASSERT(be16_to_cpu(leaf->hdr.count) > 0); | 346 | ASSERT(be16_to_cpu(leaf->hdr.count) > 0); |
347 | #endif | 347 | #endif |
@@ -358,7 +358,7 @@ xfs_dir2_leafn_lookup_for_addname( | |||
358 | curbp = state->extrablk.bp; | 358 | curbp = state->extrablk.bp; |
359 | curfdb = state->extrablk.blkno; | 359 | curfdb = state->extrablk.blkno; |
360 | free = curbp->data; | 360 | free = curbp->data; |
361 | ASSERT(be32_to_cpu(free->hdr.magic) == XFS_DIR2_FREE_MAGIC); | 361 | ASSERT(free->hdr.magic == cpu_to_be32(XFS_DIR2_FREE_MAGIC)); |
362 | } | 362 | } |
363 | length = xfs_dir2_data_entsize(args->namelen); | 363 | length = xfs_dir2_data_entsize(args->namelen); |
364 | /* | 364 | /* |
@@ -424,7 +424,8 @@ xfs_dir2_leafn_lookup_for_addname( | |||
424 | /* | 424 | /* |
425 | * If it has room, return it. | 425 | * If it has room, return it. |
426 | */ | 426 | */ |
427 | if (unlikely(be16_to_cpu(free->bests[fi]) == NULLDATAOFF)) { | 427 | if (unlikely(free->bests[fi] == |
428 | cpu_to_be16(NULLDATAOFF))) { | ||
428 | XFS_ERROR_REPORT("xfs_dir2_leafn_lookup_int", | 429 | XFS_ERROR_REPORT("xfs_dir2_leafn_lookup_int", |
429 | XFS_ERRLEVEL_LOW, mp); | 430 | XFS_ERRLEVEL_LOW, mp); |
430 | if (curfdb != newfdb) | 431 | if (curfdb != newfdb) |
@@ -485,7 +486,7 @@ xfs_dir2_leafn_lookup_for_entry( | |||
485 | tp = args->trans; | 486 | tp = args->trans; |
486 | mp = dp->i_mount; | 487 | mp = dp->i_mount; |
487 | leaf = bp->data; | 488 | leaf = bp->data; |
488 | ASSERT(be16_to_cpu(leaf->hdr.info.magic) == XFS_DIR2_LEAFN_MAGIC); | 489 | ASSERT(leaf->hdr.info.magic == cpu_to_be16(XFS_DIR2_LEAFN_MAGIC)); |
489 | #ifdef __KERNEL__ | 490 | #ifdef __KERNEL__ |
490 | ASSERT(be16_to_cpu(leaf->hdr.count) > 0); | 491 | ASSERT(be16_to_cpu(leaf->hdr.count) > 0); |
491 | #endif | 492 | #endif |
@@ -666,7 +667,8 @@ xfs_dir2_leafn_moveents( | |||
666 | int i; /* temp leaf index */ | 667 | int i; /* temp leaf index */ |
667 | 668 | ||
668 | for (i = start_s, stale = 0; i < start_s + count; i++) { | 669 | for (i = start_s, stale = 0; i < start_s + count; i++) { |
669 | if (be32_to_cpu(leaf_s->ents[i].address) == XFS_DIR2_NULL_DATAPTR) | 670 | if (leaf_s->ents[i].address == |
671 | cpu_to_be32(XFS_DIR2_NULL_DATAPTR)) | ||
670 | stale++; | 672 | stale++; |
671 | } | 673 | } |
672 | } else | 674 | } else |
@@ -713,8 +715,8 @@ xfs_dir2_leafn_order( | |||
713 | 715 | ||
714 | leaf1 = leaf1_bp->data; | 716 | leaf1 = leaf1_bp->data; |
715 | leaf2 = leaf2_bp->data; | 717 | leaf2 = leaf2_bp->data; |
716 | ASSERT(be16_to_cpu(leaf1->hdr.info.magic) == XFS_DIR2_LEAFN_MAGIC); | 718 | ASSERT(leaf1->hdr.info.magic == cpu_to_be16(XFS_DIR2_LEAFN_MAGIC)); |
717 | ASSERT(be16_to_cpu(leaf2->hdr.info.magic) == XFS_DIR2_LEAFN_MAGIC); | 719 | ASSERT(leaf2->hdr.info.magic == cpu_to_be16(XFS_DIR2_LEAFN_MAGIC)); |
718 | if (be16_to_cpu(leaf1->hdr.count) > 0 && | 720 | if (be16_to_cpu(leaf1->hdr.count) > 0 && |
719 | be16_to_cpu(leaf2->hdr.count) > 0 && | 721 | be16_to_cpu(leaf2->hdr.count) > 0 && |
720 | (be32_to_cpu(leaf2->ents[0].hashval) < be32_to_cpu(leaf1->ents[0].hashval) || | 722 | (be32_to_cpu(leaf2->ents[0].hashval) < be32_to_cpu(leaf1->ents[0].hashval) || |
@@ -862,7 +864,7 @@ xfs_dir2_leafn_remove( | |||
862 | tp = args->trans; | 864 | tp = args->trans; |
863 | mp = dp->i_mount; | 865 | mp = dp->i_mount; |
864 | leaf = bp->data; | 866 | leaf = bp->data; |
865 | ASSERT(be16_to_cpu(leaf->hdr.info.magic) == XFS_DIR2_LEAFN_MAGIC); | 867 | ASSERT(leaf->hdr.info.magic == cpu_to_be16(XFS_DIR2_LEAFN_MAGIC)); |
866 | /* | 868 | /* |
867 | * Point to the entry we're removing. | 869 | * Point to the entry we're removing. |
868 | */ | 870 | */ |
@@ -924,7 +926,7 @@ xfs_dir2_leafn_remove( | |||
924 | return error; | 926 | return error; |
925 | } | 927 | } |
926 | free = fbp->data; | 928 | free = fbp->data; |
927 | ASSERT(be32_to_cpu(free->hdr.magic) == XFS_DIR2_FREE_MAGIC); | 929 | ASSERT(free->hdr.magic == cpu_to_be32(XFS_DIR2_FREE_MAGIC)); |
928 | ASSERT(be32_to_cpu(free->hdr.firstdb) == | 930 | ASSERT(be32_to_cpu(free->hdr.firstdb) == |
929 | XFS_DIR2_MAX_FREE_BESTS(mp) * | 931 | XFS_DIR2_MAX_FREE_BESTS(mp) * |
930 | (fdb - XFS_DIR2_FREE_FIRSTDB(mp))); | 932 | (fdb - XFS_DIR2_FREE_FIRSTDB(mp))); |
@@ -976,7 +978,8 @@ xfs_dir2_leafn_remove( | |||
976 | int i; /* free entry index */ | 978 | int i; /* free entry index */ |
977 | 979 | ||
978 | for (i = findex - 1; | 980 | for (i = findex - 1; |
979 | i >= 0 && be16_to_cpu(free->bests[i]) == NULLDATAOFF; | 981 | i >= 0 && |
982 | free->bests[i] == cpu_to_be16(NULLDATAOFF); | ||
980 | i--) | 983 | i--) |
981 | continue; | 984 | continue; |
982 | free->hdr.nvalid = cpu_to_be32(i + 1); | 985 | free->hdr.nvalid = cpu_to_be32(i + 1); |
@@ -1133,7 +1136,7 @@ xfs_dir2_leafn_toosmall( | |||
1133 | */ | 1136 | */ |
1134 | blk = &state->path.blk[state->path.active - 1]; | 1137 | blk = &state->path.blk[state->path.active - 1]; |
1135 | info = blk->bp->data; | 1138 | info = blk->bp->data; |
1136 | ASSERT(be16_to_cpu(info->magic) == XFS_DIR2_LEAFN_MAGIC); | 1139 | ASSERT(info->magic == cpu_to_be16(XFS_DIR2_LEAFN_MAGIC)); |
1137 | leaf = (xfs_dir2_leaf_t *)info; | 1140 | leaf = (xfs_dir2_leaf_t *)info; |
1138 | count = be16_to_cpu(leaf->hdr.count) - be16_to_cpu(leaf->hdr.stale); | 1141 | count = be16_to_cpu(leaf->hdr.count) - be16_to_cpu(leaf->hdr.stale); |
1139 | bytes = (uint)sizeof(leaf->hdr) + count * (uint)sizeof(leaf->ents[0]); | 1142 | bytes = (uint)sizeof(leaf->hdr) + count * (uint)sizeof(leaf->ents[0]); |
@@ -1192,7 +1195,7 @@ xfs_dir2_leafn_toosmall( | |||
1192 | count = be16_to_cpu(leaf->hdr.count) - be16_to_cpu(leaf->hdr.stale); | 1195 | count = be16_to_cpu(leaf->hdr.count) - be16_to_cpu(leaf->hdr.stale); |
1193 | bytes = state->blocksize - (state->blocksize >> 2); | 1196 | bytes = state->blocksize - (state->blocksize >> 2); |
1194 | leaf = bp->data; | 1197 | leaf = bp->data; |
1195 | ASSERT(be16_to_cpu(leaf->hdr.info.magic) == XFS_DIR2_LEAFN_MAGIC); | 1198 | ASSERT(leaf->hdr.info.magic == cpu_to_be16(XFS_DIR2_LEAFN_MAGIC)); |
1196 | count += be16_to_cpu(leaf->hdr.count) - be16_to_cpu(leaf->hdr.stale); | 1199 | count += be16_to_cpu(leaf->hdr.count) - be16_to_cpu(leaf->hdr.stale); |
1197 | bytes -= count * (uint)sizeof(leaf->ents[0]); | 1200 | bytes -= count * (uint)sizeof(leaf->ents[0]); |
1198 | /* | 1201 | /* |
@@ -1251,8 +1254,8 @@ xfs_dir2_leafn_unbalance( | |||
1251 | ASSERT(save_blk->magic == XFS_DIR2_LEAFN_MAGIC); | 1254 | ASSERT(save_blk->magic == XFS_DIR2_LEAFN_MAGIC); |
1252 | drop_leaf = drop_blk->bp->data; | 1255 | drop_leaf = drop_blk->bp->data; |
1253 | save_leaf = save_blk->bp->data; | 1256 | save_leaf = save_blk->bp->data; |
1254 | ASSERT(be16_to_cpu(drop_leaf->hdr.info.magic) == XFS_DIR2_LEAFN_MAGIC); | 1257 | ASSERT(drop_leaf->hdr.info.magic == cpu_to_be16(XFS_DIR2_LEAFN_MAGIC)); |
1255 | ASSERT(be16_to_cpu(save_leaf->hdr.info.magic) == XFS_DIR2_LEAFN_MAGIC); | 1258 | ASSERT(save_leaf->hdr.info.magic == cpu_to_be16(XFS_DIR2_LEAFN_MAGIC)); |
1256 | /* | 1259 | /* |
1257 | * If there are any stale leaf entries, take this opportunity | 1260 | * If there are any stale leaf entries, take this opportunity |
1258 | * to purge them. | 1261 | * to purge them. |
@@ -1393,7 +1396,7 @@ xfs_dir2_node_addname_int( | |||
1393 | */ | 1396 | */ |
1394 | ifbno = fblk->blkno; | 1397 | ifbno = fblk->blkno; |
1395 | free = fbp->data; | 1398 | free = fbp->data; |
1396 | ASSERT(be32_to_cpu(free->hdr.magic) == XFS_DIR2_FREE_MAGIC); | 1399 | ASSERT(free->hdr.magic == cpu_to_be32(XFS_DIR2_FREE_MAGIC)); |
1397 | findex = fblk->index; | 1400 | findex = fblk->index; |
1398 | /* | 1401 | /* |
1399 | * This means the free entry showed that the data block had | 1402 | * This means the free entry showed that the data block had |
@@ -1477,7 +1480,7 @@ xfs_dir2_node_addname_int( | |||
1477 | continue; | 1480 | continue; |
1478 | } | 1481 | } |
1479 | free = fbp->data; | 1482 | free = fbp->data; |
1480 | ASSERT(be32_to_cpu(free->hdr.magic) == XFS_DIR2_FREE_MAGIC); | 1483 | ASSERT(free->hdr.magic == cpu_to_be32(XFS_DIR2_FREE_MAGIC)); |
1481 | findex = 0; | 1484 | findex = 0; |
1482 | } | 1485 | } |
1483 | /* | 1486 | /* |
@@ -1609,7 +1612,7 @@ xfs_dir2_node_addname_int( | |||
1609 | free->hdr.nused = 0; | 1612 | free->hdr.nused = 0; |
1610 | } else { | 1613 | } else { |
1611 | free = fbp->data; | 1614 | free = fbp->data; |
1612 | ASSERT(be32_to_cpu(free->hdr.magic) == XFS_DIR2_FREE_MAGIC); | 1615 | ASSERT(free->hdr.magic == cpu_to_be32(XFS_DIR2_FREE_MAGIC)); |
1613 | } | 1616 | } |
1614 | 1617 | ||
1615 | /* | 1618 | /* |
@@ -1632,7 +1635,7 @@ xfs_dir2_node_addname_int( | |||
1632 | * If this entry was for an empty data block | 1635 | * If this entry was for an empty data block |
1633 | * (this should always be true) then update the header. | 1636 | * (this should always be true) then update the header. |
1634 | */ | 1637 | */ |
1635 | if (be16_to_cpu(free->bests[findex]) == NULLDATAOFF) { | 1638 | if (free->bests[findex] == cpu_to_be16(NULLDATAOFF)) { |
1636 | be32_add_cpu(&free->hdr.nused, 1); | 1639 | be32_add_cpu(&free->hdr.nused, 1); |
1637 | xfs_dir2_free_log_header(tp, fbp); | 1640 | xfs_dir2_free_log_header(tp, fbp); |
1638 | } | 1641 | } |
@@ -1902,7 +1905,7 @@ xfs_dir2_node_replace( | |||
1902 | * Point to the data entry. | 1905 | * Point to the data entry. |
1903 | */ | 1906 | */ |
1904 | hdr = state->extrablk.bp->data; | 1907 | hdr = state->extrablk.bp->data; |
1905 | ASSERT(be32_to_cpu(hdr->magic) == XFS_DIR2_DATA_MAGIC); | 1908 | ASSERT(hdr->magic == cpu_to_be32(XFS_DIR2_DATA_MAGIC)); |
1906 | dep = (xfs_dir2_data_entry_t *) | 1909 | dep = (xfs_dir2_data_entry_t *) |
1907 | ((char *)hdr + | 1910 | ((char *)hdr + |
1908 | xfs_dir2_dataptr_to_off(state->mp, be32_to_cpu(lep->address))); | 1911 | xfs_dir2_dataptr_to_off(state->mp, be32_to_cpu(lep->address))); |
@@ -1968,7 +1971,7 @@ xfs_dir2_node_trim_free( | |||
1968 | return 0; | 1971 | return 0; |
1969 | } | 1972 | } |
1970 | free = bp->data; | 1973 | free = bp->data; |
1971 | ASSERT(be32_to_cpu(free->hdr.magic) == XFS_DIR2_FREE_MAGIC); | 1974 | ASSERT(free->hdr.magic == cpu_to_be32(XFS_DIR2_FREE_MAGIC)); |
1972 | /* | 1975 | /* |
1973 | * If there are used entries, there's nothing to do. | 1976 | * If there are used entries, there's nothing to do. |
1974 | */ | 1977 | */ |
diff --git a/fs/xfs/xfs_ialloc.c b/fs/xfs/xfs_ialloc.c index 84ebeec16642..dd5628bd8d0b 100644 --- a/fs/xfs/xfs_ialloc.c +++ b/fs/xfs/xfs_ialloc.c | |||
@@ -683,7 +683,7 @@ xfs_dialloc( | |||
683 | return 0; | 683 | return 0; |
684 | } | 684 | } |
685 | agi = XFS_BUF_TO_AGI(agbp); | 685 | agi = XFS_BUF_TO_AGI(agbp); |
686 | ASSERT(be32_to_cpu(agi->agi_magicnum) == XFS_AGI_MAGIC); | 686 | ASSERT(agi->agi_magicnum == cpu_to_be32(XFS_AGI_MAGIC)); |
687 | } else { | 687 | } else { |
688 | /* | 688 | /* |
689 | * Continue where we left off before. In this case, we | 689 | * Continue where we left off before. In this case, we |
@@ -691,7 +691,7 @@ xfs_dialloc( | |||
691 | */ | 691 | */ |
692 | agbp = *IO_agbp; | 692 | agbp = *IO_agbp; |
693 | agi = XFS_BUF_TO_AGI(agbp); | 693 | agi = XFS_BUF_TO_AGI(agbp); |
694 | ASSERT(be32_to_cpu(agi->agi_magicnum) == XFS_AGI_MAGIC); | 694 | ASSERT(agi->agi_magicnum == cpu_to_be32(XFS_AGI_MAGIC)); |
695 | ASSERT(be32_to_cpu(agi->agi_freecount) > 0); | 695 | ASSERT(be32_to_cpu(agi->agi_freecount) > 0); |
696 | } | 696 | } |
697 | mp = tp->t_mountp; | 697 | mp = tp->t_mountp; |
@@ -775,7 +775,7 @@ nextag: | |||
775 | if (error) | 775 | if (error) |
776 | goto nextag; | 776 | goto nextag; |
777 | agi = XFS_BUF_TO_AGI(agbp); | 777 | agi = XFS_BUF_TO_AGI(agbp); |
778 | ASSERT(be32_to_cpu(agi->agi_magicnum) == XFS_AGI_MAGIC); | 778 | ASSERT(agi->agi_magicnum == cpu_to_be32(XFS_AGI_MAGIC)); |
779 | } | 779 | } |
780 | /* | 780 | /* |
781 | * Here with an allocation group that has a free inode. | 781 | * Here with an allocation group that has a free inode. |
@@ -944,7 +944,7 @@ nextag: | |||
944 | * See if the most recently allocated block has any free. | 944 | * See if the most recently allocated block has any free. |
945 | */ | 945 | */ |
946 | newino: | 946 | newino: |
947 | if (be32_to_cpu(agi->agi_newino) != NULLAGINO) { | 947 | if (agi->agi_newino != cpu_to_be32(NULLAGINO)) { |
948 | error = xfs_inobt_lookup(cur, be32_to_cpu(agi->agi_newino), | 948 | error = xfs_inobt_lookup(cur, be32_to_cpu(agi->agi_newino), |
949 | XFS_LOOKUP_EQ, &i); | 949 | XFS_LOOKUP_EQ, &i); |
950 | if (error) | 950 | if (error) |
@@ -1085,7 +1085,7 @@ xfs_difree( | |||
1085 | return error; | 1085 | return error; |
1086 | } | 1086 | } |
1087 | agi = XFS_BUF_TO_AGI(agbp); | 1087 | agi = XFS_BUF_TO_AGI(agbp); |
1088 | ASSERT(be32_to_cpu(agi->agi_magicnum) == XFS_AGI_MAGIC); | 1088 | ASSERT(agi->agi_magicnum == cpu_to_be32(XFS_AGI_MAGIC)); |
1089 | ASSERT(agbno < be32_to_cpu(agi->agi_length)); | 1089 | ASSERT(agbno < be32_to_cpu(agi->agi_length)); |
1090 | /* | 1090 | /* |
1091 | * Initialize the cursor. | 1091 | * Initialize the cursor. |
@@ -1438,7 +1438,7 @@ xfs_ialloc_log_agi( | |||
1438 | xfs_agi_t *agi; /* allocation group header */ | 1438 | xfs_agi_t *agi; /* allocation group header */ |
1439 | 1439 | ||
1440 | agi = XFS_BUF_TO_AGI(bp); | 1440 | agi = XFS_BUF_TO_AGI(bp); |
1441 | ASSERT(be32_to_cpu(agi->agi_magicnum) == XFS_AGI_MAGIC); | 1441 | ASSERT(agi->agi_magicnum == cpu_to_be32(XFS_AGI_MAGIC)); |
1442 | #endif | 1442 | #endif |
1443 | /* | 1443 | /* |
1444 | * Compute byte offsets for the first and last fields. | 1444 | * Compute byte offsets for the first and last fields. |
@@ -1492,7 +1492,7 @@ xfs_read_agi( | |||
1492 | /* | 1492 | /* |
1493 | * Validate the magic number of the agi block. | 1493 | * Validate the magic number of the agi block. |
1494 | */ | 1494 | */ |
1495 | agi_ok = be32_to_cpu(agi->agi_magicnum) == XFS_AGI_MAGIC && | 1495 | agi_ok = agi->agi_magicnum == cpu_to_be32(XFS_AGI_MAGIC) && |
1496 | XFS_AGI_GOOD_VERSION(be32_to_cpu(agi->agi_versionnum)) && | 1496 | XFS_AGI_GOOD_VERSION(be32_to_cpu(agi->agi_versionnum)) && |
1497 | be32_to_cpu(agi->agi_seqno) == agno; | 1497 | be32_to_cpu(agi->agi_seqno) == agno; |
1498 | if (unlikely(XFS_TEST_ERROR(!agi_ok, mp, XFS_ERRTAG_IALLOC_READ_AGI, | 1498 | if (unlikely(XFS_TEST_ERROR(!agi_ok, mp, XFS_ERRTAG_IALLOC_READ_AGI, |
diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c index db310f8fb76a..d04ea6a2dfaf 100644 --- a/fs/xfs/xfs_inode.c +++ b/fs/xfs/xfs_inode.c | |||
@@ -167,7 +167,7 @@ xfs_imap_to_bp( | |||
167 | 167 | ||
168 | dip = (xfs_dinode_t *)xfs_buf_offset(bp, | 168 | dip = (xfs_dinode_t *)xfs_buf_offset(bp, |
169 | (i << mp->m_sb.sb_inodelog)); | 169 | (i << mp->m_sb.sb_inodelog)); |
170 | di_ok = be16_to_cpu(dip->di_magic) == XFS_DINODE_MAGIC && | 170 | di_ok = dip->di_magic == cpu_to_be16(XFS_DINODE_MAGIC) && |
171 | XFS_DINODE_GOOD_VERSION(dip->di_version); | 171 | XFS_DINODE_GOOD_VERSION(dip->di_version); |
172 | if (unlikely(XFS_TEST_ERROR(!di_ok, mp, | 172 | if (unlikely(XFS_TEST_ERROR(!di_ok, mp, |
173 | XFS_ERRTAG_ITOBP_INOTOBP, | 173 | XFS_ERRTAG_ITOBP_INOTOBP, |
@@ -802,7 +802,7 @@ xfs_iread( | |||
802 | * If we got something that isn't an inode it means someone | 802 | * If we got something that isn't an inode it means someone |
803 | * (nfs or dmi) has a stale handle. | 803 | * (nfs or dmi) has a stale handle. |
804 | */ | 804 | */ |
805 | if (be16_to_cpu(dip->di_magic) != XFS_DINODE_MAGIC) { | 805 | if (dip->di_magic != cpu_to_be16(XFS_DINODE_MAGIC)) { |
806 | #ifdef DEBUG | 806 | #ifdef DEBUG |
807 | xfs_alert(mp, | 807 | xfs_alert(mp, |
808 | "%s: dip->di_magic (0x%x) != XFS_DINODE_MAGIC (0x%x)", | 808 | "%s: dip->di_magic (0x%x) != XFS_DINODE_MAGIC (0x%x)", |
@@ -1457,7 +1457,7 @@ xfs_iunlink( | |||
1457 | ASSERT(agi->agi_unlinked[bucket_index]); | 1457 | ASSERT(agi->agi_unlinked[bucket_index]); |
1458 | ASSERT(be32_to_cpu(agi->agi_unlinked[bucket_index]) != agino); | 1458 | ASSERT(be32_to_cpu(agi->agi_unlinked[bucket_index]) != agino); |
1459 | 1459 | ||
1460 | if (be32_to_cpu(agi->agi_unlinked[bucket_index]) != NULLAGINO) { | 1460 | if (agi->agi_unlinked[bucket_index] != cpu_to_be32(NULLAGINO)) { |
1461 | /* | 1461 | /* |
1462 | * There is already another inode in the bucket we need | 1462 | * There is already another inode in the bucket we need |
1463 | * to add ourselves to. Add us at the front of the list. | 1463 | * to add ourselves to. Add us at the front of the list. |
@@ -1468,8 +1468,7 @@ xfs_iunlink( | |||
1468 | if (error) | 1468 | if (error) |
1469 | return error; | 1469 | return error; |
1470 | 1470 | ||
1471 | ASSERT(be32_to_cpu(dip->di_next_unlinked) == NULLAGINO); | 1471 | ASSERT(dip->di_next_unlinked == cpu_to_be32(NULLAGINO)); |
1472 | /* both on-disk, don't endian flip twice */ | ||
1473 | dip->di_next_unlinked = agi->agi_unlinked[bucket_index]; | 1472 | dip->di_next_unlinked = agi->agi_unlinked[bucket_index]; |
1474 | offset = ip->i_imap.im_boffset + | 1473 | offset = ip->i_imap.im_boffset + |
1475 | offsetof(xfs_dinode_t, di_next_unlinked); | 1474 | offsetof(xfs_dinode_t, di_next_unlinked); |
@@ -1534,7 +1533,7 @@ xfs_iunlink_remove( | |||
1534 | agino = XFS_INO_TO_AGINO(mp, ip->i_ino); | 1533 | agino = XFS_INO_TO_AGINO(mp, ip->i_ino); |
1535 | ASSERT(agino != 0); | 1534 | ASSERT(agino != 0); |
1536 | bucket_index = agino % XFS_AGI_UNLINKED_BUCKETS; | 1535 | bucket_index = agino % XFS_AGI_UNLINKED_BUCKETS; |
1537 | ASSERT(be32_to_cpu(agi->agi_unlinked[bucket_index]) != NULLAGINO); | 1536 | ASSERT(agi->agi_unlinked[bucket_index] != cpu_to_be32(NULLAGINO)); |
1538 | ASSERT(agi->agi_unlinked[bucket_index]); | 1537 | ASSERT(agi->agi_unlinked[bucket_index]); |
1539 | 1538 | ||
1540 | if (be32_to_cpu(agi->agi_unlinked[bucket_index]) == agino) { | 1539 | if (be32_to_cpu(agi->agi_unlinked[bucket_index]) == agino) { |
@@ -2659,7 +2658,7 @@ xfs_iflush_int( | |||
2659 | */ | 2658 | */ |
2660 | xfs_synchronize_times(ip); | 2659 | xfs_synchronize_times(ip); |
2661 | 2660 | ||
2662 | if (XFS_TEST_ERROR(be16_to_cpu(dip->di_magic) != XFS_DINODE_MAGIC, | 2661 | if (XFS_TEST_ERROR(dip->di_magic != cpu_to_be16(XFS_DINODE_MAGIC), |
2663 | mp, XFS_ERRTAG_IFLUSH_1, XFS_RANDOM_IFLUSH_1)) { | 2662 | mp, XFS_ERRTAG_IFLUSH_1, XFS_RANDOM_IFLUSH_1)) { |
2664 | xfs_alert_tag(mp, XFS_PTAG_IFLUSH, | 2663 | xfs_alert_tag(mp, XFS_PTAG_IFLUSH, |
2665 | "%s: Bad inode %Lu magic number 0x%x, ptr 0x%p", | 2664 | "%s: Bad inode %Lu magic number 0x%x, ptr 0x%p", |
diff --git a/fs/xfs/xfs_log.c b/fs/xfs/xfs_log.c index 41d5b8f2bf92..5b24a71811f8 100644 --- a/fs/xfs/xfs_log.c +++ b/fs/xfs/xfs_log.c | |||
@@ -3521,13 +3521,13 @@ xlog_verify_iclog(xlog_t *log, | |||
3521 | spin_unlock(&log->l_icloglock); | 3521 | spin_unlock(&log->l_icloglock); |
3522 | 3522 | ||
3523 | /* check log magic numbers */ | 3523 | /* check log magic numbers */ |
3524 | if (be32_to_cpu(iclog->ic_header.h_magicno) != XLOG_HEADER_MAGIC_NUM) | 3524 | if (iclog->ic_header.h_magicno != cpu_to_be32(XLOG_HEADER_MAGIC_NUM)) |
3525 | xfs_emerg(log->l_mp, "%s: invalid magic num", __func__); | 3525 | xfs_emerg(log->l_mp, "%s: invalid magic num", __func__); |
3526 | 3526 | ||
3527 | ptr = (xfs_caddr_t) &iclog->ic_header; | 3527 | ptr = (xfs_caddr_t) &iclog->ic_header; |
3528 | for (ptr += BBSIZE; ptr < ((xfs_caddr_t)&iclog->ic_header) + count; | 3528 | for (ptr += BBSIZE; ptr < ((xfs_caddr_t)&iclog->ic_header) + count; |
3529 | ptr += BBSIZE) { | 3529 | ptr += BBSIZE) { |
3530 | if (be32_to_cpu(*(__be32 *)ptr) == XLOG_HEADER_MAGIC_NUM) | 3530 | if (*(__be32 *)ptr == cpu_to_be32(XLOG_HEADER_MAGIC_NUM)) |
3531 | xfs_emerg(log->l_mp, "%s: unexpected magic num", | 3531 | xfs_emerg(log->l_mp, "%s: unexpected magic num", |
3532 | __func__); | 3532 | __func__); |
3533 | } | 3533 | } |
diff --git a/fs/xfs/xfs_log_recover.c b/fs/xfs/xfs_log_recover.c index 04142caedb2b..fb528b354c0d 100644 --- a/fs/xfs/xfs_log_recover.c +++ b/fs/xfs/xfs_log_recover.c | |||
@@ -300,14 +300,14 @@ xlog_header_check_recover( | |||
300 | xfs_mount_t *mp, | 300 | xfs_mount_t *mp, |
301 | xlog_rec_header_t *head) | 301 | xlog_rec_header_t *head) |
302 | { | 302 | { |
303 | ASSERT(be32_to_cpu(head->h_magicno) == XLOG_HEADER_MAGIC_NUM); | 303 | ASSERT(head->h_magicno == cpu_to_be32(XLOG_HEADER_MAGIC_NUM)); |
304 | 304 | ||
305 | /* | 305 | /* |
306 | * IRIX doesn't write the h_fmt field and leaves it zeroed | 306 | * IRIX doesn't write the h_fmt field and leaves it zeroed |
307 | * (XLOG_FMT_UNKNOWN). This stops us from trying to recover | 307 | * (XLOG_FMT_UNKNOWN). This stops us from trying to recover |
308 | * a dirty log created in IRIX. | 308 | * a dirty log created in IRIX. |
309 | */ | 309 | */ |
310 | if (unlikely(be32_to_cpu(head->h_fmt) != XLOG_FMT)) { | 310 | if (unlikely(head->h_fmt != cpu_to_be32(XLOG_FMT))) { |
311 | xfs_warn(mp, | 311 | xfs_warn(mp, |
312 | "dirty log written in incompatible format - can't recover"); | 312 | "dirty log written in incompatible format - can't recover"); |
313 | xlog_header_check_dump(mp, head); | 313 | xlog_header_check_dump(mp, head); |
@@ -333,7 +333,7 @@ xlog_header_check_mount( | |||
333 | xfs_mount_t *mp, | 333 | xfs_mount_t *mp, |
334 | xlog_rec_header_t *head) | 334 | xlog_rec_header_t *head) |
335 | { | 335 | { |
336 | ASSERT(be32_to_cpu(head->h_magicno) == XLOG_HEADER_MAGIC_NUM); | 336 | ASSERT(head->h_magicno == cpu_to_be32(XLOG_HEADER_MAGIC_NUM)); |
337 | 337 | ||
338 | if (uuid_is_nil(&head->h_fs_uuid)) { | 338 | if (uuid_is_nil(&head->h_fs_uuid)) { |
339 | /* | 339 | /* |
@@ -534,7 +534,7 @@ xlog_find_verify_log_record( | |||
534 | 534 | ||
535 | head = (xlog_rec_header_t *)offset; | 535 | head = (xlog_rec_header_t *)offset; |
536 | 536 | ||
537 | if (XLOG_HEADER_MAGIC_NUM == be32_to_cpu(head->h_magicno)) | 537 | if (head->h_magicno == cpu_to_be32(XLOG_HEADER_MAGIC_NUM)) |
538 | break; | 538 | break; |
539 | 539 | ||
540 | if (!smallmem) | 540 | if (!smallmem) |
@@ -916,7 +916,7 @@ xlog_find_tail( | |||
916 | if (error) | 916 | if (error) |
917 | goto done; | 917 | goto done; |
918 | 918 | ||
919 | if (XLOG_HEADER_MAGIC_NUM == be32_to_cpu(*(__be32 *)offset)) { | 919 | if (*(__be32 *)offset == cpu_to_be32(XLOG_HEADER_MAGIC_NUM)) { |
920 | found = 1; | 920 | found = 1; |
921 | break; | 921 | break; |
922 | } | 922 | } |
@@ -933,8 +933,8 @@ xlog_find_tail( | |||
933 | if (error) | 933 | if (error) |
934 | goto done; | 934 | goto done; |
935 | 935 | ||
936 | if (XLOG_HEADER_MAGIC_NUM == | 936 | if (*(__be32 *)offset == |
937 | be32_to_cpu(*(__be32 *)offset)) { | 937 | cpu_to_be32(XLOG_HEADER_MAGIC_NUM)) { |
938 | found = 2; | 938 | found = 2; |
939 | break; | 939 | break; |
940 | } | 940 | } |
@@ -1947,7 +1947,7 @@ xfs_qm_dqcheck( | |||
1947 | * This is all fine; things are still consistent, and we haven't lost | 1947 | * This is all fine; things are still consistent, and we haven't lost |
1948 | * any quota information. Just don't complain about bad dquot blks. | 1948 | * any quota information. Just don't complain about bad dquot blks. |
1949 | */ | 1949 | */ |
1950 | if (be16_to_cpu(ddq->d_magic) != XFS_DQUOT_MAGIC) { | 1950 | if (ddq->d_magic != cpu_to_be16(XFS_DQUOT_MAGIC)) { |
1951 | if (flags & XFS_QMOPT_DOWARN) | 1951 | if (flags & XFS_QMOPT_DOWARN) |
1952 | xfs_alert(mp, | 1952 | xfs_alert(mp, |
1953 | "%s : XFS dquot ID 0x%x, magic 0x%x != 0x%x", | 1953 | "%s : XFS dquot ID 0x%x, magic 0x%x != 0x%x", |
@@ -2238,7 +2238,7 @@ xlog_recover_inode_pass2( | |||
2238 | * Make sure the place we're flushing out to really looks | 2238 | * Make sure the place we're flushing out to really looks |
2239 | * like an inode! | 2239 | * like an inode! |
2240 | */ | 2240 | */ |
2241 | if (unlikely(be16_to_cpu(dip->di_magic) != XFS_DINODE_MAGIC)) { | 2241 | if (unlikely(dip->di_magic != cpu_to_be16(XFS_DINODE_MAGIC))) { |
2242 | xfs_buf_relse(bp); | 2242 | xfs_buf_relse(bp); |
2243 | xfs_alert(mp, | 2243 | xfs_alert(mp, |
2244 | "%s: Bad inode magic number, dip = 0x%p, dino bp = 0x%p, ino = %Ld", | 2244 | "%s: Bad inode magic number, dip = 0x%p, dino bp = 0x%p, ino = %Ld", |
@@ -3295,7 +3295,7 @@ xlog_valid_rec_header( | |||
3295 | { | 3295 | { |
3296 | int hlen; | 3296 | int hlen; |
3297 | 3297 | ||
3298 | if (unlikely(be32_to_cpu(rhead->h_magicno) != XLOG_HEADER_MAGIC_NUM)) { | 3298 | if (unlikely(rhead->h_magicno != cpu_to_be32(XLOG_HEADER_MAGIC_NUM))) { |
3299 | XFS_ERROR_REPORT("xlog_valid_rec_header(1)", | 3299 | XFS_ERROR_REPORT("xlog_valid_rec_header(1)", |
3300 | XFS_ERRLEVEL_LOW, log->l_mp); | 3300 | XFS_ERRLEVEL_LOW, log->l_mp); |
3301 | return XFS_ERROR(EFSCORRUPTED); | 3301 | return XFS_ERROR(EFSCORRUPTED); |