On 7/12/22 09:39, Bart Van Assche wrote: > On 7/11/22 16:11, Damien Le Moal wrote: >> Do you have these cases: >> 1) host-managed disks: >> SWR zones are *mandatory* so there is at least one. Thus read capacity >> will return either 0 if there are no conventional zones (they are >> optional) or the total capacity of the set of contiguous conventional >> zones starting at lba 0. In either case, read capacity does not give you >> the actual total capacity and you have to look at the report zones reply >> max lba field. > > Does the scsi_debug driver allow to create a host-managed disk with one > or more conventional zones and one or more sequential write required zones? As per specs, conventional zones are optional. SWR zones are mandatory. See this code in sdebug_device_create_zones(): conv_capacity = (sector_t)sdeb_zbc_nr_conv << devip->zsize_shift; if (conv_capacity >= capacity) { pr_err("Number of conventional zones too large\n"); return -EINVAL; } devip->nr_conv_zones = sdeb_zbc_nr_conv; devip->nr_seq_zones = ALIGN(capacity - conv_capacity, devip->zsize) >> devip->zsize_shift; devip->nr_zones = devip->nr_conv_zones + devip->nr_seq_zones; > >> Note that anyway, there are no drives out there that use RC BASIS = 0. I >> had to hack a drive FW to implement it to test this code... > > A JEDEC member is telling me that I should use RC BASIS = 0 for > host-managed zoned storage devices that only have sequential write > required zones. That sounds weird to me so I decided to take a look at > how the sd_zbc.c code handles RC BASIS. RC BASIS = 0 makes sense only for host-managed drives that have conventional zones starting at LBA 0 *AND* want to have some sort of backward compatibility with a regular disk by advertizing only the capacity of these conventional zones (all together, the set of conventional zones starting at LBA 0 can be used like a regular disk). That is a fairly narrow use case that is in my opinion not useful at all given that the device type differs from regular disks anyway. For host-managed disks, RC BASIS = 1 makes more sense. All SMR disks I know of on the market use that. > > Bart. > -- Damien Le Moal Western Digital Research