mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
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>