mirror of https://github.com/xqemu/xqemu.git
block: Honour BDRV_REQ_NO_SERIALISING in copy range
This semantics is needed by drive-backup so implement it before using this API there. Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Fam Zheng <famz@redhat.com> Message-id: 20180703023758.14422-3-famz@redhat.com Signed-off-by: Jeff Cody <jcody@redhat.com>
This commit is contained in:
parent
d4d3e5a0d5
commit
dee12de893
|
@ -2930,8 +2930,10 @@ static int coroutine_fn bdrv_co_copy_range_internal(BdrvChild *src,
|
||||||
tracked_request_begin(&dst_req, dst->bs, dst_offset,
|
tracked_request_begin(&dst_req, dst->bs, dst_offset,
|
||||||
bytes, BDRV_TRACKED_WRITE);
|
bytes, BDRV_TRACKED_WRITE);
|
||||||
|
|
||||||
wait_serialising_requests(&src_req);
|
if (!(flags & BDRV_REQ_NO_SERIALISING)) {
|
||||||
wait_serialising_requests(&dst_req);
|
wait_serialising_requests(&src_req);
|
||||||
|
wait_serialising_requests(&dst_req);
|
||||||
|
}
|
||||||
if (recurse_src) {
|
if (recurse_src) {
|
||||||
ret = src->bs->drv->bdrv_co_copy_range_from(src->bs,
|
ret = src->bs->drv->bdrv_co_copy_range_from(src->bs,
|
||||||
src, src_offset,
|
src, src_offset,
|
||||||
|
|
|
@ -659,13 +659,14 @@ void bdrv_unregister_buf(BlockDriverState *bs, void *host);
|
||||||
* @dst: Destination child to copy data to
|
* @dst: Destination child to copy data to
|
||||||
* @dst_offset: offset in @dst image to write data
|
* @dst_offset: offset in @dst image to write data
|
||||||
* @bytes: number of bytes to copy
|
* @bytes: number of bytes to copy
|
||||||
* @flags: request flags. Must be one of:
|
* @flags: request flags. Supported flags:
|
||||||
* 0 - actually read data from src;
|
|
||||||
* BDRV_REQ_ZERO_WRITE - treat the @src range as zero data and do zero
|
* BDRV_REQ_ZERO_WRITE - treat the @src range as zero data and do zero
|
||||||
* write on @dst as if bdrv_co_pwrite_zeroes is
|
* write on @dst as if bdrv_co_pwrite_zeroes is
|
||||||
* called. Used to simplify caller code, or
|
* called. Used to simplify caller code, or
|
||||||
* during BlockDriver.bdrv_co_copy_range_from()
|
* during BlockDriver.bdrv_co_copy_range_from()
|
||||||
* recursion.
|
* recursion.
|
||||||
|
* BDRV_REQ_NO_SERIALISING - do not serialize with other overlapping
|
||||||
|
* requests currently in flight.
|
||||||
*
|
*
|
||||||
* Returns: 0 if succeeded; negative error code if failed.
|
* Returns: 0 if succeeded; negative error code if failed.
|
||||||
**/
|
**/
|
||||||
|
|
Loading…
Reference in New Issue