[XFS] endianess annotations for xfs_da_node_entry_t
SGI-PV: 943272 SGI-Modid: xfs-linux-melb:xfs-kern:25504a Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Nathan Scott <nathans@sgi.com>
This commit is contained in:
parent
d7929ff670
commit
403432dcb5
@ -1829,9 +1829,8 @@ xfs_attr_node_list(xfs_attr_list_context_t *context)
|
|||||||
i < INT_GET(node->hdr.count, ARCH_CONVERT);
|
i < INT_GET(node->hdr.count, ARCH_CONVERT);
|
||||||
btree++, i++) {
|
btree++, i++) {
|
||||||
if (cursor->hashval
|
if (cursor->hashval
|
||||||
<= INT_GET(btree->hashval,
|
<= be32_to_cpu(btree->hashval)) {
|
||||||
ARCH_CONVERT)) {
|
cursor->blkno = be32_to_cpu(btree->before);
|
||||||
cursor->blkno = INT_GET(btree->before, ARCH_CONVERT);
|
|
||||||
xfs_attr_trace_l_cb("descending",
|
xfs_attr_trace_l_cb("descending",
|
||||||
context, btree);
|
context, btree);
|
||||||
break;
|
break;
|
||||||
@ -2228,8 +2227,8 @@ xfs_attr_trace_l_cn(char *where, struct xfs_attr_list_context *context,
|
|||||||
(__psunsigned_t)context->dupcnt,
|
(__psunsigned_t)context->dupcnt,
|
||||||
(__psunsigned_t)context->flags,
|
(__psunsigned_t)context->flags,
|
||||||
(__psunsigned_t)INT_GET(node->hdr.count, ARCH_CONVERT),
|
(__psunsigned_t)INT_GET(node->hdr.count, ARCH_CONVERT),
|
||||||
(__psunsigned_t)INT_GET(node->btree[0].hashval, ARCH_CONVERT),
|
(__psunsigned_t)be32_to_cpu(node->btree[0].hashval),
|
||||||
(__psunsigned_t)INT_GET(node->btree[INT_GET(node->hdr.count, ARCH_CONVERT)-1].hashval, ARCH_CONVERT));
|
(__psunsigned_t)be32_to_cpu(node->btree[INT_GET(node->hdr.count, ARCH_CONVERT)-1].hashval));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -2256,8 +2255,8 @@ xfs_attr_trace_l_cb(char *where, struct xfs_attr_list_context *context,
|
|||||||
: 0,
|
: 0,
|
||||||
(__psunsigned_t)context->dupcnt,
|
(__psunsigned_t)context->dupcnt,
|
||||||
(__psunsigned_t)context->flags,
|
(__psunsigned_t)context->flags,
|
||||||
(__psunsigned_t)INT_GET(btree->hashval, ARCH_CONVERT),
|
(__psunsigned_t)be32_to_cpu(btree->hashval),
|
||||||
(__psunsigned_t)INT_GET(btree->before, ARCH_CONVERT),
|
(__psunsigned_t)be32_to_cpu(btree->before),
|
||||||
(__psunsigned_t)NULL);
|
(__psunsigned_t)NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -869,7 +869,7 @@ xfs_attr_leaf_to_node(xfs_da_args_t *args)
|
|||||||
/* both on-disk, don't endian-flip twice */
|
/* both on-disk, don't endian-flip twice */
|
||||||
node->btree[0].hashval =
|
node->btree[0].hashval =
|
||||||
leaf->entries[be16_to_cpu(leaf->hdr.count)-1 ].hashval;
|
leaf->entries[be16_to_cpu(leaf->hdr.count)-1 ].hashval;
|
||||||
INT_SET(node->btree[0].before, ARCH_CONVERT, blkno);
|
node->btree[0].before = cpu_to_be32(blkno);
|
||||||
INT_SET(node->hdr.count, ARCH_CONVERT, 1);
|
INT_SET(node->hdr.count, ARCH_CONVERT, 1);
|
||||||
xfs_da_log_buf(args->trans, bp1, 0, XFS_LBSIZE(dp->i_mount) - 1);
|
xfs_da_log_buf(args->trans, bp1, 0, XFS_LBSIZE(dp->i_mount) - 1);
|
||||||
error = 0;
|
error = 0;
|
||||||
@ -2809,7 +2809,7 @@ xfs_attr_node_inactive(xfs_trans_t **trans, xfs_inode_t *dp, xfs_dabuf_t *bp,
|
|||||||
xfs_da_brelse(*trans, bp);
|
xfs_da_brelse(*trans, bp);
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
child_fsb = INT_GET(node->btree[0].before, ARCH_CONVERT);
|
child_fsb = be32_to_cpu(node->btree[0].before);
|
||||||
xfs_da_brelse(*trans, bp); /* no locks for later trans */
|
xfs_da_brelse(*trans, bp); /* no locks for later trans */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -2869,7 +2869,7 @@ xfs_attr_node_inactive(xfs_trans_t **trans, xfs_inode_t *dp, xfs_dabuf_t *bp,
|
|||||||
&bp, XFS_ATTR_FORK);
|
&bp, XFS_ATTR_FORK);
|
||||||
if (error)
|
if (error)
|
||||||
return(error);
|
return(error);
|
||||||
child_fsb = INT_GET(node->btree[i+1].before, ARCH_CONVERT);
|
child_fsb = be32_to_cpu(node->btree[i+1].before);
|
||||||
xfs_da_brelse(*trans, bp);
|
xfs_da_brelse(*trans, bp);
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
|
@ -385,10 +385,10 @@ xfs_da_root_split(xfs_da_state_t *state, xfs_da_state_blk_t *blk1,
|
|||||||
if (error)
|
if (error)
|
||||||
return(error);
|
return(error);
|
||||||
node = bp->data;
|
node = bp->data;
|
||||||
INT_SET(node->btree[0].hashval, ARCH_CONVERT, blk1->hashval);
|
node->btree[0].hashval = cpu_to_be32(blk1->hashval);
|
||||||
INT_SET(node->btree[0].before, ARCH_CONVERT, blk1->blkno);
|
node->btree[0].before = cpu_to_be32(blk1->blkno);
|
||||||
INT_SET(node->btree[1].hashval, ARCH_CONVERT, blk2->hashval);
|
node->btree[1].hashval = cpu_to_be32(blk2->hashval);
|
||||||
INT_SET(node->btree[1].before, ARCH_CONVERT, blk2->blkno);
|
node->btree[1].before = cpu_to_be32(blk2->blkno);
|
||||||
INT_SET(node->hdr.count, ARCH_CONVERT, 2);
|
INT_SET(node->hdr.count, ARCH_CONVERT, 2);
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
@ -517,9 +517,9 @@ xfs_da_node_rebalance(xfs_da_state_t *state, xfs_da_state_blk_t *blk1,
|
|||||||
* Swap the nodes around if that makes it simpler.
|
* Swap the nodes around if that makes it simpler.
|
||||||
*/
|
*/
|
||||||
if ((INT_GET(node1->hdr.count, ARCH_CONVERT) > 0) && (INT_GET(node2->hdr.count, ARCH_CONVERT) > 0) &&
|
if ((INT_GET(node1->hdr.count, ARCH_CONVERT) > 0) && (INT_GET(node2->hdr.count, ARCH_CONVERT) > 0) &&
|
||||||
((INT_GET(node2->btree[ 0 ].hashval, ARCH_CONVERT) < INT_GET(node1->btree[ 0 ].hashval, ARCH_CONVERT)) ||
|
((be32_to_cpu(node2->btree[0].hashval) < be32_to_cpu(node1->btree[0].hashval)) ||
|
||||||
(INT_GET(node2->btree[ INT_GET(node2->hdr.count, ARCH_CONVERT)-1 ].hashval, ARCH_CONVERT) <
|
(be32_to_cpu(node2->btree[INT_GET(node2->hdr.count, ARCH_CONVERT)-1].hashval) <
|
||||||
INT_GET(node1->btree[ INT_GET(node1->hdr.count, ARCH_CONVERT)-1 ].hashval, ARCH_CONVERT)))) {
|
be32_to_cpu(node1->btree[INT_GET(node1->hdr.count, ARCH_CONVERT)-1].hashval)))) {
|
||||||
tmpnode = node1;
|
tmpnode = node1;
|
||||||
node1 = node2;
|
node1 = node2;
|
||||||
node2 = tmpnode;
|
node2 = tmpnode;
|
||||||
@ -596,8 +596,8 @@ xfs_da_node_rebalance(xfs_da_state_t *state, xfs_da_state_blk_t *blk1,
|
|||||||
*/
|
*/
|
||||||
node1 = blk1->bp->data;
|
node1 = blk1->bp->data;
|
||||||
node2 = blk2->bp->data;
|
node2 = blk2->bp->data;
|
||||||
blk1->hashval = INT_GET(node1->btree[ INT_GET(node1->hdr.count, ARCH_CONVERT)-1 ].hashval, ARCH_CONVERT);
|
blk1->hashval = be32_to_cpu(node1->btree[ INT_GET(node1->hdr.count, ARCH_CONVERT)-1 ].hashval);
|
||||||
blk2->hashval = INT_GET(node2->btree[ INT_GET(node2->hdr.count, ARCH_CONVERT)-1 ].hashval, ARCH_CONVERT);
|
blk2->hashval = be32_to_cpu(node2->btree[ INT_GET(node2->hdr.count, ARCH_CONVERT)-1 ].hashval);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Adjust the expected index for insertion.
|
* Adjust the expected index for insertion.
|
||||||
@ -638,8 +638,8 @@ xfs_da_node_add(xfs_da_state_t *state, xfs_da_state_blk_t *oldblk,
|
|||||||
tmp = (INT_GET(node->hdr.count, ARCH_CONVERT) - oldblk->index) * (uint)sizeof(*btree);
|
tmp = (INT_GET(node->hdr.count, ARCH_CONVERT) - oldblk->index) * (uint)sizeof(*btree);
|
||||||
memmove(btree + 1, btree, tmp);
|
memmove(btree + 1, btree, tmp);
|
||||||
}
|
}
|
||||||
INT_SET(btree->hashval, ARCH_CONVERT, newblk->hashval);
|
btree->hashval = cpu_to_be32(newblk->hashval);
|
||||||
INT_SET(btree->before, ARCH_CONVERT, newblk->blkno);
|
btree->before = cpu_to_be32(newblk->blkno);
|
||||||
xfs_da_log_buf(state->args->trans, oldblk->bp,
|
xfs_da_log_buf(state->args->trans, oldblk->bp,
|
||||||
XFS_DA_LOGRANGE(node, btree, tmp + sizeof(*btree)));
|
XFS_DA_LOGRANGE(node, btree, tmp + sizeof(*btree)));
|
||||||
INT_MOD(node->hdr.count, ARCH_CONVERT, +1);
|
INT_MOD(node->hdr.count, ARCH_CONVERT, +1);
|
||||||
@ -649,7 +649,7 @@ xfs_da_node_add(xfs_da_state_t *state, xfs_da_state_blk_t *oldblk,
|
|||||||
/*
|
/*
|
||||||
* Copy the last hash value from the oldblk to propagate upwards.
|
* Copy the last hash value from the oldblk to propagate upwards.
|
||||||
*/
|
*/
|
||||||
oldblk->hashval = INT_GET(node->btree[ INT_GET(node->hdr.count, ARCH_CONVERT)-1 ].hashval, ARCH_CONVERT);
|
oldblk->hashval = be32_to_cpu(node->btree[ INT_GET(node->hdr.count, ARCH_CONVERT)-1 ].hashval);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*========================================================================
|
/*========================================================================
|
||||||
@ -782,7 +782,7 @@ xfs_da_root_join(xfs_da_state_t *state, xfs_da_state_blk_t *root_blk)
|
|||||||
* Read in the (only) child block, then copy those bytes into
|
* Read in the (only) child block, then copy those bytes into
|
||||||
* the root block's buffer and free the original child block.
|
* the root block's buffer and free the original child block.
|
||||||
*/
|
*/
|
||||||
child = INT_GET(oldroot->btree[ 0 ].before, ARCH_CONVERT);
|
child = be32_to_cpu(oldroot->btree[0].before);
|
||||||
ASSERT(child != 0);
|
ASSERT(child != 0);
|
||||||
error = xfs_da_read_buf(args->trans, args->dp, child, -1, &bp,
|
error = xfs_da_read_buf(args->trans, args->dp, child, -1, &bp,
|
||||||
args->whichfork);
|
args->whichfork);
|
||||||
@ -974,14 +974,14 @@ xfs_da_fixhashpath(xfs_da_state_t *state, xfs_da_state_path_t *path)
|
|||||||
node = blk->bp->data;
|
node = blk->bp->data;
|
||||||
ASSERT(be16_to_cpu(node->hdr.info.magic) == XFS_DA_NODE_MAGIC);
|
ASSERT(be16_to_cpu(node->hdr.info.magic) == XFS_DA_NODE_MAGIC);
|
||||||
btree = &node->btree[ blk->index ];
|
btree = &node->btree[ blk->index ];
|
||||||
if (INT_GET(btree->hashval, ARCH_CONVERT) == lasthash)
|
if (be32_to_cpu(btree->hashval) == lasthash)
|
||||||
break;
|
break;
|
||||||
blk->hashval = lasthash;
|
blk->hashval = lasthash;
|
||||||
INT_SET(btree->hashval, ARCH_CONVERT, lasthash);
|
btree->hashval = cpu_to_be32(lasthash);
|
||||||
xfs_da_log_buf(state->args->trans, blk->bp,
|
xfs_da_log_buf(state->args->trans, blk->bp,
|
||||||
XFS_DA_LOGRANGE(node, btree, sizeof(*btree)));
|
XFS_DA_LOGRANGE(node, btree, sizeof(*btree)));
|
||||||
|
|
||||||
lasthash = INT_GET(node->btree[ INT_GET(node->hdr.count, ARCH_CONVERT)-1 ].hashval, ARCH_CONVERT);
|
lasthash = be32_to_cpu(node->btree[ INT_GET(node->hdr.count, ARCH_CONVERT)-1 ].hashval);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1022,7 +1022,7 @@ xfs_da_node_remove(xfs_da_state_t *state, xfs_da_state_blk_t *drop_blk)
|
|||||||
* Copy the last hash value from the block to propagate upwards.
|
* Copy the last hash value from the block to propagate upwards.
|
||||||
*/
|
*/
|
||||||
btree--;
|
btree--;
|
||||||
drop_blk->hashval = INT_GET(btree->hashval, ARCH_CONVERT);
|
drop_blk->hashval = be32_to_cpu(btree->hashval);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -1048,9 +1048,9 @@ xfs_da_node_unbalance(xfs_da_state_t *state, xfs_da_state_blk_t *drop_blk,
|
|||||||
* If the dying block has lower hashvals, then move all the
|
* If the dying block has lower hashvals, then move all the
|
||||||
* elements in the remaining block up to make a hole.
|
* elements in the remaining block up to make a hole.
|
||||||
*/
|
*/
|
||||||
if ((INT_GET(drop_node->btree[ 0 ].hashval, ARCH_CONVERT) < INT_GET(save_node->btree[ 0 ].hashval, ARCH_CONVERT)) ||
|
if ((be32_to_cpu(drop_node->btree[0].hashval) < be32_to_cpu(save_node->btree[ 0 ].hashval)) ||
|
||||||
(INT_GET(drop_node->btree[ INT_GET(drop_node->hdr.count, ARCH_CONVERT)-1 ].hashval, ARCH_CONVERT) <
|
(be32_to_cpu(drop_node->btree[INT_GET(drop_node->hdr.count, ARCH_CONVERT)-1].hashval) <
|
||||||
INT_GET(save_node->btree[ INT_GET(save_node->hdr.count, ARCH_CONVERT)-1 ].hashval, ARCH_CONVERT)))
|
be32_to_cpu(save_node->btree[INT_GET(save_node->hdr.count, ARCH_CONVERT)-1 ].hashval)))
|
||||||
{
|
{
|
||||||
btree = &save_node->btree[ INT_GET(drop_node->hdr.count, ARCH_CONVERT) ];
|
btree = &save_node->btree[ INT_GET(drop_node->hdr.count, ARCH_CONVERT) ];
|
||||||
tmp = INT_GET(save_node->hdr.count, ARCH_CONVERT) * (uint)sizeof(xfs_da_node_entry_t);
|
tmp = INT_GET(save_node->hdr.count, ARCH_CONVERT) * (uint)sizeof(xfs_da_node_entry_t);
|
||||||
@ -1082,7 +1082,7 @@ xfs_da_node_unbalance(xfs_da_state_t *state, xfs_da_state_blk_t *drop_blk,
|
|||||||
/*
|
/*
|
||||||
* Save the last hashval in the remaining block for upward propagation.
|
* Save the last hashval in the remaining block for upward propagation.
|
||||||
*/
|
*/
|
||||||
save_blk->hashval = INT_GET(save_node->btree[ INT_GET(save_node->hdr.count, ARCH_CONVERT)-1 ].hashval, ARCH_CONVERT);
|
save_blk->hashval = be32_to_cpu(save_node->btree[ INT_GET(save_node->hdr.count, ARCH_CONVERT)-1 ].hashval);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*========================================================================
|
/*========================================================================
|
||||||
@ -1147,7 +1147,7 @@ xfs_da_node_lookup_int(xfs_da_state_t *state, int *result)
|
|||||||
blk->magic = be16_to_cpu(curr->magic);
|
blk->magic = be16_to_cpu(curr->magic);
|
||||||
if (blk->magic == XFS_DA_NODE_MAGIC) {
|
if (blk->magic == XFS_DA_NODE_MAGIC) {
|
||||||
node = blk->bp->data;
|
node = blk->bp->data;
|
||||||
blk->hashval = INT_GET(node->btree[ INT_GET(node->hdr.count, ARCH_CONVERT)-1 ].hashval, ARCH_CONVERT);
|
blk->hashval = be32_to_cpu(node->btree[INT_GET(node->hdr.count, ARCH_CONVERT)-1].hashval);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Binary search. (note: small blocks will skip loop)
|
* Binary search. (note: small blocks will skip loop)
|
||||||
@ -1158,25 +1158,25 @@ xfs_da_node_lookup_int(xfs_da_state_t *state, int *result)
|
|||||||
for (btree = &node->btree[probe]; span > 4;
|
for (btree = &node->btree[probe]; span > 4;
|
||||||
btree = &node->btree[probe]) {
|
btree = &node->btree[probe]) {
|
||||||
span /= 2;
|
span /= 2;
|
||||||
if (INT_GET(btree->hashval, ARCH_CONVERT) < hashval)
|
if (be32_to_cpu(btree->hashval) < hashval)
|
||||||
probe += span;
|
probe += span;
|
||||||
else if (INT_GET(btree->hashval, ARCH_CONVERT) > hashval)
|
else if (be32_to_cpu(btree->hashval) > hashval)
|
||||||
probe -= span;
|
probe -= span;
|
||||||
else
|
else
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
ASSERT((probe >= 0) && (probe < max));
|
ASSERT((probe >= 0) && (probe < max));
|
||||||
ASSERT((span <= 4) || (INT_GET(btree->hashval, ARCH_CONVERT) == hashval));
|
ASSERT((span <= 4) || (be32_to_cpu(btree->hashval) == hashval));
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Since we may have duplicate hashval's, find the first
|
* Since we may have duplicate hashval's, find the first
|
||||||
* matching hashval in the node.
|
* matching hashval in the node.
|
||||||
*/
|
*/
|
||||||
while ((probe > 0) && (INT_GET(btree->hashval, ARCH_CONVERT) >= hashval)) {
|
while ((probe > 0) && (be32_to_cpu(btree->hashval) >= hashval)) {
|
||||||
btree--;
|
btree--;
|
||||||
probe--;
|
probe--;
|
||||||
}
|
}
|
||||||
while ((probe < max) && (INT_GET(btree->hashval, ARCH_CONVERT) < hashval)) {
|
while ((probe < max) && (be32_to_cpu(btree->hashval) < hashval)) {
|
||||||
btree++;
|
btree++;
|
||||||
probe++;
|
probe++;
|
||||||
}
|
}
|
||||||
@ -1186,10 +1186,10 @@ xfs_da_node_lookup_int(xfs_da_state_t *state, int *result)
|
|||||||
*/
|
*/
|
||||||
if (probe == max) {
|
if (probe == max) {
|
||||||
blk->index = max-1;
|
blk->index = max-1;
|
||||||
blkno = INT_GET(node->btree[ max-1 ].before, ARCH_CONVERT);
|
blkno = be32_to_cpu(node->btree[max-1].before);
|
||||||
} else {
|
} else {
|
||||||
blk->index = probe;
|
blk->index = probe;
|
||||||
blkno = INT_GET(btree->before, ARCH_CONVERT);
|
blkno = be32_to_cpu(btree->before);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (be16_to_cpu(curr->magic) == XFS_ATTR_LEAF_MAGIC) {
|
else if (be16_to_cpu(curr->magic) == XFS_ATTR_LEAF_MAGIC) {
|
||||||
@ -1359,10 +1359,10 @@ xfs_da_node_order(xfs_dabuf_t *node1_bp, xfs_dabuf_t *node2_bp)
|
|||||||
ASSERT((be16_to_cpu(node1->hdr.info.magic) == XFS_DA_NODE_MAGIC) &&
|
ASSERT((be16_to_cpu(node1->hdr.info.magic) == XFS_DA_NODE_MAGIC) &&
|
||||||
(be16_to_cpu(node2->hdr.info.magic) == XFS_DA_NODE_MAGIC));
|
(be16_to_cpu(node2->hdr.info.magic) == XFS_DA_NODE_MAGIC));
|
||||||
if ((INT_GET(node1->hdr.count, ARCH_CONVERT) > 0) && (INT_GET(node2->hdr.count, ARCH_CONVERT) > 0) &&
|
if ((INT_GET(node1->hdr.count, ARCH_CONVERT) > 0) && (INT_GET(node2->hdr.count, ARCH_CONVERT) > 0) &&
|
||||||
((INT_GET(node2->btree[ 0 ].hashval, ARCH_CONVERT) <
|
((be32_to_cpu(node2->btree[0].hashval) <
|
||||||
INT_GET(node1->btree[ 0 ].hashval, ARCH_CONVERT)) ||
|
be32_to_cpu(node1->btree[0].hashval)) ||
|
||||||
(INT_GET(node2->btree[ INT_GET(node2->hdr.count, ARCH_CONVERT)-1 ].hashval, ARCH_CONVERT) <
|
(be32_to_cpu(node2->btree[INT_GET(node2->hdr.count, ARCH_CONVERT)-1].hashval) <
|
||||||
INT_GET(node1->btree[ INT_GET(node1->hdr.count, ARCH_CONVERT)-1 ].hashval, ARCH_CONVERT)))) {
|
be32_to_cpu(node1->btree[INT_GET(node1->hdr.count, ARCH_CONVERT)-1].hashval)))) {
|
||||||
return(1);
|
return(1);
|
||||||
}
|
}
|
||||||
return(0);
|
return(0);
|
||||||
@ -1382,7 +1382,7 @@ xfs_da_node_lasthash(xfs_dabuf_t *bp, int *count)
|
|||||||
*count = INT_GET(node->hdr.count, ARCH_CONVERT);
|
*count = INT_GET(node->hdr.count, ARCH_CONVERT);
|
||||||
if (!node->hdr.count)
|
if (!node->hdr.count)
|
||||||
return(0);
|
return(0);
|
||||||
return(INT_GET(node->btree[ INT_GET(node->hdr.count, ARCH_CONVERT)-1 ].hashval, ARCH_CONVERT));
|
return be32_to_cpu(node->btree[INT_GET(node->hdr.count, ARCH_CONVERT)-1].hashval);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -1493,11 +1493,11 @@ xfs_da_path_shift(xfs_da_state_t *state, xfs_da_state_path_t *path,
|
|||||||
ASSERT(be16_to_cpu(node->hdr.info.magic) == XFS_DA_NODE_MAGIC);
|
ASSERT(be16_to_cpu(node->hdr.info.magic) == XFS_DA_NODE_MAGIC);
|
||||||
if (forward && (blk->index < INT_GET(node->hdr.count, ARCH_CONVERT)-1)) {
|
if (forward && (blk->index < INT_GET(node->hdr.count, ARCH_CONVERT)-1)) {
|
||||||
blk->index++;
|
blk->index++;
|
||||||
blkno = INT_GET(node->btree[ blk->index ].before, ARCH_CONVERT);
|
blkno = be32_to_cpu(node->btree[blk->index].before);
|
||||||
break;
|
break;
|
||||||
} else if (!forward && (blk->index > 0)) {
|
} else if (!forward && (blk->index > 0)) {
|
||||||
blk->index--;
|
blk->index--;
|
||||||
blkno = INT_GET(node->btree[ blk->index ].before, ARCH_CONVERT);
|
blkno = be32_to_cpu(node->btree[blk->index].before);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1535,12 +1535,12 @@ xfs_da_path_shift(xfs_da_state_t *state, xfs_da_state_path_t *path,
|
|||||||
blk->magic = be16_to_cpu(info->magic);
|
blk->magic = be16_to_cpu(info->magic);
|
||||||
if (blk->magic == XFS_DA_NODE_MAGIC) {
|
if (blk->magic == XFS_DA_NODE_MAGIC) {
|
||||||
node = (xfs_da_intnode_t *)info;
|
node = (xfs_da_intnode_t *)info;
|
||||||
blk->hashval = INT_GET(node->btree[ INT_GET(node->hdr.count, ARCH_CONVERT)-1 ].hashval, ARCH_CONVERT);
|
blk->hashval = be32_to_cpu(node->btree[INT_GET(node->hdr.count, ARCH_CONVERT)-1].hashval);
|
||||||
if (forward)
|
if (forward)
|
||||||
blk->index = 0;
|
blk->index = 0;
|
||||||
else
|
else
|
||||||
blk->index = INT_GET(node->hdr.count, ARCH_CONVERT)-1;
|
blk->index = INT_GET(node->hdr.count, ARCH_CONVERT)-1;
|
||||||
blkno = INT_GET(node->btree[ blk->index ].before, ARCH_CONVERT);
|
blkno = be32_to_cpu(node->btree[blk->index].before);
|
||||||
} else {
|
} else {
|
||||||
ASSERT(level == path->active-1);
|
ASSERT(level == path->active-1);
|
||||||
blk->index = 0;
|
blk->index = 0;
|
||||||
@ -1796,7 +1796,7 @@ xfs_da_swap_lastblock(xfs_da_args_t *args, xfs_dablk_t *dead_blknop,
|
|||||||
ASSERT(be16_to_cpu(dead_info->magic) == XFS_DA_NODE_MAGIC);
|
ASSERT(be16_to_cpu(dead_info->magic) == XFS_DA_NODE_MAGIC);
|
||||||
dead_node = (xfs_da_intnode_t *)dead_info;
|
dead_node = (xfs_da_intnode_t *)dead_info;
|
||||||
dead_level = INT_GET(dead_node->hdr.level, ARCH_CONVERT);
|
dead_level = INT_GET(dead_node->hdr.level, ARCH_CONVERT);
|
||||||
dead_hash = INT_GET(dead_node->btree[INT_GET(dead_node->hdr.count, ARCH_CONVERT) - 1].hashval, ARCH_CONVERT);
|
dead_hash = be32_to_cpu(dead_node->btree[INT_GET(dead_node->hdr.count, ARCH_CONVERT) - 1].hashval);
|
||||||
}
|
}
|
||||||
sib_buf = par_buf = NULL;
|
sib_buf = par_buf = NULL;
|
||||||
/*
|
/*
|
||||||
@ -1863,7 +1863,7 @@ xfs_da_swap_lastblock(xfs_da_args_t *args, xfs_dablk_t *dead_blknop,
|
|||||||
level = INT_GET(par_node->hdr.level, ARCH_CONVERT);
|
level = INT_GET(par_node->hdr.level, ARCH_CONVERT);
|
||||||
for (entno = 0;
|
for (entno = 0;
|
||||||
entno < INT_GET(par_node->hdr.count, ARCH_CONVERT) &&
|
entno < INT_GET(par_node->hdr.count, ARCH_CONVERT) &&
|
||||||
INT_GET(par_node->btree[entno].hashval, ARCH_CONVERT) < dead_hash;
|
be32_to_cpu(par_node->btree[entno].hashval) < dead_hash;
|
||||||
entno++)
|
entno++)
|
||||||
continue;
|
continue;
|
||||||
if (unlikely(entno == INT_GET(par_node->hdr.count, ARCH_CONVERT))) {
|
if (unlikely(entno == INT_GET(par_node->hdr.count, ARCH_CONVERT))) {
|
||||||
@ -1872,7 +1872,7 @@ xfs_da_swap_lastblock(xfs_da_args_t *args, xfs_dablk_t *dead_blknop,
|
|||||||
error = XFS_ERROR(EFSCORRUPTED);
|
error = XFS_ERROR(EFSCORRUPTED);
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
par_blkno = INT_GET(par_node->btree[entno].before, ARCH_CONVERT);
|
par_blkno = be32_to_cpu(par_node->btree[entno].before);
|
||||||
if (level == dead_level + 1)
|
if (level == dead_level + 1)
|
||||||
break;
|
break;
|
||||||
xfs_da_brelse(tp, par_buf);
|
xfs_da_brelse(tp, par_buf);
|
||||||
@ -1885,7 +1885,7 @@ xfs_da_swap_lastblock(xfs_da_args_t *args, xfs_dablk_t *dead_blknop,
|
|||||||
for (;;) {
|
for (;;) {
|
||||||
for (;
|
for (;
|
||||||
entno < INT_GET(par_node->hdr.count, ARCH_CONVERT) &&
|
entno < INT_GET(par_node->hdr.count, ARCH_CONVERT) &&
|
||||||
INT_GET(par_node->btree[entno].before, ARCH_CONVERT) != last_blkno;
|
be32_to_cpu(par_node->btree[entno].before) != last_blkno;
|
||||||
entno++)
|
entno++)
|
||||||
continue;
|
continue;
|
||||||
if (entno < INT_GET(par_node->hdr.count, ARCH_CONVERT))
|
if (entno < INT_GET(par_node->hdr.count, ARCH_CONVERT))
|
||||||
@ -1915,7 +1915,7 @@ xfs_da_swap_lastblock(xfs_da_args_t *args, xfs_dablk_t *dead_blknop,
|
|||||||
/*
|
/*
|
||||||
* Update the parent entry pointing to the moved block.
|
* Update the parent entry pointing to the moved block.
|
||||||
*/
|
*/
|
||||||
INT_SET(par_node->btree[entno].before, ARCH_CONVERT, dead_blkno);
|
par_node->btree[entno].before = cpu_to_be32(dead_blkno);
|
||||||
xfs_da_log_buf(tp, par_buf,
|
xfs_da_log_buf(tp, par_buf,
|
||||||
XFS_DA_LOGRANGE(par_node, &par_node->btree[entno].before,
|
XFS_DA_LOGRANGE(par_node, &par_node->btree[entno].before,
|
||||||
sizeof(par_node->btree[entno].before)));
|
sizeof(par_node->btree[entno].before)));
|
||||||
|
@ -69,8 +69,8 @@ typedef struct xfs_da_intnode {
|
|||||||
__uint16_t level; /* level above leaves (leaf == 0) */
|
__uint16_t level; /* level above leaves (leaf == 0) */
|
||||||
} hdr;
|
} hdr;
|
||||||
struct xfs_da_node_entry {
|
struct xfs_da_node_entry {
|
||||||
xfs_dahash_t hashval; /* hash value for this descendant */
|
__be32 hashval; /* hash value for this descendant */
|
||||||
xfs_dablk_t before; /* Btree block before this key */
|
__be32 before; /* Btree block before this key */
|
||||||
} btree[1]; /* variable sized array of keys */
|
} btree[1]; /* variable sized array of keys */
|
||||||
} xfs_da_intnode_t;
|
} xfs_da_intnode_t;
|
||||||
typedef struct xfs_da_node_hdr xfs_da_node_hdr_t;
|
typedef struct xfs_da_node_hdr xfs_da_node_hdr_t;
|
||||||
|
@ -954,8 +954,8 @@ xfs_dir_node_getdents(xfs_trans_t *trans, xfs_inode_t *dp, uio_t *uio,
|
|||||||
btree = &node->btree[0];
|
btree = &node->btree[0];
|
||||||
xfs_dir_trace_g_dun("node: node detail", dp, uio, node);
|
xfs_dir_trace_g_dun("node: node detail", dp, uio, node);
|
||||||
for (i = 0; i < INT_GET(node->hdr.count, ARCH_CONVERT); btree++, i++) {
|
for (i = 0; i < INT_GET(node->hdr.count, ARCH_CONVERT); btree++, i++) {
|
||||||
if (INT_GET(btree->hashval, ARCH_CONVERT) >= cookhash) {
|
if (be32_to_cpu(btree->hashval) >= cookhash) {
|
||||||
bno = INT_GET(btree->before, ARCH_CONVERT);
|
bno = be32_to_cpu(btree->before);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1129,9 +1129,9 @@ xfs_dir_trace_g_dun(char *where, xfs_inode_t *dp, uio_t *uio,
|
|||||||
(void *)(unsigned long)
|
(void *)(unsigned long)
|
||||||
INT_GET(node->hdr.count, ARCH_CONVERT),
|
INT_GET(node->hdr.count, ARCH_CONVERT),
|
||||||
(void *)(unsigned long)
|
(void *)(unsigned long)
|
||||||
INT_GET(node->btree[0].hashval, ARCH_CONVERT),
|
be32_to_cpu(node->btree[0].hashval),
|
||||||
(void *)(unsigned long)
|
(void *)(unsigned long)
|
||||||
INT_GET(node->btree[last].hashval, ARCH_CONVERT),
|
be32_to_cpu(node->btree[last].hashval),
|
||||||
NULL, NULL, NULL);
|
NULL, NULL, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -745,7 +745,7 @@ xfs_dir_leaf_to_node(xfs_da_args_t *args)
|
|||||||
ASSERT(be16_to_cpu(leaf->hdr.info.magic) == XFS_DIR_LEAF_MAGIC);
|
ASSERT(be16_to_cpu(leaf->hdr.info.magic) == XFS_DIR_LEAF_MAGIC);
|
||||||
INT_SET(node->btree[0].hashval, ARCH_CONVERT, INT_GET(leaf->entries[ INT_GET(leaf->hdr.count, ARCH_CONVERT)-1 ].hashval, ARCH_CONVERT));
|
INT_SET(node->btree[0].hashval, ARCH_CONVERT, INT_GET(leaf->entries[ INT_GET(leaf->hdr.count, ARCH_CONVERT)-1 ].hashval, ARCH_CONVERT));
|
||||||
xfs_da_buf_done(bp2);
|
xfs_da_buf_done(bp2);
|
||||||
INT_SET(node->btree[0].before, ARCH_CONVERT, blkno);
|
node->btree[0].before = cpu_to_be32(blkno);
|
||||||
INT_SET(node->hdr.count, ARCH_CONVERT, 1);
|
INT_SET(node->hdr.count, ARCH_CONVERT, 1);
|
||||||
xfs_da_log_buf(args->trans, bp1,
|
xfs_da_log_buf(args->trans, bp1,
|
||||||
XFS_DA_LOGRANGE(node, &node->btree[0], sizeof(node->btree[0])));
|
XFS_DA_LOGRANGE(node, &node->btree[0], sizeof(node->btree[0])));
|
||||||
|
Loading…
Reference in New Issue
Block a user