qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Fam Zheng <famz@redhat.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: Kevin Wolf <kwolf@redhat.com>, Jeff Cody <jcody@redhat.com>,
	qemu-devel@nongnu.org, qemu-block@nongnu.org, mreitz@redhat.com
Subject: Re: [Qemu-devel] [PATCH 1/2] mirror: Rewrite mirror_iteration
Date: Fri, 20 Nov 2015 18:05:19 +0800	[thread overview]
Message-ID: <20151120100519.GA23987@ad.usersys.redhat.com> (raw)
In-Reply-To: <564C550A.8010408@redhat.com>

On Wed, 11/18 11:38, Paolo Bonzini wrote:
> 
> 
> On 17/11/2015 12:41, Fam Zheng wrote:
> > +        /* Wait for I/O to this cluster (from a previous iteration) to be
> > +         * done.*/
> > +        while (test_bit(next_chunk, s->in_flight_bitmap)) {
> > +            trace_mirror_yield_in_flight(s, next_sector, s->in_flight);
> > +            s->waiting_for_io = true;
> > +            qemu_coroutine_yield();
> > +            s->waiting_for_io = false;
> > +        }
> > +
> 
> I think this could just "break" if nb_chunks > 0, like
> 
> 	if (test_bit(next_chunk, s->in_flight_bitmap)) {
> 		if (nb_chunks > 0) {
> 			break;
> 		}
> 		mirror_wait_for_io(s);
> 		/* Now retry.  */
> 	} else {
> 		hbitmap_next = hbitmap_iter_next(&s->hbi);
> 	        assert(hbitmap_next == next_sector);
> 	        nb_chunks++;
> 	}
> 
> but it can be done later (the usage of mirror_wait_for_io is a hint :)).
> 
> There's a typo though:
> 
> > +    /* Clear dirty bits before querying the block status, because
> > +     * calling bdrv_reset_dirty_bitmap could yield - if some blocks are marked
> 
> That's bdrv_get_block_status_above.
> 
> > +     * dirty in this window, we need to know.
> > +     */
> 

Thanks. I'll adopt both suggestions and resend.

Fam

  reply	other threads:[~2015-11-20 10:05 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-17 11:41 [Qemu-devel] [PATCH 0/2] mirror: Improve zero write and discard Fam Zheng
2015-11-17 11:41 ` [Qemu-devel] [PATCH 1/2] mirror: Rewrite mirror_iteration Fam Zheng
2015-11-18 10:38   ` Paolo Bonzini
2015-11-20 10:05     ` Fam Zheng [this message]
2015-11-17 11:41 ` [Qemu-devel] [PATCH 2/2] mirror: Add mirror_wait_for_io Fam Zheng

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=20151120100519.GA23987@ad.usersys.redhat.com \
    --to=famz@redhat.com \
    --cc=jcody@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=mreitz@redhat.com \
    --cc=pbonzini@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).