[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH COLO-BLOCK v7 09/17] Backup: clear all bitmap when d
From: |
Wen Congyang |
Subject: |
[Qemu-devel] [PATCH COLO-BLOCK v7 09/17] Backup: clear all bitmap when doing block checkpoint |
Date: |
Tue, 30 Jun 2015 11:34:37 +0800 |
Signed-off-by: Wen Congyang <address@hidden>
Signed-off-by: zhanghailiang <address@hidden>
Signed-off-by: Gonglei <address@hidden>
Cc: Jeff Cody <address@hidden>
---
block/backup.c | 13 +++++++++++++
blockjob.c | 10 ++++++++++
include/block/blockjob.h | 12 ++++++++++++
3 files changed, 35 insertions(+)
diff --git a/block/backup.c b/block/backup.c
index 4a1af68..b4fea46 100644
--- a/block/backup.c
+++ b/block/backup.c
@@ -211,11 +211,24 @@ static void backup_iostatus_reset(BlockJob *job)
bdrv_iostatus_reset(s->target);
}
+static void backup_do_checkpoint(BlockJob *job, Error **errp)
+{
+ BackupBlockJob *backup_job = container_of(job, BackupBlockJob, common);
+
+ if (backup_job->sync_mode != MIRROR_SYNC_MODE_NONE) {
+ error_setg(errp, "this feature or command is not currently supported");
+ return;
+ }
+
+ hbitmap_reset_all(backup_job->bitmap);
+}
+
static const BlockJobDriver backup_job_driver = {
.instance_size = sizeof(BackupBlockJob),
.job_type = BLOCK_JOB_TYPE_BACKUP,
.set_speed = backup_set_speed,
.iostatus_reset = backup_iostatus_reset,
+ .do_checkpoint = backup_do_checkpoint,
};
static BlockErrorAction backup_error_action(BackupBlockJob *job,
diff --git a/blockjob.c b/blockjob.c
index ec46fad..cb412d1 100644
--- a/blockjob.c
+++ b/blockjob.c
@@ -400,3 +400,13 @@ void block_job_defer_to_main_loop(BlockJob *job,
qemu_bh_schedule(data->bh);
}
+
+void block_job_do_checkpoint(BlockJob *job, Error **errp)
+{
+ if (!job->driver->do_checkpoint) {
+ error_setg(errp, "this feature or command is not currently supported");
+ return;
+ }
+
+ job->driver->do_checkpoint(job, errp);
+}
diff --git a/include/block/blockjob.h b/include/block/blockjob.h
index 57d8ef1..b832dc3 100644
--- a/include/block/blockjob.h
+++ b/include/block/blockjob.h
@@ -50,6 +50,9 @@ typedef struct BlockJobDriver {
* manually.
*/
void (*complete)(BlockJob *job, Error **errp);
+
+ /** Optional callback for job types that support checkpoint. */
+ void (*do_checkpoint)(BlockJob *job, Error **errp);
} BlockJobDriver;
/**
@@ -348,4 +351,13 @@ void block_job_defer_to_main_loop(BlockJob *job,
BlockJobDeferToMainLoopFn *fn,
void *opaque);
+/**
+ * block_job_do_checkpoint:
+ * @job: The job.
+ * @errp: Error object.
+ *
+ * Do block checkpoint on the specified job.
+ */
+void block_job_do_checkpoint(BlockJob *job, Error **errp);
+
#endif
--
2.4.3
- [Qemu-devel] [PATCH COLO-BLOCK v7 00/17] Block replication for continuous checkpoints, Wen Congyang, 2015/06/29
- [Qemu-devel] [PATCH COLO-BLOCK v7 01/17] Add new block driver interface to add/delete a BDS's child, Wen Congyang, 2015/06/29
- [Qemu-devel] [PATCH COLO-BLOCK v7 04/17] introduce a new API qemu_opts_absorb_qdict_by_index(), Wen Congyang, 2015/06/29
- [Qemu-devel] [PATCH COLO-BLOCK v7 03/17] hmp: add monitor command to add/remove a child, Wen Congyang, 2015/06/29
- [Qemu-devel] [PATCH COLO-BLOCK v7 05/17] quorum: allow ignoring child errors, Wen Congyang, 2015/06/29
- [Qemu-devel] [PATCH COLO-BLOCK v7 06/17] introduce a new API to enable/disable attach device model, Wen Congyang, 2015/06/29
- [Qemu-devel] [PATCH COLO-BLOCK v7 08/17] block: make bdrv_put_ref_bh_schedule() as a public API, Wen Congyang, 2015/06/29
- [Qemu-devel] [PATCH COLO-BLOCK v7 07/17] introduce a new API to check if blk is attached, Wen Congyang, 2015/06/29
- [Qemu-devel] [PATCH COLO-BLOCK v7 09/17] Backup: clear all bitmap when doing block checkpoint,
Wen Congyang <=
- [Qemu-devel] [PATCH COLO-BLOCK v7 11/17] Allow creating backup jobs when opening BDS, Wen Congyang, 2015/06/29
- [Qemu-devel] [PATCH COLO-BLOCK v7 10/17] allow writing to the backing file, Wen Congyang, 2015/06/29
- [Qemu-devel] [PATCH COLO-BLOCK v7 12/17] block: Allow references for backing files, Wen Congyang, 2015/06/29
- [Qemu-devel] [PATCH COLO-BLOCK v7 13/17] docs: block replication's description, Wen Congyang, 2015/06/29
- [Qemu-devel] [PATCH COLO-BLOCK v7 15/17] skip nbd_target when starting block replication, Wen Congyang, 2015/06/29
- [Qemu-devel] [PATCH COLO-BLOCK v7 14/17] Add new block driver interfaces to control block replication, Wen Congyang, 2015/06/29
- [Qemu-devel] [PATCH COLO-BLOCK v7 16/17] quorum: implement block driver interfaces for block replication, Wen Congyang, 2015/06/29
- [Qemu-devel] [PATCH COLO-BLOCK v7 02/17] quorum: implement block driver interfaces add/delete a BDS's child, Wen Congyang, 2015/06/29
- [Qemu-devel] [PATCH COLO-BLOCK v7 17/17] Implement new driver for block replication, Wen Congyang, 2015/06/29