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

2013-02-21 Thread Stefan Hajnoczi
On Thu, Feb 21, 2013 at 10:47:05AM +0100, Kevin Wolf wrote: > On Mon, Feb 18, 2013 at 04:46:49PM +0100, Stefan Hajnoczi wrote: > > On Wed, Feb 13, 2013 at 02:22:10PM +0100, Kevin Wolf wrote: > > > @@ -707,6 +710,16 @@ int qcow2_alloc_cluster_link_l2(BlockDriverState > > > *bs, QCowL2Meta *m) > > >

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

2013-02-21 Thread Kevin Wolf
On Mon, Feb 18, 2013 at 04:46:49PM +0100, Stefan Hajnoczi wrote: > On Wed, Feb 13, 2013 at 02:22:10PM +0100, Kevin Wolf wrote: > > @@ -707,6 +710,16 @@ int qcow2_alloc_cluster_link_l2(BlockDriverState *bs, > > QCowL2Meta *m) > > } > > > > /* Update L2 table. */ > > +qemu_co_mutex_u

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

2013-02-18 Thread Stefan Hajnoczi
On Wed, Feb 13, 2013 at 02:22:10PM +0100, Kevin Wolf wrote: > @@ -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); > +ha

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

2013-02-18 Thread Stefan Hajnoczi
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

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

2013-02-13 Thread Kevin Wolf
This is the first part of an optimisation to improve the performance of sequential cluster allocations. Typically, write requests aren't aligned to cluster boundaries, so sequential allocation means that every other request has to wait for the COW of the previous request to complete. We can do bet