mirror of
https://github.com/mii443/qemu.git
synced 2025-08-22 23:25:48 +00:00
qemu-io: Relax 'alloc' now that block-status doesn't assert
Previously, the alloc command required that input parameters be sector-aligned and clamped to 32 bits, because the underlying bdrv_is_allocated used a 32-bit parameter and asserted aligned inputs. But now that we have fixed block status to report a 64-bit bytes value, and to properly round requests on behalf of guests, we can pass any values, and can use qemu-io to add coverage that our rounding is correct regardless of the guest alignment constraints. Update iotest 177 to intentionally probe block status at unaligned boundaries as well as with a bytes value that does not map to 32-bit sectors, which also required tweaking the image prep to leave an unallocated portion to the image under test. Signed-off-by: Eric Blake <eblake@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
This commit is contained in:
@ -1769,10 +1769,6 @@ static int alloc_f(BlockBackend *blk, int argc, char **argv)
|
||||
if (offset < 0) {
|
||||
print_cvtnum_err(offset, argv[1]);
|
||||
return 0;
|
||||
} else if (!QEMU_IS_ALIGNED(offset, BDRV_SECTOR_SIZE)) {
|
||||
printf("%" PRId64 " is not a sector-aligned value for 'offset'\n",
|
||||
offset);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (argc == 3) {
|
||||
@ -1780,19 +1776,10 @@ static int alloc_f(BlockBackend *blk, int argc, char **argv)
|
||||
if (count < 0) {
|
||||
print_cvtnum_err(count, argv[2]);
|
||||
return 0;
|
||||
} else if (count > INT_MAX * BDRV_SECTOR_SIZE) {
|
||||
printf("length argument cannot exceed %llu, given %s\n",
|
||||
INT_MAX * BDRV_SECTOR_SIZE, argv[2]);
|
||||
return 0;
|
||||
}
|
||||
} else {
|
||||
count = BDRV_SECTOR_SIZE;
|
||||
}
|
||||
if (!QEMU_IS_ALIGNED(count, BDRV_SECTOR_SIZE)) {
|
||||
printf("%" PRId64 " is not a sector-aligned value for 'count'\n",
|
||||
count);
|
||||
return 0;
|
||||
}
|
||||
|
||||
remaining = count;
|
||||
sum_alloc = 0;
|
||||
|
Reference in New Issue
Block a user