qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH v16 2/8] Backup: clear all bitmap when doing block c


From: Changlong Xie
Subject: [Qemu-devel] [PATCH v16 2/8] Backup: clear all bitmap when doing block checkpoint
Date: Fri, 11 Mar 2016 18:34:09 +0800

From: Wen Congyang <address@hidden>

Signed-off-by: Wen Congyang <address@hidden>
Signed-off-by: zhanghailiang <address@hidden>
Signed-off-by: Gonglei <address@hidden>
Signed-off-by: Changlong Xie <address@hidden>
---
 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






reply via email to

[Prev in Thread] Current Thread [Next in Thread]