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

Keith Busch
2022-10-31T15:07:57Z

On Mon, Oct 31, 2022 at 10:54:40AM -0400, Martin K. Petersen wrote:
>
> Hi Christoph!
>
> > + if (!(req->cmd_flags & REQ_NOUNMAP) && ns->dlfeat & (1 << 3))
> > + cmnd->write_zeroes.control |= cpu_to_le16(NVME_WZ_DEAC);
>
> Shouldn't we also verify that DLFEAT bits 2:0 are equal to 1 to ensure
> that deallocated blocks actually return zeroes?

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.

Minor nit on the patch: I think seeing the dlfeat value as an enum would
help.