Re: [Qemu-devel] [PATCH v5 08/11] qcow2: Rebuild refcount structure during check

2014-10-16 Thread Eric Blake
On 10/16/2014 09:27 AM, Max Reitz wrote: >>> +memset(*refcount_table + old_nb_clusters, 0, >>> + (*nb_clusters - old_nb_clusters) * sizeof(uint16_t)); >> Is this calculation unnecessarily hard-coded to refcount_order==4? > > While now in the process of editing this patch, no

Re: [Qemu-devel] [PATCH v5 08/11] qcow2: Rebuild refcount structure during check

2014-10-16 Thread Max Reitz
Am 09.10.2014 um 01:09 schrieb Eric Blake: On 08/29/2014 03:41 PM, Max Reitz wrote: + * cluster_count clusters; therefore, we have to allocate + * cluster_count - contiguous_free_clusters new clusters at the end of + * the image (which is the current value of cluster; not

Re: [Qemu-devel] [PATCH v5 08/11] qcow2: Rebuild refcount structure during check

2014-10-12 Thread Max Reitz
Am 11.10.2014 um 20:56 schrieb Benoît Canet: +int64_t first_free_cluster = 0, rt_ofs = -1, cluster = 0; +int64_t rb_ofs, rb_start, rb_index; Everytime a few day pass and I read rb_ofs and rt_ofs again I found these names obfuscated. I know Linus says that C is a spartan language but thes

Re: [Qemu-devel] [PATCH v5 08/11] qcow2: Rebuild refcount structure during check

2014-10-11 Thread Benoît Canet
> +int64_t first_free_cluster = 0, rt_ofs = -1, cluster = 0; > +int64_t rb_ofs, rb_start, rb_index; Everytime a few day pass and I read rb_ofs and rt_ofs again I found these names obfuscated. I know Linus says that C is a spartan language but these look odd. Maybe refcount_block_offset, r

Re: [Qemu-devel] [PATCH v5 08/11] qcow2: Rebuild refcount structure during check

2014-10-11 Thread Max Reitz
Am 10.10.2014 um 14:44 schrieb Benoît Canet: +*nb_clusters = cluster + cluster_count - contiguous_free_clusters; +*refcount_table = g_try_realloc(*refcount_table, +*nb_clusters * sizeof(uint16_t)); Something tells me that these sizeof(uint1

Re: [Qemu-devel] [PATCH v5 08/11] qcow2: Rebuild refcount structure during check

2014-10-11 Thread Max Reitz
Am 09.10.2014 um 01:09 schrieb Eric Blake: On 08/29/2014 03:41 PM, Max Reitz wrote: The previous commit introduced the "rebuild" variable to qcow2's implementation of the image consistency check. Now make use of this by adding a function which creates a completely new refcount structure based so

Re: [Qemu-devel] [PATCH v5 08/11] qcow2: Rebuild refcount structure during check

2014-10-10 Thread Benoît Canet
> +*nb_clusters = cluster + cluster_count - contiguous_free_clusters; > +*refcount_table = g_try_realloc(*refcount_table, > +*nb_clusters * sizeof(uint16_t)); Something tells me that these sizeof(uint16_t) are connected to s->refcount_order

Re: [Qemu-devel] [PATCH v5 08/11] qcow2: Rebuild refcount structure during check

2014-10-08 Thread Eric Blake
On 08/29/2014 03:41 PM, Max Reitz wrote: > The previous commit introduced the "rebuild" variable to qcow2's > implementation of the image consistency check. Now make use of this by > adding a function which creates a completely new refcount structure > based solely on the in-memory information gath

[Qemu-devel] [PATCH v5 08/11] qcow2: Rebuild refcount structure during check

2014-08-29 Thread Max Reitz
The previous commit introduced the "rebuild" variable to qcow2's implementation of the image consistency check. Now make use of this by adding a function which creates a completely new refcount structure based solely on the in-memory information gathered before. The old refcount structure will be