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 <s...@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 <mre...@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; > } >
signature.asc
Description: OpenPGP digital signature