qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v3 2/4] qemu-img: make --block-size optional for compare --st


From: Eric Blake
Subject: Re: [PATCH v3 2/4] qemu-img: make --block-size optional for compare --stat
Date: Fri, 29 Oct 2021 15:32:57 -0500
User-agent: NeoMutt/20211022

On Thu, Oct 28, 2021 at 12:24:39PM +0200, Vladimir Sementsov-Ogievskiy wrote:
> Let's detect block-size automatically if not specified by user:
> 
>  If both files define cluster-size, use minimum to be more precise.
>  If both files don't specify cluster-size, use default of 64K
>  If only one file specify cluster-size, just use it.
> 
> Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
> ---
>  docs/tools/qemu-img.rst |  7 +++-
>  qemu-img.c              | 71 +++++++++++++++++++++++++++++++++++++----
>  qemu-img-cmds.hx        |  4 +--
>  3 files changed, 72 insertions(+), 10 deletions(-)
>

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

> +    if (cluster_size1 > 0 && cluster_size2 > 0) {
> +        if (cluster_size1 == cluster_size2) {
> +            block_size = cluster_size1;
> +        } else {
> +            block_size = MIN(cluster_size1, cluster_size2);
> +            qprintf(quiet, "%s and %s have different cluster sizes: %d and 
> %d "
> +                    "respectively. Using minimum as block-size for "
> +                    "accuracy: %d. %s\n",
> +                    fname1, fname2, cluster_size1,
> +                    cluster_size2, block_size, note);

Results in a long line; I don't know if it's worth trying to wrap it
(if we had a generic utility function that took arbitrary text, then
outputs it wrapped to the user's current terminal column width, I'd
suggest using that instead - but that's NOT something I expect you to
write, and I don't know if glib has such a utility).

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org




reply via email to

[Prev in Thread] Current Thread [Next in Thread]