[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH COLO-Block v6 07/16] Add new block driver interface
From: |
Wen Congyang |
Subject: |
[Qemu-devel] [PATCH COLO-Block v6 07/16] Add new block driver interface to connect/disconnect the remote target |
Date: |
Thu, 18 Jun 2015 16:49:12 +0800 |
In some cases, we want to connect/disconnect the remote target when
we need, not in bdrv_open()/bdrv_close().
Signed-off-by: Wen Congyang <address@hidden>
Signed-off-by: zhanghailiang <address@hidden>
Signed-off-by: Gonglei <address@hidden>
---
block.c | 24 ++++++++++++++++++++++++
include/block/block.h | 3 +++
include/block/block_int.h | 3 +++
3 files changed, 30 insertions(+)
diff --git a/block.c b/block.c
index 0b41af4..59071d4 100644
--- a/block.c
+++ b/block.c
@@ -4400,3 +4400,27 @@ BlockAcctStats *bdrv_get_stats(BlockDriverState *bs)
{
return &bs->stats;
}
+
+void bdrv_connect(BlockDriverState *bs, Error **errp)
+{
+ BlockDriver *drv = bs->drv;
+
+ if (drv && drv->bdrv_connect) {
+ drv->bdrv_connect(bs, errp);
+ } else if (bs->file) {
+ bdrv_connect(bs->file, errp);
+ } else {
+ error_setg(errp, "this feature or command is not currently supported");
+ }
+}
+
+void bdrv_disconnect(BlockDriverState *bs)
+{
+ BlockDriver *drv = bs->drv;
+
+ if (drv && drv->bdrv_disconnect) {
+ drv->bdrv_disconnect(bs);
+ } else if (bs->file) {
+ bdrv_disconnect(bs->file);
+ }
+}
diff --git a/include/block/block.h b/include/block/block.h
index 7cdb569..2c2a0cc 100644
--- a/include/block/block.h
+++ b/include/block/block.h
@@ -606,4 +606,7 @@ void bdrv_flush_io_queue(BlockDriverState *bs);
BlockAcctStats *bdrv_get_stats(BlockDriverState *bs);
+void bdrv_connect(BlockDriverState *bs, Error **errp);
+void bdrv_disconnect(BlockDriverState *bs);
+
#endif
diff --git a/include/block/block_int.h b/include/block/block_int.h
index 87fe89a..a3e5372 100644
--- a/include/block/block_int.h
+++ b/include/block/block_int.h
@@ -290,6 +290,9 @@ struct BlockDriver {
*/
int (*bdrv_probe_geometry)(BlockDriverState *bs, HDGeometry *geo);
+ void (*bdrv_connect)(BlockDriverState *bs, Error **errp);
+ void (*bdrv_disconnect)(BlockDriverState *bs);
+
QLIST_ENTRY(BlockDriver) list;
};
--
2.4.3
- [Qemu-devel] [PATCH COLO-Block v6 01/16] docs: block replication's description, (continued)
- [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, 2015/06/18
- [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 <=
- 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
- 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/22
- 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/22
- 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/23
- 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/23