qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Eric Blake <eblake@redhat.com>
To: Max Reitz <mreitz@redhat.com>, qemu-devel@nongnu.org
Cc: Kevin Wolf <kwolf@redhat.com>, Stefan Hajnoczi <stefanha@redhat.com>
Subject: Re: [Qemu-devel] [PATCH v3] qcow2: Rewrite qcow2_alloc_bytes()
Date: Fri, 06 Feb 2015 08:31:15 -0700	[thread overview]
Message-ID: <54D4DE43.7050207@redhat.com> (raw)
In-Reply-To: <54D4DD45.5010809@redhat.com>

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

On 02/06/2015 08:27 AM, Eric Blake wrote:

>>  
>> -    /* The cluster refcount was incremented, either by qcow2_alloc_clusters()
>> -     * or explicitly by qcow2_update_cluster_refcount().  Refcount blocks must
>> -     * be flushed before the caller's L2 table updates.
>> -     */
>> +    assert(offset);
>> +    ret = update_refcount(bs, offset, size, 1, QCOW2_DISCARD_NEVER);
> 
> Case 1: This incremented the new cluster. Good
> Case 2: This incremented the old cluster. Good
> Case 3: This incremented the new cluster. Good
> Case 4: This incremented the old cluster. But the new cluster remains at
> refcount 0.  BAD.

Wait. Maybe I'm confused.  You are requesting an update_refcount()
across size bytes, and given the offset, that means that the code will
round up to cover BOTH clusters in one call.  Does update_refcount()
properly increment from  [ 1, 0 ] to [ 2, 1 ] when given a 2-cluster
size (when offset, size is rounded up to cluster boundaries)?  If so,
then there is no bug after all.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org


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

  reply	other threads:[~2015-02-06 15:31 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-06 14:39 [Qemu-devel] [PATCH v3] qcow2: Rewrite qcow2_alloc_bytes() Max Reitz
2015-02-06 15:01 ` Kevin Wolf
2015-02-06 15:27 ` Eric Blake
2015-02-06 15:31   ` Eric Blake [this message]
2015-02-06 16:22     ` 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=54D4DE43.7050207@redhat.com \
    --to=eblake@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=mreitz@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.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 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).