aboutsummaryrefslogtreecommitdiff
path: root/blockdev.c
diff options
context:
space:
mode:
authorKevin Wolf <kwolf@redhat.com>2015-06-18 14:09:57 +0200
committerKevin Wolf <kwolf@redhat.com>2015-10-16 15:34:30 +0200
commitdd62f1ca433ea60b06590884642ad2c8f8e539f2 (patch)
treea1e53e2369d7b92f71e951d8c9bb23237642e39f /blockdev.c
parentd42a8a935b8b2d567331fffa13a70918352668bb (diff)
block: Implement bdrv_append() without bdrv_swap()
Remember all parent nodes and just change the pointers there instead of swapping the contents of the BlockDriverState. Handling of snapshot=on must be moved further down in bdrv_open() because *pbs (which is the bs pointer in the BlockBackend) must already be set before bdrv_append() is called. Otherwise bdrv_append() changes the BB's pointer to the temporary snapshot, but bdrv_open() overwrites it with the read-only original image. We also need to be careful to update callers as the interface changes (becomes less insane): Previously, the meaning of the two parameters was inverted when bdrv_append() returns. Now any BDS pointers keep pointing to the same node. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Max Reitz <mreitz@redhat.com> Reviewed-by: Fam Zheng <famz@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Diffstat (limited to 'blockdev.c')
-rw-r--r--blockdev.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/blockdev.c b/blockdev.c
index b633212c12..6c8cce4508 100644
--- a/blockdev.c
+++ b/blockdev.c
@@ -1546,7 +1546,7 @@ static void external_snapshot_commit(BlkTransactionState *common)
/* We don't need (or want) to use the transactional
* bdrv_reopen_multiple() across all the entries at once, because we
* don't want to abort all of them if one of them fails the reopen */
- bdrv_reopen(state->new_bs, state->new_bs->open_flags & ~BDRV_O_RDWR,
+ bdrv_reopen(state->old_bs, state->old_bs->open_flags & ~BDRV_O_RDWR,
NULL);
aio_context_release(state->aio_context);