On 11/2/22 01:28, Bart Van Assche wrote: > On 10/31/22 20:23, Damien Le Moal wrote: >> On 11/1/22 07:47, Bart Van Assche wrote: >>> --- a/drivers/scsi/scsi_debug.c >>> +++ b/drivers/scsi/scsi_debug.c >>> @@ -1899,6 +1899,10 @@ static int resp_readcap16(struct scsi_cmnd *scp, >>> arr[14] |= 0x40; >>> } >>> >>> + /* Set RC BASIS = 1 for host-managed devices. */ >> >> No it is not necessarily set. It is up to the device vendor to choose if >> RC_BASIS is set or not, based on the device implementation. >> Applicability of RC = 0 or RC = 1 depends on the presence of conventional >> zones. so: >> >> 1) If there are conventional zones, then using RC_BASIS = 1 or = 0 are >> both OK with HM devices. In the case of RC_BASIS = 0, the host can issue a >> report zones and get the device max lba from the report header (sd_zbc.c >> does that). >> 2) If there are no conventional zones, then using RC_BASIS = 0 does not >> make much sense, but nothing in the ZBC text prevent it either... >> >> So we should refine this and maybe add an option to allow specifying rc >> basis ? > Hi Damien, > > If I remember correctly the conclusion from a previous conversation is > that setting RC BASIS = 1 for host-managed devices is what is done by > all SMR vendors and is always correct for host-managed devices. > > I think the description of the my patch is correct, namely that it makes > the READ CAPACITY response compliant with ZBC. I did not claim that my > patch is the only possible approach for making the READ CAPACITY > response ZBC compliant. Yes, your patch is correct given how scsi_debug always reports the total drive capacity. So to clarify with regards to the specs and what is allowed to do, I think that this comment: /* Set RC BASIS = 1 for host-managed devices. */ should be changed to something like this: /* * Given that scsi_debug READ CAPACITY implementation always reports * the total disk capacity, set RC BASIS = 1 for host-managed ZBC devices. */ Thoughts ? With that changed, I think your patch is good to go ! > Are there any use cases for reporting RC BASIS = 0 in combination with > the capacity of conventional zones for host-managed devices other than > testing the Linux kernel ZBC code? No use case specific to this I think, given that the kernel always corrects the reported capacity to the entire drive cap, the user never sees any difference between rc basis = 0 and rc basis = 1, at least for a system that support host-managed SMR. I only was thinking about sd tests :) And for systems that do not support HM SMR, we would not even see the drive anyway. > > Thanks, > > Bart. -- Damien Le Moal Western Digital Research