All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kevin Wolf <kwolf@suse.de>
To: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 0/3] info blockstats (block-qcow2): show highest allocated offset (bytes)
Date: Mon, 12 Jan 2009 10:50:14 +0100	[thread overview]
Message-ID: <496B1256.1060609@suse.de> (raw)
In-Reply-To: <496A0899.7010707@redhat.com>

Shahar Frank schrieb:
> Kevin Wolf wrote:
>> Uri Lublin schrieb:
>>> 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.
>>
>> Any idea what would it mean to performance if we changed the behaviour
>> so that s->free_cluster_index always points to lowest free cluster? Then
>> most of the fragmentation should be gone.
>>
> free_cluster_index if already pointing the lowest known free space. The

Right, that's what I thought, too. Until I looked at code again.

alloc_clusters_noref() moves free_cluster_index forward if the needed
number of cluster don't fit right there. It's only set back to the
lowest free cluster when that cluster is freed later.

> problem is that the its update logic is very simplistic so an allocation
> of multiple clusters may cause this pointer to skip many single (in fact
>  it will skip all cluster sequences that are shorter than the requested
> number), so the next allocation may miss it. This will increase the
> fragmentation. Note that it wasn't so important until Laurent Vivier
> implemented his optimizations that allocated cluster sequences.

Yes, it wouldn't have been a problem before these patches. But now what
is the right thing to do if we're having some one-cluster holes and want
to write a larger block? There are only two options: Try to find a place
where the clusters are physically contiguous for better performance but
at the cost of fragmentation (that's what we to today) or fill up all
the holes first at cost of performance (we could to that with a few
lines of code).

> In fact, having two or even
> several free pointers is probably a step in the right direction, but we
> may need some better allocation mechanism to really solve the problem
> (btree+ structure, or something else). The target should be a decent
> extend based allocation. This improve qcow2 performance and handle he
> fragmentation problem. The problem is that it will probably change the
> qcow2 internals, so may better implement a simple approach for qcow2 and
> start designing qcow3...

Maybe you're right. But actually I don't feel like starting qcow3 now...
And it would be a long term thing anyway.

Kevin

      reply	other threads:[~2009-01-12  9:44 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
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 [this message]

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=496B1256.1060609@suse.de \
    --to=kwolf@suse.de \
    --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.