On Wed, Feb 06, 2013 at 01:32:04PM +0100, Benoît Canet wrote:
> diff --git a/block/qcow2-refcount.c b/block/qcow2-refcount.c
> index 337fb65..d173c18 100644
> --- a/block/qcow2-refcount.c
> +++ b/block/qcow2-refcount.c
> @@ -1051,7 +1051,7 @@ static int check_dedup_l2(BlockDriverState *bs,
> BdrvCheckResult *res,
> int i, l2_size;
>
> /* Read L2 table from disk */
> - l2_size = s->cluster_size;
> + l2_size = s->hash_block_size;
> l2_table = g_malloc(l2_size);
>
> if (bdrv_pread(bs->file, l2_offset, l2_table, l2_size) != l2_size) {
> @@ -1141,7 +1141,7 @@ static int check_refcounts_l1(BlockDriverState *bs,
> /* Mark L2 table as used */
> l2_offset &= L1E_OFFSET_MASK;
> inc_refcounts(bs, res, refcount_table, refcount_table_size,
> - l2_offset, s->cluster_size);
> + l2_offset, dedup ? s->hash_block_size : s->l2_size << 3);
Why s->l2_size << 3 instead of s->cluster_size for the non-dedup case?