yeahuh / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone

Blame SOURCES/kvm-qcow2-Add-more-overlap-check-bitmask-macros.patch

9ae3a8
From cd63525d205eda67c64d0838592b819d7f73529f Mon Sep 17 00:00:00 2001
9ae3a8
From: Max Reitz <mreitz@redhat.com>
9ae3a8
Date: Mon, 4 Nov 2013 22:32:33 +0100
9ae3a8
Subject: [PATCH 40/87] qcow2: Add more overlap check bitmask macros
9ae3a8
9ae3a8
RH-Author: Max Reitz <mreitz@redhat.com>
9ae3a8
Message-id: <1383604354-12743-43-git-send-email-mreitz@redhat.com>
9ae3a8
Patchwork-id: 55342
9ae3a8
O-Subject: [RHEL-7.0 qemu-kvm PATCH 42/43] qcow2: Add more overlap check bitmask macros
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
Introduces the macros QCOW2_OL_CONSTANT and QCOW2_OL_ALL in addition to
9ae3a8
the already existing QCOW2_OL_CACHED, signifying all metadata overlap
9ae3a8
checks that can be performed in constant time (regardless of image size
9ae3a8
etc.) and truly all available overlap checks, respectively.
9ae3a8
9ae3a8
Signed-off-by: Max Reitz <mreitz@redhat.com>
9ae3a8
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
9ae3a8
(cherry picked from commit 4a273c398b0c96985d56fed8156e19876b2e3c9e)
9ae3a8
9ae3a8
Signed-off-by: Max Reitz <mreitz@redhat.com>
9ae3a8
---
9ae3a8
 block/qcow2.h | 14 +++++++++++---
9ae3a8
 1 file changed, 11 insertions(+), 3 deletions(-)
9ae3a8
9ae3a8
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
9ae3a8
---
9ae3a8
 block/qcow2.h |   14 +++++++++++---
9ae3a8
 1 files changed, 11 insertions(+), 3 deletions(-)
9ae3a8
9ae3a8
diff --git a/block/qcow2.h b/block/qcow2.h
9ae3a8
index 1bba3ed..e4c140c 100644
9ae3a8
--- a/block/qcow2.h
9ae3a8
+++ b/block/qcow2.h
9ae3a8
@@ -325,11 +325,19 @@ typedef enum QCow2MetadataOverlap {
9ae3a8
     QCOW2_OL_INACTIVE_L2    = (1 << QCOW2_OL_INACTIVE_L2_BITNR),
9ae3a8
 } QCow2MetadataOverlap;
9ae3a8
 
9ae3a8
+/* Perform all overlap checks which can be done in constant time */
9ae3a8
+#define QCOW2_OL_CONSTANT \
9ae3a8
+    (QCOW2_OL_MAIN_HEADER | QCOW2_OL_ACTIVE_L1 | QCOW2_OL_REFCOUNT_TABLE | \
9ae3a8
+     QCOW2_OL_SNAPSHOT_TABLE)
9ae3a8
+
9ae3a8
 /* Perform all overlap checks which don't require disk access */
9ae3a8
 #define QCOW2_OL_CACHED \
9ae3a8
-    (QCOW2_OL_MAIN_HEADER | QCOW2_OL_ACTIVE_L1 | QCOW2_OL_ACTIVE_L2 | \
9ae3a8
-     QCOW2_OL_REFCOUNT_TABLE | QCOW2_OL_REFCOUNT_BLOCK | \
9ae3a8
-     QCOW2_OL_SNAPSHOT_TABLE | QCOW2_OL_INACTIVE_L1)
9ae3a8
+    (QCOW2_OL_CONSTANT | QCOW2_OL_ACTIVE_L2 | QCOW2_OL_REFCOUNT_BLOCK | \
9ae3a8
+     QCOW2_OL_INACTIVE_L1)
9ae3a8
+
9ae3a8
+/* Perform all overlap checks */
9ae3a8
+#define QCOW2_OL_ALL \
9ae3a8
+    (QCOW2_OL_CACHED | QCOW2_OL_INACTIVE_L2)
9ae3a8
 
9ae3a8
 #define L1E_OFFSET_MASK 0x00ffffffffffff00ULL
9ae3a8
 #define L2E_OFFSET_MASK 0x00ffffffffffff00ULL
9ae3a8
-- 
9ae3a8
1.7.1
9ae3a8