qcow2: make refcount size calculation conservative
commit7c5bcc42120119bb46d8b2a422053467bcc7291c
authorStefan Hajnoczi <stefanha@redhat.com>
Wed, 5 Jul 2017 12:57:33 +0000 (5 13:57 +0100)
committerMax Reitz <mreitz@redhat.com>
Tue, 11 Jul 2017 15:45:00 +0000 (11 17:45 +0200)
treea8c47b8a48d3830b1bf7a0eb5e691f0a94293625
parent95c67e3bd747b119aa0a902778e1c20fd7fded7f
qcow2: make refcount size calculation conservative

The refcount metadata size calculation is inaccurate and can produce
numbers that are too small.  This is bad because we should calculate a
conservative number - one that is guaranteed to be large enough.

This patch switches the approach to a fixed point calculation because
the existing equation is hard to solve when inaccuracies are taken care
of.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Alberto Garcia <berto@igalia.com>
Message-id: 20170705125738.8777-5-stefanha@redhat.com
Signed-off-by: Max Reitz <mreitz@redhat.com>
block/qcow2.c