Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
storage: Use offset on (cold) merge instead of mesure required size.
When we commit a snapshot into a base volume, we first measure do a measure and then extend the base image with the required size. But this is not a valid assumption. The required size output from measure gives you the size that would be required for a NEW volume, but not the size required to commit the top volume into the base volume. While the final required since on a new volume might be lower than the size of the base volume. It might be required to extend the base volume to fit the comitted data. See for example: https://gitlab.com/qemu-project/qemu/-/issues/2369 Base vol: 13421772800 bytes / end offset 13421772800 Top vol: 6174015488 bytes / end offset 3488350208 Measure gives us required size: 3491168256 But if we commit the top volume, the base volume grows to 13504806912 bytes. Therefor we check the end offset of each volume, and the sum of that is the required size. We might allocate to much here, but the finalize shrinks the LV again to the end offset of the commited base image. So only some additional space during commit is needed. Signed-off-by: Jean-Louis Dupond <jean-louis@dupond.be>
- Loading branch information