From patchwork Fri Sep 20 08:37:07 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Max Reitz X-Patchwork-Id: 276254 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 952B02C012B for ; Fri, 20 Sep 2013 18:39:37 +1000 (EST) Received: from localhost ([::1]:54673 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VMwFT-0003KY-OB for incoming@patchwork.ozlabs.org; Fri, 20 Sep 2013 04:39:35 -0400 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 Received: from localhost (dhcp-200-247.str.redhat.com [10.33.200.247]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r8K8bGLv008158 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NO); Fri, 20 Sep 2013 04:37:17 -0400 From: Max Reitz To: qemu-devel@nongnu.org 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> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: Kevin Wolf , Stefan Hajnoczi , Max Reitz Subject: [Qemu-devel] [PATCH 2/6] qcow2: Make overlap check mask variable X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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