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