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

Keith Busch kbusch at kernel.org
Mon Oct 31 08:07:47 PDT 2022


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.



More information about the Linux-nvme mailing list