[PATCH 2/4] qcow2: Simplify size round-up in co_create_opts

Hanna Czenczek posted 4 patches 5 months, 2 weeks ago
Maintainers: Kevin Wolf <kwolf@redhat.com>, Hanna Reitz <hreitz@redhat.com>
[PATCH 2/4] qcow2: Simplify size round-up in co_create_opts
Posted by Hanna Czenczek 5 months, 2 weeks ago
Use the now-existing qcow2_opts pointer to simplify the size rounding up
code.

Signed-off-by: Hanna Czenczek <hreitz@redhat.com>
---
 block/qcow2.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/block/qcow2.c b/block/qcow2.c
index b11cbfd859..988ebcf138 100644
--- a/block/qcow2.c
+++ b/block/qcow2.c
@@ -4064,8 +4064,7 @@ qcow2_co_create_opts(BlockDriver *drv, const char *filename, QemuOpts *opts,
     }
 
     /* Silently round up size */
-    create_options->u.qcow2.size = ROUND_UP(create_options->u.qcow2.size,
-                                            BDRV_SECTOR_SIZE);
+    qcow2_opts->size = ROUND_UP(qcow2_opts->size, BDRV_SECTOR_SIZE);
 
     /* Create the qcow2 image (format layer) */
     ret = qcow2_co_create(create_options, errp);
-- 
2.49.0
Re: [PATCH 2/4] qcow2: Simplify size round-up in co_create_opts
Posted by Eric Blake 5 months ago
On Fri, May 30, 2025 at 10:44:45AM +0200, Hanna Czenczek wrote:
> Use the now-existing qcow2_opts pointer to simplify the size rounding up
> code.
> 
> Signed-off-by: Hanna Czenczek <hreitz@redhat.com>
> ---
>  block/qcow2.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)

Reviewed-by: Eric Blake <eblake@redhat.com>

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.
Virtualization:  qemu.org | libguestfs.org