[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 2/2] block: Inactivate all children
From: |
Fam Zheng |
Subject: |
[Qemu-devel] [PATCH 2/2] block: Inactivate all children |
Date: |
Tue, 19 Apr 2016 09:42:57 +0800 |
Currently we only inactivate the top BDS. Actually bdrv_inactivate
should be the opposite of bdrv_invalidate_cache.
Recurse into the whole subtree instead.
Signed-off-by: Fam Zheng <address@hidden>
---
block.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/block.c b/block.c
index fa8b38f..9a84ed1 100644
--- a/block.c
+++ b/block.c
@@ -3260,8 +3260,16 @@ void bdrv_invalidate_cache_all(Error **errp)
static int bdrv_inactivate(BlockDriverState *bs)
{
+ BdrvChild *child;
int ret;
+ QLIST_FOREACH(child, &bs->children, next) {
+ ret = bdrv_inactivate(child->bs);
+ if (ret < 0) {
+ return ret;
+ }
+ }
+
if (bs->drv->bdrv_inactivate) {
ret = bs->drv->bdrv_inactivate(bs);
if (ret < 0) {
--
2.8.0