29.01.2017 00:29, Max Reitz wrote:
On 23.01.2017 13:10, Vladimir Sementsov-Ogievskiy wrote:
Add bitmap extension as specified in docs/specs/qcow2.txt.
For now, just mirror extension header into Qcow2 state and check
constraints.

For now, disable image resize if it has bitmaps. It will be fixed later.

Signed-off-by: Vladimir Sementsov-Ogievskiy <vsement...@virtuozzo.com>
---
  block/qcow2.c | 119 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
  block/qcow2.h |  24 ++++++++++++
  2 files changed, 141 insertions(+), 2 deletions(-)

diff --git a/block/qcow2.c b/block/qcow2.c
index 96fb8a8f16..a8835988c7 100644
--- a/block/qcow2.c
+++ b/block/qcow2.c
[...]

@@ -185,6 +265,15 @@ static int qcow2_read_extensions(BlockDriverState *bs, 
uint64_t start_offset,
          offset += ((ext.len + 7) & ~7);
      }
+ if (need_update && !bdrv_is_root_node(bs) &&
+        !(bdrv_get_flags(bs) & BDRV_O_INACTIVE))
+    {
+        ret = qcow2_update_header(bs);
Good idea, but qcow2_read_extensions() can be called pretty early in
qcow2_open(). Therefore, some fields in the BDRVQcow2State are not
necessarily set already.

For instance, it is always called before s->snapshots_offset and
s->nb_snapshots are set. Thus, this will effectively always discard all
snapshots.

Max


So, I need to move need_update to qcow2_read_extensions parameters as 'bool *' and handle it later, in the end of qcow2_open. Ok?



--
Best regards,
Vladimir


Reply via email to