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

Dave Chinner
2024-08-29T02:05:09Z

On Wed, Aug 28, 2024 at 06:14:24AM +0200, Christoph Hellwig wrote:
> 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);

I kinda prefer this version; I noticed the code could be cleaned
up the way looking at some other patch earlier this morning...

-Dave.

--
Dave Chinner
david@fromorbit.com