Re: [PATCH 05/10] xfs: move the zero records logic into xfs_bmap_broot_space_calc

Christoph Hellwig
2024-08-28T04:14:27Z

On Tue, Aug 27, 2024 at 04:35:01PM -0700, Darrick J. Wong wrote:
> This helps us remove a level of indentation in xfs_iroot_realloc because
> we can handle the zero-size case in a single place instead of repeatedly
> checking it. We'll refactor further in the next patch.

I think we can do the same cleanup in xfs_iroot_realloc without this
special case:

This:

> + new_size = xfs_bmap_broot_space_calc(mp, new_max);
> + if (new_size == 0) {
> + kfree(ifp->if_broot);
> + ifp->if_broot = NULL;
> + ifp->if_broot_bytes = 0;
> + return;

becomes:

if (new_max == 0) {
kfree(ifp->if_broot);
ifp->if_broot = NULL;
ifp->if_broot_bytes = 0;
return;
}
new_size = xfs_bmap_broot_space_calc(mp, new_max);

But either ways is fine with me:

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