aboutsummaryrefslogtreecommitdiff
path: root/block
diff options
context:
space:
mode:
authorWen Congyang <wency@cn.fujitsu.com>2016-07-27 15:01:43 +0800
committerStefan Hajnoczi <stefanha@redhat.com>2016-09-13 11:00:56 +0100
commit49d3e828f8cf8500918d4579ab6cd9c0f9584d63 (patch)
tree19be06d9bf689cde95eaea17ab23ffbc4a355ae2 /block
parente9d6456e956898ccdd5d112d2e097e58a9d10b58 (diff)
Backup: clear all bitmap when doing block checkpoint
Signed-off-by: Wen Congyang <wency@cn.fujitsu.com> Signed-off-by: Changlong Xie <xiecl.fnst@cn.fujitsu.com> Signed-off-by: Wang WeiWei <wangww.fnst@cn.fujitsu.com> Signed-off-by: zhanghailiang <zhang.zhanghailiang@huawei.com> Signed-off-by: Gonglei <arei.gonglei@huawei.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Message-id: 1469602913-20979-3-git-send-email-xiecl.fnst@cn.fujitsu.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Diffstat (limited to 'block')
-rw-r--r--block/backup.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/block/backup.c b/block/backup.c
index bb3bb9a9eb..dbe54e2dce 100644
--- a/block/backup.c
+++ b/block/backup.c
@@ -17,6 +17,7 @@
#include "block/block.h"
#include "block/block_int.h"
#include "block/blockjob.h"
+#include "block/block_backup.h"
#include "qapi/error.h"
#include "qapi/qmp/qerror.h"
#include "qemu/ratelimit.h"
@@ -255,6 +256,23 @@ static void backup_attached_aio_context(BlockJob *job, AioContext *aio_context)
blk_set_aio_context(s->target, aio_context);
}
+void backup_do_checkpoint(BlockJob *job, Error **errp)
+{
+ BackupBlockJob *backup_job = container_of(job, BackupBlockJob, common);
+ int64_t len;
+
+ 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;
+ }
+
+ len = DIV_ROUND_UP(backup_job->common.len, backup_job->cluster_size);
+ bitmap_zero(backup_job->done_bitmap, len);
+}
+
static const BlockJobDriver backup_job_driver = {
.instance_size = sizeof(BackupBlockJob),
.job_type = BLOCK_JOB_TYPE_BACKUP,