On Jun 07, 2023 / 09:32, Jens Axboe wrote: > On 6/7/23 2:32?AM, Shin'ichiro Kawasaki wrote: > > @@ -339,6 +339,33 @@ static void zbd_write_zone_put(struct thread_data *td, const struct fio_file *f, > > z->write = 0; > > } > > > > +/** > > + * zbd_reset_zone - reset the write pointer of a single zone and remove the zone > > + * from the array of write zones. > > + * @td: FIO thread data. > > + * @f: FIO file associated with the disk for which to reset a write pointer. > > + * @z: Zone to reset. > > + * > > + * Returns 0 upon success and a negative error code upon failure. > > + * The caller must hold z->mutex. > > + */ > > +static int zbd_reset_zone(struct thread_data *td, struct fio_file *f, > > + struct fio_zone_info *z) > > +{ > > + int ret; > > + > > + ret = __zbd_reset_zone(td, f, z); > > + if (ret) > > + goto done; > > + > > + pthread_mutex_lock(&f->zbd_info->mutex); > > + zbd_write_zone_put(td, f, z); > > + pthread_mutex_unlock(&f->zbd_info->mutex); > > + > > +done: > > + return ret; > > +} > > This would look better as: > > { > int ret; > > ret = __zbd_reset_zone(td, f, z); > if (ret) > return ret; > > pthread_mutex_lock(&f->zbd_info->mutex); > zbd_write_zone_put(td, f, z); > pthread_mutex_unlock(&f->zbd_info->mutex); > return 0; > } > > to avoid that goto. Goto only makes sense if there's common cleanup to > do for multiple error cases, not for a single failure where you can just > return the error. Thanks for the comment. Will reflect in v2.