Skip to content

Optimize data cluster format for VHD and QCOW#6895

Draft
last-genius wants to merge 6 commits intoxapi-project:26.1-lcmfrom
last-genius:asv/8.3-sparse-vhd-qcow
Draft

Optimize data cluster format for VHD and QCOW#6895
last-genius wants to merge 6 commits intoxapi-project:26.1-lcmfrom
last-genius:asv/8.3-sparse-vhd-qcow

Conversation

@last-genius
Copy link
Contributor

@last-genius last-genius commented Feb 6, 2026

mirage/ocaml-qcow#134 changes the type of the data structure containing info on allocated data clusters, returning allocated intervals instead of all the virtual cluster addresses. Modify vhd-tool as well to conform to this format, and change the parsing code in vhd_qcow_parsing and qcow2-to-stdout.

I've ran vm export and vdi integrity quicktests and tested this extensively locally. The PR will only build once the new ocaml-qcow version is packaged into xs-opam, so keeping this as draft for now.

…rmat

Qcow_stream now uses Qcow_mapping to store information on allocated clusters,
which offers .to_interval_seq, outputting a list of pairs representing
intervals of allocated virtual clusters.

Signed-off-by: Andrii Sultanov <andriy.sultanov@vates.tech>
Now that qcow-stream-tool output intervals of allocated clusters, do the same
for vhd-tool. This greatly decreases the filesize and memory usage in vhd-tool.

Signed-off-by: Andrii Sultanov <andriy.sultanov@vates.tech>
This requires switching stream_vdi to the new format, away from the
memory-costly Map storing information on every single allocated cluster.

Signed-off-by: Andrii Sultanov <andriy.sultanov@vates.tech>
…er allocation

Instead of using a set with every individual allocated cluster index as a
member, use a sorted list of intervals to verify if cluster is allocated - this
uses much less memory and directly follows from the JSON format
qcow-stream-tool and vhd-tool output now.

Signed-off-by: Andrii Sultanov <andriy.sultanov@vates.tech>
…_clusters

nonzero_clusters no longer contain every single allocated cluster and instead
are intervals of allocated clusters.

Signed-off-by: Andrii Sultanov <andriy.sultanov@vates.tech>
… files

Signed-off-by: Andrii Sultanov <andriy.sultanov@vates.tech>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant