mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-07 01:33:56 -06:00
block-backend: Add blk_co_copy_range
It's a BlockBackend wrapper of the BDS interface. Signed-off-by: Fam Zheng <famz@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Message-id: 20180601092648.24614-10-famz@redhat.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
This commit is contained in:
parent
604dfaaa32
commit
b5679fa49c
2 changed files with 22 additions and 0 deletions
|
@ -2211,3 +2211,21 @@ void blk_unregister_buf(BlockBackend *blk, void *host)
|
||||||
{
|
{
|
||||||
bdrv_unregister_buf(blk_bs(blk), host);
|
bdrv_unregister_buf(blk_bs(blk), host);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int coroutine_fn blk_co_copy_range(BlockBackend *blk_in, int64_t off_in,
|
||||||
|
BlockBackend *blk_out, int64_t off_out,
|
||||||
|
int bytes, BdrvRequestFlags flags)
|
||||||
|
{
|
||||||
|
int r;
|
||||||
|
r = blk_check_byte_request(blk_in, off_in, bytes);
|
||||||
|
if (r) {
|
||||||
|
return r;
|
||||||
|
}
|
||||||
|
r = blk_check_byte_request(blk_out, off_out, bytes);
|
||||||
|
if (r) {
|
||||||
|
return r;
|
||||||
|
}
|
||||||
|
return bdrv_co_copy_range(blk_in->root, off_in,
|
||||||
|
blk_out->root, off_out,
|
||||||
|
bytes, flags);
|
||||||
|
}
|
||||||
|
|
|
@ -232,4 +232,8 @@ void blk_set_force_allow_inactivate(BlockBackend *blk);
|
||||||
void blk_register_buf(BlockBackend *blk, void *host, size_t size);
|
void blk_register_buf(BlockBackend *blk, void *host, size_t size);
|
||||||
void blk_unregister_buf(BlockBackend *blk, void *host);
|
void blk_unregister_buf(BlockBackend *blk, void *host);
|
||||||
|
|
||||||
|
int coroutine_fn blk_co_copy_range(BlockBackend *blk_in, int64_t off_in,
|
||||||
|
BlockBackend *blk_out, int64_t off_out,
|
||||||
|
int bytes, BdrvRequestFlags flags);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue