From nobody Mon Feb 9 02:13:38 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1494115853121538.7264394339354; Sat, 6 May 2017 17:10:53 -0700 (PDT) Received: from localhost ([::1]:53105 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d79ml-0006Xz-D8 for importer@patchew.org; Sat, 06 May 2017 20:10:51 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45712) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d79i9-0002bI-Vr for qemu-devel@nongnu.org; Sat, 06 May 2017 20:06:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d79i8-0007hy-UQ for qemu-devel@nongnu.org; Sat, 06 May 2017 20:06:05 -0400 Received: from mx1.redhat.com ([209.132.183.28]:57226) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1d79i5-0007gu-V7; Sat, 06 May 2017 20:06:02 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E920480F63; Sun, 7 May 2017 00:06:00 +0000 (UTC) Received: from red.redhat.com (ovpn-122-206.rdu2.redhat.com [10.10.122.206]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3AFA418345; Sun, 7 May 2017 00:06:00 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com E920480F63 Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=eblake@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com E920480F63 From: Eric Blake To: qemu-devel@nongnu.org Date: Sat, 6 May 2017 19:05:42 -0500 Message-Id: <20170507000552.20847-3-eblake@redhat.com> In-Reply-To: <20170507000552.20847-1-eblake@redhat.com> References: <20170507000552.20847-1-eblake@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Sun, 07 May 2017 00:06:01 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v13 02/12] qcow2: Use consistent switch indentation X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, qemu-block@nongnu.org, mreitz@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Fix a couple of inconsistent indentations, before an upcoming patch further tweaks the switch statements. (best viewed with 'git diff -b'). Signed-off-by: Eric Blake Reviewed-by: Max Reitz --- v13: split off non-indentation changes v12: new patch --- block/qcow2-cluster.c | 32 +++++++++---------- block/qcow2-refcount.c | 84 +++++++++++++++++++++++++---------------------= ---- 2 files changed, 58 insertions(+), 58 deletions(-) diff --git a/block/qcow2-cluster.c b/block/qcow2-cluster.c index 31077d8..335a505 100644 --- a/block/qcow2-cluster.c +++ b/block/qcow2-cluster.c @@ -1504,25 +1504,25 @@ static int discard_single_l2(BlockDriverState *bs, = uint64_t offset, * but rather fall through to the backing file. */ switch (qcow2_get_cluster_type(old_l2_entry)) { - case QCOW2_CLUSTER_UNALLOCATED: - if (full_discard || !bs->backing) { - continue; - } - break; + case QCOW2_CLUSTER_UNALLOCATED: + if (full_discard || !bs->backing) { + continue; + } + break; - case QCOW2_CLUSTER_ZERO: - /* Preallocated zero clusters should be discarded in any c= ase */ - if (!full_discard && (old_l2_entry & L2E_OFFSET_MASK) =3D= =3D 0) { - continue; - } - break; + case QCOW2_CLUSTER_ZERO: + /* Preallocated zero clusters should be discarded in any case = */ + if (!full_discard && (old_l2_entry & L2E_OFFSET_MASK) =3D=3D 0= ) { + continue; + } + break; - case QCOW2_CLUSTER_NORMAL: - case QCOW2_CLUSTER_COMPRESSED: - break; + case QCOW2_CLUSTER_NORMAL: + case QCOW2_CLUSTER_COMPRESSED: + break; - default: - abort(); + default: + abort(); } /* First remove L2 entries */ diff --git a/block/qcow2-refcount.c b/block/qcow2-refcount.c index db0af2c..908dbe5 100644 --- a/block/qcow2-refcount.c +++ b/block/qcow2-refcount.c @@ -1128,61 +1128,61 @@ int qcow2_update_snapshot_refcount(BlockDriverState= *bs, offset =3D entry & L2E_OFFSET_MASK; switch (qcow2_get_cluster_type(entry)) { - case QCOW2_CLUSTER_COMPRESSED: - nb_csectors =3D ((entry >> s->csize_shift) & - s->csize_mask) + 1; - if (addend !=3D 0) { - ret =3D update_refcount(bs, + case QCOW2_CLUSTER_COMPRESSED: + nb_csectors =3D ((entry >> s->csize_shift) & + s->csize_mask) + 1; + if (addend !=3D 0) { + ret =3D update_refcount(bs, (entry & s->cluster_offset_mask) & ~511, nb_csectors * 512, abs(addend), addend < 0, QCOW2_DISCARD_SNAPSHOT); - if (ret < 0) { - goto fail; - } - } - /* compressed clusters are never modified */ - refcount =3D 2; - break; - - case QCOW2_CLUSTER_NORMAL: - case QCOW2_CLUSTER_ZERO: - if (offset_into_cluster(s, offset)) { - qcow2_signal_corruption(bs, true, -1, -1, "Dat= a " - "cluster offset %#" PR= Ix64 - " unaligned (L2 offset= : %#" - PRIx64 ", L2 index: %#= x)", - offset, l2_offset, j); - ret =3D -EIO; + if (ret < 0) { goto fail; } + } + /* compressed clusters are never modified */ + refcount =3D 2; + break; - cluster_index =3D offset >> s->cluster_bits; - if (!cluster_index) { - /* unallocated */ - refcount =3D 0; - break; - } - if (addend !=3D 0) { - ret =3D qcow2_update_cluster_refcount(bs, + case QCOW2_CLUSTER_NORMAL: + case QCOW2_CLUSTER_ZERO: + if (offset_into_cluster(s, offset)) { + qcow2_signal_corruption(bs, true, -1, -1, "Data " + "cluster offset %#" PRIx64 + " unaligned (L2 offset: %#" + PRIx64 ", L2 index: %#x)", + offset, l2_offset, j); + ret =3D -EIO; + goto fail; + } + + cluster_index =3D offset >> s->cluster_bits; + if (!cluster_index) { + /* unallocated */ + refcount =3D 0; + break; + } + if (addend !=3D 0) { + ret =3D qcow2_update_cluster_refcount(bs, cluster_index, abs(addend), addend < 0, QCOW2_DISCARD_SNAPSHOT); - if (ret < 0) { - goto fail; - } - } - - ret =3D qcow2_get_refcount(bs, cluster_index, &ref= count); if (ret < 0) { goto fail; } - break; + } - case QCOW2_CLUSTER_UNALLOCATED: - refcount =3D 0; - break; + ret =3D qcow2_get_refcount(bs, cluster_index, &refcoun= t); + if (ret < 0) { + goto fail; + } + break; - default: - abort(); + case QCOW2_CLUSTER_UNALLOCATED: + refcount =3D 0; + break; + + default: + abort(); } if (refcount =3D=3D 1) { --=20 2.9.3