All of lore.kernel.org
 help / color / mirror / Atom feed
From: Max Reitz <mreitz@redhat.com>
To: John Snow <jsnow@redhat.com>,
	qemu-devel@nongnu.org, qemu-block@nongnu.org
Cc: jtc@redhat.com, Kevin Wolf <kwolf@redhat.com>,
	Markus Armbruster <armbru@redhat.com>,
	"Dr. David Alan Gilbert" <dgilbert@redhat.com>,
	Eric Blake <eblake@redhat.com>, Jeff Cody <jcody@redhat.com>
Subject: Re: [Qemu-devel] [PATCH v3 06/15] block/mirror: conservative mirror_exit refactor
Date: Mon, 3 Sep 2018 11:32:34 +0200	[thread overview]
Message-ID: <97a9bb99-2894-3185-da39-b214f5f8e92f@redhat.com> (raw)
In-Reply-To: <20180831222907.16257-7-jsnow@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 1745 bytes --]

On 2018-09-01 00:28, John Snow wrote:
> For purposes of minimum code movement, refactor the mirror_exit
> callback to use the post-finalization callbacks in a trivial way.
> 
> Signed-off-by: John Snow <jsnow@redhat.com>
> ---
>  block/mirror.c | 31 +++++++++++++++++++++++++------
>  1 file changed, 25 insertions(+), 6 deletions(-)
> 
> diff --git a/block/mirror.c b/block/mirror.c
> index c164fee883..5067f1764d 100644
> --- a/block/mirror.c
> +++ b/block/mirror.c

[...]

> @@ -617,7 +618,13 @@ static void mirror_exit(Job *job)
>      BlockDriverState *target_bs = blk_bs(s->target);
>      BlockDriverState *mirror_top_bs = s->mirror_top_bs;
>      Error *local_err = NULL;
> -    int ret = job->ret;
> +    bool abort = !!job->ret;

I think "job->ret < 0" could be read more easily.

> +    int ret = 0;
> +
> +    if (s->prepared) {
> +        return 0;
> +    }
> +    s->prepared = true;
>  
>      bdrv_release_dirty_bitmap(src, s->dirty_bitmap);
>  

[...]

> @@ -712,7 +719,17 @@ static void mirror_exit(Job *job)
>      bdrv_unref(mirror_top_bs);
>      bdrv_unref(src);
>  
> -    job->ret = ret;
> +    return ret;
> +}
> +
> +static int mirror_prepare(Job *job)
> +{
> +    return mirror_exit_common(job);
> +}
> +
> +static void mirror_abort(Job *job)
> +{
> +    assert(mirror_exit_common(job) == 0);

You shouldn't execute vital code in assert(), as NDEBUG would make that
code disappear.  As far as I know, we have decided (at some point) not
to ever enable NDEBUG in qemu, but, you know.  Doing it right only costs
one more line, and it would get you a

Reviewed-by: Max Reitz <mreitz@redhat.com>

>  }
>  
>  static void mirror_throttle(MirrorBlockJob *s)


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

  reply	other threads:[~2018-09-03  9:32 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-31 22:28 [Qemu-devel] [PATCH v3 00/15] jobs: Job Exit Refactoring Pt 2 John Snow
2018-08-31 22:28 ` [Qemu-devel] [PATCH v3 01/15] block/commit: add block job creation flags John Snow
2018-09-01  3:17   ` Jeff Cody
2018-08-31 22:28 ` [Qemu-devel] [PATCH v3 02/15] block/mirror: " John Snow
2018-09-01  3:31   ` Jeff Cody
2018-08-31 22:28 ` [Qemu-devel] [PATCH v3 03/15] block/stream: " John Snow
2018-08-31 22:34   ` Eric Blake
2018-09-01  3:33   ` Jeff Cody
2018-08-31 22:28 ` [Qemu-devel] [PATCH v3 04/15] block/commit: refactor commit to use job callbacks John Snow
2018-08-31 22:28 ` [Qemu-devel] [PATCH v3 05/15] block/mirror: don't install backing chain on abort John Snow
2018-09-03  9:24   ` Max Reitz
2018-09-04 19:15     ` John Snow
2018-09-04 19:30       ` Eric Blake
2018-09-04 20:10         ` John Snow
2018-09-05  9:54         ` Kevin Wolf
2018-09-05 12:59           ` John Snow
2018-08-31 22:28 ` [Qemu-devel] [PATCH v3 06/15] block/mirror: conservative mirror_exit refactor John Snow
2018-09-03  9:32   ` Max Reitz [this message]
2018-09-04 16:17     ` John Snow
2018-08-31 22:28 ` [Qemu-devel] [PATCH v3 07/15] block/commit: refactor stream to use job callbacks John Snow
2018-09-03  9:33   ` Max Reitz
2018-08-31 22:29 ` [Qemu-devel] [PATCH v3 08/15] tests/blockjob: replace Blockjob with Job John Snow
2018-08-31 22:29 ` [Qemu-devel] [PATCH v3 09/15] tests/test-blockjob: remove exit callback John Snow
2018-08-31 22:29 ` [Qemu-devel] [PATCH v3 10/15] tests/test-blockjob-txn: move .exit to .clean John Snow
2018-09-03  9:41   ` Max Reitz
2018-08-31 22:29 ` [Qemu-devel] [PATCH v3 11/15] jobs: remove .exit callback John Snow
2018-08-31 22:29 ` [Qemu-devel] [PATCH v3 12/15] qapi/block-commit: expose new job properties John Snow
2018-08-31 22:29 ` [Qemu-devel] [PATCH v3 13/15] qapi/block-mirror: " John Snow
2018-08-31 22:29 ` [Qemu-devel] [PATCH v3 14/15] qapi/block-stream: " John Snow
2018-08-31 22:29 ` [Qemu-devel] [PATCH v3 15/15] block/backup: qapi documentation fixup John Snow

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=97a9bb99-2894-3185-da39-b214f5f8e92f@redhat.com \
    --to=mreitz@redhat.com \
    --cc=armbru@redhat.com \
    --cc=dgilbert@redhat.com \
    --cc=eblake@redhat.com \
    --cc=jcody@redhat.com \
    --cc=jsnow@redhat.com \
    --cc=jtc@redhat.com \
    --cc=kwolf@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.