qemu-block
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-block] [PATCH 07/24] qcow2: add bitmaps extension


From: Vladimir Sementsov-Ogievskiy
Subject: Re: [Qemu-block] [PATCH 07/24] qcow2: add bitmaps extension
Date: Mon, 30 Jan 2017 10:21:37 +0300
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.6.0

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 <address@hidden>
---
  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

[Prev in Thread] Current Thread [Next in Thread]