qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 11/21] block/copy-before-write: use file child instead of bac


From: Vladimir Sementsov-Ogievskiy
Subject: Re: [PATCH 11/21] block/copy-before-write: use file child instead of backing
Date: Tue, 18 May 2021 15:21:22 +0300
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.10.1

18.05.2021 14:47, Max Reitz wrote:
On 17.05.21 08:44, Vladimir Sementsov-Ogievskiy wrote:
We are going to publish copy-before-write filter, and there no public
backing-child-based filter in Qemu. No reason to create a precedent, so
let's refactor copy-before-write filter instead.

Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
---
  block/copy-before-write.c | 40 ++++++++++++++++++++++-----------------
  1 file changed, 23 insertions(+), 17 deletions(-)

diff --git a/block/copy-before-write.c b/block/copy-before-write.c
index af2bb97a30..2f06a524b8 100644
--- a/block/copy-before-write.c
+++ b/block/copy-before-write.c

[...]

@@ -201,22 +195,34 @@ BlockDriverState *bdrv_cbw_append(BlockDriverState 
*source,
      state->target = bdrv_attach_child(top, target, "target", &child_of_bds,
                                        BDRV_CHILD_DATA, errp);
      if (!state->target) {
+        error_prepend(errp, "Cannot attach target child: ");
          bdrv_unref(target);
          bdrv_unref(top);
          return NULL;
      }
+    bdrv_ref(source);
+    top->file = bdrv_attach_child(top, source, "file", &child_of_bds,
+                                  BDRV_CHILD_FILTERED | BDRV_CHILD_PRIMARY,
+                                  errp);
+    if (!top->file) {
+        error_prepend(errp, "Cannot attach file child: ");
+        bdrv_unref(source);

Already existing in the code above, but why is the reference to @source dropped 
here?  Shouldn’t bdrv_attach_child()’s error path have done that already?


Hmm, yes. Looks like a preexisting bug. will fix and update this patch.


--
Best regards,
Vladimir



reply via email to

[Prev in Thread] Current Thread [Next in Thread]