On Thu, Jun 08, 2023 at 04:06:05PM +0900, Shin'ichiro Kawasaki wrote: > The commit e3be810bf0fd ("zbd: Support zone reset by trim") supported > trim for zonemode=zbd by introducing the function zbd_do_io_u_trim(), > which calls zbd_reset_zone(). However, it did not call > zbd_write_zone_put() to the trim target zone, then trim operation > resulted in wrong accounting of write zones. > > To fix the issue, call zbd_write_zone_put() from zbd_reset_zone(). To > cover the case to reset zones without a zbd_write_zone_put() call, > prepare another function __zbd_reset_zone(). While at it, simplify > zbd_reset_zones() by calling the modified zbd_reset_zone(). > > Of note is that the constifier of the argument td of do_io_u_trim() is > removed since zbd_write_zone_put() requires changes in that argument. > > Fixes: e3be810bf0fd ("zbd: Support zone reset by trim") > Suggested-by: Niklas Cassel <niklas.cassel@xxxxxxx> > Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@xxxxxxx> > --- Reviewed-by: Niklas Cassel <niklas.cassel@xxxxxxx>