nvme: honor NVME_QUIRK_DEALLOCATE_ZEROES for unmap Write Zeroes
PATCH 1/1 nvme: honor NVME_QUIRK_DEALLOCATE_ZEROES for unmap Write Zeroes
Currently, the NVMe driver sets max_hw_wzeroes_unmap_sectors to indicate the support for unmap Write Zeroes based strictly on the Deallocate Logical Block Features (dlfeat) in the Identify Namespace data (commit 545fb46e5bc6 "nvme: set max_hw_wzeroes_unmap_sectors if device supports DEAC bit").
However, certain devices already use the NVME_QUIRK_DEALLOCATE_ZEROES quirk to indicate that they deterministically return zeroes after a deallocate/discard operation to support the Write Zeroes operation in nvme_setup_write_zeroes(). For these devices, it is appropriate to treat them as supporting the unmap Write Zeroes operation.
Update nvme_update_disk_info() to allow the presence of the DEALLOCATE_ZEROES quirk (combined with DSM support) to set max_hw_wzeroes_unmap_sectors to enable the support for unmap Write Zeroes. This ensures consistency with how these devices are handled elsewhere in the driver.
--- drivers/nvme/host/core.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/nvme/host/core.c +3 -2
@@ -2120,9 +2120,10 @@ static bool nvme_update_disk_info(struct nvme_ns *ns, struct nvme_id_ns *id, lim->io_min = phys_bs; lim->io_opt = io_opt;if ((ns->ctrl->quirks &NVME_QUIRK_DEALLOCATE_ZEROES ) && - (ns->ctrl->oncs &NVME_CTRL_ONCS_DSM )) + (ns->ctrl->oncs &NVME_CTRL_ONCS_DSM )) { lim->max_write_zeroes_sectors =UINT_MAX ; -else + lim->max_hw_wzeroes_unmap_sectors =UINT_MAX ; + }else lim->max_write_zeroes_sectors = ns->ctrl->max_zeroes_sectors;return valid; }
Signature · 1 line
2.53.0.473.g4a7958ca14-goog
Christoph Hellwig
maintainerQuoted 2 lines · Robert Pang
However, certain devices already use the
NVME_QUIRK_DEALLOCATE_ZEROESquirk to indicate that they deterministically return zeroes after a deallocate/discard
Those certain devices are completely obsolete first generation Intel SSDs.
Quoted 2 lines
Update
nvme_update_disk_info()to allow the presence of theDEALLOCATE_ZEROESquirk (combined with DSM support) to setmax_hw_wzeroes_unmap_sectorsto enable
No. This was a hack that got sneaked in in the first days of the nvme driver and never should have been there. It most certainly should not be extended to any new functionality.
Hi Christoph
Quoted 8 lines · Christoph Hellwig
Quoted 2 lines · Robert Pang
However, certain devices already use the
NVME_QUIRK_DEALLOCATE_ZEROESquirk to indicate that they deterministically return zeroes after a deallocate/discardThose certain devices are completely obsolete first generation Intel SSDs.
Quoted 7 lines
Quoted 2 lines
Update
nvme_update_disk_info()to allow the presence of theDEALLOCATE_ZEROESquirk (combined with DSM support) to setmax_hw_wzeroes_unmap_sectorsto enableNo. This was a hack that got sneaked in in the first days of the nvme driver and never should have been there. It most certainly should not be extended to any new functionality.
Thank you for your review and for providing the historical context regarding this quirk. Given these insights, we can discard this patch proposal.
Best regards
Robert Pang
Hi Robert,
Quoted 14 lines · Robert Pang
Hi Christoph
Quoted 11 lines · Christoph Hellwig
Quoted 2 lines · Robert Pang
However, certain devices already use the
NVME_QUIRK_DEALLOCATE_ZEROESquirk to indicate that they deterministically return zeroes after a deallocate/discardThose certain devices are completely obsolete first generation Intel SSDs.
Quoted 2 lines
Update
nvme_update_disk_info()to allow the presence of theDEALLOCATE_ZEROESquirk (combined with DSM support) to setmax_hw_wzeroes_unmap_sectorsto enable
Quoted 9 lines
Quoted 4 lines
No. This was a hack that got sneaked in in the first days of the nvme driver and never should have been there. It most certainly should not be extended to any new functionality.
Thank you for your review and for providing the historical context regarding this quirk. Given these insights, we can discard this patch proposal.
I just wonder if you have such hardware and use cases, or if you simply want to supplement this feature for those corner devices?
Best regards
Yi.
Quoted 2 lines
Best regards
Robert Pang
Hi Zhang Yi
Quoted 23 lines · Zhang Yi
Hi Robert,
Quoted 19 lines · Robert Pang
Hi Christoph
Quoted 15 lines · Christoph Hellwig
Quoted 2 lines · Robert Pang
However, certain devices already use the
NVME_QUIRK_DEALLOCATE_ZEROESquirk to indicate that they deterministically return zeroes after a deallocate/discardThose certain devices are completely obsolete first generation Intel SSDs.
Quoted 2 lines
Update
nvme_update_disk_info()to allow the presence of theDEALLOCATE_ZEROESquirk (combined with DSM support) to setmax_hw_wzeroes_unmap_sectorsto enableNo. This was a hack that got sneaked in in the first days of the nvme driver and never should have been there. It most certainly should not be extended to any new functionality.
Quoted 8 lines
Quoted 4 lines
Thank you for your review and for providing the historical context regarding this quirk. Given these insights, we can discard this patch proposal.
I just wonder if you have such hardware and use cases, or if you simply want to supplement this feature for those corner devices?
It is the latter.
Best regards
Robert Pang
Quoted 2 lines
Best regards
Yi.