[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [RFC V6 27/33] qcow2: Adapt checking of QCOW_OFLAG_COPI
From: |
Stefan Hajnoczi |
Subject: |
Re: [Qemu-devel] [RFC V6 27/33] qcow2: Adapt checking of QCOW_OFLAG_COPIED for dedup. |
Date: |
Thu, 28 Feb 2013 10:41:39 +0100 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
On Wed, Feb 27, 2013 at 04:00:28PM +0100, Benoît Canet wrote:
> > > - if ((refcount == 1) != ((l2_entry & QCOW_OFLAG_COPIED)
> > > != 0)) {
> > > + if (!s->has_dedup &&
> > > + (refcount == 1) != ((l2_entry & QCOW_OFLAG_COPIED)
> > > != 0)) {
> > > + fprintf(stderr, "ERROR OFLAG_COPIED: offset=%"
> > > + PRIx64 " refcount=%d\n", l2_entry, refcount);
> > > + res->corruptions++;
> > > + }
> >
> > Why is this warning suppressed when dedup is enabled? The meaning of
> > QCOW_OFLAG_COPIED is that refcount == 1. If this invariant is violated
> > then something is wrong.
>
> When deduplication is done refcount will be bigger than one and
> QCOW_OFLAG_COPIED will be cleared.
>
> Then if enough logical clustere pointing to the same physical cluster are
> rewritten with something else the refcount will goes down back to one.
>
> But this time QCOW_OFLAG_COPIED can be set back so this equality won't be
> true.
When the refcount decreases to 1 again we need to set QCOW_OFLAG_COPIED
again. qcow2-snapshot.c:qcow2_snapshot_delete() does this with:
/* must update the copied flag on the current cluster offsets */
ret = qcow2_update_snapshot_refcount(bs, s->l1_table_offset, s->l1_size, 0);
Is dedup not restoring QCOW_OFLAG_COPIED?
Stefan
- Re: [Qemu-devel] [RFC V6 31/33] qcow: Set large dedup hash block size., (continued)
[Qemu-devel] [RFC V6 33/33] qcow2: Add qcow2_dedup_init and qcow2_dedup_close., Benoît Canet, 2013/02/06
[Qemu-devel] [RFC V6 08/33] qcow2: Add qcow2_dedup_store_new_hashes., Benoît Canet, 2013/02/06
[Qemu-devel] [RFC V6 27/33] qcow2: Adapt checking of QCOW_OFLAG_COPIED for dedup., Benoît Canet, 2013/02/06
[Qemu-devel] [RFC V6 07/33] qcow2: Add qcow2_dedup and related functions, Benoît Canet, 2013/02/06
[Qemu-devel] [RFC V6 13/33] qcow2: make the deduplication forget a cluster hash when a cluster is to dedupe, Benoît Canet, 2013/02/06
[Qemu-devel] [RFC V6 29/33] qcow2: Do not overwrite existing entries with QCOW_OFLAG_COPIED., Benoît Canet, 2013/02/06