On Tue, Mar 18, 2025 at 03:35:36PM +0800, Zhang Yi wrote: > From: Zhang Yi <yi.zh...@huawei.com> > > Currently, disks primarily implement the write zeroes command (aka > REQ_OP_WRITE_ZEROES) through two mechanisms: the first involves > physically writing zeros to the disk media (e.g., HDDs), while the > second performs an unmap operation on the logical blocks, effectively > putting them into a deallocated state (e.g., SSDs). The first method is > generally slow, while the second method is typically very fast. > > For example, on certain NVMe SSDs that support NVME_NS_DEAC, submitting > REQ_OP_WRITE_ZEROES requests with the NVME_WZ_DEAC bit can accelerate > the write zeros operation by placing disk blocks into
Note that this is a can, not a must. The NVMe definition of Write Zeroes is unfortunately pretty stupid. > + [RO] Devices that explicitly support the unmap write zeroes > + operation in which a single write zeroes request with the unmap > + bit set to zero out the range of contiguous blocks on storage > + by freeing blocks, rather than writing physical zeroes to the > + media. This is not actually guaranteed for nvme or scsi.