mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
Implement DISCARD using QCOW2 zero flag (bit 0 of L2 entries) with sparse aware behavior. When sparse=true - fully deallocate clusters by decrementing refcount, clearing L2 entry, and reclaiming storage via punch_hole when refcount reaches zero. When sparse=false - use zero flag to keep storage allocated while marking as reading zeros. Only works when cluster is not shared. Shared clusters are fully deallocated. Signed-off-by: Anatol Belski <anbelski@linux.microsoft.com>