On Thu, Oct 22, 2020 at 12:17:35AM +0200, Klaus Jensen wrote: > From: Klaus Jensen <k.jen...@samsung.com> > > Add support for reporting the Deallocated or Unwritten Logical Block > Error (DULBE). > > Rely on the block status flags reported by the block layer and consider > any block with the BDRV_BLOCK_ZERO flag to be deallocated. > > Multiple factors affect when a Write Zeroes command result in > deallocation of blocks. > > * the underlying file system block size > * the blockdev format > * the 'discard' and 'logical_block_size' parameters > > format | discard | wz (512b) wz (4kb) wz (64kb) > --------------------------------------------------- > qcow2 ignore n n y > qcow2 unmap n n y > raw ignore n y y > raw unmap n y y > > So, this works best with an image in raw format and 4kb LBAs, since > holes can then be punched on a per-block basis (this assumes a file > system with a 4kb block size, YMMV). A qcow2 image, uses a cluster size > of 64kb by default and blocks will only be marked deallocated if a full > cluster is zeroed or discarded. However, this *is* consistent with the > spec since Write Zeroes "should" deallocate the block if the Deallocate > attribute is set and "may" deallocate if the Deallocate attribute is not > set. Thus, we always try to deallocate (the BDRV_REQ_MAY_UNMAP flag is > always set).
This looks fine. The constraints sound reasonable to me. Reviewed-by: Keith Busch <kbu...@kernel.org>