qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Eric Blake <eblake@redhat.com>
To: Alberto Garcia <berto@igalia.com>, qemu-devel@nongnu.org
Cc: Kevin Wolf <kwolf@redhat.com>,
	qemu-block@nongnu.org, Max Reitz <mreitz@redhat.com>
Subject: Re: [Qemu-devel] [PATCH] qcow2: Reset free_cluster_index when allocating a new refcount block
Date: Wed, 21 Mar 2018 08:30:11 -0500	[thread overview]
Message-ID: <78205471-01fc-9d60-590e-feab0df79439@redhat.com> (raw)
In-Reply-To: <20180320135515.16823-1-berto@igalia.com>

On 03/20/2018 08:55 AM, Alberto Garcia wrote:
> When we try to allocate new clusters we first look for available ones
> starting from s->free_cluster_index and once we find them we increase
> their reference counts. Before we get to call update_refcount() to do
> this last step s->free_cluster_index is already pointing to the next
> cluster after the ones we are trying to allocate.
> 

> This can be reproduced easily:
> 
>       qemu-img create -f qcow2 -o cluster_size=512 hd.qcow2 1M
>       qemu-io -c 'write 0 124k' hd.qcow2

This reproduction fails if you use non-default refcount_order...

> +++ b/tests/qemu-iotests/121
> @@ -93,6 +93,26 @@ $QEMU_IO -c 'write 63M 130K' "$TEST_IMG" | _filter_qemu_io
>   
>   _check_test_img
>   
> +echo
> +echo '=== Allocating a new refcount block must not leave holes in the image ==='
> +echo
> +
> +IMGOPTS='cluster_size=512' _make_test_img 1M

...so here, I think IMGOPTS also has to include refcount_bits=4, so that 
calling iotests './check -o refcount_bits=3' or similar doesn't fail the 
test.

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org

  parent reply	other threads:[~2018-03-21 13:30 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-20 13:55 [Qemu-devel] [PATCH] qcow2: Reset free_cluster_index when allocating a new refcount block Alberto Garcia
2018-03-20 17:54 ` [Qemu-devel] [PATCH for-2.12] " Eric Blake
2018-03-21  9:28   ` Alberto Garcia
2018-03-21 13:08     ` Eric Blake
2018-03-21 13:15       ` Alberto Garcia
2018-03-21 13:30 ` Eric Blake [this message]
2018-03-21 13:31   ` [Qemu-devel] [PATCH] " Eric Blake

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=78205471-01fc-9d60-590e-feab0df79439@redhat.com \
    --to=eblake@redhat.com \
    --cc=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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).