[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH COLO-Block v6 05/16] Backup: clear all bitmap when d
From: |
Wen Congyang |
Subject: |
[Qemu-devel] [PATCH COLO-Block v6 05/16] Backup: clear all bitmap when doing block checkpoint |
Date: |
Thu, 18 Jun 2015 16:49:10 +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 d3f648d..d3d8ba7 100644
--- a/block/backup.c
+++ b/block/backup.c
@@ -210,11 +210,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 2755465..9d2128a 100644
--- a/blockjob.c
+++ b/blockjob.c
@@ -399,3 +399,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 v6 00/16] Block replication for continuous checkpoints, Wen Congyang, 2015/06/18
- [Qemu-devel] [PATCH COLO-Block v6 01/16] docs: block replication's description, Wen Congyang, 2015/06/18
- [Qemu-devel] [PATCH COLO-Block v6 03/16] Allow creating backup jobs when opening BDS, Wen Congyang, 2015/06/18
- [Qemu-devel] [PATCH COLO-Block v6 02/16] allow writing to the backing file, Wen Congyang, 2015/06/18
- [Qemu-devel] [PATCH COLO-Block v6 05/16] Backup: clear all bitmap when doing block checkpoint,
Wen Congyang <=
- [Qemu-devel] [PATCH COLO-Block v6 06/16] Don't allow a disk use backing reference target, Wen Congyang, 2015/06/18
- [Qemu-devel] [PATCH COLO-Block v6 07/16] Add new block driver interface to connect/disconnect the remote target, Wen Congyang, 2015/06/18
- Re: [Qemu-devel] [Qemu-block] [PATCH COLO-Block v6 07/16] Add new block driver interface to connect/disconnect the remote target, Stefan Hajnoczi, 2015/06/18
- Re: [Qemu-devel] [Qemu-block] [PATCH COLO-Block v6 07/16] Add new block driver interface to connect/disconnect the remote target, Wen Congyang, 2015/06/18
- Re: [Qemu-devel] [Qemu-block] [PATCH COLO-Block v6 07/16] Add new block driver interface to connect/disconnect the remote target, Stefan Hajnoczi, 2015/06/18
- Re: [Qemu-devel] [Qemu-block] [PATCH COLO-Block v6 07/16] Add new block driver interface to connect/disconnect the remote target, Wen Congyang, 2015/06/18
- Re: [Qemu-devel] [Qemu-block] [PATCH COLO-Block v6 07/16] Add new block driver interface to connect/disconnect the remote target, Stefan Hajnoczi, 2015/06/19
- Re: [Qemu-devel] [Qemu-block] [PATCH COLO-Block v6 07/16] Add new block driver interface to connect/disconnect the remote target, Wen Congyang, 2015/06/19