From nobody Sun Feb 8 19:24:46 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.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 (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1572125348; cv=none; d=zoho.com; s=zohoarc; b=DDowK/oZ1sV73W5Z8OccHn3VIGPzf8S0qI74N1NqkdpyyCoGygpAUInr85jwATf26k5TO+9o7h+pOtcHZ2E4iEUkkJ13pacWd3refV5udUTLDOKvBqMnO/QvlICc7ddFVWr0S9TueP/D0PXRsVUem6bMXs1ybqJ5/gJPsMDtwug= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1572125348; h=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=zZzQnFPNZo26UDeXp5FufenA8jUFgfP9E3m3TefOdis=; b=nMmXNQA9fAQm3Ilf5ffJQ8+TXrUp6jqdAnxJkkooepkKnL/bQ11mHyME8U60ko+km7csSMwRxBVf5Lku29kR1RF5dfa940PppnZ21cA87qenLxmmYP9IjmoLkrzq3MQNsY6br61+v02Iv0M78FODvS5RqhaAQfLkrJQzYF9dejM= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1572125347721925.7139005989116; Sat, 26 Oct 2019 14:29:07 -0700 (PDT) Received: from localhost ([::1]:42476 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iOTcL-0003ER-No for importer@patchew.org; Sat, 26 Oct 2019 17:29:01 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:60091) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iOTZk-00007B-Fk for qemu-devel@nongnu.org; Sat, 26 Oct 2019 17:26:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iOTZi-0005MY-GJ for qemu-devel@nongnu.org; Sat, 26 Oct 2019 17:26:20 -0400 Received: from fanzine.igalia.com ([178.60.130.6]:42489) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iOTZg-0005Er-99; Sat, 26 Oct 2019 17:26:17 -0400 Received: from 87-100-137-117.bb.dnainternet.fi ([87.100.137.117] helo=perseus.local) by fanzine.igalia.com with esmtpsa (Cipher TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim) id 1iOTZJ-00046D-As; Sat, 26 Oct 2019 23:25:53 +0200 Received: from berto by perseus.local with local (Exim 4.92) (envelope-from ) id 1iOTZ1-0001Pp-65; Sun, 27 Oct 2019 00:25:35 +0300 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=igalia.com; s=20170329; h=Content-Transfer-Encoding:MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From; bh=zZzQnFPNZo26UDeXp5FufenA8jUFgfP9E3m3TefOdis=; b=U9rRWQ8YLuRLUsR4u9I5uV9iJd91plJEEtSdhvvJSVnb2gFkdFhO89YF0X34Q0Y+4gLCB40AT59ZNF9mPM/jhx34DrARU2XxkWFFYn7H5zh0+Db/dy20zCxRHlNpgVQd8BfFFULSX+zFBoVP+WxuXR3dhdc4U4j6Wd5BJTlVkSEmH3WGllwwZad9AEscAM+HgyABAMNzKjcEcMBzEH3DFc9N2imNqaORTXUNOIOZHdw5g1D4WSGuwF1hv4llGKoQBHseB131GPoPJmaHYXsxiqOtdTRa2QngWeX26e5YpG2QH56uIvhCb0WFfKtc1RsQOzoOVtr6Un8IBxVqtRLPIQ==; From: Alberto Garcia To: qemu-devel@nongnu.org Subject: [RFC PATCH v2 25/26] qcow2: Allow preallocation and backing files if extended_l2 is set Date: Sun, 27 Oct 2019 00:25:27 +0300 Message-Id: <3b868557f35fbdbc9cc8d962c23be4d2daa9c2b2.1572125022.git.berto@igalia.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x (no timestamps) [generic] [fuzzy] X-Received-From: 178.60.130.6 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: Kevin Wolf , Anton Nefedov , Alberto Garcia , qemu-block@nongnu.org, Max Reitz , Vladimir Sementsov-Ogievskiy , "Denis V . Lunev" 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" Traditional qcow2 images don't allow preallocation if a backing file is set. This is because once a cluster is allocated there is no way to tell that its data should be read from the backing file. Extended L2 entries have individual allocation bits for each subcluster, and therefore it is perfectly possible to have an allocated cluster with all its subclusters unallocated. Signed-off-by: Alberto Garcia --- block/qcow2.c | 7 ++++--- tests/qemu-iotests/206.out | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/block/qcow2.c b/block/qcow2.c index b1fa7ab5da..8cf51c5d64 100644 --- a/block/qcow2.c +++ b/block/qcow2.c @@ -3307,10 +3307,11 @@ qcow2_co_create(BlockdevCreateOptions *create_optio= ns, Error **errp) qcow2_opts->preallocation =3D PREALLOC_MODE_OFF; } if (qcow2_opts->has_backing_file && - qcow2_opts->preallocation !=3D PREALLOC_MODE_OFF) + qcow2_opts->preallocation !=3D PREALLOC_MODE_OFF && + !qcow2_opts->extended_l2) { - error_setg(errp, "Backing file and preallocation cannot be used at= " - "the same time"); + error_setg(errp, "Backing file and preallocation can only be used = at " + "the same time if extended_l2 is on"); ret =3D -EINVAL; goto out; } diff --git a/tests/qemu-iotests/206.out b/tests/qemu-iotests/206.out index d2efc0394a..cfddfbfaa4 100644 --- a/tests/qemu-iotests/206.out +++ b/tests/qemu-iotests/206.out @@ -198,7 +198,7 @@ Job failed: Different refcount widths than 16 bits requ= ire compatibility level 1 =3D=3D=3D Invalid backing file options =3D=3D=3D {"execute": "blockdev-create", "arguments": {"job-id": "job0", "options": = {"backing-file": "/dev/null", "driver": "qcow2", "file": "node0", "prealloc= ation": "full", "size": 67108864}}} {"return": {}} -Job failed: Backing file and preallocation cannot be used at the same time +Job failed: Backing file and preallocation can only be used at the same ti= me if extended_l2 is on {"execute": "job-dismiss", "arguments": {"id": "job0"}} {"return": {}} =20 --=20 2.20.1