Files
cloud-hypervisor/virtio-devices
Anatol Belski 0ee0441f2b virtio-devices: block: Derive discard alignment from topology
Set discard_sector_alignment from the logical block size
reported by the backend topology instead of hardcoding it
to 1 sector. This gives the guest accurate alignment hints
so it can avoid sub block discards that the filesystem
might silently ignore.

For example, on a 4K block filesystem the alignment is now
8 sectors (4096/512) instead of 1.

For image formats with their own allocation units (QCOW2
clusters, VHD/VHDX block sizes), the ideal alignment would
be derived from the format cluster/block size. This is
left for a followup that surfaces allocation granularity
through DiskTopology.

Signed-off-by: Anatol Belski <anbelski@linux.microsoft.com>
2026-03-19 01:07:49 +00:00
..