Re: [PATCH] nvme: implement the DEAC bit for the Write Zeroes command

Christoph Hellwig
2022-11-01T09:58:14Z

On Mon, Oct 31, 2022 at 11:48:08AM -0400, Martin K. Petersen wrote:
>
> Keith,
>
> > The device must return all 0's for the range covered by a write zeroes
> > command no matter what. The controller shall not deallocate the
> > logical blocks if it can't guarantee reading deallocated blocks will
> > return 0's, so I think it's okay to skip checking the lower dlfeat
> > bits.
>
> The spec is sufficiently vague for the does-not-return-zeroes case that
> I'm concerned about "shall not deallocate" being interpreted by vendors
> as "free to ignore" based on past ATA/SCSI experience.

I think SCSI actually has the same semantics as NVMe here. WRITE SAME
must always ensure reads return the data written using it, just like
for Write Zeros in NVMe except that NVMe forces the 0s while SCSI
is more flexible. UNMAP in SCSI and DSM Deallocate in NVMe can also
return other values depending on the conditions.