qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Max Reitz <mreitz@redhat.com>
To: Sergio Lopez <slp@redhat.com>, qemu-devel@nongnu.org
Cc: Kevin Wolf <kwolf@redhat.com>,
	Markus Armbruster <armbru@redhat.com>,
	qemu-block@nongnu.org
Subject: Re: [PATCH v4 3/5] blockdev: unify qmp_blockdev_backup and blockdev-backup transaction paths
Date: Wed, 27 Nov 2019 17:49:36 +0100	[thread overview]
Message-ID: <24cd8940-4754-ff97-167b-44a236c539e8@redhat.com> (raw)
In-Reply-To: <20191121135759.101655-4-slp@redhat.com>


[-- Attachment #1.1: Type: text/plain, Size: 2133 bytes --]

On 21.11.19 14:57, Sergio Lopez wrote:
> Issuing a blockdev-backup from qmp_blockdev_backup takes a slightly
> different path than when it's issued from a transaction. In the code,
> this is manifested as some redundancy between do_blockdev_backup() and
> blockdev_backup_prepare().
> 
> This change unifies both paths, merging do_blockdev_backup() and
> blockdev_backup_prepare(), and changing qmp_blockdev_backup() to
> create a transaction instead of calling do_backup_common() direcly.
> 
> As a side-effect, now qmp_blockdev_backup() is executed inside a
> drained section, as it happens when creating a blockdev-backup
> transaction. This change is visible from the user's perspective, as
> the job gets paused and immediately resumed before starting the actual
> work.
> 
> Signed-off-by: Sergio Lopez <slp@redhat.com>
> ---
>  blockdev.c | 60 ++++++++++++------------------------------------------
>  1 file changed, 13 insertions(+), 47 deletions(-)
> 
> diff --git a/blockdev.c b/blockdev.c
> index 5e85fc042e..152a0f7454 100644
> --- a/blockdev.c
> +++ b/blockdev.c

[...]

>  static void blockdev_backup_prepare(BlkActionState *common, Error **errp)
>  {
>      BlockdevBackupState *state = DO_UPCAST(BlockdevBackupState, common, common);
>      BlockdevBackup *backup;
> -    BlockDriverState *bs, *target;
> +    BlockDriverState *bs;
> +    BlockDriverState *target_bs;

The diff stat could have been a bit smaller by keeping this as it was,
but either way:

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

>      AioContext *aio_context;
> -    Error *local_err = NULL;
>  
>      assert(common->action->type == TRANSACTION_ACTION_KIND_BLOCKDEV_BACKUP);
>      backup = common->action->u.blockdev_backup.data;
> @@ -1959,8 +1956,8 @@ static void blockdev_backup_prepare(BlkActionState *common, Error **errp)
>          return;
>      }
>  
> -    target = bdrv_lookup_bs(backup->target, backup->target, errp);
> -    if (!target) {
> +    target_bs = bdrv_lookup_bs(backup->target, backup->target, errp);
> +    if (!target_bs) {
>          return;
>      }
>  


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

  reply	other threads:[~2019-11-27 16:53 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-21 13:57 [PATCH v4 0/5] blockdev: avoid acquiring AioContext lock twice at do_drive_backup and do_blockdev_backup Sergio Lopez
2019-11-21 13:57 ` [PATCH v4 1/5] blockdev: fix coding style issues in drive_backup_prepare Sergio Lopez
2019-11-27 15:53   ` Max Reitz
2019-11-21 13:57 ` [PATCH v4 2/5] blockdev: unify qmp_drive_backup and drive-backup transaction paths Sergio Lopez
2019-11-27 16:37   ` Max Reitz
2019-11-21 13:57 ` [PATCH v4 3/5] blockdev: unify qmp_blockdev_backup and blockdev-backup " Sergio Lopez
2019-11-27 16:49   ` Max Reitz [this message]
2019-11-21 13:57 ` [PATCH v4 4/5] blockdev: honor bdrv_try_set_aio_context() context requirements Sergio Lopez
2019-11-27 17:10   ` Max Reitz
2019-11-21 13:57 ` [PATCH v4 5/5] iotests: fix 141 after qmp_drive_backup with transactions Sergio Lopez
2019-11-27 16:19   ` Max Reitz

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=24cd8940-4754-ff97-167b-44a236c539e8@redhat.com \
    --to=mreitz@redhat.com \
    --cc=armbru@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=slp@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).