Re: [Qemu-block] [Qemu-devel] [PATCH 2/6] qcow2: simplify qcow2_cache_put() and qcow2_cache_entry_mark_dirty()

2015-05-06 Thread Alberto Garcia
On Wed 06 May 2015 05:00:50 PM CEST, Stefan Hajnoczi wrote: >> >> int qcow2_cache_put(BlockDriverState *bs, Qcow2Cache *c, void **table) >> >> { >> >> -int i; >> >> +int i = (*table - c->table_array) / c->table_size; >> >> >> >> -for (i = 0; i < c->size; i++) { >> >> -if (t

Re: [Qemu-block] [Qemu-devel] [PATCH 2/6] qcow2: simplify qcow2_cache_put() and qcow2_cache_entry_mark_dirty()

2015-05-06 Thread Stefan Hajnoczi
On Tue, May 05, 2015 at 03:06:52PM +0200, Alberto Garcia wrote: > On Fri 01 May 2015 04:31:52 PM CEST, Stefan Hajnoczi wrote: > > >> int qcow2_cache_put(BlockDriverState *bs, Qcow2Cache *c, void **table) > >> { > >> -int i; > >> +int i = (*table - c->table_array) / c->table_size; > >>

Re: [Qemu-block] [Qemu-devel] [PATCH 2/6] qcow2: simplify qcow2_cache_put() and qcow2_cache_entry_mark_dirty()

2015-05-05 Thread Eric Blake
On 04/30/2015 04:11 AM, Alberto Garcia wrote: > Since all tables are now stored together, it is possible to obtain > the position of a particular table directly from its address, so the > operation becomes O(1). > > Signed-off-by: Alberto Garcia > --- > block/qcow2-cache.c | 22 +

Re: [Qemu-block] [Qemu-devel] [PATCH 2/6] qcow2: simplify qcow2_cache_put() and qcow2_cache_entry_mark_dirty()

2015-05-05 Thread Alberto Garcia
On Fri 01 May 2015 04:31:52 PM CEST, Stefan Hajnoczi wrote: >> int qcow2_cache_put(BlockDriverState *bs, Qcow2Cache *c, void **table) >> { >> -int i; >> +int i = (*table - c->table_array) / c->table_size; >> >> -for (i = 0; i < c->size; i++) { >> -if (table_addr(c, i) == *t

Re: [Qemu-block] [Qemu-devel] [PATCH 2/6] qcow2: simplify qcow2_cache_put() and qcow2_cache_entry_mark_dirty()

2015-05-01 Thread Stefan Hajnoczi
On Thu, Apr 30, 2015 at 01:11:41PM +0300, Alberto Garcia wrote: > int qcow2_cache_put(BlockDriverState *bs, Qcow2Cache *c, void **table) > { > -int i; > +int i = (*table - c->table_array) / c->table_size; > > -for (i = 0; i < c->size; i++) { > -if (table_addr(c, i) == *table