[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 28/46] qemu-img: add image fragmentation statistics
From: |
Kevin Wolf |
Subject: |
[Qemu-devel] [PATCH 28/46] qemu-img: add image fragmentation statistics |
Date: |
Thu, 5 Apr 2012 17:52:06 +0200 |
From: Dong Xu Wang <address@hidden>
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 <address@hidden>
Reviewed-by: Stefan Hajnoczi <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>
---
block.h | 7 +++++++
qemu-img.c | 9 ++++++++-
2 files changed, 15 insertions(+), 1 deletions(-)
diff --git a/block.h b/block.h
index c51ab16..ea12f5d 100644
--- a/block.h
+++ b/block.h
@@ -17,6 +17,12 @@ typedef struct BlockDriverInfo {
int64_t vm_state_offset;
} BlockDriverInfo;
+typedef struct BlockFragInfo {
+ uint64_t allocated_clusters;
+ uint64_t total_clusters;
+ uint64_t fragmented_clusters;
+} BlockFragInfo;
+
typedef struct QEMUSnapshotInfo {
char id_str[128]; /* unique snapshot id */
/* the following fields are informative. They are not needed for
@@ -175,6 +181,7 @@ typedef struct BdrvCheckResult {
int corruptions;
int leaks;
int check_errors;
+ BlockFragInfo bfi;
} BdrvCheckResult;
int bdrv_check(BlockDriverState *bs, BdrvCheckResult *res);
diff --git a/qemu-img.c b/qemu-img.c
index 0e48b35..4de48ba 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);
--
1.7.6.5
- [Qemu-devel] [PATCH 10/46] ide: Adds wwn=hex qdev option, (continued)
- [Qemu-devel] [PATCH 10/46] ide: Adds wwn=hex qdev option, Kevin Wolf, 2012/04/05
- [Qemu-devel] [PATCH 08/46] ide: Add "model=s" qdev option, Kevin Wolf, 2012/04/05
- [Qemu-devel] [PATCH 17/46] vdi: merge aio_read_cb and aio_write_cb into callers, Kevin Wolf, 2012/04/05
- [Qemu-devel] [PATCH 18/46] vdi: move aiocb fields to locals, Kevin Wolf, 2012/04/05
- [Qemu-devel] [PATCH 23/46] block: disable I/O throttling on sync api, Kevin Wolf, 2012/04/05
- [Qemu-devel] [PATCH 24/46] block: cancel jobs when a device is ready to go away, Kevin Wolf, 2012/04/05
- [Qemu-devel] [PATCH 22/46] Use DMADirection type for dma_bdrv_io, Kevin Wolf, 2012/04/05
- [Qemu-devel] [PATCH 43/46] qed: add bdrv_invalidate_cache to be called after incoming live migration, Kevin Wolf, 2012/04/05
- [Qemu-devel] [PATCH 37/46] qemu-iotests: Fix call syntax for qemu-img, Kevin Wolf, 2012/04/05
- [Qemu-devel] [PATCH 38/46] qemu-iotests: Fix call syntax for qemu-io, Kevin Wolf, 2012/04/05
- [Qemu-devel] [PATCH 28/46] qemu-img: add image fragmentation statistics,
Kevin Wolf <=
- [Qemu-devel] [PATCH 21/46] vdi: change goto to loop, Kevin Wolf, 2012/04/05
- [Qemu-devel] [PATCH 32/46] block: bdrv_append() fixes, Kevin Wolf, 2012/04/05
- [Qemu-devel] [PATCH 13/46] qdev: add blocksize property type, Kevin Wolf, 2012/04/05
- [Qemu-devel] [PATCH 20/46] vdi: do not create useless iovecs, Kevin Wolf, 2012/04/05
- [Qemu-devel] [PATCH 42/46] blockdev: open images with BDRV_O_INCOMING on incoming live migration, Kevin Wolf, 2012/04/05
- [Qemu-devel] [PATCH 25/46] block: fix streaming/closing race, Kevin Wolf, 2012/04/05
- [Qemu-devel] [PATCH 36/46] qemu-iotests: Test unknown qcow2 header extensions, Kevin Wolf, 2012/04/05
- [Qemu-devel] [PATCH 33/46] sheepdog: implement SD_OP_FLUSH_VDI operation, Kevin Wolf, 2012/04/05
- [Qemu-devel] [PATCH 11/46] block/vpc: write checksum back to footer after check, Kevin Wolf, 2012/04/05
- [Qemu-devel] [PATCH 15/46] vdi: basic conversion to coroutines, Kevin Wolf, 2012/04/05