From a84f3d5cb04f7dff1bf6904f0a05bc8df16137fb Mon Sep 17 00:00:00 2001 From: Christoph Hellwig Date: Fri, 8 Nov 2019 14:58:05 -0800 Subject: xfs: add a bests pointer to struct xfs_dir3_icfree_hdr All but two callers of the ->free_bests_p dir operation already have a struct xfs_dir3_icfree_hdr from a previous call to xfs_dir2_free_hdr_from_disk at hand. Add a pointer to the bests to struct xfs_dir3_icfree_hdr to clean up this pattern. To optimize this pattern, pass the struct xfs_dir3_icfree_hdr to xfs_dir2_free_log_bests instead of recalculating the pointer there. Signed-off-by: Christoph Hellwig Reviewed-by: Darrick J. Wong Signed-off-by: Darrick J. Wong --- fs/xfs/libxfs/xfs_dir2_leaf.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'fs/xfs/libxfs/xfs_dir2_leaf.c') diff --git a/fs/xfs/libxfs/xfs_dir2_leaf.c b/fs/xfs/libxfs/xfs_dir2_leaf.c index b435379ddaa2..bbbd7b96678a 100644 --- a/fs/xfs/libxfs/xfs_dir2_leaf.c +++ b/fs/xfs/libxfs/xfs_dir2_leaf.c @@ -1680,7 +1680,6 @@ xfs_dir2_node_to_leaf( int error; /* error return code */ struct xfs_buf *fbp; /* buffer for freespace block */ xfs_fileoff_t fo; /* freespace file offset */ - xfs_dir2_free_t *free; /* freespace structure */ struct xfs_buf *lbp; /* buffer for leaf block */ xfs_dir2_leaf_tail_t *ltp; /* tail of leaf structure */ xfs_dir2_leaf_t *leaf; /* leaf structure */ @@ -1749,8 +1748,7 @@ xfs_dir2_node_to_leaf( error = xfs_dir2_free_read(tp, dp, args->geo->freeblk, &fbp); if (error) return error; - free = fbp->b_addr; - xfs_dir2_free_hdr_from_disk(mp, &freehdr, free); + xfs_dir2_free_hdr_from_disk(mp, &freehdr, fbp->b_addr); ASSERT(!freehdr.firstdb); @@ -1784,7 +1782,7 @@ xfs_dir2_node_to_leaf( /* * Set up the leaf bests table. */ - memcpy(xfs_dir2_leaf_bests_p(ltp), dp->d_ops->free_bests_p(free), + memcpy(xfs_dir2_leaf_bests_p(ltp), freehdr.bests, freehdr.nvalid * sizeof(xfs_dir2_data_off_t)); xfs_dir2_leaf_hdr_to_disk(mp, leaf, &leafhdr); -- cgit v1.2.3