qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH 4/5] qemu-img: add compressed clusters to BlockF


From: Kevin Wolf
Subject: Re: [Qemu-devel] [PATCH 4/5] qemu-img: add compressed clusters to BlockFragInfo
Date: Wed, 06 Feb 2013 12:43:54 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:13.0) Gecko/20120605 Thunderbird/13.0

Am 05.02.2013 19:54, schrieb Stefan Hajnoczi:
> Show how many clusters are compressed.  This can be used to monitor how
> many compressed clusters remain and whether to recompress the image.
> 
> Suggested-by: Cole Robinson <address@hidden>
> Signed-off-by: Stefan Hajnoczi <address@hidden>

> diff --git a/qemu-img.c b/qemu-img.c
> index 167d65f..a06456b 100644
> --- a/qemu-img.c
> +++ b/qemu-img.c
> @@ -471,10 +471,11 @@ static int img_check(int argc, char **argv)
>  
>      if (bfi->total_clusters != 0 && bfi->allocated_clusters != 0) {
>          printf("%" PRId64 "/%" PRId64 "= %0.2f%% allocated, "
> -               "%0.2f%% fragmented\n",
> +               "%0.2f%% fragmented, %0.2f%% compressed\n",
>                 bfi->allocated_clusters, bfi->total_clusters,
>                 bfi->allocated_clusters * 100.0 / bfi->total_clusters,
> -               bfi->fragmented_clusters * 100.0 / bfi->allocated_clusters);
> +               bfi->fragmented_clusters * 100.0 / bfi->allocated_clusters,
> +               bfi->compressed_clusters * 100.0 / bfi->allocated_clusters);
>      }

Having the output in this if block assumes that all block drivers either
have both fragmentation and compression statistics or neither. Wouldn't
it make more sense to check compressed_clusters separately and not print
anything on non-qcow2 (and possibly even uncompressed qcow2) images?

Instead of getting a longer and longer output line for each new number
we add, maybe we could use the chance to introduce multiline output:

Total number of clusters:   1000
- allocated                  427 (42.7%)
- fragmented                  71 (7.1%)
- compressed                 120 (12.0%)

Or something like that. And if a line doesn't apply to the given image
(format), it's just left out.

Kevin



reply via email to

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