• K
    block: Implement bdrv_append() without bdrv_swap() · dd62f1ca
    Kevin Wolf 提交于
    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: NKevin Wolf <kwolf@redhat.com>
    Reviewed-by: NMax Reitz <mreitz@redhat.com>
    Reviewed-by: NFam Zheng <famz@redhat.com>
    Reviewed-by: NStefan Hajnoczi <stefanha@redhat.com>
    dd62f1ca
block.c 120.3 KB