All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alberto Garcia <berto@igalia.com>
To: Max Reitz <mreitz@redhat.com>, qemu-devel@nongnu.org
Cc: qemu-block@nongnu.org, Kevin Wolf <kwolf@redhat.com>
Subject: Re: [Qemu-devel] [PATCH] qcow2: Optimize the refcount-block overlap check
Date: Wed, 01 Feb 2017 11:39:56 +0100	[thread overview]
Message-ID: <w51inoury83.fsf@maestria.local.igalia.com> (raw)
In-Reply-To: <574dd15d-ace7-cbaf-574a-944c2c436b95@redhat.com>

On Wed 01 Feb 2017 02:46:20 AM CET, Max Reitz <mreitz@redhat.com> wrote:

>> The problem with the refcount table is that since it always occupies
>> complete clusters its size is usually very big.
>
> Actually the main problem is that BDRVQcow2State.refcount_table_size
> is updated very generously as opposed to BDRVQcow2State.l1_size. The
> latter is usually exactly as large as it needs to be (because the L1
> table size usually doesn't change), whereas the refcount_table_size is
> just bumped up every time the image gets bigger until it reaches or
> exceeds the value it needs to be.

That's actually a good point.

One reason why this happens is that the size of the L1 table is static
and the qcow2 header stores the actual number of entries, whereas for
the refcount table it stores the number of clusters.

Maybe we can have refcount_table_size store the actual size of the
table. The number of clusters can be calculated from that after all, and
we would get rid of max_refcount_table_index.

The change might be a bit more difficult, though, I'll take a look.

>> @@ -439,6 +450,7 @@ static int alloc_refcount_block(BlockDriverState *bs,
>>          }
>>  
>>          s->refcount_table[refcount_table_index] = new_block;
>> +        s->max_refcount_table_index = refcount_table_index;
>
> Should be MAX(s->max_refcount_table_index, refcount_table_index) or
> this won't support refcount tables with holes in them.

Good catch.

Berto

  reply	other threads:[~2017-02-01 10:40 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-30 16:14 [Qemu-devel] [PATCH] qcow2: Optimize the refcount-block overlap check Alberto Garcia
2017-01-30 16:34 ` Alberto Garcia
2017-01-30 18:27   ` Eric Blake
2017-02-01  1:16   ` Max Reitz
2017-02-01  1:46 ` Max Reitz
2017-02-01 10:39   ` Alberto Garcia [this message]
2017-02-01 11:58     ` 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=w51inoury83.fsf@maestria.local.igalia.com \
    --to=berto@igalia.com \
    --cc=kwolf@redhat.com \
    --cc=mreitz@redhat.com \
    --cc=qemu-block@nongnu.org \
    --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.