[Qemu-devel] [PATCH for-4.1] commit: Use bdrv_append() in commit_start()

Alberto Garcia posted 1 patch 5 years ago
Test docker-mingw@fedora passed
Test docker-clang@ubuntu passed
Test checkpatch passed
Test asan passed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20190403143748.9790-1-berto@igalia.com
Maintainers: John Snow <jsnow@redhat.com>, Max Reitz <mreitz@redhat.com>, Kevin Wolf <kwolf@redhat.com>
block/commit.c | 11 +----------
1 file changed, 1 insertion(+), 10 deletions(-)
[Qemu-devel] [PATCH for-4.1] commit: Use bdrv_append() in commit_start()
Posted by Alberto Garcia 5 years ago
This function combines bdrv_set_backing_hd() and bdrv_replace_node()
so we can use it to simplify the code a bit in commit_start().

Signed-off-by: Alberto Garcia <berto@igalia.com>
---
 block/commit.c | 11 +----------
 1 file changed, 1 insertion(+), 10 deletions(-)

diff --git a/block/commit.c b/block/commit.c
index ba60fef58a..a0beb7d265 100644
--- a/block/commit.c
+++ b/block/commit.c
@@ -304,23 +304,14 @@ void commit_start(const char *job_id, BlockDriverState *bs,
     commit_top_bs->total_sectors = top->total_sectors;
     bdrv_set_aio_context(commit_top_bs, bdrv_get_aio_context(top));
 
-    bdrv_set_backing_hd(commit_top_bs, top, &local_err);
+    bdrv_append(commit_top_bs, top, &local_err);
     if (local_err) {
-        bdrv_unref(commit_top_bs);
-        commit_top_bs = NULL;
-        error_propagate(errp, local_err);
-        goto fail;
-    }
-    bdrv_replace_node(top, commit_top_bs, &local_err);
-    if (local_err) {
-        bdrv_unref(commit_top_bs);
         commit_top_bs = NULL;
         error_propagate(errp, local_err);
         goto fail;
     }
 
     s->commit_top_bs = commit_top_bs;
-    bdrv_unref(commit_top_bs);
 
     /* Block all nodes between top and base, because they will
      * disappear from the chain after this operation. */
-- 
2.11.0


Re: [Qemu-devel] [PATCH for-4.1] commit: Use bdrv_append() in commit_start()
Posted by Alberto Garcia 4 years, 12 months ago
ping

On Wed 03 Apr 2019 04:37:48 PM CEST, Alberto Garcia wrote:
> This function combines bdrv_set_backing_hd() and bdrv_replace_node()
> so we can use it to simplify the code a bit in commit_start().
>
> Signed-off-by: Alberto Garcia <berto@igalia.com>
> ---
>  block/commit.c | 11 +----------
>  1 file changed, 1 insertion(+), 10 deletions(-)
>
> diff --git a/block/commit.c b/block/commit.c
> index ba60fef58a..a0beb7d265 100644
> --- a/block/commit.c
> +++ b/block/commit.c
> @@ -304,23 +304,14 @@ void commit_start(const char *job_id, BlockDriverState *bs,
>      commit_top_bs->total_sectors = top->total_sectors;
>      bdrv_set_aio_context(commit_top_bs, bdrv_get_aio_context(top));
>  
> -    bdrv_set_backing_hd(commit_top_bs, top, &local_err);
> +    bdrv_append(commit_top_bs, top, &local_err);
>      if (local_err) {
> -        bdrv_unref(commit_top_bs);
> -        commit_top_bs = NULL;
> -        error_propagate(errp, local_err);
> -        goto fail;
> -    }
> -    bdrv_replace_node(top, commit_top_bs, &local_err);
> -    if (local_err) {
> -        bdrv_unref(commit_top_bs);
>          commit_top_bs = NULL;
>          error_propagate(errp, local_err);
>          goto fail;
>      }
>  
>      s->commit_top_bs = commit_top_bs;
> -    bdrv_unref(commit_top_bs);
>  
>      /* Block all nodes between top and base, because they will
>       * disappear from the chain after this operation. */
> -- 
> 2.11.0

Re: [Qemu-devel] [PATCH for-4.1] commit: Use bdrv_append() in commit_start()
Posted by Max Reitz 4 years, 12 months ago
On 03.04.19 16:37, Alberto Garcia wrote:
> This function combines bdrv_set_backing_hd() and bdrv_replace_node()
> so we can use it to simplify the code a bit in commit_start().
> 
> Signed-off-by: Alberto Garcia <berto@igalia.com>
> ---
>  block/commit.c | 11 +----------
>  1 file changed, 1 insertion(+), 10 deletions(-)

Thanks, applied to my block branch:

https://git.xanclic.moe/XanClic/qemu/commits/branch/block

Max