All of lore.kernel.org
 help / color / mirror / Atom feed
From: Max Reitz <mreitz@redhat.com>
To: Eric Blake <eblake@redhat.com>, Ivan Ren <renyime@gmail.com>,
	qemu-devel@nongnu.org
Cc: kwolf@redhat.com, qemu-block@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] qemu-img: return allocated size for block device with qcow2 format
Date: Wed, 2 May 2018 17:33:01 +0200	[thread overview]
Message-ID: <0428cc5f-1498-c4a0-cfe8-e8432f68dca3@redhat.com> (raw)
In-Reply-To: <4ca76bd5-4b9a-636f-aa64-4f1aa02de4cf@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 1561 bytes --]

On 2018-05-02 17:19, Eric Blake wrote:
> On 05/02/2018 10:13 AM, Max Reitz wrote:
> 
>>> We also recently added 'qemu-img measure', which DOES report how many
>>> clusters are in use.  Is any of that reusable here?
>>
>> It only tells you that information for a hypothetical new image, though,
>> doesn't it?
> 
> It has two uses: with just a size, estimate the overhead needed to
> create a file with the given format and exposing the given size to the
> guest (both sparse and fully allocated sizes are estimated); and with a
> pre-existing image, compute the exact overhead needed for 'qemu-img
> convert' to create a new image with the given format and the same
> guest-visible contents.  The latter use, where it uses an existing guest
> image as the starting point to measure, indeed only tells you what a
> hypothetical new image will occupy (the used cluster count, not the
> wr_highest_offset count) - but isn't that what you want?

As far as I can tell, it only uses allocation status of the active layer
to determine how much of the hypothetical new image would be allocated
(the man page says "as if converting an existing image file using
qemu-img convert").  But this patch tries to determine exactly how much
is allocated in the current image for everything, not just how much you
need to have allocated to represent the active layer.

That may include snapshots, but it also includes bitmaps, or allocated
zero clusters (which qemu-img measure discounts), or things like empty
L2 tables.  So, everything.

Max


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

  reply	other threads:[~2018-05-02 15:33 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-02 13:34 [Qemu-devel] [PATCH] qemu-img: return allocated size for block device with qcow2 format Ivan Ren
2018-05-02 14:02 ` Eric Blake
2018-05-03 13:06   ` 叶残风
2018-05-04 14:35     ` Max Reitz
2018-05-04 15:57       ` Ivan Ren
2018-05-02 14:37 ` Max Reitz
2018-05-02 15:01   ` Eric Blake
2018-05-02 15:13     ` Max Reitz
2018-05-02 15:19       ` Eric Blake
2018-05-02 15:33         ` Max Reitz [this message]
2018-05-03 13:08   ` 叶残风
2018-05-04 14:27     ` Max Reitz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=0428cc5f-1498-c4a0-cfe8-e8432f68dca3@redhat.com \
    --to=mreitz@redhat.com \
    --cc=eblake@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=renyime@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.