Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id AF501C88E63 for ; Sun, 13 Sep 2026 19:54:28 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x5qGk-0007Uq-86; Sun, 13 Sep 2026 15:53:44 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1x5qGI-0007Op-K6 for qemu-devel@nongnu.org; Sun, 13 Sep 2026 15:53:17 -0400 Received: from mail-wm1-x32f.google.com ([2a00:1450:4864:20::32f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1x5qGC-0006D1-RR for qemu-devel@nongnu.org; Sun, 13 Sep 2026 15:53:13 -0400 Received: by mail-wm1-x32f.google.com with SMTP id 5b1f17b1804b1-49e6deb520eso16758865e9.0 for ; Sun, 13 Sep 2026 12:53:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=openvz.org; s=google; t=1789329187; x=1789933987; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=CrNy0DGUAMNQACpRIKae6EFwhUPs4CrGUyns6CD/7LI=; b=dyScXFqFzNxTml5i5hTiWj0TvII9k/K+YG0uSgJh9l135abtQ8Aam0EzSzCsftpCvc Aqb2aErmSMC3Y/SqO3TeZ7HF0DLLB+Ed1DyctQA/gMBFrg4zhqMcz9/GGgnnNwizOMI6 MPwiq3jPEiFXdn+va0KxKzvAbe/kspoO3tOFqwl8cmd8XdtSYd/e34xWzMP7snZAiT7c g6OCL9vhMkM9SN5KWYZacUeMh90ikSlwvROw5dSnRtsbiyNkK6bSimXPZaIe7HenfLyR PKYbBSRPPUyRqic5QciC+hw4Q+0MVrMFwJ30mgVWdnp6vJxlv7iYt3qceMH+v2HSdwFt 24hA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1789329187; x=1789933987; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=CrNy0DGUAMNQACpRIKae6EFwhUPs4CrGUyns6CD/7LI=; b=YFlDvSHWc0DvG19esCCRb0burP1zL2JnRxD3ZP6XeokXZSXfBBAgEWxRacJEagXuNf xtQzJOcVNTlOEcnNV6CzNge+hNUm0T8h0p8CBQJM+50FmI22vPRXDkXWzc5AsFn+6wWj wSM4gLPiBLrugjtVj4lYQMyJwHnRL80HcG9xolg0iCRjsAzepBywDrXGMsvRB1ZuVg5q C8V3SG6teSEMjAR4v6vTwB0M67pGkAYRvm5Bp4XfddPiHS+6R8hQIDK7uoA4axCh46Mt bjQX4IQ178kFOHCLzfkCAPruA9y+POUR7z4l6G6hPLhhR2Q0uYnAWuhYlkHfdyEoN3CS SD+A== X-Gm-Message-State: AFuF++lUbjzvDZbOjOQEa41PF4kfgZGpG3X8K23p7ACgGk7XEy9WAR20 gRdO1IWin4IXMppjVBF8ml6xLFrgDGhIQ+quKHz38ddOVgCrJaSEIeS1nGQH5RZPYVn4GL6eJK9 LIH/X X-Gm-Gg: AYBFou1I/uO8/VjJcv7Ni+FWnhcC0ET+9kJeyQlBgcgrw+LSMNpjHI65k0yFxYGT1Zk A//ehXh56opDSKbBeUmEjsCtCwqwUNyRLcYxEMc0BtRw6OtWQzU0yOoRfuHb1LBQIfhWxMT3VgB ntzggaB+juzPMuX2ORMq27L+lFvWITt27x2XjDRVNZNCUa1WREIBtVYFycv1JAxGP4A45arfevQ rBVKwyOhH5ZRu5FxP2vdO9gHYAjUMUPH1Z8bbW2CPVyITkKAHLj+7+Y2QAYvLx3yPLx8Dscy0El r6evkf/xUTE5PF/YwA3aA8Pa5PKWljVLPW29uNME0x/vrxr2ftuNRaWCofMwVG+e7EHi3pQxgyE xo37QJjqyTNdY98/9rAzoeXIDgNCumFCxu2JrRuWKFGi16cuh1Veal48IPVyIcK7yDWCBF/VRKu 55qCtQNbtG0xqr8/4Xkr+CgLrePIdvanft/NrWNx7b2qtdOzLEH/TanU4O8znA X-Received: by 2002:a05:600c:c049:b0:499:60bf:c6f7 with SMTP id 5b1f17b1804b1-49e61992b43mr121746705e9.13.1789329187463; Sun, 13 Sep 2026 12:53:07 -0700 (PDT) Received: from athena ([2a06:5b06:b600:300:ef7b:3cbd:e3a9:adbf]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-486eb33fc02sm20374678f8f.16.2026.09.13.12.53.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 13 Sep 2026 12:53:06 -0700 (PDT) From: "Denis V. Lunev" To: qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, "Denis V. Lunev" , Stefan Hajnoczi Subject: [PATCH v8 2/3] iotests: cover storing a parallels dirty bitmap Date: Sun, 13 Sep 2026 21:53:00 +0200 Message-ID: <20260913195301.1514888-3-den@openvz.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260913195301.1514888-1-den@openvz.org> References: <20260913195301.1514888-1-den@openvz.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=2a00:1450:4864:20::32f; envelope-from=den@openvz.org; helo=mail-wm1-x32f.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Denis V. Lunev parallels-bitmap covers loading a bitmap and parsing the Format Extension. Storing one is the other direction and is not covered at all. Nothing compares a stored bitmap with the writes it describes: test 165 compares a hash across a VM restart, which the same code produces and consumes, so a serialization wrong in both directions passes it. Write known ranges and read the bitmap back over NBD, in the shapes the storage code decides between: short ranges, a chunk dirty as a whole, a dirty run shorter than the cluster which serializes it, and a dirty tail. A bitmap which does not fit is refused when it is created, as the L1 table shares the Format Extension cluster with the feature headers of the bitmaps already there. One which fits an empty cluster does not fit next to seven others, and those seven have to survive the refusal. The rest is read out of the image file, as that is what the next open will see: a removal has to reach it when the command is given rather than when the node is closed, and the in use flag has to go with an inactivation and come back when the node is activated again. A bitmap which can not be written used to be lost in silence, so blkdebug fails the write of its data cluster: the loss has to be reported while the guest data still goes through, and the flag has to survive the failed inactivation. Cc: Stefan Hajnoczi Signed-off-by: Denis V. Lunev --- tests/qemu-iotests/tests/parallels-bitmap | 178 +++++++++++++++++- tests/qemu-iotests/tests/parallels-bitmap.out | 45 +++++ 2 files changed, 222 insertions(+), 1 deletion(-) diff --git a/tests/qemu-iotests/tests/parallels-bitmap b/tests/qemu-iotests/tests/parallels-bitmap index 814b56b32c..be0ba8185d 100755 --- a/tests/qemu-iotests/tests/parallels-bitmap +++ b/tests/qemu-iotests/tests/parallels-bitmap @@ -25,7 +25,8 @@ import uuid from qemu.utils import VerboseProcessError import iotests -from iotests import qemu_nbd_popen, qemu_img, qemu_img_map, log, file_path +from iotests import qemu_nbd_popen, qemu_img, qemu_img_create, qemu_img_map, \ + qemu_io, log, file_path, QemuStorageDaemon iotests.script_initialize(supported_fmts=['parallels']) @@ -258,3 +259,178 @@ def check_multi_l1(): check_multi_l1() + + +# Storing a bitmap. The driver has to produce the extension itself here, +# so the images are real ones rather than hand crafted clusters. + +INUSE_MAGIC = 0x746F6E59 +INUSE_OFF = 0x2c +EXT_OFF = 0x38 +TRACKS_OFF = 0x1c + +stored = file_path('stored') +copy = file_path('copy') +STORED = '9b7b8b2e-1c4a-4d3f-8e6a-1f2d3c4b5a69' +OTHER = '11111111-2222-3333-4444-555555555555' + + +def read_header(off, fmt): + with open(stored, 'rb') as f: + return struct.unpack_from(fmt, f.read(0x40), off)[0] + + +def in_use(): + return read_header(INUSE_OFF, '