Re: [PATCH 08/10] xfs: hoist the code that moves the incore inode fork broot memory

Christoph Hellwig
2024-08-28T04:20:36Z

On Tue, Aug 27, 2024 at 04:35:48PM -0700, Darrick J. Wong wrote:
> From: Darrick J. Wong <djwong@kernel.org>
>
> Whenever we change the size of the memory buffer holding an inode fork
> btree root block, we have to copy the contents over. Refactor all this
> into a single function that handles both, in preparation for making
> xfs_iroot_realloc more generic.
>
> Signed-off-by: Darrick J. Wong <djwong@kernel.org>
> ---
> fs/xfs/libxfs/xfs_inode_fork.c | 87 ++++++++++++++++++++++++++--------------
> 1 file changed, 56 insertions(+), 31 deletions(-)
>
>
> diff --git a/fs/xfs/libxfs/xfs_inode_fork.c b/fs/xfs/libxfs/xfs_inode_fork.c
> index 60646a6c32ec7..307207473abdb 100644
> --- a/fs/xfs/libxfs/xfs_inode_fork.c
> +++ b/fs/xfs/libxfs/xfs_inode_fork.c
> @@ -387,6 +387,50 @@ xfs_iroot_free(
> ifp->if_broot = NULL;
> }
>
> +/* Move the bmap btree root from one incore buffer to another. */
> +static void
> +xfs_ifork_move_broot(
> + struct xfs_inode *ip,
> + int whichfork,
> + struct xfs_btree_block *dst_broot,
> + size_t dst_bytes,
> + struct xfs_btree_block *src_broot,
> + size_t src_bytes,
> + unsigned int numrecs)
> +{
> + struct xfs_mount *mp = ip->i_mount;
> + void *dptr;
> + void *sptr;
> +
> + ASSERT(xfs_bmap_bmdr_space(src_broot) <= xfs_inode_fork_size(ip, whichfork));

Overly long line.

Otherwise looks good:

Reviewed-by: Christoph Hellwig <hch@lst.de>