@@ -3273,7 +3273,8 @@ qcow2_co_create(BlockdevCreateOptions *create_options, Error **errp)
/* Validate options and set default values */
if (!QEMU_IS_ALIGNED(qcow2_opts->size, BDRV_SECTOR_SIZE)) {
- error_setg(errp, "Image size must be a multiple of 512 bytes");
+ error_setg(errp, "Image size must be a multiple of %u bytes",
+ (unsigned) BDRV_SECTOR_SIZE);
ret = -EINVAL;
goto out;
}
@@ -3947,8 +3948,9 @@ static int coroutine_fn qcow2_co_truncate(BlockDriverState *bs, int64_t offset,
return -ENOTSUP;
}
- if (offset & 511) {
- error_setg(errp, "The new size must be a multiple of 512");
+ if (!QEMU_IS_ALIGNED(offset, BDRV_SECTOR_SIZE)) {
+ error_setg(errp, "The new size must be a multiple of %u",
+ (unsigned) BDRV_SECTOR_SIZE);
return -EINVAL;
}
This replaces all remaining instances in the qcow2 code. Signed-off-by: Alberto Garcia <berto@igalia.com> --- block/qcow2.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)