Now we support extensions saving and can let to work with them in
read-write mode.

Place dirty bitmap loading after used bitmap initialization - in the next
patch we will work with used bitmap during dirty bitmap loading.

Signed-off-by: Alexander Ivanov <alexander.iva...@virtuozzo.com>
---
 block/parallels-ext.c |  4 ----
 block/parallels.c     | 25 ++++++++-----------------
 2 files changed, 8 insertions(+), 21 deletions(-)

diff --git a/block/parallels-ext.c b/block/parallels-ext.c
index 7fa14b057d..2d839006a4 100644
--- a/block/parallels-ext.c
+++ b/block/parallels-ext.c
@@ -175,10 +175,6 @@ parallels_load_bitmap(BlockDriverState *bs, uint8_t *data, 
size_t data_size,
         return NULL;
     }
 
-    /* We support format extension only for RO parallels images. */
-    assert(!(bs->open_flags & BDRV_O_RDWR));
-    bdrv_dirty_bitmap_set_readonly(bitmap, true);
-
     return bitmap;
 }
 
diff --git a/block/parallels.c b/block/parallels.c
index 9536e4241e..f51e35788e 100644
--- a/block/parallels.c
+++ b/block/parallels.c
@@ -1378,23 +1378,6 @@ static int parallels_open(BlockDriverState *bs, QDict 
*options, int flags,
         s->header_size = size;
     }
 
-    if (ph.ext_off) {
-        if (flags & BDRV_O_RDWR) {
-            /*
-             * It's unsafe to open image RW if there is an extension (as we
-             * don't support it). But parallels driver in QEMU historically
-             * ignores the extension, so print warning and don't care.
-             */
-            warn_report("Format Extension ignored in RW mode");
-        } else {
-            ret = parallels_read_format_extension(
-                    bs, le64_to_cpu(ph.ext_off) << BDRV_SECTOR_BITS, errp);
-            if (ret < 0) {
-                goto fail;
-            }
-        }
-    }
-
     if ((flags & BDRV_O_RDWR) && !(flags & BDRV_O_INACTIVE)) {
         s->header->inuse = cpu_to_le32(HEADER_INUSE_MAGIC);
         ret = parallels_update_header(bs);
@@ -1432,6 +1415,14 @@ static int parallels_open(BlockDriverState *bs, QDict 
*options, int flags,
     }
     need_check = need_check || ret < 0; /* These are correctable errors */
 
+    if (ph.ext_off) {
+        ret = parallels_read_format_extension(
+                bs, le64_to_cpu(ph.ext_off) << BDRV_SECTOR_BITS, errp);
+        if (ret < 0) {
+            goto fail;
+        }
+    }
+
     /*
      * We don't repair the image here if it's opened for checks. Also we don't
      * want to change inactive images and can't change readonly images.
-- 
2.40.1


Reply via email to