[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 06/17] Backup: clear all bitmap when doing block chec
From: |
Stefan Hajnoczi |
Subject: |
[Qemu-devel] [PULL 06/17] Backup: clear all bitmap when doing block checkpoint |
Date: |
Mon, 12 Sep 2016 15:08:43 +0100 |
From: Wen Congyang <address@hidden>
Signed-off-by: Wen Congyang <address@hidden>
Signed-off-by: Changlong Xie <address@hidden>
Signed-off-by: Wang WeiWei <address@hidden>
Signed-off-by: zhanghailiang <address@hidden>
Signed-off-by: Gonglei <address@hidden>
Reviewed-by: Stefan Hajnoczi <address@hidden>
Message-id: address@hidden
Signed-off-by: Stefan Hajnoczi <address@hidden>
---
block/backup.c | 18 ++++++++++++++++++
include/block/block_backup.h | 25 +++++++++++++++++++++++++
2 files changed, 43 insertions(+)
create mode 100644 include/block/block_backup.h
diff --git a/block/backup.c b/block/backup.c
index bb3bb9a..dbe54e2 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,
diff --git a/include/block/block_backup.h b/include/block/block_backup.h
new file mode 100644
index 0000000..157596c
--- /dev/null
+++ b/include/block/block_backup.h
@@ -0,0 +1,25 @@
+/*
+ * QEMU backup
+ *
+ * Copyright (c) 2013 Proxmox Server Solutions
+ * Copyright (c) 2016 HUAWEI TECHNOLOGIES CO., LTD.
+ * Copyright (c) 2016 Intel Corporation
+ * Copyright (c) 2016 FUJITSU LIMITED
+ *
+ * Authors:
+ * Dietmar Maurer <address@hidden>
+ * Changlong Xie <address@hidden>
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
+ * See the COPYING file in the top-level directory.
+ *
+ */
+
+#ifndef BLOCK_BACKUP_H
+#define BLOCK_BACKUP_H
+
+#include "block/block_int.h"
+
+void backup_do_checkpoint(BlockJob *job, Error **errp);
+
+#endif
--
2.7.4
- [Qemu-devel] [PULL 00/17] Block patches, Stefan Hajnoczi, 2016/09/12
- [Qemu-devel] [PULL 01/17] linux-aio: consume events in userspace instead of calling io_getevents, Stefan Hajnoczi, 2016/09/12
- [Qemu-devel] [PULL 02/17] linux-aio: split processing events function, Stefan Hajnoczi, 2016/09/12
- [Qemu-devel] [PULL 04/17] virtio-blk: rename virtio_device_info to virtio_blk_info, Stefan Hajnoczi, 2016/09/12
- [Qemu-devel] [PULL 03/17] linux-aio: process completions from ioq_submit(), Stefan Hajnoczi, 2016/09/12
- [Qemu-devel] [PULL 05/17] block: unblock backup operations in backing file, Stefan Hajnoczi, 2016/09/12
- [Qemu-devel] [PULL 06/17] Backup: clear all bitmap when doing block checkpoint,
Stefan Hajnoczi <=
- [Qemu-devel] [PULL 07/17] Backup: export interfaces for extra serialization, Stefan Hajnoczi, 2016/09/12
- [Qemu-devel] [PULL 09/17] docs: block replication's description, Stefan Hajnoczi, 2016/09/12
- [Qemu-devel] [PULL 08/17] block: Link backup into block core, Stefan Hajnoczi, 2016/09/12
- [Qemu-devel] [PULL 10/17] mirror: auto complete active commit, Stefan Hajnoczi, 2016/09/12
- [Qemu-devel] [PULL 11/17] configure: support replication, Stefan Hajnoczi, 2016/09/12
- [Qemu-devel] [PULL 12/17] replication: Introduce new APIs to do replication operation, Stefan Hajnoczi, 2016/09/12
- [Qemu-devel] [PULL 14/17] tests: add unit test case for replication, Stefan Hajnoczi, 2016/09/12
- [Qemu-devel] [PULL 13/17] replication: Implement new driver for block replication, Stefan Hajnoczi, 2016/09/12
- [Qemu-devel] [PULL 15/17] support replication driver in blockdev-add, Stefan Hajnoczi, 2016/09/12
- [Qemu-devel] [PULL 16/17] MAINTAINERS: add maintainer for replication, Stefan Hajnoczi, 2016/09/12