aboutsummaryrefslogtreecommitdiff
path: root/block/backup-top.c
diff options
context:
space:
mode:
authorVladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>2021-02-02 15:49:44 +0300
committerEric Blake <eblake@redhat.com>2021-02-12 15:39:44 -0600
commit934aee14d36e67468260635af61c387227cdaf78 (patch)
treebaa87d2a9264822f6fe7ebcd71f5523ff989a9df /block/backup-top.c
parenta1e708fcda5eab10c866a7d6a4fad4f80b69ad15 (diff)
block: use return status of bdrv_append()
Now bdrv_append returns status and we can drop all the local_err things around it. Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> Reviewed-by: Alberto Garcia <berto@igalia.com> Message-Id: <20210202124956.63146-3-vsementsov@virtuozzo.com> Signed-off-by: Eric Blake <eblake@redhat.com>
Diffstat (limited to 'block/backup-top.c')
-rw-r--r--block/backup-top.c23
1 files changed, 11 insertions, 12 deletions
diff --git a/block/backup-top.c b/block/backup-top.c
index 6e7e7bf340..d1253e1aa6 100644
--- a/block/backup-top.c
+++ b/block/backup-top.c
@@ -191,7 +191,8 @@ BlockDriverState *bdrv_backup_top_append(BlockDriverState *source,
BlockCopyState **bcs,
Error **errp)
{
- Error *local_err = NULL;
+ ERRP_GUARD();
+ int ret;
BDRVBackupTopState *state;
BlockDriverState *top;
bool appended = false;
@@ -224,9 +225,9 @@ BlockDriverState *bdrv_backup_top_append(BlockDriverState *source,
bdrv_drained_begin(source);
bdrv_ref(top);
- bdrv_append(top, source, &local_err);
- if (local_err) {
- error_prepend(&local_err, "Cannot append backup-top filter: ");
+ ret = bdrv_append(top, source, errp);
+ if (ret < 0) {
+ error_prepend(errp, "Cannot append backup-top filter: ");
goto fail;
}
appended = true;
@@ -236,19 +237,18 @@ BlockDriverState *bdrv_backup_top_append(BlockDriverState *source,
* we want.
*/
state->active = true;
- bdrv_child_refresh_perms(top, top->backing, &local_err);
- if (local_err) {
- error_prepend(&local_err,
- "Cannot set permissions for backup-top filter: ");
+ ret = bdrv_child_refresh_perms(top, top->backing, errp);
+ if (ret < 0) {
+ error_prepend(errp, "Cannot set permissions for backup-top filter: ");
goto fail;
}
state->cluster_size = cluster_size;
state->bcs = block_copy_state_new(top->backing, state->target,
cluster_size, perf->use_copy_range,
- write_flags, &local_err);
- if (local_err) {
- error_prepend(&local_err, "Cannot create block-copy-state: ");
+ write_flags, errp);
+ if (!state->bcs) {
+ error_prepend(errp, "Cannot create block-copy-state: ");
goto fail;
}
*bcs = state->bcs;
@@ -266,7 +266,6 @@ fail:
}
bdrv_drained_end(source);
- error_propagate(errp, local_err);
return NULL;
}