Re: [PATCH] nvme: don't apply NVME_QUIRK_DEALLOCATE_ZEROES when DSM is not supported

Keith Busch
2024-11-27T15:45:17Z

On Wed, Nov 27, 2024 at 07:42:18AM +0100, Christoph Hellwig wrote:
> Commit 63dfa1004322 ("nvme: move NVME_QUIRK_DEALLOCATE_ZEROES out of
> nvme_config_discard") started applying the NVME_QUIRK_DEALLOCATE_ZEROES
> quirk even then the Dataset Management is not supported. It turns out
> that there versions of these old Intel SSDs that have DSM support
> disabled in the firmware, which will now lead to errors everytime
> a Write Zeroes command is issued. Fix this by checking for DSM support
> before applying the quirk.

I still think this is wrong, and we should just remove the quirk for
this device. With the exception to this firmware version, this device
generally supports both discards and write zeroes. The only reason it
added this quirk was because the quirk used to mean something completely
different (specifically, it would set the "discard_zeroes_data"
attribute that's no longer used). It didn't mean to prefer discards over
write zeroes, but that's what it means now, and that's not what this
drive wants.