From nobody Sat Nov 15 17:47:13 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1748594733; cv=none; d=zohomail.com; s=zohoarc; b=aGPpwMs4ATxqPPiDGae+EXnp0pJf9TQmqPswMFGrZAqPguPRw7FRqaG9AE0wQ9BLySp9SgToL9GbTxid2jq9GfYlxNdoBmRCjzpuiE/TdZNCarAMgCWIG1h3gTuHhnNTEBatOPftrOs1ThAAlXQSFzQghlfHJAFjjs63DJjwFsI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1748594733; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=J/2Ra3xOF2Xk1EgqPad2PlpU9ziLUGgRLqoaKoZcQW8=; b=XmAyeGG2jFncptE8mfWFcKWncswUT/Rf4gxNULGL1mfa+1rcA7UeOBOeCTuAr5GWtkdKyDnpgwnVtODEVRHXmVoLaRUb9GEcAwhsNiWc1ExwftrZF0+9tuwC9S89jPm4x/l9OyBTY3MMR253oIB7vUca8xFC8pgtMcgEysN49gM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1748594733512763.3644768461895; Fri, 30 May 2025 01:45:33 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uKvMd-0005A0-9r; Fri, 30 May 2025 04:45:19 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uKvMS-00053m-5q for qemu-devel@nongnu.org; Fri, 30 May 2025 04:45:08 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uKvMO-0000jQ-9F for qemu-devel@nongnu.org; Fri, 30 May 2025 04:45:06 -0400 Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-144-D432dj4LOjuTTUf-om7dtA-1; Fri, 30 May 2025 04:45:01 -0400 Received: by mail-wr1-f72.google.com with SMTP id ffacd0b85a97d-3a4fabcafecso41198f8f.0 for ; Fri, 30 May 2025 01:45:01 -0700 (PDT) Received: from localhost (p200300cfd700f320acd9b9a35df3ddfd.dip0.t-ipconnect.de. [2003:cf:d700:f320:acd9:b9a3:5df3:ddfd]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3a4efe73f22sm4167030f8f.43.2025.05.30.01.44.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 30 May 2025 01:44:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1748594703; 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=J/2Ra3xOF2Xk1EgqPad2PlpU9ziLUGgRLqoaKoZcQW8=; b=OjNNBXiUaMNijcHgpbM/MGe9xviiNvHneVMt6I0mBeV5Y76bYFfGFA/ZOmTAXPvzy6Dw7a dzumHtxGTCJlzK5oTx/ZO0IA8d7XF/twnGTrLbr5Dh1rtdEts3ZbKhKmrELH3GOw6PbwMr Fci/BwkqjH1hv1TdlRDaHqDMDaKzO0o= X-MC-Unique: D432dj4LOjuTTUf-om7dtA-1 X-Mimecast-MFC-AGG-ID: D432dj4LOjuTTUf-om7dtA_1748594701 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1748594700; x=1749199500; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=J/2Ra3xOF2Xk1EgqPad2PlpU9ziLUGgRLqoaKoZcQW8=; b=Y877vzXouOeh4drHGBRAQcqxHX3cJ7Xy4Un3tyalg0iQ7si7EO0qlJafRw8a4FcYuZ +nZrwodIxWqiEGj6mV/hgs72bgHfasbLeWU9YLvO9g1+FeNzQKDz3Gkx7w+uUmiziDzN RpORqZ1+NB9r5bN6BG/NYHeFB7KB3OpeG2HUybtukDj14rZT0i6tEJ63/jsFxmydCUBt znCOo1byrcxOjrtQNYV+IGjVsR4f2IslRtwKJ2nEfQsqDA1o62Nbw+MrDECnC6Ie36xK bP484qBkljmo6coyHyADFXJ99kTtB8nv86I4dO3+ScgFTN4lsRVUPe13kLXJCYKkSBA2 W/WQ== X-Gm-Message-State: AOJu0YwWVCthPZn28WAYmmPdMdbBBoBQrj5RsZ3+6knpNdGiedpJlurm hnL83we0K1mTloznt/AnYOA+Bd2bIyaZgIr0gTN8mEAolIKDBg//1Hy58auln87LtykDiuOWCBz Bepaw9WYyDA5qYEHHY8Qlzf0yEKdmk6lpiP8jBPoHf+016M8LQ8ZF54y3 X-Gm-Gg: ASbGncsThKJl+Rf4tUIDQjepOz5c1b5tPt3wfQlp69oH1g1ovaCQNFBo2o2Dh5W0s+K 0KmCaKThtuFtR1XdpTmpVAr7vL3ZbDsrB3Wozajq+OjobPuvvnFPOsNT1xUXQE8vgbmn8QvJrED EyPs4BUdv3lKr6TE4ibvhfWJrkBYb0dG4U5UuuJwgh11rkZdpWhxKlAFYYKf+uXdC9WGu2rkEhY jsMzBHyB6Ylc3Xei6EUfv1esPgSVhbDOXjbPDNJJ6JXwtX8dWsItDS8qrNUVSLvWiwBjh2XBAVv hcJI5Gb1jRsxLLm34uguGpO7AyuL6gaalQSAa27w5q2egR2BQmDM3cHcXJ88j+29j58SNg== X-Received: by 2002:a05:6000:22c3:b0:3a4:eeb6:3b6b with SMTP id ffacd0b85a97d-3a4f7a6d218mr1895444f8f.43.1748594700343; Fri, 30 May 2025 01:45:00 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEIAR5pg+VPt9A7j2XOVfGOG12DylkyqP/x0l9RkdRkwt4V7ChfwB/eUeGnAod4xuIBEEFZFQ== X-Received: by 2002:a05:6000:22c3:b0:3a4:eeb6:3b6b with SMTP id ffacd0b85a97d-3a4f7a6d218mr1895421f8f.43.1748594699835; Fri, 30 May 2025 01:44:59 -0700 (PDT) From: Hanna Czenczek To: qemu-block@nongnu.org Cc: qemu-devel@nongnu.org, Hanna Czenczek , Kevin Wolf Subject: [PATCH 1/4] qcow2: Add keep_data_file command-line option Date: Fri, 30 May 2025 10:44:44 +0200 Message-ID: <20250530084448.192369-2-hreitz@redhat.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250530084448.192369-1-hreitz@redhat.com> References: <20250530084448.192369-1-hreitz@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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; Received-SPF: pass client-ip=170.10.133.124; envelope-from=hreitz@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -49 X-Spam_score: -5.0 X-Spam_bar: ----- X-Spam_report: (-5.0 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-2.902, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1748594735163116600 Content-Type: text/plain; charset="utf-8" Add a command-line-only option to prevent overwriting the file specified as external data file. This option is only available on the qemu-img create command line, not via blockdev-create, as it makes no sense there: That interface separates file creation and formatting, so where the external data file attached to a newly formatted qcow2 node comes from is completely up to the user. Implementation detail: Enabling this option will not only not overwrite the external data file, but also assume it already exists, for two reasons: - It is simpler than checking whether the file exists, and only skipping creating it when it does not. It is therefore also less error-prone, i.e. we can never accidentally overwrite an existing file because we made some mistake in checking whether it exists. - I think it makes sense from a user's perspective: You set this option when you want to use an existing data file, and you unset it when you want a new one. Getting an error when you expect to use an existing data file seems to me a nice warning that something is not right. Signed-off-by: Hanna Czenczek Reviewed-by: Eric Blake --- include/block/block_int-common.h | 1 + block/qcow2.c | 75 ++++++++++++++++++++++++++++++-- tests/qemu-iotests/082.out | 18 ++++++++ 3 files changed, 90 insertions(+), 4 deletions(-) diff --git a/include/block/block_int-common.h b/include/block/block_int-com= mon.h index 2982dd3118..b52e441b42 100644 --- a/include/block/block_int-common.h +++ b/include/block/block_int-common.h @@ -57,6 +57,7 @@ #define BLOCK_OPT_DATA_FILE_RAW "data_file_raw" #define BLOCK_OPT_COMPRESSION_TYPE "compression_type" #define BLOCK_OPT_EXTL2 "extended_l2" +#define BLOCK_OPT_KEEP_DATA_FILE "keep_data_file" =20 #define BLOCK_PROBE_BUF_SIZE 512 =20 diff --git a/block/qcow2.c b/block/qcow2.c index 66fba89b41..b11cbfd859 100644 --- a/block/qcow2.c +++ b/block/qcow2.c @@ -3902,6 +3902,8 @@ qcow2_co_create_opts(BlockDriver *drv, const char *fi= lename, QemuOpts *opts, BlockDriverState *bs =3D NULL; BlockDriverState *data_bs =3D NULL; const char *val; + bool keep_data_file =3D false; + BlockdevCreateOptionsQcow2 *qcow2_opts; int ret; =20 /* Only the keyval visitor supports the dotted syntax needed for @@ -3933,6 +3935,22 @@ qcow2_co_create_opts(BlockDriver *drv, const char *f= ilename, QemuOpts *opts, qdict_put_str(qdict, BLOCK_OPT_COMPAT_LEVEL, "v3"); } =20 + val =3D qdict_get_try_str(qdict, BLOCK_OPT_KEEP_DATA_FILE); + if (val) { + if (!strcmp(val, "on")) { + keep_data_file =3D true; + } else if (!strcmp(val, "off")) { + keep_data_file =3D false; + } else { + error_setg(errp, + "Invalid value '%s' for '%s': Must be 'on' or 'off'= ", + val, BLOCK_OPT_KEEP_DATA_FILE); + ret =3D -EINVAL; + goto finish; + } + qdict_del(qdict, BLOCK_OPT_KEEP_DATA_FILE); + } + /* Change legacy command line options into QMP ones */ static const QDictRenames opt_renames[] =3D { { BLOCK_OPT_BACKING_FILE, "backing-file" }, @@ -3969,9 +3987,11 @@ qcow2_co_create_opts(BlockDriver *drv, const char *f= ilename, QemuOpts *opts, /* Create and open an external data file (protocol layer) */ val =3D qdict_get_try_str(qdict, BLOCK_OPT_DATA_FILE); if (val) { - ret =3D bdrv_co_create_file(val, opts, errp); - if (ret < 0) { - goto finish; + if (!keep_data_file) { + ret =3D bdrv_co_create_file(val, opts, errp); + if (ret < 0) { + goto finish; + } } =20 data_bs =3D bdrv_co_open(val, NULL, NULL, @@ -3984,6 +4004,11 @@ qcow2_co_create_opts(BlockDriver *drv, const char *f= ilename, QemuOpts *opts, =20 qdict_del(qdict, BLOCK_OPT_DATA_FILE); qdict_put_str(qdict, "data-file", data_bs->node_name); + } else if (keep_data_file) { + error_setg(errp, "Must not use '%s=3Don' without '%s'", + BLOCK_OPT_KEEP_DATA_FILE, BLOCK_OPT_DATA_FILE); + ret =3D -EINVAL; + goto finish; } =20 /* Set 'driver' and 'node' options */ @@ -4004,6 +4029,40 @@ qcow2_co_create_opts(BlockDriver *drv, const char *f= ilename, QemuOpts *opts, goto finish; } =20 + qcow2_opts =3D &create_options->u.qcow2; + + if (!qcow2_opts->has_preallocation) { + qcow2_opts->preallocation =3D PREALLOC_MODE_OFF; + } + if (!qcow2_opts->has_data_file_raw) { + qcow2_opts->data_file_raw =3D false; + } + + if (keep_data_file && + qcow2_opts->preallocation !=3D PREALLOC_MODE_OFF && + qcow2_opts->preallocation !=3D PREALLOC_MODE_METADATA) + { + error_setg(errp, "Preallocating more than only metadata would " + "overwrite the external data file's content and is " + "therefore incompatible with '%s=3Don'", + BLOCK_OPT_KEEP_DATA_FILE); + ret =3D -EINVAL; + goto finish; + } + + if (keep_data_file && + qcow2_opts->preallocation =3D=3D PREALLOC_MODE_OFF && + !qcow2_opts->data_file_raw) + { + error_setg(errp, "'%s=3Don' requires '%s=3Dmetadata' or '%s=3Don',= or the " + "file contents will not be visible", + BLOCK_OPT_KEEP_DATA_FILE, + BLOCK_OPT_PREALLOC, + BLOCK_OPT_DATA_FILE_RAW); + ret =3D -EINVAL; + goto finish; + } + /* Silently round up size */ create_options->u.qcow2.size =3D ROUND_UP(create_options->u.qcow2.size, BDRV_SECTOR_SIZE); @@ -4014,7 +4073,9 @@ finish: if (ret < 0) { bdrv_graph_co_rdlock(); bdrv_co_delete_file_noerr(bs); - bdrv_co_delete_file_noerr(data_bs); + if (!keep_data_file) { + bdrv_co_delete_file_noerr(data_bs); + } bdrv_graph_co_rdunlock(); } else { ret =3D 0; @@ -6113,6 +6174,12 @@ static QemuOptsList qcow2_create_opts =3D { .help =3D "Compression method used for image cluster " \ "compression", \ .def_value_str =3D "zlib" \ + }, \ + { \ + .name =3D BLOCK_OPT_KEEP_DATA_FILE, \ + .type =3D QEMU_OPT_BOOL, \ + .help =3D "Assume the external data file already exists and " \ + "do not overwrite it" \ }, QCOW_COMMON_OPTIONS, { /* end of list */ } diff --git a/tests/qemu-iotests/082.out b/tests/qemu-iotests/082.out index d0dd333117..e0463815c6 100644 --- a/tests/qemu-iotests/082.out +++ b/tests/qemu-iotests/082.out @@ -66,6 +66,7 @@ Supported options: encryption=3D - Encrypt the image with format 'aes'. (Dep= recated in favor of encrypt.format=3Daes) extended_l2=3D - Extended L2 tables extent_size_hint=3D - Extent size hint for the image file, 0 to di= sable + keep_data_file=3D - Assume the external data file already= exists and do not overwrite it lazy_refcounts=3D - Postpone refcount updates nocow=3D - Turn off copy-on-write (valid only on btrfs) preallocation=3D - Preallocation mode (allowed values: off, meta= data, falloc, full) @@ -92,6 +93,7 @@ Supported options: encryption=3D - Encrypt the image with format 'aes'. (Dep= recated in favor of encrypt.format=3Daes) extended_l2=3D - Extended L2 tables extent_size_hint=3D - Extent size hint for the image file, 0 to di= sable + keep_data_file=3D - Assume the external data file already= exists and do not overwrite it lazy_refcounts=3D - Postpone refcount updates nocow=3D - Turn off copy-on-write (valid only on btrfs) preallocation=3D - Preallocation mode (allowed values: off, meta= data, falloc, full) @@ -118,6 +120,7 @@ Supported options: encryption=3D - Encrypt the image with format 'aes'. (Dep= recated in favor of encrypt.format=3Daes) extended_l2=3D - Extended L2 tables extent_size_hint=3D - Extent size hint for the image file, 0 to di= sable + keep_data_file=3D - Assume the external data file already= exists and do not overwrite it lazy_refcounts=3D - Postpone refcount updates nocow=3D - Turn off copy-on-write (valid only on btrfs) preallocation=3D - Preallocation mode (allowed values: off, meta= data, falloc, full) @@ -144,6 +147,7 @@ Supported options: encryption=3D - Encrypt the image with format 'aes'. (Dep= recated in favor of encrypt.format=3Daes) extended_l2=3D - Extended L2 tables extent_size_hint=3D - Extent size hint for the image file, 0 to di= sable + keep_data_file=3D - Assume the external data file already= exists and do not overwrite it lazy_refcounts=3D - Postpone refcount updates nocow=3D - Turn off copy-on-write (valid only on btrfs) preallocation=3D - Preallocation mode (allowed values: off, meta= data, falloc, full) @@ -170,6 +174,7 @@ Supported options: encryption=3D - Encrypt the image with format 'aes'. (Dep= recated in favor of encrypt.format=3Daes) extended_l2=3D - Extended L2 tables extent_size_hint=3D - Extent size hint for the image file, 0 to di= sable + keep_data_file=3D - Assume the external data file already= exists and do not overwrite it lazy_refcounts=3D - Postpone refcount updates nocow=3D - Turn off copy-on-write (valid only on btrfs) preallocation=3D - Preallocation mode (allowed values: off, meta= data, falloc, full) @@ -196,6 +201,7 @@ Supported options: encryption=3D - Encrypt the image with format 'aes'. (Dep= recated in favor of encrypt.format=3Daes) extended_l2=3D - Extended L2 tables extent_size_hint=3D - Extent size hint for the image file, 0 to di= sable + keep_data_file=3D - Assume the external data file already= exists and do not overwrite it lazy_refcounts=3D - Postpone refcount updates nocow=3D - Turn off copy-on-write (valid only on btrfs) preallocation=3D - Preallocation mode (allowed values: off, meta= data, falloc, full) @@ -222,6 +228,7 @@ Supported options: encryption=3D - Encrypt the image with format 'aes'. (Dep= recated in favor of encrypt.format=3Daes) extended_l2=3D - Extended L2 tables extent_size_hint=3D - Extent size hint for the image file, 0 to di= sable + keep_data_file=3D - Assume the external data file already= exists and do not overwrite it lazy_refcounts=3D - Postpone refcount updates nocow=3D - Turn off copy-on-write (valid only on btrfs) preallocation=3D - Preallocation mode (allowed values: off, meta= data, falloc, full) @@ -248,6 +255,7 @@ Supported options: encryption=3D - Encrypt the image with format 'aes'. (Dep= recated in favor of encrypt.format=3Daes) extended_l2=3D - Extended L2 tables extent_size_hint=3D - Extent size hint for the image file, 0 to di= sable + keep_data_file=3D - Assume the external data file already= exists and do not overwrite it lazy_refcounts=3D - Postpone refcount updates nocow=3D - Turn off copy-on-write (valid only on btrfs) preallocation=3D - Preallocation mode (allowed values: off, meta= data, falloc, full) @@ -288,6 +296,7 @@ Supported qcow2 options: encrypt.key-secret=3D - ID of secret providing qcow AES key or LUKS= passphrase encryption=3D - Encrypt the image with format 'aes'. (Dep= recated in favor of encrypt.format=3Daes) extended_l2=3D - Extended L2 tables + keep_data_file=3D - Assume the external data file already= exists and do not overwrite it lazy_refcounts=3D - Postpone refcount updates preallocation=3D - Preallocation mode (allowed values: off, meta= data, falloc, full) refcount_bits=3D - Width of a reference count entry in bits @@ -376,6 +385,7 @@ Supported options: encryption=3D - Encrypt the image with format 'aes'. (Dep= recated in favor of encrypt.format=3Daes) extended_l2=3D - Extended L2 tables extent_size_hint=3D - Extent size hint for the image file, 0 to di= sable + keep_data_file=3D - Assume the external data file already= exists and do not overwrite it lazy_refcounts=3D - Postpone refcount updates nocow=3D - Turn off copy-on-write (valid only on btrfs) preallocation=3D - Preallocation mode (allowed values: off, meta= data, falloc, full) @@ -402,6 +412,7 @@ Supported options: encryption=3D - Encrypt the image with format 'aes'. (Dep= recated in favor of encrypt.format=3Daes) extended_l2=3D - Extended L2 tables extent_size_hint=3D - Extent size hint for the image file, 0 to di= sable + keep_data_file=3D - Assume the external data file already= exists and do not overwrite it lazy_refcounts=3D - Postpone refcount updates nocow=3D - Turn off copy-on-write (valid only on btrfs) preallocation=3D - Preallocation mode (allowed values: off, meta= data, falloc, full) @@ -428,6 +439,7 @@ Supported options: encryption=3D - Encrypt the image with format 'aes'. (Dep= recated in favor of encrypt.format=3Daes) extended_l2=3D - Extended L2 tables extent_size_hint=3D - Extent size hint for the image file, 0 to di= sable + keep_data_file=3D - Assume the external data file already= exists and do not overwrite it lazy_refcounts=3D - Postpone refcount updates nocow=3D - Turn off copy-on-write (valid only on btrfs) preallocation=3D - Preallocation mode (allowed values: off, meta= data, falloc, full) @@ -454,6 +466,7 @@ Supported options: encryption=3D - Encrypt the image with format 'aes'. (Dep= recated in favor of encrypt.format=3Daes) extended_l2=3D - Extended L2 tables extent_size_hint=3D - Extent size hint for the image file, 0 to di= sable + keep_data_file=3D - Assume the external data file already= exists and do not overwrite it lazy_refcounts=3D - Postpone refcount updates nocow=3D - Turn off copy-on-write (valid only on btrfs) preallocation=3D - Preallocation mode (allowed values: off, meta= data, falloc, full) @@ -480,6 +493,7 @@ Supported options: encryption=3D - Encrypt the image with format 'aes'. (Dep= recated in favor of encrypt.format=3Daes) extended_l2=3D - Extended L2 tables extent_size_hint=3D - Extent size hint for the image file, 0 to di= sable + keep_data_file=3D - Assume the external data file already= exists and do not overwrite it lazy_refcounts=3D - Postpone refcount updates nocow=3D - Turn off copy-on-write (valid only on btrfs) preallocation=3D - Preallocation mode (allowed values: off, meta= data, falloc, full) @@ -506,6 +520,7 @@ Supported options: encryption=3D - Encrypt the image with format 'aes'. (Dep= recated in favor of encrypt.format=3Daes) extended_l2=3D - Extended L2 tables extent_size_hint=3D - Extent size hint for the image file, 0 to di= sable + keep_data_file=3D - Assume the external data file already= exists and do not overwrite it lazy_refcounts=3D - Postpone refcount updates nocow=3D - Turn off copy-on-write (valid only on btrfs) preallocation=3D - Preallocation mode (allowed values: off, meta= data, falloc, full) @@ -532,6 +547,7 @@ Supported options: encryption=3D - Encrypt the image with format 'aes'. (Dep= recated in favor of encrypt.format=3Daes) extended_l2=3D - Extended L2 tables extent_size_hint=3D - Extent size hint for the image file, 0 to di= sable + keep_data_file=3D - Assume the external data file already= exists and do not overwrite it lazy_refcounts=3D - Postpone refcount updates nocow=3D - Turn off copy-on-write (valid only on btrfs) preallocation=3D - Preallocation mode (allowed values: off, meta= data, falloc, full) @@ -558,6 +574,7 @@ Supported options: encryption=3D - Encrypt the image with format 'aes'. (Dep= recated in favor of encrypt.format=3Daes) extended_l2=3D - Extended L2 tables extent_size_hint=3D - Extent size hint for the image file, 0 to di= sable + keep_data_file=3D - Assume the external data file already= exists and do not overwrite it lazy_refcounts=3D - Postpone refcount updates nocow=3D - Turn off copy-on-write (valid only on btrfs) preallocation=3D - Preallocation mode (allowed values: off, meta= data, falloc, full) @@ -598,6 +615,7 @@ Supported qcow2 options: encrypt.key-secret=3D - ID of secret providing qcow AES key or LUKS= passphrase encryption=3D - Encrypt the image with format 'aes'. (Dep= recated in favor of encrypt.format=3Daes) extended_l2=3D - Extended L2 tables + keep_data_file=3D - Assume the external data file already= exists and do not overwrite it lazy_refcounts=3D - Postpone refcount updates preallocation=3D - Preallocation mode (allowed values: off, meta= data, falloc, full) refcount_bits=3D - Width of a reference count entry in bits --=20 2.49.0 From nobody Sat Nov 15 17:47:13 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1748594788; cv=none; d=zohomail.com; s=zohoarc; b=Y9CaE+PpqkwL+x0bkcVzDsm7m5QgBQdsGydIMLB2nu8uSxm7ruLkJuNDuUU7p+REpP1VWeg37m7wpcxst1pMWF+rbZVvw5pjI/O/idyxJqQVltrNZpEQk0fFsVdgqSg4WW3soeduGn13tvVdk2r0GJ5t9QYmYlfVCtYhNFRCwPY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1748594788; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=B5vtQo6scS2XCrA0t0y/9hjFqbhJ1P++sODcfsG33Xo=; b=iPRqU4vvchq2/D6RUbz+kT+bpOTYG0UFYWgnjh1118+hqtQZmF2igJ5C+P/O5qcjCzamLocmOaPAprwe3pOhTVibohqmC9KGSJ5SN72IzO4DoKhk7p1fczqkLAtwR+7uy4CgJMJ2m7ApudUiAqfIXpEgVK0hJ0sXdpHXv+nYSj0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1748594788515113.8359300382084; Fri, 30 May 2025 01:46:28 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uKvMe-0005AS-17; Fri, 30 May 2025 04:45:20 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uKvMT-000541-BY for qemu-devel@nongnu.org; Fri, 30 May 2025 04:45:10 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uKvMR-0000rF-U7 for qemu-devel@nongnu.org; Fri, 30 May 2025 04:45:09 -0400 Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-458-5Tf5gHXXMCiaBy_s8-6XBg-1; Fri, 30 May 2025 04:45:04 -0400 Received: by mail-wm1-f72.google.com with SMTP id 5b1f17b1804b1-450787c8626so11223875e9.1 for ; Fri, 30 May 2025 01:45:04 -0700 (PDT) Received: from localhost (p200300cfd700f320acd9b9a35df3ddfd.dip0.t-ipconnect.de. [2003:cf:d700:f320:acd9:b9a3:5df3:ddfd]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-450d7f9efa3sm11764675e9.9.2025.05.30.01.45.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 30 May 2025 01:45:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1748594705; 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=B5vtQo6scS2XCrA0t0y/9hjFqbhJ1P++sODcfsG33Xo=; b=EgwPkiaSZlekP3YNUhqnmlzKHC5HiYW8hCaC1Jwm+G3mlZkXErfT5F4a9L4Uo53+/HVaIX isQpo0JRQdzi0c5Bq6JpNdbWOBo/xXShKg/Ul9rauMNxjqT1RMSOUyIMq9tY4dY1J3sfF2 +EGSl+C4eWI+be4BE/3FWCkUhOPcVb0= X-MC-Unique: 5Tf5gHXXMCiaBy_s8-6XBg-1 X-Mimecast-MFC-AGG-ID: 5Tf5gHXXMCiaBy_s8-6XBg_1748594703 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1748594703; x=1749199503; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=B5vtQo6scS2XCrA0t0y/9hjFqbhJ1P++sODcfsG33Xo=; b=TimOMX6Qu05IhV40uNdnpmC/FVaBadhTL7vwu8WhK3DaM96TpOczy03EJQ2b9U6xuS tTXu49nkvzyXeGxIr7Wu0WrsoEu9oPInhiAeJF2gs0Sza+VoOAuwCup6cvlxHTJI3OPg MBlKYxtMgSznnYDhDI66r/P5h47DHvYFtIdEuWfUMrolq0/tSJiC7eKtgWNhvb3uLrko t1w94T1/BpoT2CZXt3MkJWnh5UMB+iurhrcailkywb5aRQKRO34mY1hSPqswBtgwcW7Q eRLBbg4p0sd3b/6use+a5/N6rdHb6/QmOqjg4fL2cJN7ibq/JWYkMrsg4VlgN7Hke4fi 4DrA== X-Gm-Message-State: AOJu0YzpblcRlfNOsM7HS/sNKyri3hxfYmO6HzXjMrJ05AxXc9fRHQdM qtmjO7GnqrQfv4/EOVl9hKnl+bMop//w3waQf9n6J+M3MMg/yOornpu22blZ/3lz8iQXrPpZ2BU I+IXAY/MGh4iiOuMze4X7UCcbYDvYLXOwxhGGjmAfDkTchVdFrW762kbj X-Gm-Gg: ASbGncuLzgpIixxLt2yg9YTHV5Y/ANByo6U9LI2tb2qmUhXKLmq7Lq+pRNpErQZamwb pCovvfBODMVX+9ELBto3yXixEFQ0g4dBUcohs+5/0WP1ttM4t/AncOfRoYgu+Br8d4Qc6qOuaig 17zUtO7j+1oMESqIjzn+LWhT7luWvzbOzDUGpI6/hkWwxTraYCi5xEy+WiabnqfOo+IjF3fomdC CwsH8GMqMeGeGsRZXQvOt1wSAQzTl+sx3hiWFeMvw+NgpLPaMwhViwbHWR52d1BUwc4TdFqLZuB /4CZ8HmkREVvVEVjJa2t5Jr0IJXkPLgkSf9tpkv7gC58SDtjFGMXXrOY+UhbkDxTleAWxw== X-Received: by 2002:a05:600c:3b26:b0:44b:1f5b:8c85 with SMTP id 5b1f17b1804b1-450d65344bamr23259565e9.13.1748594703087; Fri, 30 May 2025 01:45:03 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFVjbyZ7ZFhtFnX0rvhghU4xb5jFGU0O+6HeOhKyYkCg6do+KmqwvvfPSS24GqWBIAe3ZNEoQ== X-Received: by 2002:a05:600c:3b26:b0:44b:1f5b:8c85 with SMTP id 5b1f17b1804b1-450d65344bamr23259335e9.13.1748594702749; Fri, 30 May 2025 01:45:02 -0700 (PDT) From: Hanna Czenczek To: qemu-block@nongnu.org Cc: qemu-devel@nongnu.org, Hanna Czenczek , Kevin Wolf Subject: [PATCH 2/4] qcow2: Simplify size round-up in co_create_opts Date: Fri, 30 May 2025 10:44:45 +0200 Message-ID: <20250530084448.192369-3-hreitz@redhat.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250530084448.192369-1-hreitz@redhat.com> References: <20250530084448.192369-1-hreitz@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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; Received-SPF: pass client-ip=170.10.133.124; envelope-from=hreitz@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -49 X-Spam_score: -5.0 X-Spam_bar: ----- X-Spam_report: (-5.0 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-2.902, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, 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: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1748594789628116600 Content-Type: text/plain; charset="utf-8" Use the now-existing qcow2_opts pointer to simplify the size rounding up code. Signed-off-by: Hanna Czenczek Reviewed-by: Eric Blake --- block/qcow2.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/block/qcow2.c b/block/qcow2.c index b11cbfd859..988ebcf138 100644 --- a/block/qcow2.c +++ b/block/qcow2.c @@ -4064,8 +4064,7 @@ qcow2_co_create_opts(BlockDriver *drv, const char *fi= lename, QemuOpts *opts, } =20 /* Silently round up size */ - create_options->u.qcow2.size =3D ROUND_UP(create_options->u.qcow2.size, - BDRV_SECTOR_SIZE); + qcow2_opts->size =3D ROUND_UP(qcow2_opts->size, BDRV_SECTOR_SIZE); =20 /* Create the qcow2 image (format layer) */ ret =3D qcow2_co_create(create_options, errp); --=20 2.49.0 From nobody Sat Nov 15 17:47:13 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1748594775; cv=none; d=zohomail.com; s=zohoarc; b=WGSKFS3f6ZWUoXlFTsww2e7ff/Q/4oM1ccSsupUpIziXvhkJZVJdGlbsRBHWk1xvyGFopyWydhLA+2oMUxdaQSZYUP9mqg/I1dOXDfnmlDpVnHlz7QpD93i78T1YqFeZ1qz/CPgZUA0oORfDLUBJeyv9X0pAE9awdkauHAVcPwo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1748594775; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=gk1BpX+DWlk1ccwYz/mV2ZvL76JZlfynXExlLgJwf0w=; b=bKlIV3o+TO+S/FZeu14eDZkH470AwzcYUwUxuvuPXJFY22XCp98Jhw6wUTvFJOZb33z+1tIUZQyc1NeDKGLDTPO44Y8obW+NfzK2BbWHTA2X1ndBJojrswLRPNgyn809sWogzTgIG3IXufPMhHwl6kCbZIeYvxRiapssS9MYnFE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1748594775922247.93996232975599; Fri, 30 May 2025 01:46:15 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uKvMe-0005B7-PP; Fri, 30 May 2025 04:45:20 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uKvMW-00054r-VT for qemu-devel@nongnu.org; Fri, 30 May 2025 04:45:13 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uKvMU-0000rw-H1 for qemu-devel@nongnu.org; Fri, 30 May 2025 04:45:11 -0400 Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-347-DyRzb5l-MJqpzqSIy-foxg-1; Fri, 30 May 2025 04:45:08 -0400 Received: by mail-wm1-f70.google.com with SMTP id 5b1f17b1804b1-43f251dc364so9500625e9.2 for ; Fri, 30 May 2025 01:45:08 -0700 (PDT) Received: from localhost (p200300cfd700f320acd9b9a35df3ddfd.dip0.t-ipconnect.de. [2003:cf:d700:f320:acd9:b9a3:5df3:ddfd]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3a4efe5b96fsm4150040f8f.8.2025.05.30.01.45.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 30 May 2025 01:45:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1748594709; 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=gk1BpX+DWlk1ccwYz/mV2ZvL76JZlfynXExlLgJwf0w=; b=bogy9/IRoS6Ne3h9z7PS4QGYbDAo2hpl+fmweHHQoDZ7h2AGgw4fH9zlW92uKHjlMUFstn MKmEbYr1jcYCVLBAYmcwuNDasGqds2ClAJhgQQVA0rXpUl7XVWtL3skS+LuMfBEbeHzw2Q Z37toBe3ZGhvlESh6Z3cxQQrx40EsRo= X-MC-Unique: DyRzb5l-MJqpzqSIy-foxg-1 X-Mimecast-MFC-AGG-ID: DyRzb5l-MJqpzqSIy-foxg_1748594707 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1748594706; x=1749199506; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=gk1BpX+DWlk1ccwYz/mV2ZvL76JZlfynXExlLgJwf0w=; b=aB1nQPJg1cZX80F0ozf+RYrNiqR+aMYV6xI41ExYBEvkyQRz/fMWzwf0zOHaUv2UWK sWVfNDRC+CB2kwJ4wX8fM9+3Oa6TGNI2TM1wDWuQWCaREPQi6OhdQVFtLP8IwPZ84sis SFuapGqGljyPpokJFbBM+856kSEa68V25Fnm2iez1ATQ7I6Ibhyfdi5c14GpXKHTVqdq Ol8RFnR+uFUqDlalTaI7HxCNWjms3NReZbRY7WdRi6yNDS96AHw3CYMZYnid5smHQHmn ESReYqIwIiHN78Ceu+ua05dWjBy2u9m1egeyYbRnPrPhN+ouKxfafyvYY2P47vw+u/tW FMfA== X-Gm-Message-State: AOJu0YxsOmZi9akPmH33aH6cBaFwPcYtFNk48USKVoPWprZWapnOCX3L CcpbtNYQBJa0YFJBz+Fdxdb2Z3Tplt9Oi2RRYt1VG3sigqQXYUd9iNpqsdNcU2f2M251MBKaxBu mdAhE+W7jP6T/4iedyrQ41kJz8XEYGTrgBVFHMmWiasZ2RG0xrsfJk8iNN8WNGs1k X-Gm-Gg: ASbGncsAj6dgS+Bes2GIgphzxFAyuQadCCZauFfjywASZptahdeTOf7OAyLB8/Adty/ tJqQ+oIiK3o03IhGChHDk7YgAPfGQg1lu5H4p+1GbLaGyDhtTl8cCPhrVpqr9ZfuZxPEEERoY3s FQFgsa6PQLJ5U15IHEgU5M/C6QBGs/3Cbt+dVThoAWgowWZCiiZVxvTdcnZXmOpaDuuAh7BVagf x0gqwgrIbZVqxnNzXaLsq6mesJezTDlYGX7Ic1Z3E2XyTYTFRN2FsexsuwgYW3ZghGMw0poZd5H rgpzNh/GL66xIJ7+zh/p6DGjqKnnDBqhPq9HFTHhmd6YzER6duzw6PE4Qo+hvdRjsNx2Gw== X-Received: by 2002:a5d:64ed:0:b0:3a1:fa6c:4735 with SMTP id ffacd0b85a97d-3a4f7a714a4mr1899041f8f.35.1748594705797; Fri, 30 May 2025 01:45:05 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEYTcNkH8nBG14RIqrJ7WIXpQH5DGvUP22Jt0PfMBEn7MADFlHdtNPee2KGzNQTGz3MZn7o8g== X-Received: by 2002:a5d:64ed:0:b0:3a1:fa6c:4735 with SMTP id ffacd0b85a97d-3a4f7a714a4mr1899025f8f.35.1748594705485; Fri, 30 May 2025 01:45:05 -0700 (PDT) From: Hanna Czenczek To: qemu-block@nongnu.org Cc: qemu-devel@nongnu.org, Hanna Czenczek , Kevin Wolf Subject: [PATCH 3/4] iotests/common.filter: Sort keep_data_file Date: Fri, 30 May 2025 10:44:46 +0200 Message-ID: <20250530084448.192369-4-hreitz@redhat.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250530084448.192369-1-hreitz@redhat.com> References: <20250530084448.192369-1-hreitz@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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; Received-SPF: pass client-ip=170.10.129.124; envelope-from=hreitz@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -49 X-Spam_score: -5.0 X-Spam_bar: ----- X-Spam_report: (-5.0 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-2.902, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, 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: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1748594777461116600 Content-Type: text/plain; charset="utf-8" Sort the new keep_data_file creation option together with data_file and data_file_raw. Signed-off-by: Hanna Czenczek Reviewed-by: Eric Blake --- tests/qemu-iotests/common.filter | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/qemu-iotests/common.filter b/tests/qemu-iotests/common.f= ilter index fc3c64bcb8..3744326d2d 100644 --- a/tests/qemu-iotests/common.filter +++ b/tests/qemu-iotests/common.filter @@ -176,7 +176,7 @@ _do_filter_img_create() -e 's/^\(fmt\)/0-\1/' \ -e 's/^\(size\)/1-\1/' \ -e 's/^\(backing\)/2-\1/' \ - -e 's/^\(data_file\)/3-\1/' \ + -e 's/^\(\(keep_\)\?data_file\)/3-\1/' \ -e 's/^\(encryption\)/4-\1/' \ -e 's/^\(preallocation\)/8-\1/' \ | LC_ALL=3DC sort \ --=20 2.49.0 From nobody Sat Nov 15 17:47:13 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1748594783; cv=none; d=zohomail.com; s=zohoarc; b=aeNou6g1r+vCcJ6CDAk/O3TC8I/xrdyc1yzdUKDQ+rvjgQVcekxbdCGxBk/5wnz5nt5wtqtX39OFz9xmtFl4nhak9nYuvx37wDfLUcd/LxiCHEDSCsF6+tkBREaVWwhQclhNoqB0By2JYwFN2iELKOkm3YXAf/aFKTzuJtLpkAg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1748594783; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=m9H+auuRyXtdUGXXh+5pwrUEG4tf8Si41EBllzDy1U8=; b=j7xNNTSbnaDkIqhO3UX2VUgbkrZBodIRNF2W6BdEx4Tkn7hXYGfXL9m7MFq6q/aK6fkLn54lSEno4IRwKzG26p5vXRn+1PjrEGGaGkteUIAJGZJpC3/t+PYgQvyi8D9eOuomYH2uH0Ympq8alqNvc2RMXkj2g5xnKRYwisGT+vw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 174859478352258.06679425894856; Fri, 30 May 2025 01:46:23 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uKvMf-0005BQ-B6; Fri, 30 May 2025 04:45:21 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uKvMb-00057T-36 for qemu-devel@nongnu.org; Fri, 30 May 2025 04:45:17 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uKvMX-0000sX-Pp for qemu-devel@nongnu.org; Fri, 30 May 2025 04:45:15 -0400 Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-300-q2nE-Zp5OVuRz_2RNwdrpA-1; Fri, 30 May 2025 04:45:11 -0400 Received: by mail-wr1-f70.google.com with SMTP id ffacd0b85a97d-3a4f7f1b932so429864f8f.2 for ; Fri, 30 May 2025 01:45:11 -0700 (PDT) Received: from localhost (p200300cfd700f320acd9b9a35df3ddfd.dip0.t-ipconnect.de. [2003:cf:d700:f320:acd9:b9a3:5df3:ddfd]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3a4efe6c7adsm4144688f8f.26.2025.05.30.01.45.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 30 May 2025 01:45:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1748594712; 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=m9H+auuRyXtdUGXXh+5pwrUEG4tf8Si41EBllzDy1U8=; b=IJKU0GIAEUVrRejdOC6SA+vZ6rlFDF6haeLt6KsVMHkyeG3nehwn+wRhLLaLVOt/5KfyYO iwEyyZj2e2qLwrjKj62HTbdAEpfYDP5zSlXEJF7cnE3nqx2QVfga/v1z3V5j+RXcGDgtbo LrDoGbh7bStGMyBAIw1pf4BNq/A2UXk= X-MC-Unique: q2nE-Zp5OVuRz_2RNwdrpA-1 X-Mimecast-MFC-AGG-ID: q2nE-Zp5OVuRz_2RNwdrpA_1748594710 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1748594710; x=1749199510; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=m9H+auuRyXtdUGXXh+5pwrUEG4tf8Si41EBllzDy1U8=; b=ZptemVPVyRWQvBr281qudTvtv5JAZEsvVxcqs7kJ2LJFZ86KRMT+SjwFVo4y5JM1Rj OBcLptoa8As5bkd/aiT5RWEmxCnbr8zfzFWCU7YLVDU/5eb1WGs4jkeoTa1BecF+EQIR iCswtJuMIQUuU7862/BT0Xz/uBg07UWI0kL/3oQcW9E9cEKAyEh/H1g51mNKRNfo+EEU PQlHWu8EAqlav9HQ4Ja+Y9/YrsaJwcJiUocH0Y4RFVE7WWdkqpjj2I3uBkO11TEuDS3+ MZ9ytOKU6zDuPzB9e1asEitsq4POjBEiEDglRhEffZqA4G+vxtLO1MxF9n4qXnL2L4Us 1bDw== X-Gm-Message-State: AOJu0YzV3QPXl5HpbBOs9czCS4TKw1c25ZmhJ3gAsysIVYIVCyD60lIF nZwa0vHehBIEncXFH3eTkuCndMMDwi455RPETNnl3ewY2YPrN5PDtyKqmmp2Mn1LB+ulbV0AE0C rhKlSpGYpovXSJU5XBA/FAhk1tRjI7E2/1qjTCGDhclyEuV4JiKhgrUI9 X-Gm-Gg: ASbGncuKaBcnTly8cMxzzcTQXTg5pSCTENJBSrI3Kcm//MXxWMGySZJIOpz9/ehGKaY 4DkTTQ5zw5O0cOkQSfEbyj7ujtZOs6RTguGrsAhf79aIxmtZDcK6Dy8qCP2plx9sIaulnAC1+09 kQDKWRp4qXKFH1S2gbIZCD9umhIscwz/F8S2ztQVW0Cbl9pUIHNbAfNY8DiqwzhagpkLeX8DTZ7 EMNcnNrznrt+gIyq5sChkSDgfd92EpNs2b+c+VfQw+v4IE6DA8yoqcfJAqVwn1xJ+EFqc/2je+9 oFNbJ9JtHG4tR46snnWoEO4jje6P3FMQN1sOJKKZLxIrnjEJSO65XlLQo/DO0TrN1u320w== X-Received: by 2002:a05:6000:2505:b0:3a4:cfbf:5199 with SMTP id ffacd0b85a97d-3a4f7a3c0ecmr1773513f8f.9.1748594710236; Fri, 30 May 2025 01:45:10 -0700 (PDT) X-Google-Smtp-Source: AGHT+IExVQi7zB78K2k9X0cH/WwccVl81a4DbZSF7w7dqdd6W4bNFSQDB42rYnGf04jLZuMU8DLczw== X-Received: by 2002:a05:6000:2505:b0:3a4:cfbf:5199 with SMTP id ffacd0b85a97d-3a4f7a3c0ecmr1773486f8f.9.1748594709824; Fri, 30 May 2025 01:45:09 -0700 (PDT) From: Hanna Czenczek To: qemu-block@nongnu.org Cc: qemu-devel@nongnu.org, Hanna Czenczek , Kevin Wolf Subject: [PATCH 4/4] iotests/244: Add test cases for keep_data_file Date: Fri, 30 May 2025 10:44:47 +0200 Message-ID: <20250530084448.192369-5-hreitz@redhat.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250530084448.192369-1-hreitz@redhat.com> References: <20250530084448.192369-1-hreitz@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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; Received-SPF: pass client-ip=170.10.133.124; envelope-from=hreitz@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -49 X-Spam_score: -5.0 X-Spam_bar: ----- X-Spam_report: (-5.0 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-2.902, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, 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: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1748594785878116600 Content-Type: text/plain; charset="utf-8" Add various test cases around keep_data_file to the existing data_file test suite 244. Signed-off-by: Hanna Czenczek Reviewed-by: Eric Blake --- tests/qemu-iotests/244 | 71 ++++++++++++++++++++++++++++++++++++++ tests/qemu-iotests/244.out | 53 ++++++++++++++++++++++++++++ 2 files changed, 124 insertions(+) diff --git a/tests/qemu-iotests/244 b/tests/qemu-iotests/244 index bb9cc6512f..ec81df8d6a 100755 --- a/tests/qemu-iotests/244 +++ b/tests/qemu-iotests/244 @@ -384,6 +384,77 @@ $QEMU_IMG compare --image-opts \ "driver=3Draw,file.filename=3D$TEST_IMG.data" \ "file.filename=3D$TEST_IMG,backing.file.filename=3D$TEST_IMG.base" =20 +echo +echo '=3D=3D=3D keep_data_file tests =3D=3D=3D' + +echo +echo '--- Creating test data file ---' + +# Easiest way to create the raw data file without having to create and +# access it manually +_make_test_img -o "data_file=3D$TEST_IMG.data,data_file_raw=3Don" 1M +# Values chosen by a fair random.org evaluation +$QEMU_IO -c 'write -P 3 0 512k' -c 'write -P 96 512k 512k' "$TEST_IMG" | + _filter_qemu_io + +echo +echo '--- Testing stand-alone option ---' + +# Cannot work, needs data file +_make_test_img -o "keep_data_file=3Don" 1M + +# Invalid option value +_make_test_img -o "keep_data_file=3Dtrue" 1M + +# Should be the same as omitting +_make_test_img -o "keep_data_file=3Doff" 1M + +# No preallocation is OK when also specifying data_file_raw; otherwise, no= ne of +# the data file will be mapped, i.e. its contents will stay hidden, so +# requesting its contents to be kept (but hidden) doesn't make much sense. +# +# Metadata preallocation is OK: It will not overwrite the data file's cont= ents, +# but ensure the contents are mapped and visible. +# +# Any data preallocation (like falloc) is not OK, as this would overwrite = the +# data file's contents despite keep_data_file requesting they should not be +# overwritten. +# +# Note that all of these cases use the data file created above: This verif= ies +# that when passing keep_data_file=3Don, the data file is always kept as-i= s (and +# e.g. not deleted on error). +for prealloc in off metadata falloc; do + # Without metadata preallocation, the data_file_raw flag is required s= o that + # the data file's contents are visible. + for data_file_raw in off on; do + echo + echo "--- Testing prealloc=3D$prealloc data_file_raw=3D$data_file_= raw ---" + + # Remove previously existing qcow2 (metadata) file + _cleanup_test_img + + opts=3D"data_file=3D$TEST_IMG.data,keep_data_file=3Don" + opts+=3D",preallocation=3D$prealloc" + opts+=3D",data_file_raw=3D$data_file_raw" + + _make_test_img -o "$opts" 1M + if [ -f "$TEST_IMG" ]; then + $QEMU_IO -c 'read -P 3 0 512k' -c 'read -P 96 512k 512k' "$TES= T_IMG" | + _filter_qemu_io + fi + done +done + +echo +echo '--- Testing non-existent data file ---' + +# Maybe a matter of taste whether this should fail or create the file, but +# failing is simpler (=3D will always skip create) and seems safer (users = may +# expect the file to exist, and the error will warn them when it does not). +_make_test_img \ + -o "data_file=3D$TEST_IMG.doesnotexist,keep_data_file=3Don,data_file_r= aw=3Don" \ + 1M + # success, all done echo "*** done" rm -f $seq.full diff --git a/tests/qemu-iotests/244.out b/tests/qemu-iotests/244.out index f46cfe93f1..9fbfa82cd9 100644 --- a/tests/qemu-iotests/244.out +++ b/tests/qemu-iotests/244.out @@ -197,4 +197,57 @@ wrote 1048576/1048576 bytes at offset 0 =20 Comparing qcow2 image and raw data file: Images are identical. + +=3D=3D=3D keep_data_file tests =3D=3D=3D + +--- Creating test data file --- +Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1048576 data_file=3DTE= ST_DIR/t.IMGFMT.data data_file_raw=3Don +wrote 524288/524288 bytes at offset 0 +512 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +wrote 524288/524288 bytes at offset 524288 +512 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) + +--- Testing stand-alone option --- +Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1048576 keep_data_file= =3Don +qemu-img: TEST_DIR/t.IMGFMT: Must not use 'keep_data_file=3Don' without 'd= ata_file' +Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1048576 keep_data_file= =3Dtrue +qemu-img: TEST_DIR/t.IMGFMT: Invalid value 'true' for 'keep_data_file': Mu= st be 'on' or 'off' +Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1048576 keep_data_file= =3Doff + +--- Testing prealloc=3Doff data_file_raw=3Doff --- +Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1048576 data_file=3DTE= ST_DIR/t.IMGFMT.data data_file_raw=3Doff keep_data_file=3Don preallocation= =3Doff +qemu-img: TEST_DIR/t.IMGFMT: 'keep_data_file=3Don' requires 'preallocation= =3Dmetadata' or 'data_file_raw=3Don', or the file contents will not be visi= ble + +--- Testing prealloc=3Doff data_file_raw=3Don --- +Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1048576 data_file=3DTE= ST_DIR/t.IMGFMT.data data_file_raw=3Don keep_data_file=3Don preallocation= =3Doff +read 524288/524288 bytes at offset 0 +512 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +read 524288/524288 bytes at offset 524288 +512 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) + +--- Testing prealloc=3Dmetadata data_file_raw=3Doff --- +Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1048576 data_file=3DTE= ST_DIR/t.IMGFMT.data data_file_raw=3Doff keep_data_file=3Don preallocation= =3Dmetadata +read 524288/524288 bytes at offset 0 +512 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +read 524288/524288 bytes at offset 524288 +512 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) + +--- Testing prealloc=3Dmetadata data_file_raw=3Don --- +Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1048576 data_file=3DTE= ST_DIR/t.IMGFMT.data data_file_raw=3Don keep_data_file=3Don preallocation= =3Dmetadata +read 524288/524288 bytes at offset 0 +512 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +read 524288/524288 bytes at offset 524288 +512 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) + +--- Testing prealloc=3Dfalloc data_file_raw=3Doff --- +Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1048576 data_file=3DTE= ST_DIR/t.IMGFMT.data data_file_raw=3Doff keep_data_file=3Don preallocation= =3Dfalloc +qemu-img: TEST_DIR/t.IMGFMT: Preallocating more than only metadata would o= verwrite the external data file's content and is therefore incompatible wit= h 'keep_data_file=3Don' + +--- Testing prealloc=3Dfalloc data_file_raw=3Don --- +Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1048576 data_file=3DTE= ST_DIR/t.IMGFMT.data data_file_raw=3Don keep_data_file=3Don preallocation= =3Dfalloc +qemu-img: TEST_DIR/t.IMGFMT: Preallocating more than only metadata would o= verwrite the external data file's content and is therefore incompatible wit= h 'keep_data_file=3Don' + +--- Testing non-existent data file --- +Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1048576 data_file=3DTE= ST_DIR/t.IMGFMT.doesnotexist data_file_raw=3Don keep_data_file=3Don +qemu-img: TEST_DIR/t.IMGFMT: Could not open 'TEST_DIR/t.IMGFMT.doesnotexis= t': No such file or directory *** done --=20 2.49.0