|
|
9ae3a8 |
From 0d32273cd7f5daa7431b5e2068537154dea101fb Mon Sep 17 00:00:00 2001
|
|
|
9ae3a8 |
From: Max Reitz <mreitz@redhat.com>
|
|
|
9ae3a8 |
Date: Mon, 4 Nov 2013 22:32:30 +0100
|
|
|
9ae3a8 |
Subject: [PATCH 37/87] qcow2: Make overlap check mask variable
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
RH-Author: Max Reitz <mreitz@redhat.com>
|
|
|
9ae3a8 |
Message-id: <1383604354-12743-40-git-send-email-mreitz@redhat.com>
|
|
|
9ae3a8 |
Patchwork-id: 55339
|
|
|
9ae3a8 |
O-Subject: [RHEL-7.0 qemu-kvm PATCH 39/43] qcow2: Make overlap check mask variable
|
|
|
9ae3a8 |
Bugzilla: 1004347
|
|
|
9ae3a8 |
RH-Acked-by: Kevin Wolf <kwolf@redhat.com>
|
|
|
9ae3a8 |
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>
|
|
|
9ae3a8 |
RH-Acked-by: Fam Zheng <famz@redhat.com>
|
|
|
9ae3a8 |
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
BZ: 1004347
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Replace the QCOW2_OL_DEFAULT macro by a variable overlap_check in
|
|
|
9ae3a8 |
BDRVQcowState.
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Signed-off-by: Max Reitz <mreitz@redhat.com>
|
|
|
9ae3a8 |
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
|
|
9ae3a8 |
(cherry picked from commit 3e3553905cfc814d59de6d1a634c3a991b2a9257)
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Signed-off-by: Max Reitz <mreitz@redhat.com>
|
|
|
9ae3a8 |
---
|
|
|
9ae3a8 |
block/qcow2-refcount.c | 2 +-
|
|
|
9ae3a8 |
block/qcow2.c | 2 ++
|
|
|
9ae3a8 |
block/qcow2.h | 5 ++---
|
|
|
9ae3a8 |
3 files changed, 5 insertions(+), 4 deletions(-)
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
9ae3a8 |
---
|
|
|
9ae3a8 |
block/qcow2-refcount.c | 2 +-
|
|
|
9ae3a8 |
block/qcow2.c | 2 ++
|
|
|
9ae3a8 |
block/qcow2.h | 5 ++---
|
|
|
9ae3a8 |
3 files changed, 5 insertions(+), 4 deletions(-)
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
diff --git a/block/qcow2-refcount.c b/block/qcow2-refcount.c
|
|
|
9ae3a8 |
index 91c446b..3787314 100644
|
|
|
9ae3a8 |
--- a/block/qcow2-refcount.c
|
|
|
9ae3a8 |
+++ b/block/qcow2-refcount.c
|
|
|
9ae3a8 |
@@ -1629,7 +1629,7 @@ int qcow2_check_metadata_overlap(BlockDriverState *bs, int ign, int64_t offset,
|
|
|
9ae3a8 |
int64_t size)
|
|
|
9ae3a8 |
{
|
|
|
9ae3a8 |
BDRVQcowState *s = bs->opaque;
|
|
|
9ae3a8 |
- int chk = QCOW2_OL_DEFAULT & ~ign;
|
|
|
9ae3a8 |
+ int chk = s->overlap_check & ~ign;
|
|
|
9ae3a8 |
int i, j;
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
if (!size) {
|
|
|
9ae3a8 |
diff --git a/block/qcow2.c b/block/qcow2.c
|
|
|
9ae3a8 |
index ac5ed47..157361f 100644
|
|
|
9ae3a8 |
--- a/block/qcow2.c
|
|
|
9ae3a8 |
+++ b/block/qcow2.c
|
|
|
9ae3a8 |
@@ -630,6 +630,8 @@ static int qcow2_open(BlockDriverState *bs, QDict *options, int flags,
|
|
|
9ae3a8 |
s->discard_passthrough[QCOW2_DISCARD_OTHER] =
|
|
|
9ae3a8 |
qemu_opt_get_bool(opts, QCOW2_OPT_DISCARD_OTHER, false);
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
+ s->overlap_check = QCOW2_OL_CACHED;
|
|
|
9ae3a8 |
+
|
|
|
9ae3a8 |
qemu_opts_del(opts);
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
if (s->use_lazy_refcounts && s->qcow_version < 3) {
|
|
|
9ae3a8 |
diff --git a/block/qcow2.h b/block/qcow2.h
|
|
|
9ae3a8 |
index 64ad43c..d1fd91b 100644
|
|
|
9ae3a8 |
--- a/block/qcow2.h
|
|
|
9ae3a8 |
+++ b/block/qcow2.h
|
|
|
9ae3a8 |
@@ -202,6 +202,8 @@ typedef struct BDRVQcowState {
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
bool discard_passthrough[QCOW2_DISCARD_MAX];
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
+ int overlap_check; /* bitmask of Qcow2MetadataOverlap values */
|
|
|
9ae3a8 |
+
|
|
|
9ae3a8 |
uint64_t incompatible_features;
|
|
|
9ae3a8 |
uint64_t compatible_features;
|
|
|
9ae3a8 |
uint64_t autoclear_features;
|
|
|
9ae3a8 |
@@ -320,9 +322,6 @@ typedef enum QCow2MetadataOverlap {
|
|
|
9ae3a8 |
QCOW2_OL_REFCOUNT_TABLE | QCOW2_OL_REFCOUNT_BLOCK | \
|
|
|
9ae3a8 |
QCOW2_OL_SNAPSHOT_TABLE | QCOW2_OL_INACTIVE_L1)
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
-/* The default checks to perform */
|
|
|
9ae3a8 |
-#define QCOW2_OL_DEFAULT QCOW2_OL_CACHED
|
|
|
9ae3a8 |
-
|
|
|
9ae3a8 |
#define L1E_OFFSET_MASK 0x00ffffffffffff00ULL
|
|
|
9ae3a8 |
#define L2E_OFFSET_MASK 0x00ffffffffffff00ULL
|
|
|
9ae3a8 |
#define L2E_COMPRESSED_OFFSET_SIZE_MASK 0x3fffffffffffffffULL
|
|
|
9ae3a8 |
--
|
|
|
9ae3a8 |
1.7.1
|
|
|
9ae3a8 |
|