From: Kevin Wolf <kwolf@redhat.com>
To: "Benoît Canet" <benoit.canet@irqsave.net>
Cc: qemu-devel@nongnu.org, Stefan Hajnoczi <stefanha@redhat.com>
Subject: Re: [Qemu-devel] [RFC V6 27/33] qcow2: Adapt checking of QCOW_OFLAG_COPIED for dedup.
Date: Fri, 1 Mar 2013 09:59:33 +0100 [thread overview]
Message-ID: <20130301085933.GA2461@dhcp-200-207.str.redhat.com> (raw)
In-Reply-To: <20130228161418.GA4214@irqsave.net>
Am 28.02.2013 um 17:14 hat Benoît Canet geschrieben:
> Le Thursday 28 Feb 2013 à 11:14:34 (+0100), Kevin Wolf a écrit :
> > Am 28.02.2013 um 10:41 hat Stefan Hajnoczi geschrieben:
> > > 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?
> >
> > This is a very expensive operation. I don't think that you can do it for
> > each deduplicated cluster that is overwritten. Not doing it comes with
> > the cost of doing more COW than is actually needed. And we need to
> > mention in the spec that QCOW_OFLAG_COPIED can be missing on clusters
> > with deduplication enabled.
>
> Also when two logical clusters point to the same physical cluster and one of the
> logical cluster get overwritten the deduplication code has no way to know the
> index of the last logical cluster entry.
Well, strictly speaking you can. The qcow2_update_snapshot_refcount()
call that Stefan mention does exactly that. It's just insanely expensive
because it has to look at the refcounts for all clusters.
Kevin
next parent reply other threads:[~2013-03-01 8:59 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1360153926-9492-1-git-send-email-benoit@irqsave.net>
[not found] ` <1360153926-9492-28-git-send-email-benoit@irqsave.net>
[not found] ` <20130208105746.GD7835@stefanha-thinkpad.redhat.com>
[not found] ` <20130227150028.GC4010@irqsave.net>
[not found] ` <20130228094139.GB12748@stefanha-thinkpad.redhat.com>
[not found] ` <20130228101434.GD2429@dhcp-200-207.str.redhat.com>
[not found] ` <20130228161418.GA4214@irqsave.net>
2013-03-01 8:59 ` Kevin Wolf [this message]
2013-03-01 9:34 ` [Qemu-devel] [RFC V6 27/33] qcow2: Adapt checking of QCOW_OFLAG_COPIED for dedup Stefan Hajnoczi
[not found] ` <1360153926-9492-14-git-send-email-benoit@irqsave.net>
[not found] ` <20130207094814.GH1081@stefanha-thinkpad.redhat.com>
2013-03-11 12:59 ` [Qemu-devel] [RFC V6 13/33] qcow2: make the deduplication forget a cluster hash when a cluster is to dedupe Benoît Canet
[not found] ` <1360153926-9492-20-git-send-email-benoit@irqsave.net>
[not found] ` <20130207101621.GM1081@stefanha-thinkpad.redhat.com>
2013-03-11 15:20 ` [Qemu-devel] [RFC V6 19/33] block: Add qcow2_dedup format and image creation code Benoît Canet
2013-03-12 9:33 ` Stefan Hajnoczi
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=20130301085933.GA2461@dhcp-200-207.str.redhat.com \
--to=kwolf@redhat.com \
--cc=benoit.canet@irqsave.net \
--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).