Message ID | 1331813614-3754-1-git-send-email-wdongxu@linux.vnet.ibm.com |
---|---|
State | New |
Headers | show |
On Thu, Mar 15, 2012 at 12:45 PM, Stefan Hajnoczi <stefanha@linux.vnet.ibm.com> wrote: > On Thu, Mar 15, 2012 at 08:13:31PM +0800, Dong Xu Wang wrote: >> From: Dong Xu Wang <wdongxu@linux.vnet.ibm.com> >> >> 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> >> --- >> block.h | 7 +++++++ >> qemu-img.c | 9 ++++++++- >> 2 files changed, 15 insertions(+), 1 deletions(-) > > A minor comment that doesn't require resending: > > Please avoid introducing whitespace or reformatting changes in a patch > that makes other code changes. Patch 1 changes whitespace in a place > that is not touched by the rest of your patch, so that change is not > essential and it's best to leave it out. > > Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com> Ping? Stefan
On Thu, Mar 15, 2012 at 12:13 PM, Dong Xu Wang <wdongxu@linux.vnet.ibm.com> wrote: > From: Dong Xu Wang <wdongxu@linux.vnet.ibm.com> > > 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> > --- > block.h | 7 +++++++ > qemu-img.c | 9 ++++++++- > 2 files changed, 15 insertions(+), 1 deletions(-) In the future please send a 0/4 email when sending a patch series: git format-patch --cover-letter ... The cover letter introduces the patch series and also acts as the single place where reviewers can reply to say they are happy with the series. Kevin: my Reviewed-by: applies to the whole series. Stefan
Am 15.03.2012 13:13, schrieb Dong Xu Wang: > From: Dong Xu Wang <wdongxu@linux.vnet.ibm.com> > > 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> Thanks, applied all to the block branch. Please make the subject line prefix more specific in future commits, I changed it for this series. For example, don't write "block: foo in qed" or "block: Add bar to qemu-img", but "qed: foo" and "qemu-img: Add bar". The "block:" prefix is reserved for changes that are purely in the generic block layer (mainly block.c, blockdev.c). Kevin
diff --git a/block.h b/block.h index 415bb17..32e1e58 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);