Commit 3c1f9c15 authored by Nathan Scott's avatar Nathan Scott

[XFS] endianess annotations for xfs_dir2_leaf_entry_t

SGI-PV: 943272
SGI-Modid: xfs-linux-melb:xfs-kern:25493a
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Signed-off-by: default avatarNathan Scott <nathans@sgi.com>
parent a818e5de
...@@ -1798,7 +1798,7 @@ xfs_da_swap_lastblock(xfs_da_args_t *args, xfs_dablk_t *dead_blknop, ...@@ -1798,7 +1798,7 @@ xfs_da_swap_lastblock(xfs_da_args_t *args, xfs_dablk_t *dead_blknop,
ASSERT(XFS_DIR_IS_V2(mp)); ASSERT(XFS_DIR_IS_V2(mp));
dead_leaf2 = (xfs_dir2_leaf_t *)dead_info; dead_leaf2 = (xfs_dir2_leaf_t *)dead_info;
dead_level = 0; dead_level = 0;
dead_hash = INT_GET(dead_leaf2->ents[be16_to_cpu(dead_leaf2->hdr.count) - 1].hashval, ARCH_CONVERT); dead_hash = be32_to_cpu(dead_leaf2->ents[be16_to_cpu(dead_leaf2->hdr.count) - 1].hashval);
} else { } else {
ASSERT(INT_GET(dead_info->magic, ARCH_CONVERT) == XFS_DA_NODE_MAGIC); ASSERT(INT_GET(dead_info->magic, ARCH_CONVERT) == XFS_DA_NODE_MAGIC);
dead_node = (xfs_da_intnode_t *)dead_info; dead_node = (xfs_da_intnode_t *)dead_info;
......
...@@ -246,7 +246,7 @@ xfs_dir2_block_addname( ...@@ -246,7 +246,7 @@ xfs_dir2_block_addname(
highstale = lfloghigh = -1; highstale = lfloghigh = -1;
fromidx >= 0; fromidx >= 0;
fromidx--) { fromidx--) {
if (INT_GET(blp[fromidx].address, ARCH_CONVERT) == XFS_DIR2_NULL_DATAPTR) { if (be32_to_cpu(blp[fromidx].address) == XFS_DIR2_NULL_DATAPTR) {
if (highstale == -1) if (highstale == -1)
highstale = toidx; highstale = toidx;
else { else {
...@@ -291,14 +291,14 @@ xfs_dir2_block_addname( ...@@ -291,14 +291,14 @@ xfs_dir2_block_addname(
*/ */
for (low = 0, high = be32_to_cpu(btp->count) - 1; low <= high; ) { for (low = 0, high = be32_to_cpu(btp->count) - 1; low <= high; ) {
mid = (low + high) >> 1; mid = (low + high) >> 1;
if ((hash = INT_GET(blp[mid].hashval, ARCH_CONVERT)) == args->hashval) if ((hash = be32_to_cpu(blp[mid].hashval)) == args->hashval)
break; break;
if (hash < args->hashval) if (hash < args->hashval)
low = mid + 1; low = mid + 1;
else else
high = mid - 1; high = mid - 1;
} }
while (mid >= 0 && INT_GET(blp[mid].hashval, ARCH_CONVERT) >= args->hashval) { while (mid >= 0 && be32_to_cpu(blp[mid].hashval) >= args->hashval) {
mid--; mid--;
} }
/* /*
...@@ -345,12 +345,12 @@ xfs_dir2_block_addname( ...@@ -345,12 +345,12 @@ xfs_dir2_block_addname(
else { else {
for (lowstale = mid; for (lowstale = mid;
lowstale >= 0 && lowstale >= 0 &&
INT_GET(blp[lowstale].address, ARCH_CONVERT) != XFS_DIR2_NULL_DATAPTR; be32_to_cpu(blp[lowstale].address) != XFS_DIR2_NULL_DATAPTR;
lowstale--) lowstale--)
continue; continue;
for (highstale = mid + 1; for (highstale = mid + 1;
highstale < be32_to_cpu(btp->count) && highstale < be32_to_cpu(btp->count) &&
INT_GET(blp[highstale].address, ARCH_CONVERT) != XFS_DIR2_NULL_DATAPTR && be32_to_cpu(blp[highstale].address) != XFS_DIR2_NULL_DATAPTR &&
(lowstale < 0 || mid - lowstale > highstale - mid); (lowstale < 0 || mid - lowstale > highstale - mid);
highstale++) highstale++)
continue; continue;
...@@ -387,8 +387,9 @@ xfs_dir2_block_addname( ...@@ -387,8 +387,9 @@ xfs_dir2_block_addname(
/* /*
* Fill in the leaf entry. * Fill in the leaf entry.
*/ */
INT_SET(blp[mid].hashval, ARCH_CONVERT, args->hashval); blp[mid].hashval = cpu_to_be32(args->hashval);
INT_SET(blp[mid].address, ARCH_CONVERT, XFS_DIR2_BYTE_TO_DATAPTR(mp, (char *)dep - (char *)block)); blp[mid].address = cpu_to_be32(XFS_DIR2_BYTE_TO_DATAPTR(mp,
(char *)dep - (char *)block));
xfs_dir2_block_log_leaf(tp, bp, lfloglow, lfloghigh); xfs_dir2_block_log_leaf(tp, bp, lfloglow, lfloghigh);
/* /*
* Mark space for the data entry used. * Mark space for the data entry used.
...@@ -621,7 +622,7 @@ xfs_dir2_block_lookup( ...@@ -621,7 +622,7 @@ xfs_dir2_block_lookup(
* Get the offset from the leaf entry, to point to the data. * Get the offset from the leaf entry, to point to the data.
*/ */
dep = (xfs_dir2_data_entry_t *) dep = (xfs_dir2_data_entry_t *)
((char *)block + XFS_DIR2_DATAPTR_TO_OFF(mp, INT_GET(blp[ent].address, ARCH_CONVERT))); ((char *)block + XFS_DIR2_DATAPTR_TO_OFF(mp, be32_to_cpu(blp[ent].address)));
/* /*
* Fill in inode number, release the block. * Fill in inode number, release the block.
*/ */
...@@ -676,7 +677,7 @@ xfs_dir2_block_lookup_int( ...@@ -676,7 +677,7 @@ xfs_dir2_block_lookup_int(
for (low = 0, high = be32_to_cpu(btp->count) - 1; ; ) { for (low = 0, high = be32_to_cpu(btp->count) - 1; ; ) {
ASSERT(low <= high); ASSERT(low <= high);
mid = (low + high) >> 1; mid = (low + high) >> 1;
if ((hash = INT_GET(blp[mid].hashval, ARCH_CONVERT)) == args->hashval) if ((hash = be32_to_cpu(blp[mid].hashval)) == args->hashval)
break; break;
if (hash < args->hashval) if (hash < args->hashval)
low = mid + 1; low = mid + 1;
...@@ -691,7 +692,7 @@ xfs_dir2_block_lookup_int( ...@@ -691,7 +692,7 @@ xfs_dir2_block_lookup_int(
/* /*
* Back up to the first one with the right hash value. * Back up to the first one with the right hash value.
*/ */
while (mid > 0 && INT_GET(blp[mid - 1].hashval, ARCH_CONVERT) == args->hashval) { while (mid > 0 && be32_to_cpu(blp[mid - 1].hashval) == args->hashval) {
mid--; mid--;
} }
/* /*
...@@ -699,7 +700,7 @@ xfs_dir2_block_lookup_int( ...@@ -699,7 +700,7 @@ xfs_dir2_block_lookup_int(
* right hash value looking for our name. * right hash value looking for our name.
*/ */
do { do {
if ((addr = INT_GET(blp[mid].address, ARCH_CONVERT)) == XFS_DIR2_NULL_DATAPTR) if ((addr = be32_to_cpu(blp[mid].address)) == XFS_DIR2_NULL_DATAPTR)
continue; continue;
/* /*
* Get pointer to the entry from the leaf. * Get pointer to the entry from the leaf.
...@@ -716,7 +717,7 @@ xfs_dir2_block_lookup_int( ...@@ -716,7 +717,7 @@ xfs_dir2_block_lookup_int(
*entno = mid; *entno = mid;
return 0; return 0;
} }
} while (++mid < be32_to_cpu(btp->count) && INT_GET(blp[mid].hashval, ARCH_CONVERT) == hash); } while (++mid < be32_to_cpu(btp->count) && be32_to_cpu(blp[mid].hashval) == hash);
/* /*
* No match, release the buffer and return ENOENT. * No match, release the buffer and return ENOENT.
*/ */
...@@ -766,7 +767,7 @@ xfs_dir2_block_removename( ...@@ -766,7 +767,7 @@ xfs_dir2_block_removename(
* Point to the data entry using the leaf entry. * Point to the data entry using the leaf entry.
*/ */
dep = (xfs_dir2_data_entry_t *) dep = (xfs_dir2_data_entry_t *)
((char *)block + XFS_DIR2_DATAPTR_TO_OFF(mp, INT_GET(blp[ent].address, ARCH_CONVERT))); ((char *)block + XFS_DIR2_DATAPTR_TO_OFF(mp, be32_to_cpu(blp[ent].address)));
/* /*
* Mark the data entry's space free. * Mark the data entry's space free.
*/ */
...@@ -782,7 +783,7 @@ xfs_dir2_block_removename( ...@@ -782,7 +783,7 @@ xfs_dir2_block_removename(
/* /*
* Remove the leaf entry by marking it stale. * Remove the leaf entry by marking it stale.
*/ */
INT_SET(blp[ent].address, ARCH_CONVERT, XFS_DIR2_NULL_DATAPTR); blp[ent].address = cpu_to_be32(XFS_DIR2_NULL_DATAPTR);
xfs_dir2_block_log_leaf(tp, bp, ent, ent); xfs_dir2_block_log_leaf(tp, bp, ent, ent);
/* /*
* Fix up bestfree, log the header if necessary. * Fix up bestfree, log the header if necessary.
...@@ -842,7 +843,7 @@ xfs_dir2_block_replace( ...@@ -842,7 +843,7 @@ xfs_dir2_block_replace(
* Point to the data entry we need to change. * Point to the data entry we need to change.
*/ */
dep = (xfs_dir2_data_entry_t *) dep = (xfs_dir2_data_entry_t *)
((char *)block + XFS_DIR2_DATAPTR_TO_OFF(mp, INT_GET(blp[ent].address, ARCH_CONVERT))); ((char *)block + XFS_DIR2_DATAPTR_TO_OFF(mp, be32_to_cpu(blp[ent].address)));
ASSERT(INT_GET(dep->inumber, ARCH_CONVERT) != args->inumber); ASSERT(INT_GET(dep->inumber, ARCH_CONVERT) != args->inumber);
/* /*
* Change the inode number to the new value. * Change the inode number to the new value.
...@@ -867,8 +868,8 @@ xfs_dir2_block_sort( ...@@ -867,8 +868,8 @@ xfs_dir2_block_sort(
la = a; la = a;
lb = b; lb = b;
return INT_GET(la->hashval, ARCH_CONVERT) < INT_GET(lb->hashval, ARCH_CONVERT) ? -1 : return be32_to_cpu(la->hashval) < be32_to_cpu(lb->hashval) ? -1 :
(INT_GET(la->hashval, ARCH_CONVERT) > INT_GET(lb->hashval, ARCH_CONVERT) ? 1 : 0); (be32_to_cpu(la->hashval) > be32_to_cpu(lb->hashval) ? 1 : 0);
} }
/* /*
...@@ -976,7 +977,7 @@ xfs_dir2_leaf_to_block( ...@@ -976,7 +977,7 @@ xfs_dir2_leaf_to_block(
*/ */
lep = XFS_DIR2_BLOCK_LEAF_P(btp); lep = XFS_DIR2_BLOCK_LEAF_P(btp);
for (from = to = 0; from < be16_to_cpu(leaf->hdr.count); from++) { for (from = to = 0; from < be16_to_cpu(leaf->hdr.count); from++) {
if (INT_GET(leaf->ents[from].address, ARCH_CONVERT) == XFS_DIR2_NULL_DATAPTR) if (be32_to_cpu(leaf->ents[from].address) == XFS_DIR2_NULL_DATAPTR)
continue; continue;
lep[to++] = leaf->ents[from]; lep[to++] = leaf->ents[from];
} }
...@@ -1135,8 +1136,9 @@ xfs_dir2_sf_to_block( ...@@ -1135,8 +1136,9 @@ xfs_dir2_sf_to_block(
tagp = XFS_DIR2_DATA_ENTRY_TAG_P(dep); tagp = XFS_DIR2_DATA_ENTRY_TAG_P(dep);
INT_SET(*tagp, ARCH_CONVERT, (xfs_dir2_data_off_t)((char *)dep - (char *)block)); INT_SET(*tagp, ARCH_CONVERT, (xfs_dir2_data_off_t)((char *)dep - (char *)block));
xfs_dir2_data_log_entry(tp, bp, dep); xfs_dir2_data_log_entry(tp, bp, dep);
INT_SET(blp[0].hashval, ARCH_CONVERT, xfs_dir_hash_dot); blp[0].hashval = cpu_to_be32(xfs_dir_hash_dot);
INT_SET(blp[0].address, ARCH_CONVERT, XFS_DIR2_BYTE_TO_DATAPTR(mp, (char *)dep - (char *)block)); blp[0].address = cpu_to_be32(XFS_DIR2_BYTE_TO_DATAPTR(mp,
(char *)dep - (char *)block));
/* /*
* Create entry for .. * Create entry for ..
*/ */
...@@ -1148,8 +1150,9 @@ xfs_dir2_sf_to_block( ...@@ -1148,8 +1150,9 @@ xfs_dir2_sf_to_block(
tagp = XFS_DIR2_DATA_ENTRY_TAG_P(dep); tagp = XFS_DIR2_DATA_ENTRY_TAG_P(dep);
INT_SET(*tagp, ARCH_CONVERT, (xfs_dir2_data_off_t)((char *)dep - (char *)block)); INT_SET(*tagp, ARCH_CONVERT, (xfs_dir2_data_off_t)((char *)dep - (char *)block));
xfs_dir2_data_log_entry(tp, bp, dep); xfs_dir2_data_log_entry(tp, bp, dep);
INT_SET(blp[1].hashval, ARCH_CONVERT, xfs_dir_hash_dotdot); blp[1].hashval = cpu_to_be32(xfs_dir_hash_dotdot);
INT_SET(blp[1].address, ARCH_CONVERT, XFS_DIR2_BYTE_TO_DATAPTR(mp, (char *)dep - (char *)block)); blp[1].address = cpu_to_be32(XFS_DIR2_BYTE_TO_DATAPTR(mp,
(char *)dep - (char *)block));
offset = XFS_DIR2_DATA_FIRST_OFFSET; offset = XFS_DIR2_DATA_FIRST_OFFSET;
/* /*
* Loop over existing entries, stuff them in. * Loop over existing entries, stuff them in.
...@@ -1197,8 +1200,9 @@ xfs_dir2_sf_to_block( ...@@ -1197,8 +1200,9 @@ xfs_dir2_sf_to_block(
tagp = XFS_DIR2_DATA_ENTRY_TAG_P(dep); tagp = XFS_DIR2_DATA_ENTRY_TAG_P(dep);
INT_SET(*tagp, ARCH_CONVERT, (xfs_dir2_data_off_t)((char *)dep - (char *)block)); INT_SET(*tagp, ARCH_CONVERT, (xfs_dir2_data_off_t)((char *)dep - (char *)block));
xfs_dir2_data_log_entry(tp, bp, dep); xfs_dir2_data_log_entry(tp, bp, dep);
INT_SET(blp[2 + i].hashval, ARCH_CONVERT, xfs_da_hashname((char *)sfep->name, sfep->namelen)); blp[2 + i].hashval = cpu_to_be32(xfs_da_hashname(
INT_SET(blp[2 + i].address, ARCH_CONVERT, XFS_DIR2_BYTE_TO_DATAPTR(mp, (char *)sfep->name, sfep->namelen));
blp[2 + i].address = cpu_to_be32(XFS_DIR2_BYTE_TO_DATAPTR(mp,
(char *)dep - (char *)block)); (char *)dep - (char *)block));
offset = (int)((char *)(tagp + 1) - (char *)block); offset = (int)((char *)(tagp + 1) - (char *)block);
if (++i == INT_GET(sfp->hdr.count, ARCH_CONVERT)) if (++i == INT_GET(sfp->hdr.count, ARCH_CONVERT))
......
...@@ -144,8 +144,8 @@ xfs_dir2_data_check( ...@@ -144,8 +144,8 @@ xfs_dir2_data_check(
((char *)dep - (char *)d)); ((char *)dep - (char *)d));
hash = xfs_da_hashname((char *)dep->name, dep->namelen); hash = xfs_da_hashname((char *)dep->name, dep->namelen);
for (i = 0; i < be32_to_cpu(btp->count); i++) { for (i = 0; i < be32_to_cpu(btp->count); i++) {
if (INT_GET(lep[i].address, ARCH_CONVERT) == addr && if (be32_to_cpu(lep[i].address) == addr &&
INT_GET(lep[i].hashval, ARCH_CONVERT) == hash) be32_to_cpu(lep[i].hashval) == hash)
break; break;
} }
ASSERT(i < be32_to_cpu(btp->count)); ASSERT(i < be32_to_cpu(btp->count));
...@@ -158,10 +158,10 @@ xfs_dir2_data_check( ...@@ -158,10 +158,10 @@ xfs_dir2_data_check(
ASSERT(freeseen == 7); ASSERT(freeseen == 7);
if (be32_to_cpu(d->hdr.magic) == XFS_DIR2_BLOCK_MAGIC) { if (be32_to_cpu(d->hdr.magic) == XFS_DIR2_BLOCK_MAGIC) {
for (i = stale = 0; i < be32_to_cpu(btp->count); i++) { for (i = stale = 0; i < be32_to_cpu(btp->count); i++) {
if (INT_GET(lep[i].address, ARCH_CONVERT) == XFS_DIR2_NULL_DATAPTR) if (be32_to_cpu(lep[i].address) == XFS_DIR2_NULL_DATAPTR)
stale++; stale++;
if (i > 0) if (i > 0)
ASSERT(INT_GET(lep[i].hashval, ARCH_CONVERT) >= INT_GET(lep[i - 1].hashval, ARCH_CONVERT)); ASSERT(be32_to_cpu(lep[i].hashval) >= be32_to_cpu(lep[i - 1].hashval));
} }
ASSERT(count == be32_to_cpu(btp->count) - be32_to_cpu(btp->stale)); ASSERT(count == be32_to_cpu(btp->count) - be32_to_cpu(btp->stale));
ASSERT(stale == be32_to_cpu(btp->stale)); ASSERT(stale == be32_to_cpu(btp->stale));
......
...@@ -222,11 +222,11 @@ xfs_dir2_leaf_addname( ...@@ -222,11 +222,11 @@ xfs_dir2_leaf_addname(
* in a data block, improving the lookup of those entries. * in a data block, improving the lookup of those entries.
*/ */
for (use_block = -1, lep = &leaf->ents[index]; for (use_block = -1, lep = &leaf->ents[index];
index < be16_to_cpu(leaf->hdr.count) && INT_GET(lep->hashval, ARCH_CONVERT) == args->hashval; index < be16_to_cpu(leaf->hdr.count) && be32_to_cpu(lep->hashval) == args->hashval;
index++, lep++) { index++, lep++) {
if (INT_GET(lep->address, ARCH_CONVERT) == XFS_DIR2_NULL_DATAPTR) if (be32_to_cpu(lep->address) == XFS_DIR2_NULL_DATAPTR)
continue; continue;
i = XFS_DIR2_DATAPTR_TO_DB(mp, INT_GET(lep->address, ARCH_CONVERT)); i = XFS_DIR2_DATAPTR_TO_DB(mp, be32_to_cpu(lep->address));
ASSERT(i < be32_to_cpu(ltp->bestcount)); ASSERT(i < be32_to_cpu(ltp->bestcount));
ASSERT(be16_to_cpu(bestsp[i]) != NULLDATAOFF); ASSERT(be16_to_cpu(bestsp[i]) != NULLDATAOFF);
if (be16_to_cpu(bestsp[i]) >= length) { if (be16_to_cpu(bestsp[i]) >= length) {
...@@ -468,7 +468,7 @@ xfs_dir2_leaf_addname( ...@@ -468,7 +468,7 @@ xfs_dir2_leaf_addname(
*/ */
for (lowstale = index - 1; for (lowstale = index - 1;
lowstale >= 0 && lowstale >= 0 &&
INT_GET(leaf->ents[lowstale].address, ARCH_CONVERT) != be32_to_cpu(leaf->ents[lowstale].address) !=
XFS_DIR2_NULL_DATAPTR; XFS_DIR2_NULL_DATAPTR;
lowstale--) lowstale--)
continue; continue;
...@@ -479,7 +479,7 @@ xfs_dir2_leaf_addname( ...@@ -479,7 +479,7 @@ xfs_dir2_leaf_addname(
*/ */
for (highstale = index; for (highstale = index;
highstale < be16_to_cpu(leaf->hdr.count) && highstale < be16_to_cpu(leaf->hdr.count) &&
INT_GET(leaf->ents[highstale].address, ARCH_CONVERT) != be32_to_cpu(leaf->ents[highstale].address) !=
XFS_DIR2_NULL_DATAPTR && XFS_DIR2_NULL_DATAPTR &&
(lowstale < 0 || (lowstale < 0 ||
index - lowstale - 1 >= highstale - index); index - lowstale - 1 >= highstale - index);
...@@ -493,7 +493,7 @@ xfs_dir2_leaf_addname( ...@@ -493,7 +493,7 @@ xfs_dir2_leaf_addname(
(highstale == be16_to_cpu(leaf->hdr.count) || (highstale == be16_to_cpu(leaf->hdr.count) ||
index - lowstale - 1 < highstale - index)) { index - lowstale - 1 < highstale - index)) {
ASSERT(index - lowstale - 1 >= 0); ASSERT(index - lowstale - 1 >= 0);
ASSERT(INT_GET(leaf->ents[lowstale].address, ARCH_CONVERT) == ASSERT(be32_to_cpu(leaf->ents[lowstale].address) ==
XFS_DIR2_NULL_DATAPTR); XFS_DIR2_NULL_DATAPTR);
/* /*
* Copy entries up to cover the stale entry * Copy entries up to cover the stale entry
...@@ -512,7 +512,7 @@ xfs_dir2_leaf_addname( ...@@ -512,7 +512,7 @@ xfs_dir2_leaf_addname(
*/ */
else { else {
ASSERT(highstale - index >= 0); ASSERT(highstale - index >= 0);
ASSERT(INT_GET(leaf->ents[highstale].address, ARCH_CONVERT) == ASSERT(be32_to_cpu(leaf->ents[highstale].address) ==
XFS_DIR2_NULL_DATAPTR); XFS_DIR2_NULL_DATAPTR);
/* /*
* Copy entries down to copver the stale entry * Copy entries down to copver the stale entry
...@@ -531,8 +531,9 @@ xfs_dir2_leaf_addname( ...@@ -531,8 +531,9 @@ xfs_dir2_leaf_addname(
/* /*
* Fill in the new leaf entry. * Fill in the new leaf entry.
*/ */
INT_SET(lep->hashval, ARCH_CONVERT, args->hashval); lep->hashval = cpu_to_be32(args->hashval);
INT_SET(lep->address, ARCH_CONVERT, XFS_DIR2_DB_OFF_TO_DATAPTR(mp, use_block, INT_GET(*tagp, ARCH_CONVERT))); lep->address = cpu_to_be32(XFS_DIR2_DB_OFF_TO_DATAPTR(mp, use_block,
INT_GET(*tagp, ARCH_CONVERT)));
/* /*
* Log the leaf fields and give up the buffers. * Log the leaf fields and give up the buffers.
*/ */
...@@ -581,9 +582,9 @@ xfs_dir2_leaf_check( ...@@ -581,9 +582,9 @@ xfs_dir2_leaf_check(
*/ */
for (i = stale = 0; i < be16_to_cpu(leaf->hdr.count); i++) { for (i = stale = 0; i < be16_to_cpu(leaf->hdr.count); i++) {
if (i + 1 < be16_to_cpu(leaf->hdr.count)) if (i + 1 < be16_to_cpu(leaf->hdr.count))
ASSERT(INT_GET(leaf->ents[i].hashval, ARCH_CONVERT) <= ASSERT(be32_to_cpu(leaf->ents[i].hashval) <=
INT_GET(leaf->ents[i + 1].hashval, ARCH_CONVERT)); be32_to_cpu(leaf->ents[i + 1].hashval));
if (INT_GET(leaf->ents[i].address, ARCH_CONVERT) == XFS_DIR2_NULL_DATAPTR) if (be32_to_cpu(leaf->ents[i].address) == XFS_DIR2_NULL_DATAPTR)
stale++; stale++;
} }
ASSERT(be16_to_cpu(leaf->hdr.stale) == stale); ASSERT(be16_to_cpu(leaf->hdr.stale) == stale);
...@@ -612,7 +613,7 @@ xfs_dir2_leaf_compact( ...@@ -612,7 +613,7 @@ xfs_dir2_leaf_compact(
* Compress out the stale entries in place. * Compress out the stale entries in place.
*/ */
for (from = to = 0, loglow = -1; from < be16_to_cpu(leaf->hdr.count); from++) { for (from = to = 0, loglow = -1; from < be16_to_cpu(leaf->hdr.count); from++) {
if (INT_GET(leaf->ents[from].address, ARCH_CONVERT) == XFS_DIR2_NULL_DATAPTR) if (be32_to_cpu(leaf->ents[from].address) == XFS_DIR2_NULL_DATAPTR)
continue; continue;
/* /*
* Only actually copy the entries that are different. * Only actually copy the entries that are different.
...@@ -669,7 +670,7 @@ xfs_dir2_leaf_compact_x1( ...@@ -669,7 +670,7 @@ xfs_dir2_leaf_compact_x1(
*/ */
for (lowstale = index - 1; for (lowstale = index - 1;
lowstale >= 0 && lowstale >= 0 &&
INT_GET(leaf->ents[lowstale].address, ARCH_CONVERT) != XFS_DIR2_NULL_DATAPTR; be32_to_cpu(leaf->ents[lowstale].address) != XFS_DIR2_NULL_DATAPTR;
lowstale--) lowstale--)
continue; continue;
/* /*
...@@ -678,7 +679,7 @@ xfs_dir2_leaf_compact_x1( ...@@ -678,7 +679,7 @@ xfs_dir2_leaf_compact_x1(
*/ */
for (highstale = index; for (highstale = index;
highstale < be16_to_cpu(leaf->hdr.count) && highstale < be16_to_cpu(leaf->hdr.count) &&
INT_GET(leaf->ents[highstale].address, ARCH_CONVERT) != XFS_DIR2_NULL_DATAPTR && be32_to_cpu(leaf->ents[highstale].address) != XFS_DIR2_NULL_DATAPTR &&
(lowstale < 0 || index - lowstale > highstale - index); (lowstale < 0 || index - lowstale > highstale - index);
highstale++) highstale++)
continue; continue;
...@@ -702,7 +703,7 @@ xfs_dir2_leaf_compact_x1( ...@@ -702,7 +703,7 @@ xfs_dir2_leaf_compact_x1(
if (index == from) if (index == from)
newindex = to; newindex = to;
if (from != keepstale && if (from != keepstale &&
INT_GET(leaf->ents[from].address, ARCH_CONVERT) == XFS_DIR2_NULL_DATAPTR) { be32_to_cpu(leaf->ents[from].address) == XFS_DIR2_NULL_DATAPTR) {
if (from == to) if (from == to)
*lowlogp = to; *lowlogp = to;
continue; continue;
...@@ -1314,7 +1315,7 @@ xfs_dir2_leaf_lookup( ...@@ -1314,7 +1315,7 @@ xfs_dir2_leaf_lookup(
*/ */
dep = (xfs_dir2_data_entry_t *) dep = (xfs_dir2_data_entry_t *)
((char *)dbp->data + ((char *)dbp->data +
XFS_DIR2_DATAPTR_TO_OFF(dp->i_mount, INT_GET(lep->address, ARCH_CONVERT))); XFS_DIR2_DATAPTR_TO_OFF(dp->i_mount, be32_to_cpu(lep->address)));
/* /*
* Return the found inode number. * Return the found inode number.
*/ */
...@@ -1373,17 +1374,17 @@ xfs_dir2_leaf_lookup_int( ...@@ -1373,17 +1374,17 @@ xfs_dir2_leaf_lookup_int(
* looking to match the name. * looking to match the name.
*/ */
for (lep = &leaf->ents[index], dbp = NULL, curdb = -1; for (lep = &leaf->ents[index], dbp = NULL, curdb = -1;
index < be16_to_cpu(leaf->hdr.count) && INT_GET(lep->hashval, ARCH_CONVERT) == args->hashval; index < be16_to_cpu(leaf->hdr.count) && be32_to_cpu(lep->hashval) == args->hashval;
lep++, index++) { lep++, index++) {
/* /*
* Skip over stale leaf entries. * Skip over stale leaf entries.
*/ */
if (INT_GET(lep->address, ARCH_CONVERT) == XFS_DIR2_NULL_DATAPTR) if (be32_to_cpu(lep->address) == XFS_DIR2_NULL_DATAPTR)
continue; continue;
/* /*
* Get the new data block number. * Get the new data block number.
*/ */
newdb = XFS_DIR2_DATAPTR_TO_DB(mp, INT_GET(lep->address, ARCH_CONVERT)); newdb = XFS_DIR2_DATAPTR_TO_DB(mp, be32_to_cpu(lep->address));
/* /*
* If it's not the same as the old data block number, * If it's not the same as the old data block number,
* need to pitch the old one and read the new one. * need to pitch the old one and read the new one.
...@@ -1406,7 +1407,7 @@ xfs_dir2_leaf_lookup_int( ...@@ -1406,7 +1407,7 @@ xfs_dir2_leaf_lookup_int(
*/ */
dep = (xfs_dir2_data_entry_t *) dep = (xfs_dir2_data_entry_t *)
((char *)dbp->data + ((char *)dbp->data +
XFS_DIR2_DATAPTR_TO_OFF(mp, INT_GET(lep->address, ARCH_CONVERT))); XFS_DIR2_DATAPTR_TO_OFF(mp, be32_to_cpu(lep->address)));
/* /*
* If it matches then return it. * If it matches then return it.
*/ */
...@@ -1471,9 +1472,9 @@ xfs_dir2_leaf_removename( ...@@ -1471,9 +1472,9 @@ xfs_dir2_leaf_removename(
* Point to the leaf entry, use that to point to the data entry. * Point to the leaf entry, use that to point to the data entry.
*/ */
lep = &leaf->ents[index]; lep = &leaf->ents[index];
db = XFS_DIR2_DATAPTR_TO_DB(mp, INT_GET(lep->address, ARCH_CONVERT)); db = XFS_DIR2_DATAPTR_TO_DB(mp, be32_to_cpu(lep->address));
dep = (xfs_dir2_data_entry_t *) dep = (xfs_dir2_data_entry_t *)
((char *)data + XFS_DIR2_DATAPTR_TO_OFF(mp, INT_GET(lep->address, ARCH_CONVERT))); ((char *)data + XFS_DIR2_DATAPTR_TO_OFF(mp, be32_to_cpu(lep->address)));
needscan = needlog = 0; needscan = needlog = 0;
oldbest = be16_to_cpu(data->hdr.bestfree[0].length); oldbest = be16_to_cpu(data->hdr.bestfree[0].length);
ltp = XFS_DIR2_LEAF_TAIL_P(mp, leaf); ltp = XFS_DIR2_LEAF_TAIL_P(mp, leaf);
...@@ -1490,7 +1491,7 @@ xfs_dir2_leaf_removename( ...@@ -1490,7 +1491,7 @@ xfs_dir2_leaf_removename(
*/ */
be16_add(&leaf->hdr.stale, 1); be16_add(&leaf->hdr.stale, 1);
xfs_dir2_leaf_log_header(tp, lbp); xfs_dir2_leaf_log_header(tp, lbp);
INT_SET(lep->address, ARCH_CONVERT, XFS_DIR2_NULL_DATAPTR); lep->address = cpu_to_be32(XFS_DIR2_NULL_DATAPTR);
xfs_dir2_leaf_log_ents(tp, lbp, index, index); xfs_dir2_leaf_log_ents(tp, lbp, index, index);
/* /*
* Scan the freespace in the data block again if necessary, * Scan the freespace in the data block again if necessary,
...@@ -1604,7 +1605,7 @@ xfs_dir2_leaf_replace( ...@@ -1604,7 +1605,7 @@ xfs_dir2_leaf_replace(
*/ */
dep = (xfs_dir2_data_entry_t *) dep = (xfs_dir2_data_entry_t *)
((char *)dbp->data + ((char *)dbp->data +
XFS_DIR2_DATAPTR_TO_OFF(dp->i_mount, INT_GET(lep->address, ARCH_CONVERT))); XFS_DIR2_DATAPTR_TO_OFF(dp->i_mount, be32_to_cpu(lep->address)));
ASSERT(args->inumber != INT_GET(dep->inumber, ARCH_CONVERT)); ASSERT(args->inumber != INT_GET(dep->inumber, ARCH_CONVERT));
/* /*
* Put the new inode number in, log it. * Put the new inode number in, log it.
...@@ -1649,7 +1650,7 @@ xfs_dir2_leaf_search_hash( ...@@ -1649,7 +1650,7 @@ xfs_dir2_leaf_search_hash(
hashwant = args->hashval; hashwant = args->hashval;
low <= high; ) { low <= high; ) {
mid = (low + high) >> 1; mid = (low + high) >> 1;
if ((hash = INT_GET(lep[mid].hashval, ARCH_CONVERT)) == hashwant) if ((hash = be32_to_cpu(lep[mid].hashval)) == hashwant)
break; break;
if (hash < hashwant) if (hash < hashwant)
low = mid + 1; low = mid + 1;
...@@ -1660,7 +1661,7 @@ xfs_dir2_leaf_search_hash( ...@@ -1660,7 +1661,7 @@ xfs_dir2_leaf_search_hash(
* Found one, back up through all the equal hash values. * Found one, back up through all the equal hash values.
*/ */
if (hash == hashwant) { if (hash == hashwant) {
while (mid > 0 && INT_GET(lep[mid - 1].hashval, ARCH_CONVERT) == hashwant) { while (mid > 0 && be32_to_cpu(lep[mid - 1].hashval) == hashwant) {
mid--; mid--;
} }
} }
......
...@@ -54,8 +54,8 @@ typedef struct xfs_dir2_leaf_hdr { ...@@ -54,8 +54,8 @@ typedef struct xfs_dir2_leaf_hdr {
* Leaf block entry. * Leaf block entry.
*/ */
typedef struct xfs_dir2_leaf_entry { typedef struct xfs_dir2_leaf_entry {
xfs_dahash_t hashval; /* hash value of name */ __be32 hashval; /* hash value of name */
xfs_dir2_dataptr_t address; /* address of data entry */ __be32 address; /* address of data entry */
} xfs_dir2_leaf_entry_t; } xfs_dir2_leaf_entry_t;
/* /*
......
...@@ -223,9 +223,9 @@ xfs_dir2_leafn_add( ...@@ -223,9 +223,9 @@ xfs_dir2_leafn_add(
compact = be16_to_cpu(leaf->hdr.stale) > 1; compact = be16_to_cpu(leaf->hdr.stale) > 1;
} else } else
compact = 0; compact = 0;
ASSERT(index == 0 || INT_GET(leaf->ents[index - 1].hashval, ARCH_CONVERT) <= args->hashval); ASSERT(index == 0 || be32_to_cpu(leaf->ents[index - 1].hashval) <= args->hashval);
ASSERT(index == be16_to_cpu(leaf->hdr.count) || ASSERT(index == be16_to_cpu(leaf->hdr.count) ||
INT_GET(leaf->ents[index].hashval, ARCH_CONVERT) >= args->hashval); be32_to_cpu(leaf->ents[index].hashval) >= args->hashval);
if (args->justcheck) if (args->justcheck)
return 0; return 0;
...@@ -271,7 +271,7 @@ xfs_dir2_leafn_add( ...@@ -271,7 +271,7 @@ xfs_dir2_leafn_add(
*/ */
for (lowstale = index - 1; for (lowstale = index - 1;
lowstale >= 0 && lowstale >= 0 &&
INT_GET(leaf->ents[lowstale].address, ARCH_CONVERT) != be32_to_cpu(leaf->ents[lowstale].address) !=
XFS_DIR2_NULL_DATAPTR; XFS_DIR2_NULL_DATAPTR;
lowstale--) lowstale--)
continue; continue;
...@@ -282,7 +282,7 @@ xfs_dir2_leafn_add( ...@@ -282,7 +282,7 @@ xfs_dir2_leafn_add(
*/ */
for (highstale = index; for (highstale = index;
highstale < be16_to_cpu(leaf->hdr.count) && highstale < be16_to_cpu(leaf->hdr.count) &&
INT_GET(leaf->ents[highstale].address, ARCH_CONVERT) != be32_to_cpu(leaf->ents[highstale].address) !=
XFS_DIR2_NULL_DATAPTR && XFS_DIR2_NULL_DATAPTR &&
(lowstale < 0 || (lowstale < 0 ||
index - lowstale - 1 >= highstale - index); index - lowstale - 1 >= highstale - index);
...@@ -296,7 +296,7 @@ xfs_dir2_leafn_add( ...@@ -296,7 +296,7 @@ xfs_dir2_leafn_add(
if (lowstale >= 0 && if (lowstale >= 0 &&
(highstale == be16_to_cpu(leaf->hdr.count) || (highstale == be16_to_cpu(leaf->hdr.count) ||
index - lowstale - 1 < highstale - index)) { index - lowstale - 1 < highstale - index)) {
ASSERT(INT_GET(leaf->ents[lowstale].address, ARCH_CONVERT) == ASSERT(be32_to_cpu(leaf->ents[lowstale].address) ==
XFS_DIR2_NULL_DATAPTR); XFS_DIR2_NULL_DATAPTR);
ASSERT(index - lowstale - 1 >= 0); ASSERT(index - lowstale - 1 >= 0);
if (index - lowstale - 1 > 0) if (index - lowstale - 1 > 0)
...@@ -312,7 +312,7 @@ xfs_dir2_leafn_add( ...@@ -312,7 +312,7 @@ xfs_dir2_leafn_add(
* Shift entries down toward the stale slot. * Shift entries down toward the stale slot.
*/ */
else { else {
ASSERT(INT_GET(leaf->ents[highstale].address, ARCH_CONVERT) == ASSERT(be32_to_cpu(leaf->ents[highstale].address) ==
XFS_DIR2_NULL_DATAPTR); XFS_DIR2_NULL_DATAPTR);
ASSERT(highstale - index >= 0); ASSERT(highstale - index >= 0);
if (highstale - index > 0) if (highstale - index > 0)
...@@ -328,8 +328,9 @@ xfs_dir2_leafn_add( ...@@ -328,8 +328,9 @@ xfs_dir2_leafn_add(
/* /*
* Insert the new entry, log everything. * Insert the new entry, log everything.
*/ */
INT_SET(lep->hashval, ARCH_CONVERT, args->hashval); lep->hashval = cpu_to_be32(args->hashval);
INT_SET(lep->address, ARCH_CONVERT, XFS_DIR2_DB_OFF_TO_DATAPTR(mp, args->blkno, args->index)); lep->address = cpu_to_be32(XFS_DIR2_DB_OFF_TO_DATAPTR(mp,
args->blkno, args->index));
xfs_dir2_leaf_log_header(tp, bp); xfs_dir2_leaf_log_header(tp, bp);
xfs_dir2_leaf_log_ents(tp, bp, lfloglow, lfloghigh); xfs_dir2_leaf_log_ents(tp, bp, lfloglow, lfloghigh);
xfs_dir2_leafn_check(dp, bp); xfs_dir2_leafn_check(dp, bp);
...@@ -356,10 +357,10 @@ xfs_dir2_leafn_check( ...@@ -356,10 +357,10 @@ xfs_dir2_leafn_check(
ASSERT(be16_to_cpu(leaf->hdr.count) <= XFS_DIR2_MAX_LEAF_ENTS(mp)); ASSERT(be16_to_cpu(leaf->hdr.count) <= XFS_DIR2_MAX_LEAF_ENTS(mp));
for (i = stale = 0; i < be16_to_cpu(leaf->hdr.count); i++) { for (i = stale = 0; i < be16_to_cpu(leaf->hdr.count); i++) {
if (i + 1 < be16_to_cpu(leaf->hdr.count)) { if (i + 1 < be16_to_cpu(leaf->hdr.count)) {
ASSERT(INT_GET(leaf->ents[i].hashval, ARCH_CONVERT) <= ASSERT(be32_to_cpu(leaf->ents[i].hashval) <=
INT_GET(leaf->ents[i + 1].hashval, ARCH_CONVERT)); be32_to_cpu(leaf->ents[i + 1].hashval));
} }
if (INT_GET(leaf->ents[i].address, ARCH_CONVERT) == XFS_DIR2_NULL_DATAPTR) if (be32_to_cpu(leaf->ents[i].address) == XFS_DIR2_NULL_DATAPTR)
stale++; stale++;
} }
ASSERT(be16_to_cpu(leaf->hdr.stale) == stale); ASSERT(be16_to_cpu(leaf->hdr.stale) == stale);
...@@ -383,7 +384,7 @@ xfs_dir2_leafn_lasthash( ...@@ -383,7 +384,7 @@ xfs_dir2_leafn_lasthash(
*count = be16_to_cpu(leaf->hdr.count); *count = be16_to_cpu(leaf->hdr.count);
if (!leaf->hdr.count) if (!leaf->hdr.count)
return 0; return 0;
return INT_GET(leaf->ents[be16_to_cpu(leaf->hdr.count) - 1].hashval, ARCH_CONVERT); return be32_to_cpu(leaf->ents[be16_to_cpu(leaf->hdr.count) - 1].hashval);
} }
/* /*
...@@ -456,17 +457,17 @@ xfs_dir2_leafn_lookup_int( ...@@ -456,17 +457,17 @@ xfs_dir2_leafn_lookup_int(
* Loop over leaf entries with the right hash value. * Loop over leaf entries with the right hash value.
*/ */
for (lep = &leaf->ents[index]; for (lep = &leaf->ents[index];
index < be16_to_cpu(leaf->hdr.count) && INT_GET(lep->hashval, ARCH_CONVERT) == args->hashval; index < be16_to_cpu(leaf->hdr.count) && be32_to_cpu(lep->hashval) == args->hashval;
lep++, index++) { lep++, index++) {
/* /*
* Skip stale leaf entries. * Skip stale leaf entries.
*/ */
if (INT_GET(lep->address, ARCH_CONVERT) == XFS_DIR2_NULL_DATAPTR) if (be32_to_cpu(lep->address) == XFS_DIR2_NULL_DATAPTR)
continue; continue;
/* /*
* Pull the data block number from the entry. * Pull the data block number from the entry.
*/ */
newdb = XFS_DIR2_DATAPTR_TO_DB(mp, INT_GET(lep->address, ARCH_CONVERT)); newdb = XFS_DIR2_DATAPTR_TO_DB(mp, be32_to_cpu(lep->address));
/* /*
* For addname, we're looking for a place to put the new entry. * For addname, we're looking for a place to put the new entry.
* We want to use a data block with an entry of equal * We want to use a data block with an entry of equal
...@@ -572,7 +573,7 @@ xfs_dir2_leafn_lookup_int( ...@@ -572,7 +573,7 @@ xfs_dir2_leafn_lookup_int(
*/ */
dep = (xfs_dir2_data_entry_t *) dep = (xfs_dir2_data_entry_t *)
((char *)curbp->data + ((char *)curbp->data +
XFS_DIR2_DATAPTR_TO_OFF(mp, INT_GET(lep->address, ARCH_CONVERT))); XFS_DIR2_DATAPTR_TO_OFF(mp, be32_to_cpu(lep->address)));
/* /*
* Compare the entry, return it if it matches. * Compare the entry, return it if it matches.
*/ */
...@@ -672,7 +673,7 @@ xfs_dir2_leafn_moveents( ...@@ -672,7 +673,7 @@ xfs_dir2_leafn_moveents(
int i; /* temp leaf index */ int i; /* temp leaf index */
for (i = start_s, stale = 0; i < start_s + count; i++) { for (i = start_s, stale = 0; i < start_s + count; i++) {
if (INT_GET(leaf_s->ents[i].address, ARCH_CONVERT) == XFS_DIR2_NULL_DATAPTR) if (be32_to_cpu(leaf_s->ents[i].address) == XFS_DIR2_NULL_DATAPTR)
stale++; stale++;
} }
} else } else
...@@ -723,9 +724,9 @@ xfs_dir2_leafn_order( ...@@ -723,9 +724,9 @@ xfs_dir2_leafn_order(
ASSERT(INT_GET(leaf2->hdr.info.magic, ARCH_CONVERT) == XFS_DIR2_LEAFN_MAGIC); ASSERT(INT_GET(leaf2->hdr.info.magic, ARCH_CONVERT) == XFS_DIR2_LEAFN_MAGIC);
if (be16_to_cpu(leaf1->hdr.count) > 0 && if (be16_to_cpu(leaf1->hdr.count) > 0 &&
be16_to_cpu(leaf2->hdr.count) > 0 && be16_to_cpu(leaf2->hdr.count) > 0 &&
(INT_GET(leaf2->ents[0].hashval, ARCH_CONVERT) < INT_GET(leaf1->ents[0].hashval, ARCH_CONVERT) || (be32_to_cpu(leaf2->ents[0].hashval) < be32_to_cpu(leaf1->ents[0].hashval) ||
INT_GET(leaf2->ents[be16_to_cpu(leaf2->hdr.count) - 1].hashval, ARCH_CONVERT) < be32_to_cpu(leaf2->ents[be16_to_cpu(leaf2->hdr.count) - 1].hashval) <
INT_GET(leaf1->ents[be16_to_cpu(leaf1->hdr.count) - 1].hashval, ARCH_CONVERT))) be32_to_cpu(leaf1->ents[be16_to_cpu(leaf1->hdr.count) - 1].hashval)))
return 1; return 1;
return 0; return 0;
} }
...@@ -781,9 +782,9 @@ xfs_dir2_leafn_rebalance( ...@@ -781,9 +782,9 @@ xfs_dir2_leafn_rebalance(
xfs_dahash_t midhash; /* middle entry hash value */ xfs_dahash_t midhash; /* middle entry hash value */
if (mid >= be16_to_cpu(leaf1->hdr.count)) if (mid >= be16_to_cpu(leaf1->hdr.count))
midhash = INT_GET(leaf2->ents[mid - be16_to_cpu(leaf1->hdr.count)].hashval, ARCH_CONVERT); midhash = be32_to_cpu(leaf2->ents[mid - be16_to_cpu(leaf1->hdr.count)].hashval);
else else
midhash = INT_GET(leaf1->ents[mid].hashval, ARCH_CONVERT); midhash = be32_to_cpu(leaf1->ents[mid].hashval);
isleft = args->hashval <= midhash; isleft = args->hashval <= midhash;
} }
/* /*
...@@ -875,9 +876,9 @@ xfs_dir2_leafn_remove( ...@@ -875,9 +876,9 @@ xfs_dir2_leafn_remove(
/* /*
* Extract the data block and offset from the entry. * Extract the data block and offset from the entry.
*/ */
db = XFS_DIR2_DATAPTR_TO_DB(mp, INT_GET(lep->address, ARCH_CONVERT)); db = XFS_DIR2_DATAPTR_TO_DB(mp, be32_to_cpu(lep->address));
ASSERT(dblk->blkno == db); ASSERT(dblk->blkno == db);
off = XFS_DIR2_DATAPTR_TO_OFF(mp, INT_GET(lep->address, ARCH_CONVERT)); off = XFS_DIR2_DATAPTR_TO_OFF(mp, be32_to_cpu(lep->address));
ASSERT(dblk->index == off); ASSERT(dblk->index == off);
/* /*
* Kill the leaf entry by marking it stale. * Kill the leaf entry by marking it stale.
...@@ -885,7 +886,7 @@ xfs_dir2_leafn_remove( ...@@ -885,7 +886,7 @@ xfs_dir2_leafn_remove(
*/ */
be16_add(&leaf->hdr.stale, 1); be16_add(&leaf->hdr.stale, 1);
xfs_dir2_leaf_log_header(tp, bp); xfs_dir2_leaf_log_header(tp, bp);
INT_SET(lep->address, ARCH_CONVERT, XFS_DIR2_NULL_DATAPTR); lep->address = cpu_to_be32(XFS_DIR2_NULL_DATAPTR);
xfs_dir2_leaf_log_ents(tp, bp, index, index); xfs_dir2_leaf_log_ents(tp, bp, index, index);
/* /*
* Make the data entry free. Keep track of the longest freespace * Make the data entry free. Keep track of the longest freespace
...@@ -1269,14 +1270,14 @@ xfs_dir2_leafn_unbalance( ...@@ -1269,14 +1270,14 @@ xfs_dir2_leafn_unbalance(
/* /*
* Move the entries from drop to the appropriate end of save. * Move the entries from drop to the appropriate end of save.
*/ */
drop_blk->hashval = INT_GET(drop_leaf->ents[be16_to_cpu(drop_leaf->hdr.count) - 1].hashval, ARCH_CONVERT); drop_blk->hashval = be32_to_cpu(drop_leaf->ents[be16_to_cpu(drop_leaf->hdr.count) - 1].hashval);
if (xfs_dir2_leafn_order(save_blk->bp, drop_blk->bp)) if (xfs_dir2_leafn_order(save_blk->bp, drop_blk->bp))
xfs_dir2_leafn_moveents(args, drop_blk->bp, 0, save_blk->bp, 0, xfs_dir2_leafn_moveents(args, drop_blk->bp, 0, save_blk->bp, 0,
be16_to_cpu(drop_leaf->hdr.count)); be16_to_cpu(drop_leaf->hdr.count));
else else
xfs_dir2_leafn_moveents(args, drop_blk->bp, 0, save_blk->bp, xfs_dir2_leafn_moveents(args, drop_blk->bp, 0, save_blk->bp,
be16_to_cpu(save_leaf->hdr.count), be16_to_cpu(drop_leaf->hdr.count)); be16_to_cpu(save_leaf->hdr.count), be16_to_cpu(drop_leaf->hdr.count));
save_blk->hashval = INT_GET(save_leaf->ents[be16_to_cpu(save_leaf->hdr.count) - 1].hashval, ARCH_CONVERT); save_blk->hashval = be32_to_cpu(save_leaf->ents[be16_to_cpu(save_leaf->hdr.count) - 1].hashval);
xfs_dir2_leafn_check(args->dp, save_blk->bp); xfs_dir2_leafn_check(args->dp, save_blk->bp);
} }
...@@ -1903,7 +1904,7 @@ xfs_dir2_node_replace( ...@@ -1903,7 +1904,7 @@ xfs_dir2_node_replace(
ASSERT(be32_to_cpu(data->hdr.magic) == XFS_DIR2_DATA_MAGIC); ASSERT(be32_to_cpu(data->hdr.magic) == XFS_DIR2_DATA_MAGIC);
dep = (xfs_dir2_data_entry_t *) dep = (xfs_dir2_data_entry_t *)
((char *)data + ((char *)data +
XFS_DIR2_DATAPTR_TO_OFF(state->mp, INT_GET(lep->address, ARCH_CONVERT))); XFS_DIR2_DATAPTR_TO_OFF(state->mp, be32_to_cpu(lep->address)));
ASSERT(inum != INT_GET(dep->inumber, ARCH_CONVERT)); ASSERT(inum != INT_GET(dep->inumber, ARCH_CONVERT));
/* /*
* Fill in the new inode number and log the entry. * Fill in the new inode number and log the entry.
......
...@@ -99,7 +99,7 @@ xfs_dir2_block_sfsize( ...@@ -99,7 +99,7 @@ xfs_dir2_block_sfsize(
* Iterate over the block's data entries by using the leaf pointers. * Iterate over the block's data entries by using the leaf pointers.
*/ */
for (i = 0; i < be32_to_cpu(btp->count); i++) { for (i = 0; i < be32_to_cpu(btp->count); i++) {
if ((addr = INT_GET(blp[i].address, ARCH_CONVERT)) == XFS_DIR2_NULL_DATAPTR) if ((addr = be32_to_cpu(blp[i].address)) == XFS_DIR2_NULL_DATAPTR)
continue; continue;
/* /*
* Calculate the pointer to the entry at hand. * Calculate the pointer to the entry at hand.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment