mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
run_unaligned_operation staged every unaligned request in a plain Vec and then handed it to AlignedFile, which bounced again through an aligned buffer. That Vec only gave the operation a contiguous range to scatter into or gather from, which the aligned buffer already is, so each slow path request paid for an extra allocation and a full length copy. Add read_unaligned and write_unaligned on AlignedFile that own the single aligned bounce and scatter or gather through a closure over the staging slice. run_unaligned_operation and the FileExt read_at and write_at impls both route through them, so the staging and read-modify-write logic lives in one place. The closures keep AlignedFile free of any AsyncIoOperation dependency. Signed-off-by: Anatol Belski <anbelski@linux.microsoft.com>