Re: [PATCH v3 2/8] zbd: fix write zone accounting

Shinichiro Kawasaki <[email protected]> Mon, 2 Mar 2026 06:49:48 +0000
Newsgroups org.kernel.vger.fio
Message-ID <aaUy7dt-QeaFOJLN@shinmob>
On Mar 02, 2026 / 12:41, Damien Le Moal wrote:
[...]
> > diff --git a/zbd.c b/zbd.c
> > index b71f842c..c511b709 100644
> > --- a/zbd.c
> > +++ b/zbd.c
> > @@ -1693,8 +1693,17 @@ retry:
> > =20
> >  		zone_lock(td, f, z);
> >  		if (zbd_zone_remainder(z) >=3D min_bs) {
> > -			need_zone_finish =3D false;
> > -			goto out;
> > +			/*
> > +			 * The zone might be already removed from
> > +			 * zbdi->write_zones[] by other jobs at this moment.
> > +			 * Even if the zone has remainder, call
> > +			 * zbd_write_zone_get() to ensure that it is in the
> > +			 * array.
> > +			 */
> > +			if (zbd_write_zone_get(td, f, z)) {
> > +				need_zone_finish =3D false;
> > +				goto out;
> > +			}
>=20
> Please change this to:
>=20
> 		if (zbd_zone_remainder(z) >=3D min_bs &&
> 		    zbd_write_zone_get(td, f, z)) {
> 			need_zone_finish =3D false;
> 			goto out;
> 		}
>=20
> And move the comment block above the if. You could also improve the comme=
nt to
> explain why we look at "zbd_zone_remainder(z) >=3D min_bs"
>=20
> With that (and the much better commit message), feel free to add:
>=20
> Reviewed-by: Damien Le Moal <[email protected]>

Thanks, will reflect the comments in v4.=