From: Wen Congyang <we...@cn.fujitsu.com> Signed-off-by: Wen Congyang <we...@cn.fujitsu.com> Signed-off-by: zhanghailiang <zhang.zhanghaili...@huawei.com> Signed-off-by: Gonglei <arei.gong...@huawei.com> Signed-off-by: Changlong Xie <xiecl.f...@cn.fujitsu.com> --- block/backup.c | 15 +++++++++++++++ include/block/block_int.h | 2 ++ 2 files changed, 17 insertions(+)
diff --git a/block/backup.c b/block/backup.c index 0f1b1bc..b2ba939 100644 --- a/block/backup.c +++ b/block/backup.c @@ -256,6 +256,21 @@ static void backup_abort(BlockJob *job) } } +void backup_do_checkpoint(BlockJob *job, Error **errp) +{ + BackupBlockJob *backup_job = container_of(job, BackupBlockJob, common); + + assert(job->driver->job_type == BLOCK_JOB_TYPE_BACKUP); + + if (backup_job->sync_mode != MIRROR_SYNC_MODE_NONE) { + error_setg(errp, "The backup job only supports block checkpoint in" + " sync=none mode"); + return; + } + + hbitmap_reset_all(backup_job->bitmap); +} + static const BlockJobDriver backup_job_driver = { .instance_size = sizeof(BackupBlockJob), .job_type = BLOCK_JOB_TYPE_BACKUP, diff --git a/include/block/block_int.h b/include/block/block_int.h index 704efe5..48f0f1f 100644 --- a/include/block/block_int.h +++ b/include/block/block_int.h @@ -699,6 +699,8 @@ void backup_start(BlockDriverState *bs, BlockDriverState *target, BlockCompletionFunc *cb, void *opaque, BlockJobTxn *txn, Error **errp); +void backup_do_checkpoint(BlockJob *job, Error **errp); + void blk_set_bs(BlockBackend *blk, BlockDriverState *bs); void blk_dev_change_media_cb(BlockBackend *blk, bool load); -- 1.9.3