Blame SOURCES/kvm-bloc-qcow2-drop-dirty_bitmaps_loaded-state-variable.patch

7711c0
From 428b1ae675f8018ef457d095d726bc2e4cc5b5d4 Mon Sep 17 00:00:00 2001
7711c0
From: John Snow <jsnow@redhat.com>
7711c0
Date: Wed, 6 Feb 2019 22:12:40 +0100
7711c0
Subject: [PATCH 30/33] bloc/qcow2: drop dirty_bitmaps_loaded state variable
7711c0
7711c0
RH-Author: John Snow <jsnow@redhat.com>
7711c0
Message-id: <20190206221243.7407-21-jsnow@redhat.com>
7711c0
Patchwork-id: 84279
7711c0
O-Subject: [RHEL-7.7 qemu-kvm-rhev PATCH v2 20/23] bloc/qcow2: drop dirty_bitmaps_loaded state variable
7711c0
Bugzilla: 1658343
7711c0
RH-Acked-by: Thomas Huth <thuth@redhat.com>
7711c0
RH-Acked-by: Laurent Vivier <lvivier@redhat.com>
7711c0
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
7711c0
7711c0
From: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
7711c0
7711c0
This variable doesn't work as it should, because it is actually cleared
7711c0
in qcow2_co_invalidate_cache() by memset(). Drop it, as the following
7711c0
patch will introduce new behavior.
7711c0
7711c0
Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
7711c0
Reviewed-by: John Snow <jsnow@redhat.com>
7711c0
Signed-off-by: John Snow <jsnow@redhat.com>
7711c0
(cherry picked from commit 2ea427effff61efa5d0dc69f9cae126d13879617)
7711c0
Signed-off-by: John Snow <jsnow@redhat.com>
7711c0
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
7711c0
---
7711c0
 block/qcow2.c | 19 ++-----------------
7711c0
 block/qcow2.h |  1 -
7711c0
 2 files changed, 2 insertions(+), 18 deletions(-)
7711c0
7711c0
diff --git a/block/qcow2.c b/block/qcow2.c
7711c0
index 5c5530d..d260cd6 100644
7711c0
--- a/block/qcow2.c
7711c0
+++ b/block/qcow2.c
7711c0
@@ -1149,7 +1149,6 @@ static int coroutine_fn qcow2_do_open(BlockDriverState *bs, QDict *options,
7711c0
     uint64_t ext_end;
7711c0
     uint64_t l1_vm_state_index;
7711c0
     bool update_header = false;
7711c0
-    bool header_updated = false;
7711c0
 
7711c0
     ret = bdrv_pread(bs->file, 0, &header, sizeof(header));
7711c0
     if (ret < 0) {
7711c0
@@ -1488,23 +1487,9 @@ static int coroutine_fn qcow2_do_open(BlockDriverState *bs, QDict *options,
7711c0
         s->autoclear_features &= QCOW2_AUTOCLEAR_MASK;
7711c0
     }
7711c0
 
7711c0
-    if (s->dirty_bitmaps_loaded) {
7711c0
-        /* It's some kind of reopen. There are no known cases where we need to
7711c0
-         * reload bitmaps in such a situation, so it's safer to skip them.
7711c0
-         *
7711c0
-         * Moreover, if we have some readonly bitmaps and we are reopening for
7711c0
-         * rw we should reopen bitmaps correspondingly.
7711c0
-         */
7711c0
-        if (bdrv_has_readonly_bitmaps(bs) &&
7711c0
-            !bdrv_is_read_only(bs) && !(bdrv_get_flags(bs) & BDRV_O_INACTIVE))
7711c0
-        {
7711c0
-            qcow2_reopen_bitmaps_rw_hint(bs, &header_updated, &local_err);
7711c0
-        }
7711c0
-    } else {
7711c0
-        header_updated = qcow2_load_dirty_bitmaps(bs, &local_err);
7711c0
-        s->dirty_bitmaps_loaded = true;
7711c0
+    if (qcow2_load_dirty_bitmaps(bs, &local_err)) {
7711c0
+        update_header = false;
7711c0
     }
7711c0
-    update_header = update_header && !header_updated;
7711c0
     if (local_err != NULL) {
7711c0
         error_propagate(errp, local_err);
7711c0
         ret = -EINVAL;
7711c0
diff --git a/block/qcow2.h b/block/qcow2.h
7711c0
index d2c63e4..43163b2 100644
7711c0
--- a/block/qcow2.h
7711c0
+++ b/block/qcow2.h
7711c0
@@ -299,7 +299,6 @@ typedef struct BDRVQcow2State {
7711c0
     uint32_t nb_bitmaps;
7711c0
     uint64_t bitmap_directory_size;
7711c0
     uint64_t bitmap_directory_offset;
7711c0
-    bool dirty_bitmaps_loaded;
7711c0
 
7711c0
     int flags;
7711c0
     int qcow_version;
7711c0
-- 
7711c0
1.8.3.1
7711c0