Thanks for your review, Eric.
Yes, the wr_highest_offset can tell the end offset at runtime, and
write_threshold similar to it. But in my situation, I need to know
the allocated end without a vm running.

Eric Blake <ebl...@redhat.com> 于2018年5月2日周三 下午10:02写道:

> On 05/02/2018 08:34 AM, Ivan Ren wrote:
> > qemu-img info with a block device which has a qcow2 format always
> > return 0 for disk size, and this can not reflect the qcow2 size
> > and the used space of the block device. This patch return the
> > allocated size of qcow2 as the disk size.
>
> How does this differ from what qemu can already give you at runtime via
> the wr_highest_offset property in BlockDeviceStats, and related to the
> write_threshold ('block-set-write-threshold command,
> BLOCK_WRITE_THRESHOLD event)?  Is there any code we can reuse, rather
> than writing something from scratch?
>
> >
> > Signed-off-by: Ivan Ren <ivan...@tencent.com>
> > ---
> >   block/qcow2-bitmap.c |  69 +++++++++++++++++
> >   block/qcow2.c        | 212
> +++++++++++++++++++++++++++++++++++++++++++++++++++
> >   block/qcow2.h        |  42 ++++++++++
> >   3 files changed, 323 insertions(+)
> >
>
> --
> Eric Blake, Principal Software Engineer
> Red Hat, Inc.           +1-919-301-3266
> Virtualization:  qemu.org | libvirt.org
>

Reply via email to