[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [RFC PATCH 04/14] Add new block driver interfaces to contro
From: |
Wen Congyang |
Subject: |
[Qemu-devel] [RFC PATCH 04/14] Add new block driver interfaces to control disk replication |
Date: |
Thu, 12 Feb 2015 11:07:08 +0800 |
Signed-off-by: Wen Congyang <address@hidden>
Signed-off-by: zhanghailiang <address@hidden>
Signed-off-by: Gonglei <address@hidden>
---
block.c | 36 ++++++++++++++++++++++++++++++++++++
include/block/block.h | 10 ++++++++++
include/block/block_int.h | 12 ++++++++++++
3 files changed, 58 insertions(+)
diff --git a/block.c b/block.c
index 210fd5f..2335af1 100644
--- a/block.c
+++ b/block.c
@@ -6156,3 +6156,39 @@ BlockAcctStats *bdrv_get_stats(BlockDriverState *bs)
{
return &bs->stats;
}
+
+int bdrv_start_replication(BlockDriverState *bs, int mode)
+{
+ BlockDriver *drv = bs->drv;
+ if (drv && drv->bdrv_start_replication) {
+ return drv->bdrv_start_replication(bs, mode);
+ } else if (bs->file) {
+ return bdrv_start_replication(bs->file, mode);
+ }
+
+ return -1;
+}
+
+int bdrv_do_checkpoint(BlockDriverState *bs)
+{
+ BlockDriver *drv = bs->drv;
+ if (drv && drv->bdrv_do_checkpoint) {
+ return drv->bdrv_do_checkpoint(bs);
+ } else if (bs->file) {
+ return bdrv_do_checkpoint(bs->file);
+ }
+
+ return -1;
+}
+
+int bdrv_stop_replication(BlockDriverState *bs)
+{
+ BlockDriver *drv = bs->drv;
+ if (drv && drv->bdrv_stop_replication) {
+ return drv->bdrv_stop_replication(bs);
+ } else if (bs->file) {
+ return bdrv_stop_replication(bs->file);
+ }
+
+ return -1;
+}
diff --git a/include/block/block.h b/include/block/block.h
index 321295e..632b9fc 100644
--- a/include/block/block.h
+++ b/include/block/block.h
@@ -557,4 +557,14 @@ void bdrv_flush_io_queue(BlockDriverState *bs);
BlockAcctStats *bdrv_get_stats(BlockDriverState *bs);
+/* Checkpoint control, called in migration/checkpoint thread */
+enum {
+ COLO_UNPROTECTED_MODE = 0,
+ COLO_PRIMARY_MODE,
+ COLO_SECONDARY_MODE,
+};
+int bdrv_start_replication(BlockDriverState *bs, int mode);
+int bdrv_do_checkpoint(BlockDriverState *bs);
+int bdrv_stop_replication(BlockDriverState *bs);
+
#endif
diff --git a/include/block/block_int.h b/include/block/block_int.h
index 7ad1950..603f704 100644
--- a/include/block/block_int.h
+++ b/include/block/block_int.h
@@ -273,6 +273,18 @@ struct BlockDriver {
void (*bdrv_io_unplug)(BlockDriverState *bs);
void (*bdrv_flush_io_queue)(BlockDriverState *bs);
+
+ /* Checkpoint control, called in migration/checkpoint thread */
+ int (*bdrv_start_replication)(BlockDriverState *bs, int mode);
+ /*
+ * Drop Disk buffer when doing checkpoint.
+ */
+ int (*bdrv_do_checkpoint)(BlockDriverState *bs);
+ /* After failover, we should flush Disk buffer into secondary disk
+ * and stop block replication.
+ */
+ int (*bdrv_stop_replication)(BlockDriverState *bs);
+
QLIST_ENTRY(BlockDriver) list;
};
--
2.1.0
- Re: [Qemu-devel] [RFC PATCH 01/14] docs: block replication's description, (continued)
- Re: [Qemu-devel] [RFC PATCH 01/14] docs: block replication's description, Fam Zheng, 2015/02/12
- Re: [Qemu-devel] [RFC PATCH 01/14] docs: block replication's description, Wen Congyang, 2015/02/24
- Re: [Qemu-devel] [RFC PATCH 01/14] docs: block replication's description, Fam Zheng, 2015/02/24
- Re: [Qemu-devel] [RFC PATCH 01/14] docs: block replication's description, Wen Congyang, 2015/02/25
- Re: [Qemu-devel] [RFC PATCH 01/14] docs: block replication's description, Fam Zheng, 2015/02/25
- Re: [Qemu-devel] [RFC PATCH 01/14] docs: block replication's description, Wen Congyang, 2015/02/25
- Re: [Qemu-devel] [RFC PATCH 01/14] docs: block replication's description, Wen Congyang, 2015/02/25
- Re: [Qemu-devel] [RFC PATCH 01/14] docs: block replication's description, Fam Zheng, 2015/02/25
- Re: [Qemu-devel] [RFC PATCH 01/14] docs: block replication's description, Wen Congyang, 2015/02/25
- Re: [Qemu-devel] [RFC PATCH 01/14] docs: block replication's description, Fam Zheng, 2015/02/25
[Qemu-devel] [RFC PATCH 04/14] Add new block driver interfaces to control disk replication,
Wen Congyang <=
[Qemu-devel] [RFC PATCH 03/14] quorum: ignore 0-length child, Wen Congyang, 2015/02/11
[Qemu-devel] [RFC PATCH 05/14] quorom: implement block driver interfaces for block replication, Wen Congyang, 2015/02/11
[Qemu-devel] [RFC PATCH 06/14] NBD client: connect to nbd server later, Wen Congyang, 2015/02/11