summaryrefslogtreecommitdiffstats
path: root/include/block/block-copy.h
diff options
context:
space:
mode:
authorVladimir Sementsov-Ogievskiy2021-01-16 22:46:49 +0100
committerMax Reitz2021-01-26 14:36:37 +0100
commita6d23d56df06027acb1202e64316b00d0c05aa75 (patch)
tree9549e574be5b1565d2e969065769c0009719c7ad /include/block/block-copy.h
parentblock/block-copy: add ratelimit to block-copy (diff)
downloadqemu-a6d23d56df06027acb1202e64316b00d0c05aa75.tar.gz
qemu-a6d23d56df06027acb1202e64316b00d0c05aa75.tar.xz
qemu-a6d23d56df06027acb1202e64316b00d0c05aa75.zip
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 <vsementsov@virtuozzo.com> Reviewed-by: Max Reitz <mreitz@redhat.com> Message-Id: <20210116214705.822267-8-vsementsov@virtuozzo.com> Signed-off-by: Max Reitz <mreitz@redhat.com>
Diffstat (limited to 'include/block/block-copy.h')
-rw-r--r--include/block/block-copy.h13
1 files changed, 13 insertions, 0 deletions
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 + <run block_copy with same parameters> 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);