qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Kevin Wolf <kwolf@redhat.com>
To: Eric Blake <eblake@redhat.com>
Cc: qemu-devel@nongnu.org, Stefan Hajnoczi <stefanha@redhat.com>,
	Max Reitz <mreitz@redhat.com>
Subject: Re: [Qemu-devel] [PATCH v3] qcow2: Rewrite qcow2_alloc_bytes()
Date: Fri, 6 Feb 2015 17:22:20 +0100	[thread overview]
Message-ID: <20150206162220.GH13081@noname.redhat.com> (raw)
In-Reply-To: <54D4DE43.7050207@redhat.com>

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

Am 06.02.2015 um 16:31 hat Eric Blake geschrieben:
> 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.

Yes, this is what it should be doing. Letting one update_refcount() call
(more or less) atomically increment both refcounts was the whole point
of my suggestion anyway because that is what enables the simplification.

Kevin

[-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --]

      reply	other threads:[~2015-02-06 16:22 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
2015-02-06 16:22     ` 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=20150206162220.GH13081@noname.redhat.com \
    --to=kwolf@redhat.com \
    --cc=eblake@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).