aboutsummaryrefslogtreecommitdiff
path: root/qemu-img.c
diff options
context:
space:
mode:
authorDong Xu Wang <wdongxu@linux.vnet.ibm.com>2012-03-15 20:13:31 +0800
committerKevin Wolf <kwolf@redhat.com>2012-04-05 14:54:40 +0200
commitf8111c241afa75544032dcfa23df0699c91f9866 (patch)
tree43f9bd6d27759201855a1cb421a961794c813efe /qemu-img.c
parentdc534f8fc045a51a8eb678ab3d330fba1e9e631c (diff)
qemu-img: add image fragmentation statistics
Discussion can be found at: http://patchwork.ozlabs.org/patch/128730/ This patch add image fragmentation statistics while using qemu-img check. Signed-off-by: Dong Xu Wang <wdongxu@linux.vnet.ibm.com> Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'qemu-img.c')
-rw-r--r--qemu-img.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/qemu-img.c b/qemu-img.c
index 0e48b35296..4de48bac58 100644
--- a/qemu-img.c
+++ b/qemu-img.c
@@ -428,6 +428,13 @@ static int img_check(int argc, char **argv)
}
}
+ if (result.bfi.total_clusters != 0 && result.bfi.allocated_clusters != 0) {
+ printf("%" PRId64 "/%" PRId64 "= %0.2f%% allocated, %0.2f%% fragmented\n",
+ result.bfi.allocated_clusters, result.bfi.total_clusters,
+ result.bfi.allocated_clusters * 100.0 / result.bfi.total_clusters,
+ result.bfi.fragmented_clusters * 100.0 / result.bfi.allocated_clusters);
+ }
+
bdrv_delete(bs);
if (ret < 0 || result.check_errors) {
@@ -716,7 +723,7 @@ static int img_convert(int argc, char **argv)
ret = -1;
goto out;
}
-
+
qemu_progress_init(progress, 2.0);
qemu_progress_print(0, 100);