From: Kevin Wolf <kwolf@redhat.com>
To: Max Reitz <mreitz@redhat.com>
Cc: Fam Zheng <famz@redhat.com>,
qemu-devel@nongnu.org, qemu-block@nongnu.org
Subject: Re: [Qemu-devel] [Qemu-block] [PATCH for-2.6 2/2] block/mirror: Refresh stale bitmap iterator cache
Date: Wed, 20 Apr 2016 14:51:25 +0200 [thread overview]
Message-ID: <20160420125125.GK6517@noname.str.redhat.com> (raw)
In-Reply-To: <20160420121341.GH6517@noname.str.redhat.com>
Am 20.04.2016 um 14:13 hat Kevin Wolf geschrieben:
> Am 20.04.2016 um 00:59 hat Max Reitz geschrieben:
> > If the drive's dirty bitmap is dirtied while the mirror operation is
> > running, the cache of the iterator used by the mirror code may become
> > stale and not contain all dirty bits.
> >
> > This only becomes an issue if we are looking for contiguously dirty
> > chunks on the drive. In that case, we can easily detect the discrepancy
> > and just refresh the iterator if one occurs.
> >
> > Signed-off-by: Max Reitz <mreitz@redhat.com>
> > ---
> > block/mirror.c | 5 +++++
> > 1 file changed, 5 insertions(+)
> >
> > diff --git a/block/mirror.c b/block/mirror.c
> > index 2714a77..9df1fae 100644
> > --- a/block/mirror.c
> > +++ b/block/mirror.c
> > @@ -334,6 +334,11 @@ static uint64_t coroutine_fn mirror_iteration(MirrorBlockJob *s)
> > }
> >
> > hbitmap_next = hbitmap_iter_next(&s->hbi);
> > + if (hbitmap_next > next_sector || hbitmap_next < 0) {
> > + /* The bitmap iterator's cache is stale, refresh it */
> > + bdrv_set_dirty_iter(&s->hbi, next_sector);
> > + hbitmap_next = hbitmap_iter_next(&s->hbi);
> > + }
> > assert(hbitmap_next == next_sector);
>
> The iterator doesn't seem to be used afterwards anyway, so why not just
> use next_sector and stop using the iterator when we already know what
> result we want to get?
And of course I read that code completely wrong because in reality
&s->hbi isn't local. Seems to be the right way to do things then.
Kevin
next prev parent reply other threads:[~2016-04-20 12:51 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-19 22:59 [Qemu-devel] [PATCH for-2.6 0/2] block/mirror: Fix mirroring with guest I/O load Max Reitz
2016-04-19 22:59 ` [Qemu-devel] [PATCH for-2.6 1/2] block/mirror: Revive dead yielding code Max Reitz
2016-04-20 5:47 ` Fam Zheng
2016-04-20 12:15 ` Kevin Wolf
2016-04-19 22:59 ` [Qemu-devel] [PATCH for-2.6 2/2] block/mirror: Refresh stale bitmap iterator cache Max Reitz
2016-04-20 8:19 ` Fam Zheng
2016-04-20 12:13 ` Kevin Wolf
2016-04-20 12:51 ` Kevin Wolf [this message]
2016-04-20 12:51 ` [Qemu-devel] [PATCH for-2.6 0/2] block/mirror: Fix mirroring with guest I/O load 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=20160420125125.GK6517@noname.str.redhat.com \
--to=kwolf@redhat.com \
--cc=famz@redhat.com \
--cc=mreitz@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
/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).