You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ocaml/libs: Check if blocks are filled with zeros in vhd_format (#6720)
`find_data_blocks` is used to determine which blocks need to be copied
to the destination VHD file during export. It uses `lseek(SEEK_DATA)` to
skip "holes" in files. Raw files presented by the storage layer,
however, do not have holes, instead returning blocks filled with zeros.
This means that `vhd-tool` ends up allocating every single block (even
if all of them contain zeroes and no actual data).
In addition to using `lseek_data`, read the whole block and check if it
only contains zeros. This avoids allocating zero blocks and greatly
speeds up export from raw to vhd (which happens when exporting qcow2 to
vhd as well).
Before this fix, when exporting a QCOW2-backed VDI (which vhd-tool falls
back to treating as "raw"):
$ xe vdi-export uuid=VDI_UUID filename=test.vhd format=vhd
$ ll -h test.vhd
2.1G test.vhd
Compared to the qcow2 backing file:
$ ll -h /var/run/sr-mount/SR_UUID/VDI_UUID.qcow2
165M /var/run/sr-mount/SR_UUID/VDI_UUID.qcow2
After this fix:
$ ll -h test.vhd
219M test.vhd
0 commit comments