diff options
Diffstat (limited to 'fs/xfs/xfs_attr_leaf.c')
-rw-r--r-- | fs/xfs/xfs_attr_leaf.c | 98 |
1 files changed, 35 insertions, 63 deletions
diff --git a/fs/xfs/xfs_attr_leaf.c b/fs/xfs/xfs_attr_leaf.c index fe91eac4e2a7..d279d944e03d 100644 --- a/fs/xfs/xfs_attr_leaf.c +++ b/fs/xfs/xfs_attr_leaf.c | |||
@@ -720,8 +720,7 @@ xfs_attr_shortform_allfit(xfs_dabuf_t *bp, xfs_inode_t *dp) | |||
720 | int bytes, i; | 720 | int bytes, i; |
721 | 721 | ||
722 | leaf = bp->data; | 722 | leaf = bp->data; |
723 | ASSERT(INT_GET(leaf->hdr.info.magic, ARCH_CONVERT) | 723 | ASSERT(be16_to_cpu(leaf->hdr.info.magic) == XFS_ATTR_LEAF_MAGIC); |
724 | == XFS_ATTR_LEAF_MAGIC); | ||
725 | 724 | ||
726 | entry = &leaf->entries[0]; | 725 | entry = &leaf->entries[0]; |
727 | bytes = sizeof(struct xfs_attr_sf_hdr); | 726 | bytes = sizeof(struct xfs_attr_sf_hdr); |
@@ -766,8 +765,7 @@ xfs_attr_leaf_to_shortform(xfs_dabuf_t *bp, xfs_da_args_t *args, int forkoff) | |||
766 | ASSERT(bp != NULL); | 765 | ASSERT(bp != NULL); |
767 | memcpy(tmpbuffer, bp->data, XFS_LBSIZE(dp->i_mount)); | 766 | memcpy(tmpbuffer, bp->data, XFS_LBSIZE(dp->i_mount)); |
768 | leaf = (xfs_attr_leafblock_t *)tmpbuffer; | 767 | leaf = (xfs_attr_leafblock_t *)tmpbuffer; |
769 | ASSERT(INT_GET(leaf->hdr.info.magic, ARCH_CONVERT) | 768 | ASSERT(be16_to_cpu(leaf->hdr.info.magic) == XFS_ATTR_LEAF_MAGIC); |
770 | == XFS_ATTR_LEAF_MAGIC); | ||
771 | memset(bp->data, 0, XFS_LBSIZE(dp->i_mount)); | 769 | memset(bp->data, 0, XFS_LBSIZE(dp->i_mount)); |
772 | 770 | ||
773 | /* | 771 | /* |
@@ -875,8 +873,7 @@ xfs_attr_leaf_to_node(xfs_da_args_t *args) | |||
875 | goto out; | 873 | goto out; |
876 | node = bp1->data; | 874 | node = bp1->data; |
877 | leaf = bp2->data; | 875 | leaf = bp2->data; |
878 | ASSERT(INT_GET(leaf->hdr.info.magic, ARCH_CONVERT) | 876 | ASSERT(be16_to_cpu(leaf->hdr.info.magic) == XFS_ATTR_LEAF_MAGIC); |
879 | == XFS_ATTR_LEAF_MAGIC); | ||
880 | /* both on-disk, don't endian-flip twice */ | 877 | /* both on-disk, don't endian-flip twice */ |
881 | node->btree[0].hashval = | 878 | node->btree[0].hashval = |
882 | leaf->entries[INT_GET(leaf->hdr.count, ARCH_CONVERT)-1 ].hashval; | 879 | leaf->entries[INT_GET(leaf->hdr.count, ARCH_CONVERT)-1 ].hashval; |
@@ -920,7 +917,7 @@ xfs_attr_leaf_create(xfs_da_args_t *args, xfs_dablk_t blkno, xfs_dabuf_t **bpp) | |||
920 | leaf = bp->data; | 917 | leaf = bp->data; |
921 | memset((char *)leaf, 0, XFS_LBSIZE(dp->i_mount)); | 918 | memset((char *)leaf, 0, XFS_LBSIZE(dp->i_mount)); |
922 | hdr = &leaf->hdr; | 919 | hdr = &leaf->hdr; |
923 | INT_SET(hdr->info.magic, ARCH_CONVERT, XFS_ATTR_LEAF_MAGIC); | 920 | hdr->info.magic = cpu_to_be16(XFS_ATTR_LEAF_MAGIC); |
924 | INT_SET(hdr->firstused, ARCH_CONVERT, XFS_LBSIZE(dp->i_mount)); | 921 | INT_SET(hdr->firstused, ARCH_CONVERT, XFS_LBSIZE(dp->i_mount)); |
925 | if (!hdr->firstused) { | 922 | if (!hdr->firstused) { |
926 | INT_SET(hdr->firstused, ARCH_CONVERT, | 923 | INT_SET(hdr->firstused, ARCH_CONVERT, |
@@ -1004,8 +1001,7 @@ xfs_attr_leaf_add(xfs_dabuf_t *bp, xfs_da_args_t *args) | |||
1004 | int tablesize, entsize, sum, tmp, i; | 1001 | int tablesize, entsize, sum, tmp, i; |
1005 | 1002 | ||
1006 | leaf = bp->data; | 1003 | leaf = bp->data; |
1007 | ASSERT(INT_GET(leaf->hdr.info.magic, ARCH_CONVERT) | 1004 | ASSERT(be16_to_cpu(leaf->hdr.info.magic) == XFS_ATTR_LEAF_MAGIC); |
1008 | == XFS_ATTR_LEAF_MAGIC); | ||
1009 | ASSERT((args->index >= 0) | 1005 | ASSERT((args->index >= 0) |
1010 | && (args->index <= INT_GET(leaf->hdr.count, ARCH_CONVERT))); | 1006 | && (args->index <= INT_GET(leaf->hdr.count, ARCH_CONVERT))); |
1011 | hdr = &leaf->hdr; | 1007 | hdr = &leaf->hdr; |
@@ -1079,8 +1075,7 @@ xfs_attr_leaf_add_work(xfs_dabuf_t *bp, xfs_da_args_t *args, int mapindex) | |||
1079 | int tmp, i; | 1075 | int tmp, i; |
1080 | 1076 | ||
1081 | leaf = bp->data; | 1077 | leaf = bp->data; |
1082 | ASSERT(INT_GET(leaf->hdr.info.magic, ARCH_CONVERT) | 1078 | ASSERT(be16_to_cpu(leaf->hdr.info.magic) == XFS_ATTR_LEAF_MAGIC); |
1083 | == XFS_ATTR_LEAF_MAGIC); | ||
1084 | hdr = &leaf->hdr; | 1079 | hdr = &leaf->hdr; |
1085 | ASSERT((mapindex >= 0) && (mapindex < XFS_ATTR_LEAF_MAPSIZE)); | 1080 | ASSERT((mapindex >= 0) && (mapindex < XFS_ATTR_LEAF_MAPSIZE)); |
1086 | ASSERT((args->index >= 0) | 1081 | ASSERT((args->index >= 0) |
@@ -1279,10 +1274,8 @@ xfs_attr_leaf_rebalance(xfs_da_state_t *state, xfs_da_state_blk_t *blk1, | |||
1279 | ASSERT(blk2->magic == XFS_ATTR_LEAF_MAGIC); | 1274 | ASSERT(blk2->magic == XFS_ATTR_LEAF_MAGIC); |
1280 | leaf1 = blk1->bp->data; | 1275 | leaf1 = blk1->bp->data; |
1281 | leaf2 = blk2->bp->data; | 1276 | leaf2 = blk2->bp->data; |
1282 | ASSERT(INT_GET(leaf1->hdr.info.magic, ARCH_CONVERT) | 1277 | ASSERT(be16_to_cpu(leaf1->hdr.info.magic) == XFS_ATTR_LEAF_MAGIC); |
1283 | == XFS_ATTR_LEAF_MAGIC); | 1278 | ASSERT(be16_to_cpu(leaf2->hdr.info.magic) == XFS_ATTR_LEAF_MAGIC); |
1284 | ASSERT(INT_GET(leaf2->hdr.info.magic, ARCH_CONVERT) | ||
1285 | == XFS_ATTR_LEAF_MAGIC); | ||
1286 | args = state->args; | 1279 | args = state->args; |
1287 | 1280 | ||
1288 | /* | 1281 | /* |
@@ -1566,7 +1559,7 @@ xfs_attr_leaf_toosmall(xfs_da_state_t *state, int *action) | |||
1566 | */ | 1559 | */ |
1567 | blk = &state->path.blk[ state->path.active-1 ]; | 1560 | blk = &state->path.blk[ state->path.active-1 ]; |
1568 | info = blk->bp->data; | 1561 | info = blk->bp->data; |
1569 | ASSERT(INT_GET(info->magic, ARCH_CONVERT) == XFS_ATTR_LEAF_MAGIC); | 1562 | ASSERT(be16_to_cpu(info->magic) == XFS_ATTR_LEAF_MAGIC); |
1570 | leaf = (xfs_attr_leafblock_t *)info; | 1563 | leaf = (xfs_attr_leafblock_t *)info; |
1571 | count = INT_GET(leaf->hdr.count, ARCH_CONVERT); | 1564 | count = INT_GET(leaf->hdr.count, ARCH_CONVERT); |
1572 | bytes = sizeof(xfs_attr_leaf_hdr_t) + | 1565 | bytes = sizeof(xfs_attr_leaf_hdr_t) + |
@@ -1588,7 +1581,7 @@ xfs_attr_leaf_toosmall(xfs_da_state_t *state, int *action) | |||
1588 | * Make altpath point to the block we want to keep and | 1581 | * Make altpath point to the block we want to keep and |
1589 | * path point to the block we want to drop (this one). | 1582 | * path point to the block we want to drop (this one). |
1590 | */ | 1583 | */ |
1591 | forward = info->forw; | 1584 | forward = (info->forw != 0); |
1592 | memcpy(&state->altpath, &state->path, sizeof(state->path)); | 1585 | memcpy(&state->altpath, &state->path, sizeof(state->path)); |
1593 | error = xfs_da_path_shift(state, &state->altpath, forward, | 1586 | error = xfs_da_path_shift(state, &state->altpath, forward, |
1594 | 0, &retval); | 1587 | 0, &retval); |
@@ -1610,13 +1603,12 @@ xfs_attr_leaf_toosmall(xfs_da_state_t *state, int *action) | |||
1610 | * to shrink an attribute list over time. | 1603 | * to shrink an attribute list over time. |
1611 | */ | 1604 | */ |
1612 | /* start with smaller blk num */ | 1605 | /* start with smaller blk num */ |
1613 | forward = (INT_GET(info->forw, ARCH_CONVERT) | 1606 | forward = (be32_to_cpu(info->forw) < be32_to_cpu(info->back)); |
1614 | < INT_GET(info->back, ARCH_CONVERT)); | ||
1615 | for (i = 0; i < 2; forward = !forward, i++) { | 1607 | for (i = 0; i < 2; forward = !forward, i++) { |
1616 | if (forward) | 1608 | if (forward) |
1617 | blkno = INT_GET(info->forw, ARCH_CONVERT); | 1609 | blkno = be32_to_cpu(info->forw); |
1618 | else | 1610 | else |
1619 | blkno = INT_GET(info->back, ARCH_CONVERT); | 1611 | blkno = be32_to_cpu(info->back); |
1620 | if (blkno == 0) | 1612 | if (blkno == 0) |
1621 | continue; | 1613 | continue; |
1622 | error = xfs_da_read_buf(state->args->trans, state->args->dp, | 1614 | error = xfs_da_read_buf(state->args->trans, state->args->dp, |
@@ -1630,8 +1622,7 @@ xfs_attr_leaf_toosmall(xfs_da_state_t *state, int *action) | |||
1630 | bytes = state->blocksize - (state->blocksize>>2); | 1622 | bytes = state->blocksize - (state->blocksize>>2); |
1631 | bytes -= INT_GET(leaf->hdr.usedbytes, ARCH_CONVERT); | 1623 | bytes -= INT_GET(leaf->hdr.usedbytes, ARCH_CONVERT); |
1632 | leaf = bp->data; | 1624 | leaf = bp->data; |
1633 | ASSERT(INT_GET(leaf->hdr.info.magic, ARCH_CONVERT) | 1625 | ASSERT(be16_to_cpu(leaf->hdr.info.magic) == XFS_ATTR_LEAF_MAGIC); |
1634 | == XFS_ATTR_LEAF_MAGIC); | ||
1635 | count += INT_GET(leaf->hdr.count, ARCH_CONVERT); | 1626 | count += INT_GET(leaf->hdr.count, ARCH_CONVERT); |
1636 | bytes -= INT_GET(leaf->hdr.usedbytes, ARCH_CONVERT); | 1627 | bytes -= INT_GET(leaf->hdr.usedbytes, ARCH_CONVERT); |
1637 | bytes -= count * sizeof(xfs_attr_leaf_entry_t); | 1628 | bytes -= count * sizeof(xfs_attr_leaf_entry_t); |
@@ -1685,8 +1676,7 @@ xfs_attr_leaf_remove(xfs_dabuf_t *bp, xfs_da_args_t *args) | |||
1685 | xfs_mount_t *mp; | 1676 | xfs_mount_t *mp; |
1686 | 1677 | ||
1687 | leaf = bp->data; | 1678 | leaf = bp->data; |
1688 | ASSERT(INT_GET(leaf->hdr.info.magic, ARCH_CONVERT) | 1679 | ASSERT(be16_to_cpu(leaf->hdr.info.magic) == XFS_ATTR_LEAF_MAGIC); |
1689 | == XFS_ATTR_LEAF_MAGIC); | ||
1690 | hdr = &leaf->hdr; | 1680 | hdr = &leaf->hdr; |
1691 | mp = args->trans->t_mountp; | 1681 | mp = args->trans->t_mountp; |
1692 | ASSERT((INT_GET(hdr->count, ARCH_CONVERT) > 0) | 1682 | ASSERT((INT_GET(hdr->count, ARCH_CONVERT) > 0) |
@@ -1859,10 +1849,8 @@ xfs_attr_leaf_unbalance(xfs_da_state_t *state, xfs_da_state_blk_t *drop_blk, | |||
1859 | ASSERT(save_blk->magic == XFS_ATTR_LEAF_MAGIC); | 1849 | ASSERT(save_blk->magic == XFS_ATTR_LEAF_MAGIC); |
1860 | drop_leaf = drop_blk->bp->data; | 1850 | drop_leaf = drop_blk->bp->data; |
1861 | save_leaf = save_blk->bp->data; | 1851 | save_leaf = save_blk->bp->data; |
1862 | ASSERT(INT_GET(drop_leaf->hdr.info.magic, ARCH_CONVERT) | 1852 | ASSERT(be16_to_cpu(drop_leaf->hdr.info.magic) == XFS_ATTR_LEAF_MAGIC); |
1863 | == XFS_ATTR_LEAF_MAGIC); | 1853 | ASSERT(be16_to_cpu(save_leaf->hdr.info.magic) == XFS_ATTR_LEAF_MAGIC); |
1864 | ASSERT(INT_GET(save_leaf->hdr.info.magic, ARCH_CONVERT) | ||
1865 | == XFS_ATTR_LEAF_MAGIC); | ||
1866 | drop_hdr = &drop_leaf->hdr; | 1854 | drop_hdr = &drop_leaf->hdr; |
1867 | save_hdr = &save_leaf->hdr; | 1855 | save_hdr = &save_leaf->hdr; |
1868 | 1856 | ||
@@ -1972,8 +1960,7 @@ xfs_attr_leaf_lookup_int(xfs_dabuf_t *bp, xfs_da_args_t *args) | |||
1972 | xfs_dahash_t hashval; | 1960 | xfs_dahash_t hashval; |
1973 | 1961 | ||
1974 | leaf = bp->data; | 1962 | leaf = bp->data; |
1975 | ASSERT(INT_GET(leaf->hdr.info.magic, ARCH_CONVERT) | 1963 | ASSERT(be16_to_cpu(leaf->hdr.info.magic) == XFS_ATTR_LEAF_MAGIC); |
1976 | == XFS_ATTR_LEAF_MAGIC); | ||
1977 | ASSERT(INT_GET(leaf->hdr.count, ARCH_CONVERT) | 1964 | ASSERT(INT_GET(leaf->hdr.count, ARCH_CONVERT) |
1978 | < (XFS_LBSIZE(args->dp->i_mount)/8)); | 1965 | < (XFS_LBSIZE(args->dp->i_mount)/8)); |
1979 | 1966 | ||
@@ -2090,8 +2077,7 @@ xfs_attr_leaf_getvalue(xfs_dabuf_t *bp, xfs_da_args_t *args) | |||
2090 | xfs_attr_leaf_name_remote_t *name_rmt; | 2077 | xfs_attr_leaf_name_remote_t *name_rmt; |
2091 | 2078 | ||
2092 | leaf = bp->data; | 2079 | leaf = bp->data; |
2093 | ASSERT(INT_GET(leaf->hdr.info.magic, ARCH_CONVERT) | 2080 | ASSERT(be16_to_cpu(leaf->hdr.info.magic) == XFS_ATTR_LEAF_MAGIC); |
2094 | == XFS_ATTR_LEAF_MAGIC); | ||
2095 | ASSERT(INT_GET(leaf->hdr.count, ARCH_CONVERT) | 2081 | ASSERT(INT_GET(leaf->hdr.count, ARCH_CONVERT) |
2096 | < (XFS_LBSIZE(args->dp->i_mount)/8)); | 2082 | < (XFS_LBSIZE(args->dp->i_mount)/8)); |
2097 | ASSERT(args->index < ((int)INT_GET(leaf->hdr.count, ARCH_CONVERT))); | 2083 | ASSERT(args->index < ((int)INT_GET(leaf->hdr.count, ARCH_CONVERT))); |
@@ -2159,10 +2145,8 @@ xfs_attr_leaf_moveents(xfs_attr_leafblock_t *leaf_s, int start_s, | |||
2159 | /* | 2145 | /* |
2160 | * Set up environment. | 2146 | * Set up environment. |
2161 | */ | 2147 | */ |
2162 | ASSERT(INT_GET(leaf_s->hdr.info.magic, ARCH_CONVERT) | 2148 | ASSERT(be16_to_cpu(leaf_s->hdr.info.magic) == XFS_ATTR_LEAF_MAGIC); |
2163 | == XFS_ATTR_LEAF_MAGIC); | 2149 | ASSERT(be16_to_cpu(leaf_d->hdr.info.magic) == XFS_ATTR_LEAF_MAGIC); |
2164 | ASSERT(INT_GET(leaf_d->hdr.info.magic, ARCH_CONVERT) | ||
2165 | == XFS_ATTR_LEAF_MAGIC); | ||
2166 | hdr_s = &leaf_s->hdr; | 2150 | hdr_s = &leaf_s->hdr; |
2167 | hdr_d = &leaf_d->hdr; | 2151 | hdr_d = &leaf_d->hdr; |
2168 | ASSERT((INT_GET(hdr_s->count, ARCH_CONVERT) > 0) | 2152 | ASSERT((INT_GET(hdr_s->count, ARCH_CONVERT) > 0) |
@@ -2301,10 +2285,8 @@ xfs_attr_leaf_order(xfs_dabuf_t *leaf1_bp, xfs_dabuf_t *leaf2_bp) | |||
2301 | 2285 | ||
2302 | leaf1 = leaf1_bp->data; | 2286 | leaf1 = leaf1_bp->data; |
2303 | leaf2 = leaf2_bp->data; | 2287 | leaf2 = leaf2_bp->data; |
2304 | ASSERT((INT_GET(leaf1->hdr.info.magic, ARCH_CONVERT) | 2288 | ASSERT((be16_to_cpu(leaf1->hdr.info.magic) == XFS_ATTR_LEAF_MAGIC) && |
2305 | == XFS_ATTR_LEAF_MAGIC) && | 2289 | (be16_to_cpu(leaf2->hdr.info.magic) == XFS_ATTR_LEAF_MAGIC)); |
2306 | (INT_GET(leaf2->hdr.info.magic, ARCH_CONVERT) | ||
2307 | == XFS_ATTR_LEAF_MAGIC)); | ||
2308 | if ( (INT_GET(leaf1->hdr.count, ARCH_CONVERT) > 0) | 2290 | if ( (INT_GET(leaf1->hdr.count, ARCH_CONVERT) > 0) |
2309 | && (INT_GET(leaf2->hdr.count, ARCH_CONVERT) > 0) | 2291 | && (INT_GET(leaf2->hdr.count, ARCH_CONVERT) > 0) |
2310 | && ( (INT_GET(leaf2->entries[ 0 ].hashval, ARCH_CONVERT) < | 2292 | && ( (INT_GET(leaf2->entries[ 0 ].hashval, ARCH_CONVERT) < |
@@ -2327,8 +2309,7 @@ xfs_attr_leaf_lasthash(xfs_dabuf_t *bp, int *count) | |||
2327 | xfs_attr_leafblock_t *leaf; | 2309 | xfs_attr_leafblock_t *leaf; |
2328 | 2310 | ||
2329 | leaf = bp->data; | 2311 | leaf = bp->data; |
2330 | ASSERT(INT_GET(leaf->hdr.info.magic, ARCH_CONVERT) | 2312 | ASSERT(be16_to_cpu(leaf->hdr.info.magic) == XFS_ATTR_LEAF_MAGIC); |
2331 | == XFS_ATTR_LEAF_MAGIC); | ||
2332 | if (count) | 2313 | if (count) |
2333 | *count = INT_GET(leaf->hdr.count, ARCH_CONVERT); | 2314 | *count = INT_GET(leaf->hdr.count, ARCH_CONVERT); |
2334 | if (!leaf->hdr.count) | 2315 | if (!leaf->hdr.count) |
@@ -2348,8 +2329,7 @@ xfs_attr_leaf_entsize(xfs_attr_leafblock_t *leaf, int index) | |||
2348 | xfs_attr_leaf_name_remote_t *name_rmt; | 2329 | xfs_attr_leaf_name_remote_t *name_rmt; |
2349 | int size; | 2330 | int size; |
2350 | 2331 | ||
2351 | ASSERT(INT_GET(leaf->hdr.info.magic, ARCH_CONVERT) | 2332 | ASSERT(be16_to_cpu(leaf->hdr.info.magic) == XFS_ATTR_LEAF_MAGIC); |
2352 | == XFS_ATTR_LEAF_MAGIC); | ||
2353 | if (leaf->entries[index].flags & XFS_ATTR_LOCAL) { | 2333 | if (leaf->entries[index].flags & XFS_ATTR_LOCAL) { |
2354 | name_loc = XFS_ATTR_LEAF_NAME_LOCAL(leaf, index); | 2334 | name_loc = XFS_ATTR_LEAF_NAME_LOCAL(leaf, index); |
2355 | size = XFS_ATTR_LEAF_ENTSIZE_LOCAL(name_loc->namelen, | 2335 | size = XFS_ATTR_LEAF_ENTSIZE_LOCAL(name_loc->namelen, |
@@ -2596,8 +2576,7 @@ xfs_attr_leaf_clearflag(xfs_da_args_t *args) | |||
2596 | ASSERT(bp != NULL); | 2576 | ASSERT(bp != NULL); |
2597 | 2577 | ||
2598 | leaf = bp->data; | 2578 | leaf = bp->data; |
2599 | ASSERT(INT_GET(leaf->hdr.info.magic, ARCH_CONVERT) | 2579 | ASSERT(be16_to_cpu(leaf->hdr.info.magic) == XFS_ATTR_LEAF_MAGIC); |
2600 | == XFS_ATTR_LEAF_MAGIC); | ||
2601 | ASSERT(args->index < INT_GET(leaf->hdr.count, ARCH_CONVERT)); | 2580 | ASSERT(args->index < INT_GET(leaf->hdr.count, ARCH_CONVERT)); |
2602 | ASSERT(args->index >= 0); | 2581 | ASSERT(args->index >= 0); |
2603 | entry = &leaf->entries[ args->index ]; | 2582 | entry = &leaf->entries[ args->index ]; |
@@ -2663,8 +2642,7 @@ xfs_attr_leaf_setflag(xfs_da_args_t *args) | |||
2663 | ASSERT(bp != NULL); | 2642 | ASSERT(bp != NULL); |
2664 | 2643 | ||
2665 | leaf = bp->data; | 2644 | leaf = bp->data; |
2666 | ASSERT(INT_GET(leaf->hdr.info.magic, ARCH_CONVERT) | 2645 | ASSERT(be16_to_cpu(leaf->hdr.info.magic) == XFS_ATTR_LEAF_MAGIC); |
2667 | == XFS_ATTR_LEAF_MAGIC); | ||
2668 | ASSERT(args->index < INT_GET(leaf->hdr.count, ARCH_CONVERT)); | 2646 | ASSERT(args->index < INT_GET(leaf->hdr.count, ARCH_CONVERT)); |
2669 | ASSERT(args->index >= 0); | 2647 | ASSERT(args->index >= 0); |
2670 | entry = &leaf->entries[ args->index ]; | 2648 | entry = &leaf->entries[ args->index ]; |
@@ -2736,15 +2714,13 @@ xfs_attr_leaf_flipflags(xfs_da_args_t *args) | |||
2736 | } | 2714 | } |
2737 | 2715 | ||
2738 | leaf1 = bp1->data; | 2716 | leaf1 = bp1->data; |
2739 | ASSERT(INT_GET(leaf1->hdr.info.magic, ARCH_CONVERT) | 2717 | ASSERT(be16_to_cpu(leaf1->hdr.info.magic) == XFS_ATTR_LEAF_MAGIC); |
2740 | == XFS_ATTR_LEAF_MAGIC); | ||
2741 | ASSERT(args->index < INT_GET(leaf1->hdr.count, ARCH_CONVERT)); | 2718 | ASSERT(args->index < INT_GET(leaf1->hdr.count, ARCH_CONVERT)); |
2742 | ASSERT(args->index >= 0); | 2719 | ASSERT(args->index >= 0); |
2743 | entry1 = &leaf1->entries[ args->index ]; | 2720 | entry1 = &leaf1->entries[ args->index ]; |
2744 | 2721 | ||
2745 | leaf2 = bp2->data; | 2722 | leaf2 = bp2->data; |
2746 | ASSERT(INT_GET(leaf2->hdr.info.magic, ARCH_CONVERT) | 2723 | ASSERT(be16_to_cpu(leaf2->hdr.info.magic) == XFS_ATTR_LEAF_MAGIC); |
2747 | == XFS_ATTR_LEAF_MAGIC); | ||
2748 | ASSERT(args->index2 < INT_GET(leaf2->hdr.count, ARCH_CONVERT)); | 2724 | ASSERT(args->index2 < INT_GET(leaf2->hdr.count, ARCH_CONVERT)); |
2749 | ASSERT(args->index2 >= 0); | 2725 | ASSERT(args->index2 >= 0); |
2750 | entry2 = &leaf2->entries[ args->index2 ]; | 2726 | entry2 = &leaf2->entries[ args->index2 ]; |
@@ -2842,9 +2818,9 @@ xfs_attr_root_inactive(xfs_trans_t **trans, xfs_inode_t *dp) | |||
2842 | * This is a depth-first traversal! | 2818 | * This is a depth-first traversal! |
2843 | */ | 2819 | */ |
2844 | info = bp->data; | 2820 | info = bp->data; |
2845 | if (INT_GET(info->magic, ARCH_CONVERT) == XFS_DA_NODE_MAGIC) { | 2821 | if (be16_to_cpu(info->magic) == XFS_DA_NODE_MAGIC) { |
2846 | error = xfs_attr_node_inactive(trans, dp, bp, 1); | 2822 | error = xfs_attr_node_inactive(trans, dp, bp, 1); |
2847 | } else if (INT_GET(info->magic, ARCH_CONVERT) == XFS_ATTR_LEAF_MAGIC) { | 2823 | } else if (be16_to_cpu(info->magic) == XFS_ATTR_LEAF_MAGIC) { |
2848 | error = xfs_attr_leaf_inactive(trans, dp, bp); | 2824 | error = xfs_attr_leaf_inactive(trans, dp, bp); |
2849 | } else { | 2825 | } else { |
2850 | error = XFS_ERROR(EIO); | 2826 | error = XFS_ERROR(EIO); |
@@ -2892,8 +2868,7 @@ xfs_attr_node_inactive(xfs_trans_t **trans, xfs_inode_t *dp, xfs_dabuf_t *bp, | |||
2892 | } | 2868 | } |
2893 | 2869 | ||
2894 | node = bp->data; | 2870 | node = bp->data; |
2895 | ASSERT(INT_GET(node->hdr.info.magic, ARCH_CONVERT) | 2871 | ASSERT(be16_to_cpu(node->hdr.info.magic) == XFS_DA_NODE_MAGIC); |
2896 | == XFS_DA_NODE_MAGIC); | ||
2897 | parent_blkno = xfs_da_blkno(bp); /* save for re-read later */ | 2872 | parent_blkno = xfs_da_blkno(bp); /* save for re-read later */ |
2898 | count = INT_GET(node->hdr.count, ARCH_CONVERT); | 2873 | count = INT_GET(node->hdr.count, ARCH_CONVERT); |
2899 | if (!count) { | 2874 | if (!count) { |
@@ -2927,12 +2902,10 @@ xfs_attr_node_inactive(xfs_trans_t **trans, xfs_inode_t *dp, xfs_dabuf_t *bp, | |||
2927 | * Invalidate the subtree, however we have to. | 2902 | * Invalidate the subtree, however we have to. |
2928 | */ | 2903 | */ |
2929 | info = child_bp->data; | 2904 | info = child_bp->data; |
2930 | if (INT_GET(info->magic, ARCH_CONVERT) | 2905 | if (be16_to_cpu(info->magic) == XFS_DA_NODE_MAGIC) { |
2931 | == XFS_DA_NODE_MAGIC) { | ||
2932 | error = xfs_attr_node_inactive(trans, dp, | 2906 | error = xfs_attr_node_inactive(trans, dp, |
2933 | child_bp, level+1); | 2907 | child_bp, level+1); |
2934 | } else if (INT_GET(info->magic, ARCH_CONVERT) | 2908 | } else if (be16_to_cpu(info->magic) == XFS_ATTR_LEAF_MAGIC) { |
2935 | == XFS_ATTR_LEAF_MAGIC) { | ||
2936 | error = xfs_attr_leaf_inactive(trans, dp, | 2909 | error = xfs_attr_leaf_inactive(trans, dp, |
2937 | child_bp); | 2910 | child_bp); |
2938 | } else { | 2911 | } else { |
@@ -2991,8 +2964,7 @@ xfs_attr_leaf_inactive(xfs_trans_t **trans, xfs_inode_t *dp, xfs_dabuf_t *bp) | |||
2991 | int error, count, size, tmp, i; | 2964 | int error, count, size, tmp, i; |
2992 | 2965 | ||
2993 | leaf = bp->data; | 2966 | leaf = bp->data; |
2994 | ASSERT(INT_GET(leaf->hdr.info.magic, ARCH_CONVERT) | 2967 | ASSERT(be16_to_cpu(leaf->hdr.info.magic) == XFS_ATTR_LEAF_MAGIC); |
2995 | == XFS_ATTR_LEAF_MAGIC); | ||
2996 | 2968 | ||
2997 | /* | 2969 | /* |
2998 | * Count the number of "remote" value extents. | 2970 | * Count the number of "remote" value extents. |