Received: from eggs.gnu.org ([2001:4830:134:3::10]:33550) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VMwDO-0000Du-3A for qemu-devel@nongnu.org; Fri, 20 Sep 2013 04:37:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VMwDH-0003Cr-4W for qemu-devel@nongnu.org; Fri, 20 Sep 2013 04:37:26 -0400 Received: from mx1.redhat.com ([209.132.183.28]:58414) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VMwDG-0003Cn-Ra for qemu-devel@nongnu.org; Fri, 20 Sep 2013 04:37:19 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r8K8bIuK016735 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 20 Sep 2013 04:37:18 -0400 From: Max Reitz Date: Fri, 20 Sep 2013 10:37:07 +0200 Message-Id: <1379666231-10443-3-git-send-email-mreitz@redhat.com> In-Reply-To: <1379666231-10443-1-git-send-email-mreitz@redhat.com> References: <1379666231-10443-1-git-send-email-mreitz@redhat.com> Subject: [Qemu-devel] [PATCH 2/6] qcow2: Make overlap check mask variable List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Kevin Wolf , Stefan Hajnoczi , Max Reitz Replace the QCOW2_OL_DEFAULT macro by a variable overlap_check in BDRVQcowState. Signed-off-by: Max Reitz --- block/qcow2-refcount.c | 2 +- block/qcow2.c | 2 ++ block/qcow2.h | 5 ++--- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/block/qcow2-refcount.c b/block/qcow2-refcount.c index 2fa6acb..3edd558 100644 --- a/block/qcow2-refcount.c +++ b/block/qcow2-refcount.c @@ -1650,7 +1650,7 @@ int qcow2_check_metadata_overlap(BlockDriverState *bs, int ign, int64_t offset, int64_t size) { BDRVQcowState *s = bs->opaque; - int chk = QCOW2_OL_DEFAULT & ~ign; + int chk = s->overlap_check & ~ign; int i, j; if (!size) { diff --git a/block/qcow2.c b/block/qcow2.c index 13c9d5e..a1b854c 100644 --- a/block/qcow2.c +++ b/block/qcow2.c @@ -631,6 +631,8 @@ static int qcow2_open(BlockDriverState *bs, QDict *options, int flags, s->discard_passthrough[QCOW2_DISCARD_OTHER] = qemu_opt_get_bool(opts, QCOW2_OPT_DISCARD_OTHER, false); + s->overlap_check = QCOW2_OL_CACHED; + qemu_opts_del(opts); if (s->use_lazy_refcounts && s->qcow_version < 3) { diff --git a/block/qcow2.h b/block/qcow2.h index b5a158f..7dd787d 100644 --- a/block/qcow2.h +++ b/block/qcow2.h @@ -203,6 +203,8 @@ typedef struct BDRVQcowState { bool discard_passthrough[QCOW2_DISCARD_MAX]; + int overlap_check; /* bitmask of Qcow2MetadataOverlap values */ + uint64_t incompatible_features; uint64_t compatible_features; uint64_t autoclear_features; @@ -321,9 +323,6 @@ typedef enum QCow2MetadataOverlap { QCOW2_OL_REFCOUNT_TABLE | QCOW2_OL_REFCOUNT_BLOCK | \ QCOW2_OL_SNAPSHOT_TABLE | QCOW2_OL_INACTIVE_L1) -/* The default checks to perform */ -#define QCOW2_OL_DEFAULT QCOW2_OL_CACHED - #define L1E_OFFSET_MASK 0x00ffffffffffff00ULL #define L2E_OFFSET_MASK 0x00ffffffffffff00ULL #define L2E_COMPRESSED_OFFSET_SIZE_MASK 0x3fffffffffffffffULL -- 1.8.3.1