qcow: Fix wrong alignment calculation
With the existing code, `round_up(7, 2)` would generate `6` which is
obviously wrong. Also, following what's done for 'round_down()', the
fixed code does not handle 'alignment == 0' explicitly.
@@ -69,7 +69,7 @@ impl RawFile {
fn round_up(&self, offset: u64) -> u64 {
let align: u64 = self.alignment.try_into().unwrap();
- ((offset / (align + 1)) + 1) * align
+ ((offset + align - 1) / align) * align
}
fn round_down(&self, offset: u64) -> u64 {
