On 2022-07-11 20: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?
Yes. See https://doug-gilbert.github.io/scsi_debug.html
Example from that page:
# modprobe scsi_debug max_luns=1 sector_size=512 zbc=managed zone_size_mb=8
zone_nr_conv=3
# sg_rep_zones -S /dev/sda
Number of conventional type zones: 3
Number of sequential write required type zones: 13
Lowest starting LBA: 0xc000
Number of 'not write pointer' condition zones: 3
Lowest starting LBA: 0x0
Number of empty condition zones: 13
Lowest starting LBA: 0xc000
Number of used blocks in write pointer zones: 0x0
Size of all conventional zones: 25165824 bytes, 24.0 MiB, 0.03 GB
All zones are the same size. So if you rmmod that instance and do:
# modprobe scsi_debug max_luns=1 sector_size=512 zbc=managed zone_size_mb=8
zone_nr_conv=3 dev_size_mb=40
# sg_rep_zones /dev/sda -S
Number of conventional type zones: 3
Number of sequential write required type zones: 2
Lowest starting LBA: 0xc000
Number of 'not write pointer' condition zones: 3
Lowest starting LBA: 0x0
Number of empty condition zones: 2
Lowest starting LBA: 0xc000
Number of used blocks in write pointer zones: 0x0
Size of all conventional zones: 25165824 bytes, 24.0 MiB, 0.03 GB
So the 40 MiB was divided up into 3 conventional zones followed by
2 SWR zones, each of 8 MiB. So you have all the control needed to
specify 1 (zero ?) or more conventional zones and 1 or more SWR
zones.
Doug Gilbert
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.
Bart.