[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v3] qcow2: Rewrite qcow2_alloc_bytes()
From: |
Kevin Wolf |
Subject: |
Re: [Qemu-devel] [PATCH v3] qcow2: Rewrite qcow2_alloc_bytes() |
Date: |
Fri, 6 Feb 2015 17:22:20 +0100 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
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
pgp60QLPyvvao.pgp
Description: PGP signature