Re: [PATCH 24/43] xfs: add the zoned space allocator

Christoph Hellwig
2024-12-15T05:27:17Z

On Fri, Dec 13, 2024 at 10:33:04AM -0800, Darrick J. Wong wrote:
> > + struct xfs_mount *mp = tp->t_mountp;
> > + xfs_rgblock_t rgbno = xfs_rtb_to_rgbno(mp, fsbno);
> > + struct xfs_inode *rmapip;
> > + struct xfs_open_zone *oz;
> > + struct xfs_rtgroup *rtg;
> > + int error = 0;
> > +
> > + rtg = xfs_rtgroup_get(mp, xfs_rtb_to_rgno(mp, fsbno));
> > + if (WARN_ON_ONCE(!rtg))
> > + return -EIO;
> > + rmapip = rtg_rmap(rtg);
> > +
> > + xfs_ilock(rmapip, XFS_ILOCK_EXCL);
>
> xfs_rtgroup_lock?

Yeah, I'll do an audit for using the proper helpers.

>
> > +
> > + /*
> > + * There is a reference on the oz until all blocks were written, and it
> > + * is only dropped below with the rmapip ILOCK held. Thus we don't need
> > + * to grab an extra reference here.
> > + */
> > + oz = READ_ONCE(rtg->rtg_open_zone);
> > + if (WARN_ON_ONCE(!oz)) {
>
> I wonder if this should be using XFS_IS_CORRUPT() instead of
> WARN_ON_ONCE?

Probably.

> > +}
> > +
> > +static int
> > +xfs_zoned_end_extent(
>
> xfs_zoned_remap_extent?

It doesn't really remap much, right? It maps, so I guess I could
use that.