aboutsummaryrefslogtreecommitdiff
path: root/block/block-copy.c
diff options
context:
space:
mode:
authorVladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>2019-10-01 16:14:07 +0300
committerMax Reitz <mreitz@redhat.com>2019-10-10 10:56:18 +0200
commit0f4b02b73e71cb761bfedcef180c5f10812f2953 (patch)
treec89335a3fb9e016dbf09591c1c0bcdbf2bb37bce /block/block-copy.c
parent843670f30f35935cfd7781b6a49c258f22261b1d (diff)
block/block-copy: split block_copy_set_callbacks function
Split block_copy_set_callbacks out of block_copy_state_new. It's needed for further commit: block-copy will use BdrvChildren of backup-top filter, so it will be created from backup-top filter creation function. But callbacks will still belong to backup job and will be set in separate. Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> Message-id: 20191001131409.14202-4-vsementsov@virtuozzo.com Reviewed-by: Max Reitz <mreitz@redhat.com> Signed-off-by: Max Reitz <mreitz@redhat.com>
Diffstat (limited to 'block/block-copy.c')
-rw-r--r--block/block-copy.c24
1 files changed, 15 insertions, 9 deletions
diff --git a/block/block-copy.c b/block/block-copy.c
index 61e5ea5f46..fcb112da14 100644
--- a/block/block-copy.c
+++ b/block/block-copy.c
@@ -66,12 +66,10 @@ void block_copy_state_free(BlockCopyState *s)
g_free(s);
}
-BlockCopyState *block_copy_state_new(
- BlockDriverState *source, BlockDriverState *target,
- int64_t cluster_size, BdrvRequestFlags write_flags,
- ProgressBytesCallbackFunc progress_bytes_callback,
- ProgressResetCallbackFunc progress_reset_callback,
- void *progress_opaque, Error **errp)
+BlockCopyState *block_copy_state_new(BlockDriverState *source,
+ BlockDriverState *target,
+ int64_t cluster_size,
+ BdrvRequestFlags write_flags, Error **errp)
{
BlockCopyState *s;
int ret;
@@ -95,9 +93,6 @@ BlockCopyState *block_copy_state_new(
.cluster_size = cluster_size,
.len = bdrv_dirty_bitmap_size(copy_bitmap),
.write_flags = write_flags,
- .progress_bytes_callback = progress_bytes_callback,
- .progress_reset_callback = progress_reset_callback,
- .progress_opaque = progress_opaque,
};
s->copy_range_size = QEMU_ALIGN_DOWN(MIN(blk_get_max_transfer(s->source),
@@ -144,6 +139,17 @@ fail:
return NULL;
}
+void block_copy_set_callbacks(
+ BlockCopyState *s,
+ ProgressBytesCallbackFunc progress_bytes_callback,
+ ProgressResetCallbackFunc progress_reset_callback,
+ void *progress_opaque)
+{
+ s->progress_bytes_callback = progress_bytes_callback;
+ s->progress_reset_callback = progress_reset_callback;
+ s->progress_opaque = progress_opaque;
+}
+
/*
* Copy range to target with a bounce buffer and return the bytes copied. If
* error occurred, return a negative error number