Re: [PATCH 23/43] xfs: parse and validate hardware zone information

Christoph Hellwig
2024-12-15T05:24:42Z

On Fri, Dec 13, 2024 at 09:31:32AM -0800, Darrick J. Wong wrote:
> > + xfs_rgblock_t *write_pointer)
> > +{
> > + struct xfs_mount *mp = rtg_mount(rtg);
> > +
> > + if (rtg_rmap(rtg)->i_used_blocks > 0) {
> > + xfs_warn(mp, "empty zone %u has non-zero used counter (0x%x).",
> > + rtg_rgno(rtg), rtg_rmap(rtg)->i_used_blocks);
> > + return -EIO;
>
> Why do some of these validation failures return EIO vs. EFSCORRUPTED?
> Is "EIO" used for "filesystem metadata out of sync with storage device"
> whereas "EFSCORRUPTED" is used for "filesystem metadata inconsistent
> with itself"?

If there was a rule I forgot about it :) This should be changed to
return the same error everywhere, and that should probably be
EFSCORRUPTED, or maybe the whole code should be changed to return a
bool.

> Do the _validate_{empty,full} functions need to validate zone->wp is
> zero/rtg_extents, respectively?

zone->wp is not defined for them in the hardware specs, so the only
thing we'd validate is what the block layer / drivers put into it.