From nobody Thu Apr 25 11:57:39 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1585071925; cv=none; d=zohomail.com; s=zohoarc; b=bEyiTam0F6TiTfN1J3NEDs/HX2w79TQUFv0TGWMaqsh/JdlxHNSxniKQSGiDm7Z1+lvMic6bq+q0D2vu4j5OnpzY3HqmfEXa43NadG49na7jlcKup64tLL0S6S8wfGoaVR7cLLwnmNM3lzfaD0agZBpgrHpiE+3bTkFgIlPlX4E= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1585071925; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=pUcEpHT8Uzfw8y4D8iDNs1gTxjJECUDULaSvlQH1DRI=; b=eaoQKFozpqWMfbk8ip0SZLHE2l8dEfXc9SW3vw0+CGDQYj8ntPZX8k0mOuyg/VJlBGBE75HehrOXmkz3gcIvAItwyF1EBbaL/UwT5XIp7fN22hE0L7OhXnaWK5BNh4d6f46hRa00gLUtpfLY1urgJ/dXCn+NFWrYXiXEm58swc0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 158507192568127.311715204734128; Tue, 24 Mar 2020 10:45:25 -0700 (PDT) Received: from localhost ([::1]:52928 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jGncC-0007pe-Ay for importer@patchew.org; Tue, 24 Mar 2020 13:45:24 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58711) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jGnZZ-0004Zy-6t for qemu-devel@nongnu.org; Tue, 24 Mar 2020 13:42:42 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jGnZY-0007Tr-83 for qemu-devel@nongnu.org; Tue, 24 Mar 2020 13:42:41 -0400 Received: from us-smtp-delivery-74.mimecast.com ([216.205.24.74]:36986) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jGnZY-0007Ta-4Y for qemu-devel@nongnu.org; Tue, 24 Mar 2020 13:42:40 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-251-awxce53kPHWYXXm3CcT-Ng-1; Tue, 24 Mar 2020 13:42:38 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 1C02B107ACC4; Tue, 24 Mar 2020 17:42:37 +0000 (UTC) Received: from blue.redhat.com (ovpn-113-103.phx2.redhat.com [10.3.113.103]) by smtp.corp.redhat.com (Postfix) with ESMTP id 696FC1001B0B; Tue, 24 Mar 2020 17:42:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1585071759; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=pUcEpHT8Uzfw8y4D8iDNs1gTxjJECUDULaSvlQH1DRI=; b=f1nw7wgrwisarRP1mts41fOnZ5oueaDywpVooPY/DBnZaeSHDdTORIMzvmV/Ykt6DDkhOV /S+kkTNBX43+gDjDNxL/qnT8rglPazNI1RATsQ73B1VjxjXRhV8PwJVE8eASfH9y+dMCey Yqnn3hORUY6dhPwNn6gQLVbqMBwDris= X-MC-Unique: awxce53kPHWYXXm3CcT-Ng-1 From: Eric Blake To: qemu-devel@nongnu.org Subject: [PATCH v2 1/4] qcow2: Comment typo fixes Date: Tue, 24 Mar 2020 12:42:30 -0500 Message-Id: <20200324174233.1622067-2-eblake@redhat.com> In-Reply-To: <20200324174233.1622067-1-eblake@redhat.com> References: <20200324174233.1622067-1-eblake@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 216.205.24.74 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, Vladimir Sementsov-Ogievskiy , Alberto Garcia , qemu-block@nongnu.org, mreitz@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Various trivial typos noticed while working on this file. Signed-off-by: Eric Blake Reviewed-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Alberto Garcia --- block/qcow2.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/block/qcow2.c b/block/qcow2.c index d1da3d91db21..5a7f30e692a2 100644 --- a/block/qcow2.c +++ b/block/qcow2.c @@ -177,7 +177,7 @@ static ssize_t qcow2_crypto_hdr_write_func(QCryptoBlock= *block, size_t offset, } -/*=20 +/* * read qcow2 extension and fill bs * start reading from start_offset * finish reading upon magic of value 0 or when end_offset reached @@ -3255,7 +3255,7 @@ qcow2_co_create(BlockdevCreateOptions *create_options= , Error **errp) * inconsistency later. * * We do need a refcount table because growing the refcount table means - * allocating two new refcount blocks - the seconds of which would be = at + * allocating two new refcount blocks - the second of which would be at * 2 GB for 64k clusters, and we don't want to have a 2 GB initial file * size for any qcow2 image. */ @@ -3500,7 +3500,7 @@ qcow2_co_create(BlockdevCreateOptions *create_options= , Error **errp) goto out; } - /* Want a backing file? There you go.*/ + /* Want a backing file? There you go. */ if (qcow2_opts->has_backing_file) { const char *backing_format =3D NULL; --=20 2.26.0.rc2 From nobody Thu Apr 25 11:57:39 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1585071856; cv=none; d=zohomail.com; s=zohoarc; b=O1MgFSmCLd5bkH0dIw07HBaLlN+M0OztTYBGcxW/a4MLztMH2Ewe+HAY+QNKd3lG0VY/9t9d9zsSLeZovV1U/5ZaajHWLYGu0ton6xOsmCQEPXc1x8u/lsH6tyz2qwLAG3UIaZi5cEGifvSzs1466jA7ePYoQo61deL0Ue5N4us= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1585071856; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=U6wtncJP3zO6sGz8kGxr5WteIftJyjdZ7Vd49Bzf7j0=; b=YKwQT7Zjvj30uwoktp1JMpZgtKRymhHy1Tk6L0z7SFZRGe20ZEqpBl8a3YUpn1rdQZ8yw7A7RhNYlezR+RlyPb+d/itjFSIQqFB7YMk0ArQO2sU7srYXd2WWYKXDhrcDIWyhApL31KCQGNGZ5gh/bYbEpOOkfvUZkiIfFwqUQa8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1585071856082663.849061485016; Tue, 24 Mar 2020 10:44:16 -0700 (PDT) Received: from localhost ([::1]:52906 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jGnb3-0006E8-3o for importer@patchew.org; Tue, 24 Mar 2020 13:44:13 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58734) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jGnZa-0004cq-T0 for qemu-devel@nongnu.org; Tue, 24 Mar 2020 13:42:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jGnZZ-0007US-Iz for qemu-devel@nongnu.org; Tue, 24 Mar 2020 13:42:42 -0400 Received: from us-smtp-delivery-74.mimecast.com ([63.128.21.74]:21710) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jGnZZ-0007UF-Du for qemu-devel@nongnu.org; Tue, 24 Mar 2020 13:42:41 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-16-cYBQkxDENz6vbF9BbQgegA-1; Tue, 24 Mar 2020 13:42:39 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id C6B7F800D53; Tue, 24 Mar 2020 17:42:37 +0000 (UTC) Received: from blue.redhat.com (ovpn-113-103.phx2.redhat.com [10.3.113.103]) by smtp.corp.redhat.com (Postfix) with ESMTP id 529FD1000322; Tue, 24 Mar 2020 17:42:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1585071761; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=U6wtncJP3zO6sGz8kGxr5WteIftJyjdZ7Vd49Bzf7j0=; b=AcoquW/16y2ELatYbbTU+Y/YuRkpU9oJUyJNb7w/NF4xc3obU8AHh436VuMEFiSHYyhHQ7 3Zk3334auvW/um6tLqlj63MZTXLblMduDf3ZGGFiUKkHb+GRTPH3j7kGryHa/RHaCA8PwH 36K2sbA0Rk/8umZHHSDdWuv1xneDR1I= X-MC-Unique: cYBQkxDENz6vbF9BbQgegA-1 From: Eric Blake To: qemu-devel@nongnu.org Subject: [PATCH v2 2/4] qcow2: List autoclear bit names in header Date: Tue, 24 Mar 2020 12:42:31 -0500 Message-Id: <20200324174233.1622067-3-eblake@redhat.com> In-Reply-To: <20200324174233.1622067-1-eblake@redhat.com> References: <20200324174233.1622067-1-eblake@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 63.128.21.74 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, Vladimir Sementsov-Ogievskiy , qemu-block@nongnu.org, mreitz@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" The feature table is supposed to advertise the name of all feature bits that we support; however, we forgot to update the table for autoclear bits. While at it, move the table to read-only memory in code, and tweak the qcow2 spec to name the second autoclear bit. Update iotests that are affected by the longer header length. Fixes: 88ddffae Fixes: 93c24936 Signed-off-by: Eric Blake Reviewed-by: Vladimir Sementsov-Ogievskiy --- [v2] tweak name of "bitmaps" autoclear bit [Vladimir] --- docs/interop/qcow2.txt | 3 ++- block/qcow2.c | 12 +++++++++++- tests/qemu-iotests/031.out | 8 ++++---- tests/qemu-iotests/036.out | 4 ++-- tests/qemu-iotests/061.out | 14 +++++++------- 5 files changed, 26 insertions(+), 15 deletions(-) diff --git a/docs/interop/qcow2.txt b/docs/interop/qcow2.txt index 5597e244746e..640e0eca4000 100644 --- a/docs/interop/qcow2.txt +++ b/docs/interop/qcow2.txt @@ -143,7 +143,8 @@ the next fields through header_length. bit is unset, the bitmaps extension data m= ust be considered inconsistent. - Bit 1: If this bit is set, the external data file= can + Bit 1: Raw external data bit + If this bit is set, the external data file= can be read as a consistent standalone raw ima= ge without looking at the qcow2 metadata. diff --git a/block/qcow2.c b/block/qcow2.c index 5a7f30e692a2..67b0c214fba4 100644 --- a/block/qcow2.c +++ b/block/qcow2.c @@ -2825,7 +2825,7 @@ int qcow2_update_header(BlockDriverState *bs) /* Feature table */ if (s->qcow_version >=3D 3) { - Qcow2Feature features[] =3D { + static const Qcow2Feature features[] =3D { { .type =3D QCOW2_FEAT_TYPE_INCOMPATIBLE, .bit =3D QCOW2_INCOMPAT_DIRTY_BITNR, @@ -2846,6 +2846,16 @@ int qcow2_update_header(BlockDriverState *bs) .bit =3D QCOW2_COMPAT_LAZY_REFCOUNTS_BITNR, .name =3D "lazy refcounts", }, + { + .type =3D QCOW2_FEAT_TYPE_AUTOCLEAR, + .bit =3D QCOW2_AUTOCLEAR_BITMAPS_BITNR, + .name =3D "bitmaps", + }, + { + .type =3D QCOW2_FEAT_TYPE_AUTOCLEAR, + .bit =3D QCOW2_AUTOCLEAR_DATA_FILE_RAW_BITNR, + .name =3D "raw external data", + }, }; ret =3D header_ext_add(buf, QCOW2_EXT_MAGIC_FEATURE_TABLE, diff --git a/tests/qemu-iotests/031.out b/tests/qemu-iotests/031.out index d535e407bc30..46f97c5a4ea4 100644 --- a/tests/qemu-iotests/031.out +++ b/tests/qemu-iotests/031.out @@ -117,7 +117,7 @@ header_length 104 Header extension: magic 0x6803f857 -length 192 +length 288 data Header extension: @@ -150,7 +150,7 @@ header_length 104 Header extension: magic 0x6803f857 -length 192 +length 288 data Header extension: @@ -164,7 +164,7 @@ No errors were found on the image. magic 0x514649fb version 3 -backing_file_offset 0x178 +backing_file_offset 0x1d8 backing_file_size 0x17 cluster_bits 16 size 67108864 @@ -188,7 +188,7 @@ data 'host_device' Header extension: magic 0x6803f857 -length 192 +length 288 data Header extension: diff --git a/tests/qemu-iotests/036.out b/tests/qemu-iotests/036.out index 0b52b934e115..23b699ce0622 100644 --- a/tests/qemu-iotests/036.out +++ b/tests/qemu-iotests/036.out @@ -26,7 +26,7 @@ compatible_features [] autoclear_features [63] Header extension: magic 0x6803f857 -length 192 +length 288 data @@ -38,7 +38,7 @@ compatible_features [] autoclear_features [] Header extension: magic 0x6803f857 -length 192 +length 288 data *** done diff --git a/tests/qemu-iotests/061.out b/tests/qemu-iotests/061.out index 8b3091a412bc..413cc4e0f4ab 100644 --- a/tests/qemu-iotests/061.out +++ b/tests/qemu-iotests/061.out @@ -26,7 +26,7 @@ header_length 104 Header extension: magic 0x6803f857 -length 192 +length 288 data magic 0x514649fb @@ -84,7 +84,7 @@ header_length 104 Header extension: magic 0x6803f857 -length 192 +length 288 data magic 0x514649fb @@ -140,7 +140,7 @@ header_length 104 Header extension: magic 0x6803f857 -length 192 +length 288 data ERROR cluster 5 refcount=3D0 reference=3D1 @@ -195,7 +195,7 @@ header_length 104 Header extension: magic 0x6803f857 -length 192 +length 288 data magic 0x514649fb @@ -264,7 +264,7 @@ header_length 104 Header extension: magic 0x6803f857 -length 192 +length 288 data read 65536/65536 bytes at offset 44040192 @@ -298,7 +298,7 @@ header_length 104 Header extension: magic 0x6803f857 -length 192 +length 288 data ERROR cluster 5 refcount=3D0 reference=3D1 @@ -327,7 +327,7 @@ header_length 104 Header extension: magic 0x6803f857 -length 192 +length 288 data read 131072/131072 bytes at offset 0 --=20 2.26.0.rc2 From nobody Thu Apr 25 11:57:39 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1585071994; cv=none; d=zohomail.com; s=zohoarc; b=erEoFskuz7LWWlhogjqN0ULeVAD7DbxxK7EAUpVS71lcuPtTN3EBfygeLD7bBlGPbhZu8AMsnSoSPXryR/0Rjr9x8R2bKohM01Cnw9vC+JWlEqk2J4RokmtV14g+zdFm11Xo+Ck7/EwPN29yKc6u/Qr0U7hkKd7qaBrkgKSL7gE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1585071994; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=Os7shVWGnwyIrqpsGwPcel1dyMctuX/2vS68bUpjp3s=; b=LgfQIfm6rxQq+hPpVS02GJ8RqSfwJosYkXQf97lQDLUvmGhPHzlhub/tQp/EBZ5TdClln81fjCTkratLQgvCIRnmjCbrDqhyBWunCK+mnhES9Ze6n1ItDeirYPdPKyYgocIkIXfh7EtYEpoL97Ya0S5CgqYOwJUp0xqpEqLiEXo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 158507199489297.55549725399749; Tue, 24 Mar 2020 10:46:34 -0700 (PDT) Received: from localhost ([::1]:52962 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jGndJ-00010h-Ld for importer@patchew.org; Tue, 24 Mar 2020 13:46:33 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58788) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jGnZe-0004nG-Mb for qemu-devel@nongnu.org; Tue, 24 Mar 2020 13:42:47 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jGnZd-0007WC-DL for qemu-devel@nongnu.org; Tue, 24 Mar 2020 13:42:46 -0400 Received: from us-smtp-delivery-74.mimecast.com ([216.205.24.74]:23133) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jGnZd-0007Vx-A3 for qemu-devel@nongnu.org; Tue, 24 Mar 2020 13:42:45 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-257-jtPHLTuANZ2abgNMvILVqw-1; Tue, 24 Mar 2020 13:42:40 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 835F0800D5B; Tue, 24 Mar 2020 17:42:38 +0000 (UTC) Received: from blue.redhat.com (ovpn-113-103.phx2.redhat.com [10.3.113.103]) by smtp.corp.redhat.com (Postfix) with ESMTP id 041FB1001B0B; Tue, 24 Mar 2020 17:42:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1585071765; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Os7shVWGnwyIrqpsGwPcel1dyMctuX/2vS68bUpjp3s=; b=WvHj9CftMIxopi01pP35s03oRw8+EvqayWPxwHqUHJ0KtkDvE9Fi93sG/VdAlSgNWPggUr yFjORvtgbZ0yBQJ2pbaqyqtISSYqjPnz8iqLt7Mtd4NOQTw4PJCPIdlTKqDXT35DIuYt/w ZWy1ATORdXEjp0HJNc2gzxwzBUvmaqw= X-MC-Unique: jtPHLTuANZ2abgNMvILVqw-1 From: Eric Blake To: qemu-devel@nongnu.org Subject: [PATCH v2 3/4] qcow2: Avoid feature name extension on small cluster size Date: Tue, 24 Mar 2020 12:42:32 -0500 Message-Id: <20200324174233.1622067-4-eblake@redhat.com> In-Reply-To: <20200324174233.1622067-1-eblake@redhat.com> References: <20200324174233.1622067-1-eblake@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 216.205.24.74 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, Vladimir Sementsov-Ogievskiy , Alberto Garcia , qemu-block@nongnu.org, mreitz@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" As the feature name table can be quite large (over 9k if all 64 bits of all three feature fields have names; a mere 8 features leaves only 8 bytes for a backing file name in a 512-byte cluster), it is unwise to emit this optional header in images with small cluster sizes. Update iotest 036 to skip running on small cluster sizes; meanwhile, note that iotest 061 never passed on alternative cluster sizes (however, I limited this patch to tests with output affected by adding feature names, rather than auditing for other tests that are not robust to alternative cluster sizes). Signed-off-by: Eric Blake Reviewed-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Alberto Garcia --- block/qcow2.c | 11 +++++++++-- tests/qemu-iotests/036 | 6 ++++-- tests/qemu-iotests/061 | 6 ++++-- 3 files changed, 17 insertions(+), 6 deletions(-) diff --git a/block/qcow2.c b/block/qcow2.c index 67b0c214fba4..9475ace57163 100644 --- a/block/qcow2.c +++ b/block/qcow2.c @@ -2823,8 +2823,15 @@ int qcow2_update_header(BlockDriverState *bs) buflen -=3D ret; } - /* Feature table */ - if (s->qcow_version >=3D 3) { + /* + * Feature table. A mere 8 feature names occupies 392 bytes, and + * when coupled with the v3 minimum header of 104 bytes plus the + * 8-byte end-of-extension marker, that would leave only 8 bytes + * for a backing file name in an image with 512-byte clusters. + * Thus, we choose to omit this header for cluster sizes 4k and + * smaller. + */ + if (s->qcow_version >=3D 3 && s->cluster_size > 4096) { static const Qcow2Feature features[] =3D { { .type =3D QCOW2_FEAT_TYPE_INCOMPATIBLE, diff --git a/tests/qemu-iotests/036 b/tests/qemu-iotests/036 index 512598421c20..cf522de7a1aa 100755 --- a/tests/qemu-iotests/036 +++ b/tests/qemu-iotests/036 @@ -44,8 +44,10 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 _supported_fmt qcow2 _supported_proto file # Only qcow2v3 and later supports feature bits; -# qcow2.py does not support external data files -_unsupported_imgopts 'compat=3D0.10' data_file +# qcow2.py does not support external data files; +# this test requires a cluster size large enough for the feature table +_unsupported_imgopts 'compat=3D0.10' data_file \ + 'cluster_size=3D\(512\|1024\|2048\|4096\)' echo echo =3D=3D=3D Image with unknown incompatible feature bit =3D=3D=3D diff --git a/tests/qemu-iotests/061 b/tests/qemu-iotests/061 index 36b040491fef..ce285d308408 100755 --- a/tests/qemu-iotests/061 +++ b/tests/qemu-iotests/061 @@ -44,8 +44,10 @@ _supported_os Linux # Conversion between different compat versions can only really work # with refcount_bits=3D16; # we have explicit tests for data_file here, but the whole test does -# not work with it -_unsupported_imgopts 'refcount_bits=3D\([^1]\|.\([^6]\|$\)\)' data_file +# not work with it; +# we have explicit tests for various cluster sizes, the remaining tests +# require the default 64k cluster +_unsupported_imgopts 'refcount_bits=3D\([^1]\|.\([^6]\|$\)\)' data_file cl= uster_size echo echo "=3D=3D=3D Testing version downgrade with zero expansion =3D=3D=3D" --=20 2.26.0.rc2 From nobody Thu Apr 25 11:57:39 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1585072006; cv=none; d=zohomail.com; s=zohoarc; b=OFvFv7X3b10AyxU3rWeiWuIqmtm863V5vND6lNL7ukJwWFdtW/VRFyLbfus5+P7S/iEsLuQMI4FjnoriUdLvf1KQ7lXEg/tvfYtWdDb2y6lA7C7RYMJ3Ta8BS4MuntrvgWgvdiob/iFZE5i0eCWywTUfFFDQbfXXL+DsiHU3Tu4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1585072006; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=uivZlGw/PF880rbLriUotiKEjwGQJhiL5E+HnBH1sZU=; b=VhM5GxqBnbzvHfiqXlY/MGbqGfAY4Y4RDb1HeN4y9oFu83tmPINWqIAQO1ARmYypNujBLkf6Aq/LjuZoLqzvUBtmTDKWVPXn3x+rqaw8eZKsWhJGfgqxyZOGUKK/QZQ/Gx8Y4qbJH0fVGn3Khw0gvu1y+fUow057hb6YZYhoeP8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1585072006451898.4517576413826; Tue, 24 Mar 2020 10:46:46 -0700 (PDT) Received: from localhost ([::1]:52968 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jGndV-0001It-85 for importer@patchew.org; Tue, 24 Mar 2020 13:46:45 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58756) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jGnZc-0004hx-NV for qemu-devel@nongnu.org; Tue, 24 Mar 2020 13:42:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jGnZb-0007VJ-OB for qemu-devel@nongnu.org; Tue, 24 Mar 2020 13:42:44 -0400 Received: from us-smtp-delivery-74.mimecast.com ([216.205.24.74]:39878) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jGnZb-0007V0-Kd for qemu-devel@nongnu.org; Tue, 24 Mar 2020 13:42:43 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-411-0zejlRMwMhiRPoSrjN4lBg-1; Tue, 24 Mar 2020 13:42:41 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id B1197DBA3; Tue, 24 Mar 2020 17:42:39 +0000 (UTC) Received: from blue.redhat.com (ovpn-113-103.phx2.redhat.com [10.3.113.103]) by smtp.corp.redhat.com (Postfix) with ESMTP id B06C410027A3; Tue, 24 Mar 2020 17:42:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1585071763; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=uivZlGw/PF880rbLriUotiKEjwGQJhiL5E+HnBH1sZU=; b=Qg5jjSkBxz+eoPx7B2SkHzVpgadFwv6jtYj14BEzRQjJ7sdqAja7knbiY26KwUhJmLETPg 2E8Wzken19Bt5X/NDOj64evStCufe9hmazppRf05jeaPDT1d9wZteiTbcsGIND4uYxF0Mr sBW1uUQOQhYz6eLIWgNxDvEH6d90Xws= X-MC-Unique: 0zejlRMwMhiRPoSrjN4lBg-1 From: Eric Blake To: qemu-devel@nongnu.org Subject: [PATCH v2 4/4] sheepdog: Consistently set bdrv_has_zero_init_truncate Date: Tue, 24 Mar 2020 12:42:33 -0500 Message-Id: <20200324174233.1622067-5-eblake@redhat.com> In-Reply-To: <20200324174233.1622067-1-eblake@redhat.com> References: <20200324174233.1622067-1-eblake@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 216.205.24.74 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, Liu Yuan , "open list:Sheepdog" , qemu-block@nongnu.org, mreitz@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" block_int.h claims that .bdrv_has_zero_init must return 0 if .bdrv_has_zero_init_truncate does likewise; but this is violated if only the former callback is provided if .bdrv_co_truncate also exists. When adding the latter callback, it was mistakenly added to only one of the three possible sheepdog instantiations. Fixes: 1dcaf527 Signed-off-by: Eric Blake Reviewed-by: John Snow Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- block/sheepdog.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/block/sheepdog.c b/block/sheepdog.c index cfa84338a2d6..522c16a93676 100644 --- a/block/sheepdog.c +++ b/block/sheepdog.c @@ -3269,6 +3269,7 @@ static BlockDriver bdrv_sheepdog_tcp =3D { .bdrv_co_create =3D sd_co_create, .bdrv_co_create_opts =3D sd_co_create_opts, .bdrv_has_zero_init =3D bdrv_has_zero_init_1, + .bdrv_has_zero_init_truncate =3D bdrv_has_zero_init_1, .bdrv_getlength =3D sd_getlength, .bdrv_get_allocated_file_size =3D sd_get_allocated_file_size, .bdrv_co_truncate =3D sd_co_truncate, @@ -3307,6 +3308,7 @@ static BlockDriver bdrv_sheepdog_unix =3D { .bdrv_co_create =3D sd_co_create, .bdrv_co_create_opts =3D sd_co_create_opts, .bdrv_has_zero_init =3D bdrv_has_zero_init_1, + .bdrv_has_zero_init_truncate =3D bdrv_has_zero_init_1, .bdrv_getlength =3D sd_getlength, .bdrv_get_allocated_file_size =3D sd_get_allocated_file_size, .bdrv_co_truncate =3D sd_co_truncate, --=20 2.26.0.rc2