On 2020/08/28 16:47, Klaus Jensen wrote: > On Aug 28 07:36, Damien Le Moal wrote: >> On 2020/08/28 16:23, Klaus Jensen wrote: >>> On Aug 28 07:06, Damien Le Moal wrote: >>>> On 2020/08/27 22:50, Niklas Cassel wrote: >>>>> +static blk_status_t null_finish_zone(struct nullb_device *dev, struct blk_zone *zone) >>>>> +{ >>>>> + if (zone->type == BLK_ZONE_TYPE_CONVENTIONAL) >>>>> + return BLK_STS_IOERR; >>>>> + >>>>> + switch (zone->cond) { >>>>> + case BLK_ZONE_COND_FULL: >>>>> + /* finish operation on full is not an error */ >>>>> + return BLK_STS_OK; >>>>> + case BLK_ZONE_COND_EMPTY: >>>>> + if (!null_manage_zone_resources(dev, zone)) >>>> >>>> OK. So you are hitting a fuzzy case here that is not actually well described in >>>> the standards. That is, does finishing an empty zone necessarilly imply a >>>> temporary transition through imp open ? Which you are assuming is a yes here. >>>> Personally, I would say that is not necessary, but no strong feeling either way. >>>> >>> >>> For ZNS, the spec is pretty clear that ZSE to ZSF is a legal direct >>> transition. So I don't think the transition should be allowed to fail >>> due to a lack of resources. >> >> I had a doubt and checked again ZBC & ZAC. I section 4.4.3.2.4 it says: >> >> The Zone Condition state machine (see 4.4.3.5) requires the specified zone to >> have a Zone Condition of EXPLICITLY OPENED or IMPLICITLY OPENED before a finish >> zone operation is performed. If a zone with a Zone Condition of EMPTY or CLOSED >> is specified for a finish zone operation, prior to processing the finish zone >> operation, then the Zone Condition state machine requires that: >> a) a manage open zone resources operation (see 4.4.3.2.6) be performed; and >> b) the Zone Condition becomes IMPLICITLY OPENED. >> >> And section 5.3 describing the zone finish command points to this section. >> So this is not the same as ZNS. >> >> As Niklas mentioned, nullblk tends to follow more ZBC than ZNS, so the code is >> correct in this respect. We could also lean toward ZNS on this one. I personally >> have no strong opinion either way since there is not real good reasons for >> finishing an empty zone that I can think of. >> >> > > Alrighty then; thanks for looking it up! I won't fight for the ZNS > behavior then :) If it becomes a problem, we could add another option to force one way or the other, something like "zone_specs=zbc" or "zone_specs=zns". That actually may prove useful for testing file systems etc. -- Damien Le Moal Western Digital Research