Damien Le Moal <damien.lem...@opensource.wdc.com> 于2023年3月14日周二 11:49写道: > > On 3/14/23 11:23, Dmitry Fomichev wrote: > >> @@ -3339,10 +3473,27 @@ static int coroutine_fn > >> raw_co_zone_mgmt(BlockDriverState *bs, BlockZoneOp op, > >> len >> BDRV_SECTOR_BITS); > >> ret = raw_thread_pool_submit(bs, handle_aiocb_zone_mgmt, &acb); > >> if (ret != 0) { > >> + update_zones_wp(s->fd, wps, offset, index); > >> ret = -errno; > >> error_report("ioctl %s failed %d", op_name, ret); > >> + goto out; > >> } > >> > >> + if (zo == BLKRESETZONE && len == capacity) { > >> + for (int i = 0; i < bs->bl.nr_zones; ++i) { > >> + if (!BDRV_ZT_IS_CONV(wps->wp[i])) { > >> + wps->wp[i] = i * bs->bl.zone_size; > > > > This will reset write pointers of all read-only zones that may exist on the > > device and make the data stored in those zones unreadable. R/O zones need > > to be > > skipped in this loop. > > And offline zones need to be skipped as well.
I see. That can be done thanks to get_zones_wp() which can show the state of the zone at specific position. Sam