qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH 2/3] qcow2: Free allocated L2 cluster on error


From: Benoît Canet
Subject: Re: [Qemu-devel] [PATCH 2/3] qcow2: Free allocated L2 cluster on error
Date: Wed, 25 Sep 2013 16:50:10 +0200
User-agent: Mutt/1.5.21 (2010-09-15)

Le Wednesday 25 Sep 2013 à 16:37:19 (+0200), Max Reitz a écrit :
> If an error occurs in l2_allocate, the allocated (but unused) L2 cluster
> should be freed.
> 
> Signed-off-by: Max Reitz <address@hidden>
> ---
>  block/qcow2-cluster.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/block/qcow2-cluster.c b/block/qcow2-cluster.c
> index f6d47c9..1c3d3fc 100644
> --- a/block/qcow2-cluster.c
> +++ b/block/qcow2-cluster.c
> @@ -269,6 +269,10 @@ fail:
>          qcow2_cache_put(bs, s->l2_table_cache, (void**) table);
>      }
>      s->l1_table[l1_index] = old_l2_offset;
> +    if (l2_offset > 0) {
> +        qcow2_free_clusters(bs, l2_offset, s->l2_size * sizeof(uint64_t),
> +                            QCOW2_DISCARD_ALWAYS);
> +    }
>      return ret;
>  }
>  
> -- 
> 1.8.3.1
> 
> 
Reviewed-by: Benoit Canet <address@hidden>



reply via email to

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