[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [RFC PATCH 10/14] allow the backing image access the origin
From: |
Wen Congyang |
Subject: |
[Qemu-devel] [RFC PATCH 10/14] allow the backing image access the origin BlockDriverState |
Date: |
Thu, 12 Feb 2015 11:07:14 +0800 |
Block replication needs this feature.
Signed-off-by: Wen Congyang <address@hidden>
Signed-off-by: zhanghailiang <address@hidden>
Signed-off-by: Gonglei <address@hidden>
---
block.c | 2 ++
include/block/block_int.h | 2 ++
2 files changed, 4 insertions(+)
diff --git a/block.c b/block.c
index a7a8932..067c44b 100644
--- a/block.c
+++ b/block.c
@@ -1181,6 +1181,7 @@ void bdrv_set_backing_hd(BlockDriverState *bs,
BlockDriverState *backing_hd)
if (bs->backing_hd) {
assert(bs->backing_blocker);
bdrv_op_unblock_all(bs->backing_hd, bs->backing_blocker);
+ bs->backing_hd->origin_file = NULL;
} else if (backing_hd) {
error_setg(&bs->backing_blocker,
"device is used as backing hd of '%s'",
@@ -1193,6 +1194,7 @@ void bdrv_set_backing_hd(BlockDriverState *bs,
BlockDriverState *backing_hd)
bs->backing_blocker = NULL;
goto out;
}
+ backing_hd->origin_file = bs;
bs->open_flags &= ~BDRV_O_NO_BACKING;
pstrcpy(bs->backing_file, sizeof(bs->backing_file), backing_hd->filename);
pstrcpy(bs->backing_format, sizeof(bs->backing_format),
diff --git a/include/block/block_int.h b/include/block/block_int.h
index 603f704..9be13a8 100644
--- a/include/block/block_int.h
+++ b/include/block/block_int.h
@@ -360,6 +360,8 @@ struct BlockDriverState {
char exact_filename[PATH_MAX];
BlockDriverState *backing_hd;
+ /* used by backing image */
+ BlockDriverState *origin_file;
BlockDriverState *file;
NotifierList close_notifiers;
--
2.1.0
- [Qemu-devel] [RFC PATCH 06/14] NBD client: connect to nbd server later, (continued)
[Qemu-devel] [RFC PATCH 09/14] block: give backing image its own BlockBackend, Wen Congyang, 2015/02/11
[Qemu-devel] [RFC PATCH 07/14] NBD client: implement block driver interfaces for block replication, Wen Congyang, 2015/02/11
[Qemu-devel] [RFC PATCH 10/14] allow the backing image access the origin BlockDriverState,
Wen Congyang <=
[Qemu-devel] [RFC PATCH 11/14] allow writing to the backing file, Wen Congyang, 2015/02/11
[Qemu-devel] [RFC PATCH 13/14] COW: move cow interfaces to a seperate file, Wen Congyang, 2015/02/11
[Qemu-devel] [RFC PATCH 08/14] block: add a new API to create a hidden BlockBackend, Wen Congyang, 2015/02/11
[Qemu-devel] [RFC PATCH 12/14] Add disk buffer for block replication, Wen Congyang, 2015/02/11
[Qemu-devel] [RFC PATCH 14/14] COLO: implement a new block driver, Wen Congyang, 2015/02/11