From patchwork Fri Sep 13 11:50:37 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kevin Wolf X-Patchwork-Id: 274764 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 0FD112C015D for ; Fri, 13 Sep 2013 22:14:31 +1000 (EST) Received: from localhost ([::1]:46175 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VKRxy-0003eh-Jz for incoming@patchwork.ozlabs.org; Fri, 13 Sep 2013 07:55:14 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40450) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VKRuG-0006NU-Ot for qemu-devel@nongnu.org; Fri, 13 Sep 2013 07:51:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VKRuA-0001Pv-Km for qemu-devel@nongnu.org; Fri, 13 Sep 2013 07:51:24 -0400 Received: from mx1.redhat.com ([209.132.183.28]:47672) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VKRuA-0001Pi-Cp for qemu-devel@nongnu.org; Fri, 13 Sep 2013 07:51:18 -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 r8DBpGgV005846 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 13 Sep 2013 07:51:17 -0400 Received: from dhcp-200-207.str.redhat.com (dhcp-192-197.str.redhat.com [10.33.192.197]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r8DBp5Ei032643; Fri, 13 Sep 2013 07:51:15 -0400 From: Kevin Wolf To: anthony@codemonkey.ws Date: Fri, 13 Sep 2013 13:50:37 +0200 Message-Id: <1379073063-14963-8-git-send-email-kwolf@redhat.com> In-Reply-To: <1379073063-14963-1-git-send-email-kwolf@redhat.com> References: <1379073063-14963-1-git-send-email-kwolf@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: kwolf@redhat.com, qemu-devel@nongnu.org Subject: [Qemu-devel] [PULL 07/33] qcow2: Save refcount order in BDRVQcowState 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 From: Max Reitz Save the image refcount order in BDRVQcowState. This will be relevant for future code supporting different refcount orders than four and also for code that needs to verify a certain refcount order for an opened image. Signed-off-by: Max Reitz Signed-off-by: Kevin Wolf --- block/qcow2.c | 3 ++- block/qcow2.h | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/block/qcow2.c b/block/qcow2.c index c9e266e..27203f8 100644 --- a/block/qcow2.c +++ b/block/qcow2.c @@ -455,6 +455,7 @@ static int qcow2_open(BlockDriverState *bs, QDict *options, int flags) ret = -ENOTSUP; goto fail; } + s->refcount_order = header.refcount_order; if (header.cluster_bits < MIN_CLUSTER_BITS || header.cluster_bits > MAX_CLUSTER_BITS) { @@ -1143,7 +1144,7 @@ int qcow2_update_header(BlockDriverState *bs) .incompatible_features = cpu_to_be64(s->incompatible_features), .compatible_features = cpu_to_be64(s->compatible_features), .autoclear_features = cpu_to_be64(s->autoclear_features), - .refcount_order = cpu_to_be32(3 + REFCOUNT_SHIFT), + .refcount_order = cpu_to_be32(s->refcount_order), .header_length = cpu_to_be32(header_length), }; diff --git a/block/qcow2.h b/block/qcow2.h index 48080fd..bea6ddb 100644 --- a/block/qcow2.h +++ b/block/qcow2.h @@ -199,6 +199,7 @@ typedef struct BDRVQcowState { int flags; int qcow_version; bool use_lazy_refcounts; + int refcount_order; bool discard_passthrough[QCOW2_DISCARD_MAX];