block: Add and use bdrv_replace_in_backing_chain()
commit3f09bfbc7bee812a44838f4c8b254007a9b86cab
authorKevin Wolf <kwolf@redhat.com>
Tue, 15 Sep 2015 09:58:23 +0000 (15 11:58 +0200)
committerKevin Wolf <kwolf@redhat.com>
Fri, 16 Oct 2015 13:34:30 +0000 (16 15:34 +0200)
tree775e62f32f4e2aa77a60a952212044060f11bcdd
parent8ccb9569a976056c9594bb720ba33d84827648d9
block: Add and use bdrv_replace_in_backing_chain()

This cleans up the mess we left behind in the mirror code after the
previous patch. Instead of using bdrv_swap(), just change pointers.

The interface change of the mirror job that callers must consider is
that after job completion, their local BDS pointers still point to the
same node now. qemu-img must change its code accordingly (which makes it
easier to understand); the other callers stays unchanged because after
completion they don't do anything with the BDS, but just with the job,
and the job is still owned by the source BDS.

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>
block.c
block/mirror.c
include/block/block.h
qemu-img.c