mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
Filesystems such as tmpfs do not support fallocate with FALLOC_FL_ZERO_RANGE or FALLOC_FL_PUNCH_HOLE and return EOPNOTSUPP. When a raw disk image lives on such a filesystem, virtio write zeroes and discard requests fail with IOERR. Use the WriteZeroesAt trait from vmm_sys_util through AlignedFile, which already bundles fallocate with a positional write fallback. For punch_hole, catch EOPNOTSUPP and fall back to the same trait. The io_uring engine previously submitted fallocate directly through the ring, where the async EOPNOTSUPP completion had no retry path. Route it through the same sync helpers that the other engines already use. Signed-off-by: Anatol Belski <anbelski@linux.microsoft.com>