Am 29.08.2014 um 23:40 hat Max Reitz geschrieben: > Put the code for calculating the reference counts and comparing them > during qemu-img check into own functions. > > Signed-off-by: Max Reitz <mre...@redhat.com> > Reviewed-by: BenoƮt Canet <benoit.ca...@nodalink.com>
> +static int calculate_refcounts(BlockDriverState *bs, BdrvCheckResult *res, > + BdrvCheckMode fix, uint16_t **refcount_table, > + int64_t *nb_clusters) [..] > + return check_refblocks(bs, res, fix, refcount_table, nb_clusters); > +} At first I wanted to comment that it would make more sense to call check_refblocks() from the main function qcow2_check_refcounts(). Now I see that you call it here because it also increases the refcounts for the refblocks. The only thing we could consider here is to split the function into a counting part that is called in calculate_refcounts() and a checking part that is called in qcow2_check_refcounts(). I'll leave that to you, though. Reviewed-by: Kevin Wolf <kw...@redhat.com>