[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 7/7] vpc: Don't round up already aligned BAT sizes
From: |
Kevin Wolf |
Subject: |
[PULL 7/7] vpc: Don't round up already aligned BAT sizes |
Date: |
Tue, 7 Apr 2020 16:26:16 +0200 |
As reported on Launchpad, Azure apparently doesn't accept images for
upload that are not both aligned to 1 MB blocks and have a BAT size that
matches the image size exactly.
As far as I can tell, there is no real reason why we create a BAT that
is one entry longer than necessary for aligned image sizes, so change
that.
(Even though the condition is only mentioned as "should" in the spec and
previous products accepted larger BATs - but we'll try to maintain
compatibility with as many of Microsoft's ever-changing interpretations
of the VHD spec as possible.)
Fixes: https://bugs.launchpad.net/bugs/1870098
Reported-by: Tobias Witek
Signed-off-by: Kevin Wolf <address@hidden>
Message-Id: <address@hidden>
Reviewed-by: Max Reitz <address@hidden>
Reviewed-by: Philippe Mathieu-Daudé <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>
---
block/vpc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/block/vpc.c b/block/vpc.c
index 6df75e22dc..d8141b52da 100644
--- a/block/vpc.c
+++ b/block/vpc.c
@@ -835,7 +835,7 @@ static int create_dynamic_disk(BlockBackend *blk, uint8_t
*buf,
/* Write the footer (twice: at the beginning and at the end) */
block_size = 0x200000;
- num_bat_entries = (total_sectors + block_size / 512) / (block_size / 512);
+ num_bat_entries = DIV_ROUND_UP(total_sectors, block_size / 512);
ret = blk_pwrite(blk, offset, buf, HEADER_SIZE, 0);
if (ret < 0) {
--
2.20.1
- [PULL 0/7] Block layer patches, Kevin Wolf, 2020/04/07
- [PULL 1/7] job: take each job's lock individually in job_txn_apply, Kevin Wolf, 2020/04/07
- [PULL 4/7] block-backend: Reorder flush/pdiscard function definitions, Kevin Wolf, 2020/04/07
- [PULL 5/7] block: Increase BB.in_flight for coroutine and sync interfaces, Kevin Wolf, 2020/04/07
- [PULL 6/7] block: Fix blk->in_flight during blk_wait_while_drained(), Kevin Wolf, 2020/04/07
- [PULL 7/7] vpc: Don't round up already aligned BAT sizes,
Kevin Wolf <=
- [PULL 3/7] backup: don't acquire aio_context in backup_clean, Kevin Wolf, 2020/04/07
- [PULL 2/7] replication: assert we own context before job_cancel_sync, Kevin Wolf, 2020/04/07
- Re: [PULL 0/7] Block layer patches, Peter Maydell, 2020/04/07