On Wed, Apr 23, 2025 at 07:58:50AM -0700, Darrick J. Wong wrote: > > > +xfs_calc_default_atomic_ioend_reservation( > > > + struct xfs_mount *mp, > > > + struct xfs_trans_resv *resp) > > > +{ > > > + if (xfs_has_reflink(mp)) > > > + resp->tr_atomic_ioend = resp->tr_itruncate; > > > + else > > > + memset(&resp->tr_atomic_ioend, 0, > > > + sizeof(resp->tr_atomic_ioend)); > > > +} > > > > What is the point of zeroing out the structure for the non-reflink > > case? Just as a poision for not using it when not supported as no > > code should be doing that? Just thinking of this because it is a > > potentially nasty landmine for the zoned atomic support. > > Yes. I thought about adding a really stupid helper: Why don't we just always set up the xfs_trans_resv structure? We do that for all kinds of other transactions not supported as well, don't we? > static inline bool xfs_has_sw_atomic_write(struct xfs_mount *mp) > { > return xfs_has_reflink(mp); > } > > But that seemed too stupid so I left it out. Maybe it wasn't so dumb, > since that would be where you'd enable ZNS support by changing that to: > > return xfs_has_reflink(mp) || xfs_has_zoned(mp); But that helper might actually be useful in various places, so independent of the above I'm in favor of it.