qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [RFC PATCH v2 20/23] qcow2: Cancel COW when overwritten


From: Stefan Hajnoczi
Subject: Re: [Qemu-devel] [RFC PATCH v2 20/23] qcow2: Cancel COW when overwritten
Date: Mon, 18 Feb 2013 16:03:59 +0100
User-agent: Mutt/1.5.21 (2010-09-15)

On Wed, Feb 13, 2013 at 02:22:10PM +0100, Kevin Wolf wrote:
> @@ -689,6 +691,7 @@ int qcow2_alloc_cluster_link_l2(BlockDriverState *bs, 
> QCowL2Meta *m)
>      int i, j = 0, l2_index, ret;
>      uint64_t *old_cluster, *l2_table;
>      uint64_t cluster_offset = m->alloc_offset;
> +    bool has_wr_lock = false;
>  
>      trace_qcow2_cluster_link_l2(qemu_coroutine_self(), m->nb_clusters);
>      assert(m->nb_clusters > 0);
> @@ -707,6 +710,16 @@ int qcow2_alloc_cluster_link_l2(BlockDriverState *bs, 
> QCowL2Meta *m)
>      }
>  
>      /* Update L2 table. */
> +    qemu_co_mutex_unlock(&s->lock);
> +    qemu_co_rwlock_wrlock(&m->l2_writeback_lock);
> +    has_wr_lock = true;

This variable is only used in err.  IMO it's simpler to have an
err_l2_writeback_locked label which unlocks l2_writeback_lock.  That way
has_wr_lock is avoided and I need to keep less local variables in mind
when reading the code.



reply via email to

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