All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Fam Zheng <famz@redhat.com>, qemu-devel@nongnu.org
Cc: Kevin Wolf <kwolf@redhat.com>, Jeff Cody <jcody@redhat.com>,
	qemu-block@nongnu.org, mreitz@redhat.com
Subject: Re: [Qemu-devel] [PATCH 1/2] mirror: Rewrite mirror_iteration
Date: Wed, 18 Nov 2015 11:38:02 +0100	[thread overview]
Message-ID: <564C550A.8010408@redhat.com> (raw)
In-Reply-To: <1447760483-21094-2-git-send-email-famz@redhat.com>



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,

Paolo

  reply	other threads:[~2015-11-18 10:38 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 [this message]
2015-11-20 10:05     ` Fam Zheng
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=564C550A.8010408@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=famz@redhat.com \
    --cc=jcody@redhat.com \
    --cc=kwolf@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.