All of lore.kernel.org
 help / color / mirror / Atom feed
From: Uri Lublin <uril@redhat.com>
To: Anthony Liguori <anthony@codemonkey.ws>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 0/3] info blockstats (block-qcow2): show highest allocated offset (bytes)
Date: Sun, 11 Jan 2009 11:26:57 +0200	[thread overview]
Message-ID: <4969BB61.9070803@redhat.com> (raw)
In-Reply-To: <4966560B.30504@codemonkey.ws>

Anthony Liguori wrote:
> Uri Lublin wrote:
>> From: Uri Lublin <uril@redhat.com>
>>
>> This patchset let the user know the highest allocated byte of qcow2 
>> images.
>> Actually it's the first unallocated byte after the highest byte written,
>> cluster-size aligned.
>>
>> The highest allocated byte gives a maximal limit (easy to calculate)
>> to the number of bytes allocated for that image, and may hint how many 
>> more allocations can be done before we reach end-of-file (end of host 
>> block device).
>> Although there may be many free blocks below that number (allocated 
>> and freed)
>> the file system can not deallocate those blocks, and they have to be 
>> reused
>> by qemu. Also note that due to fragmentation those free blocks may not
>> be used on next allocations.
>>
>> It can be useful for truncation of backing file images (ftruncate).
>> Also it may be useful for defragmentation later (although we'll need
>> the number of free blocks as well).
> 
> I'm having trouble seeing the utility of this as it seems to be not 
> really reliable.  Surely, after a lot of work, you'll have one block far 
> at the end of the file, no?  I don't see how knowing this location helps 
> practically speaking.  Can you explain a little more about what you want 
> to use this functionality for?
> 

Currently, qcow2 images can only grow, never shrink.
The main usage would be to trigger an appropriate operation when a threshold is 
reached. The threshold and operation are defined by a management application.
Basically we can do one of the following:
1. Defragment the qcow2 image (simplest way is to qemu-img convert it, the best 
is to do it online if possible).
2. Allocate more space (especially when using LVM)

I plan on adding another "blockstat" that shows the number of free 
bytes/blocks/clusters for a qcow2 image. This would make it easier to choose the 
appropriate operation above.

Thanks,
     Uri.

  reply	other threads:[~2009-01-11  9:27 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-08 18:49 [Qemu-devel] [PATCH 0/3] info blockstats (block-qcow2): show highest allocated offset (bytes) Uri Lublin
2009-01-08 19:37 ` Anthony Liguori
2009-01-11  9:26   ` Uri Lublin [this message]
2009-01-11 15:16     ` Shahar Frank
2009-01-09  9:09 ` Kevin Wolf
2009-01-11  9:31   ` Uri Lublin
2009-01-11 14:56   ` Shahar Frank
2009-01-12  9:50     ` Kevin Wolf

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=4969BB61.9070803@redhat.com \
    --to=uril@redhat.com \
    --cc=anthony@codemonkey.ws \
    --cc=qemu-devel@nongnu.org \
    /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.