From a6d23d56df06027acb1202e64316b00d0c05aa75 Mon Sep 17 00:00:00 2001 From: Vladimir Sementsov-Ogievskiy Date: Sun, 17 Jan 2021 00:46:49 +0300 Subject: block/block-copy: add block_copy_cancel Add function to cancel running async block-copy call. It will be used in backup. Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Max Reitz Message-Id: <20210116214705.822267-8-vsementsov@virtuozzo.com> Signed-off-by: Max Reitz --- include/block/block-copy.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'include/block/block-copy.h') diff --git a/include/block/block-copy.h b/include/block/block-copy.h index b5a53ad59e..7821850f88 100644 --- a/include/block/block-copy.h +++ b/include/block/block-copy.h @@ -74,11 +74,24 @@ void block_copy_call_free(BlockCopyCallState *call_state); bool block_copy_call_finished(BlockCopyCallState *call_state); bool block_copy_call_succeeded(BlockCopyCallState *call_state); bool block_copy_call_failed(BlockCopyCallState *call_state); +bool block_copy_call_cancelled(BlockCopyCallState *call_state); int block_copy_call_status(BlockCopyCallState *call_state, bool *error_is_read); void block_copy_set_speed(BlockCopyState *s, uint64_t speed); void block_copy_kick(BlockCopyCallState *call_state); +/* + * Cancel running block-copy call. + * + * Cancel leaves block-copy state valid: dirty bits are correct and you may use + * cancel + to emulate pause/resume. + * + * Note also, that the cancel is async: it only marks block-copy call to be + * cancelled. So, the call may be cancelled (block_copy_call_cancelled() reports + * true) but not yet finished (block_copy_call_finished() reports false). + */ +void block_copy_call_cancel(BlockCopyCallState *call_state); + BdrvDirtyBitmap *block_copy_dirty_bitmap(BlockCopyState *s); void block_copy_set_skip_unallocated(BlockCopyState *s, bool skip); -- cgit v1.2.3-55-g7522