From e6439d783cce2c5cdbe4f8028f0b45162b540f82 Mon Sep 17 00:00:00 2001 From: Stefan Hajnoczi Date: Thu, 7 Feb 2013 17:15:04 +0100 Subject: qemu-img: add compressed clusters to BlockFragInfo 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 Signed-off-by: Stefan Hajnoczi --- qemu-img.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'qemu-img.c') diff --git a/qemu-img.c b/qemu-img.c index 0e34bf0..fa9b2af 100644 --- a/qemu-img.c +++ b/qemu-img.c @@ -428,10 +428,11 @@ static void dump_human_image_check(ImageCheck *check) if (check->total_clusters != 0 && check->allocated_clusters != 0) { printf("%" PRId64 "/%" PRId64 " = %0.2f%% allocated, " - "%0.2f%% fragmented\n", + "%0.2f%% fragmented, %0.2f%% compressed clusters\n", check->allocated_clusters, check->total_clusters, check->allocated_clusters * 100.0 / check->total_clusters, - check->fragmented_clusters * 100.0 / check->allocated_clusters); + check->fragmented_clusters * 100.0 / check->allocated_clusters, + check->compressed_clusters * 100.0 / check->allocated_clusters); } if (check->image_end_offset) { @@ -472,6 +473,8 @@ static int collect_image_check(BlockDriverState *bs, check->has_allocated_clusters = result.bfi.allocated_clusters != 0; check->fragmented_clusters = result.bfi.fragmented_clusters; check->has_fragmented_clusters = result.bfi.fragmented_clusters != 0; + check->compressed_clusters = result.bfi.compressed_clusters; + check->has_compressed_clusters = result.bfi.compressed_clusters != 0; return 0; } -- cgit v1.1