From 51908ca75feb5b2dd4f0d0146f9c92775520812c Mon Sep 17 00:00:00 2001 From: Christoph Hellwig Date: Fri, 8 Nov 2019 14:57:48 -0800 Subject: xfs: add a btree entries pointer to struct xfs_da3_icnode_hdr All but two callers of the ->node_tree_p dir operation already have a xfs_da3_icnode_hdr from a previous call to xfs_da3_node_hdr_from_disk at hand. Add a pointer to the btree entries to struct xfs_da3_icnode_hdr to clean up this pattern. The two remaining callers now expand the whole header as well, but that isn't very expensive and not in a super hot path anyway. Signed-off-by: Christoph Hellwig Reviewed-by: Darrick J. Wong Signed-off-by: Darrick J. Wong --- fs/xfs/scrub/dabtree.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'fs/xfs/scrub/dabtree.c') diff --git a/fs/xfs/scrub/dabtree.c b/fs/xfs/scrub/dabtree.c index b91c64046c0d..85b9207359ec 100644 --- a/fs/xfs/scrub/dabtree.c +++ b/fs/xfs/scrub/dabtree.c @@ -83,11 +83,12 @@ xchk_da_btree_node_entry( int level) { struct xfs_da_state_blk *blk = &ds->state->path.blk[level]; + struct xfs_da3_icnode_hdr hdr; ASSERT(blk->magic == XFS_DA_NODE_MAGIC); - return (void *)ds->dargs.dp->d_ops->node_tree_p(blk->bp->b_addr) + - (blk->index * sizeof(struct xfs_da_node_entry)); + xfs_da3_node_hdr_from_disk(ds->sc->mp, &hdr, blk->bp->b_addr); + return hdr.btree + blk->index; } /* Scrub a da btree hash (key). */ @@ -409,7 +410,7 @@ xchk_da_btree_block( blk->magic = XFS_DA_NODE_MAGIC; node = blk->bp->b_addr; xfs_da3_node_hdr_from_disk(ip->i_mount, &nodehdr, node); - btree = ip->d_ops->node_tree_p(node); + btree = nodehdr.btree; *pmaxrecs = nodehdr.count; blk->hashval = be32_to_cpu(btree[*pmaxrecs - 1].hashval); if (level == 0) { -- cgit v1.2.3