diff options
author | Alberto Garcia <berto@igalia.com> | 2019-04-03 17:37:48 +0300 |
---|---|---|
committer | Max Reitz <mreitz@redhat.com> | 2019-05-07 17:14:21 +0200 |
commit | 6a63419980499b4fad1416326dc98609380c4df8 (patch) | |
tree | 7b82148a26a857d54363509cf6d360138404708a /block/commit.c | |
parent | 0b3ca76e52f025caf234b77d471465e983a711d0 (diff) | |
download | qemu-6a63419980499b4fad1416326dc98609380c4df8.zip qemu-6a63419980499b4fad1416326dc98609380c4df8.tar.gz qemu-6a63419980499b4fad1416326dc98609380c4df8.tar.bz2 |
commit: Use bdrv_append() in commit_start()
This function combines bdrv_set_backing_hd() and bdrv_replace_node()
so we can use it to simplify the code a bit in commit_start().
Signed-off-by: Alberto Garcia <berto@igalia.com>
Message-id: 20190403143748.9790-1-berto@igalia.com
Signed-off-by: Max Reitz <mreitz@redhat.com>
Diffstat (limited to 'block/commit.c')
-rw-r--r-- | block/commit.c | 11 |
1 files changed, 1 insertions, 10 deletions
diff --git a/block/commit.c b/block/commit.c index 27537d9..14e5bb3 100644 --- a/block/commit.c +++ b/block/commit.c @@ -303,23 +303,14 @@ void commit_start(const char *job_id, BlockDriverState *bs, commit_top_bs->total_sectors = top->total_sectors; bdrv_set_aio_context(commit_top_bs, bdrv_get_aio_context(top)); - bdrv_set_backing_hd(commit_top_bs, top, &local_err); + bdrv_append(commit_top_bs, top, &local_err); if (local_err) { - bdrv_unref(commit_top_bs); - commit_top_bs = NULL; - error_propagate(errp, local_err); - goto fail; - } - bdrv_replace_node(top, commit_top_bs, &local_err); - if (local_err) { - bdrv_unref(commit_top_bs); commit_top_bs = NULL; error_propagate(errp, local_err); goto fail; } s->commit_top_bs = commit_top_bs; - bdrv_unref(commit_top_bs); /* Block all nodes between top and base, because they will * disappear from the chain after this operation. */ |