From nobody Sat Feb 7 08:23:03 2026 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=1770210994; cv=none; d=zohomail.com; s=zohoarc; b=UX0dwAUFzPe4Te3J9sUgBjuHU82Oew8pdKp18nZqOY2q0b6Q9ZM7GmFqc5O3djZ+LPeQEI7cYMnTsZHb8o42KTcgPY6lBhrgeovF7L812kHPICkrNJ+Pt+7+T/+gGuQZtWp+ytxoYstEkpg1lU+AtOIzuwKd1wn0jrcRyFlPUT8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1770210994; 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=CLu7X2+SdWA9HEcMYPBDxBpfhgicnuI8jqTWKaPDU20=; b=KLvqMWqiwQRBV2qrhmpRdHVOvblqPJ6ITSQJ7VQwZEsPjP8S7VbqZJpzXyfL4Zy9DvdDSMGW/Cx3E11SFcET4pTuYrYGkvjaGdCVJO+ZFGyyUBo/iXbfJfWo7tdipEYM/Cc7ELf9omsjVuN8wW0WoJDJnWIkHC/OikWTrFtMeUw= 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 177021099450751.876566001600054; Wed, 4 Feb 2026 05:16:34 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vncjq-0007tU-W5; Wed, 04 Feb 2026 08:16:11 -0500 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 1vncjc-0007jx-Um for qemu-devel@nongnu.org; Wed, 04 Feb 2026 08:15:56 -0500 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 1vncjb-00016F-6k for qemu-devel@nongnu.org; Wed, 04 Feb 2026 08:15:56 -0500 Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-147-4n5nfPOGPmK-U0ujC8pcug-1; Wed, 04 Feb 2026 08:15:51 -0500 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 6FD701956089; Wed, 4 Feb 2026 13:15:50 +0000 (UTC) Received: from speedmetal.lan (unknown [10.45.242.3]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 9C0CB30001B9; Wed, 4 Feb 2026 13:15:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1770210954; 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=CLu7X2+SdWA9HEcMYPBDxBpfhgicnuI8jqTWKaPDU20=; b=Bc7ApzusURPOsu2X6pGm6+LBRVbsyspSKs3TAzTIJH09wm4RWsQh8YeFnQA73foIOcaYh+ NYJ8YN+uAtcHZKjiXTokryNEnmr+n2R9yQe9B+IxAS003cZyeBzZnUuWLx0Bf6yWcl+bUX WeU1D9FuaecdZytCOtWQn0U3nrtdviI= X-MC-Unique: 4n5nfPOGPmK-U0ujC8pcug-1 X-Mimecast-MFC-AGG-ID: 4n5nfPOGPmK-U0ujC8pcug_1770210950 From: Peter Krempa To: qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, Kevin Wolf , Hanna Reitz , Eric Blake , Markus Armbruster Subject: [PATCH v4 1/2] block: Wire up 'flat' mode also for 'query-block' Date: Wed, 4 Feb 2026 14:15:43 +0100 Message-ID: In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 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=pkrempa@redhat.com; helo=us-smtp-delivery-124.mimecast.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, DKIMWL_WL_HIGH=-0.001, 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_H2=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-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: qemu development 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: 1770210995703154100 Content-Type: text/plain; charset="utf-8" From: Peter Krempa Some time ago (commit facda5443f5a8) I've added 'flat' mode (which omits 'backing-image' key in reply) to 'query-named-block-nodes' to minimize the size of the returned JSON for deeper backing chains. While 'query-block' behaved slightly better it turns out that in libvirt we do call 'query-block' to figure out some information about the block device (e.g. throttling info) but we don't look at the backing chain itself. Wire up 'flat' for 'query-block' so that libvirt can ask for an abbreviated output. The implementation is much simpler as the internals are shared with 'query-named-block-nodes'. Signed-off-by: Peter Krempa Acked-by: Markus Armbruster --- block/monitor/block-hmp-cmds.c | 4 ++-- block/qapi.c | 8 ++++---- qapi/block-core.json | 5 +++++ ui/cocoa.m | 2 +- 4 files changed, 12 insertions(+), 7 deletions(-) diff --git a/block/monitor/block-hmp-cmds.c b/block/monitor/block-hmp-cmds.c index 3391cee4d2..bde25bb588 100644 --- a/block/monitor/block-hmp-cmds.c +++ b/block/monitor/block-hmp-cmds.c @@ -422,7 +422,7 @@ void hmp_nbd_server_start(Monitor *mon, const QDict *qd= ict) /* Then try adding all block devices. If one fails, close all and * exit. */ - block_list =3D qmp_query_block(NULL); + block_list =3D qmp_query_block(false, false, NULL); for (info =3D block_list; info; info =3D info->next) { if (!info->value->inserted) { @@ -741,7 +741,7 @@ void hmp_info_block(Monitor *mon, const QDict *qdict) /* Print BlockBackend information */ if (!nodes) { - block_list =3D qmp_query_block(NULL); + block_list =3D qmp_query_block(false, false, NULL); } else { block_list =3D NULL; } diff --git a/block/qapi.c b/block/qapi.c index 27e0ac6a32..eabfbfc258 100644 --- a/block/qapi.c +++ b/block/qapi.c @@ -456,7 +456,7 @@ fail: /* @p_info will be set only on success. */ static void GRAPH_RDLOCK -bdrv_query_info(BlockBackend *blk, BlockInfo **p_info, Error **errp) +bdrv_query_info(BlockBackend *blk, bool flat, BlockInfo **p_info, Error **= errp) { BlockInfo *info =3D g_malloc0(sizeof(*info)); BlockDriverState *bs =3D blk_bs(blk); @@ -488,7 +488,7 @@ bdrv_query_info(BlockBackend *blk, BlockInfo **p_info, = Error **errp) } if (bs && bs->drv) { - info->inserted =3D bdrv_block_device_info(blk, bs, false, errp); + info->inserted =3D bdrv_block_device_info(blk, bs, flat, errp); if (info->inserted =3D=3D NULL) { goto err; } @@ -698,7 +698,7 @@ bdrv_query_bds_stats(BlockDriverState *bs, bool blk_lev= el) return s; } -BlockInfoList *qmp_query_block(Error **errp) +BlockInfoList *qmp_query_block(bool has_flat, bool flat, Error **errp) { BlockInfoList *head =3D NULL, **p_next =3D &head; BlockBackend *blk; @@ -714,7 +714,7 @@ BlockInfoList *qmp_query_block(Error **errp) } info =3D g_malloc0(sizeof(*info)); - bdrv_query_info(blk, &info->value, &local_err); + bdrv_query_info(blk, flat, &info->value, &local_err); if (local_err) { error_propagate(errp, local_err); g_free(info); diff --git a/qapi/block-core.json b/qapi/block-core.json index b82af74256..b66bf316e2 100644 --- a/qapi/block-core.json +++ b/qapi/block-core.json @@ -855,6 +855,10 @@ # # Get a list of `BlockInfo` for all virtual block devices. # +# @flat: Omit nested data about the backing image, i.e. `BlockInfo` +# member 'inserted.image.backing-image' will be absent. +# Default is false. (Since 11.0) +# # Returns: a list describing each virtual block device. Filter nodes # that were created implicitly are skipped over. # @@ -945,6 +949,7 @@ # } ## { 'command': 'query-block', 'returns': ['BlockInfo'], + 'data': { '*flat': 'bool' }, 'allow-preconfig': true } ## diff --git a/ui/cocoa.m b/ui/cocoa.m index 23b7a736d7..5b21fe3aea 100644 --- a/ui/cocoa.m +++ b/ui/cocoa.m @@ -1849,7 +1849,7 @@ static void addRemovableDevicesMenuItems(void) BlockInfoList *currentDevice, *pointerToFree; NSString *deviceName; - currentDevice =3D qmp_query_block(NULL); + currentDevice =3D qmp_query_block(false, false, NULL); pointerToFree =3D currentDevice; menu =3D [[[NSApp mainMenu] itemWithTitle:@"Machine"] submenu]; --=20 2.52.0 From nobody Sat Feb 7 08:23:03 2026 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=1770210987; cv=none; d=zohomail.com; s=zohoarc; b=AZfAvJL0DQ6X7NatTq4mO5cUXU/HD1HuIbggRMGwEAlwfzYfz2DWFe9ha7JS3d3Di9Xmo3z6XFiwsHE96qGDLIjN9sf56NI2FDNAmm8gA3M87P51Zh8atlh3c2rv3WQqAG2cHi50E1yu48T37vi4d6hEGe4MbywWdutvZTB1R8I= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1770210987; 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=h8k3XMtTeVC9HUtzi4IX4QOd53yiAU3NnJ9b2/fmKqA=; b=h8zq37ZHw/NXbUgoKqSHgsKbMeYEdiVLj4adW75ETwft7p00cOOXtPqmIr0jkXEvS2uikIs5x/PUAmunVLSTApzDkQoWd5b70GyGLN9TbrYnSIYYRyo6IDYihDWyy9xraOoyztzcouWC2S0iju7lBwMD1sDPHJ+BesmEpptKmls= 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 1770210987237692.6721181603926; Wed, 4 Feb 2026 05:16:27 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vncjq-0007tQ-Uh; Wed, 04 Feb 2026 08:16:11 -0500 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 1vncjd-0007mP-Lz for qemu-devel@nongnu.org; Wed, 04 Feb 2026 08:16:01 -0500 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 1vncjc-00016L-7s for qemu-devel@nongnu.org; Wed, 04 Feb 2026 08:15:57 -0500 Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-311-if6VnBB0PbGmHuGPZnt8oQ-1; Wed, 04 Feb 2026 08:15:53 -0500 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id DBB991955D8C; Wed, 4 Feb 2026 13:15:52 +0000 (UTC) Received: from speedmetal.lan (unknown [10.45.242.3]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id D719630001A5; Wed, 4 Feb 2026 13:15:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1770210955; 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=h8k3XMtTeVC9HUtzi4IX4QOd53yiAU3NnJ9b2/fmKqA=; b=O+YWYPmOKUI14KAYf1RFmuqPXT+HaJVofcJ1aAuL1bkhgNOwjYBv+SG41uVhcxB4pLMpuR uO26rbIscYbVSocZqZObb7mbFQ9mS+DrI6WYi2H+3ilKkeQ8s18h5pjU+RUWZoRSw0Q/+/ Ge4n2E5UIYu5Ogj5uWZoRqxTuMEYi9Y= X-MC-Unique: if6VnBB0PbGmHuGPZnt8oQ-1 X-Mimecast-MFC-AGG-ID: if6VnBB0PbGmHuGPZnt8oQ_1770210953 From: Peter Krempa To: qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, Kevin Wolf , Hanna Reitz , Eric Blake , Markus Armbruster Subject: [PATCH v4 2/2] hmp_nbd_server_start: Don't ask for backing image data Date: Wed, 4 Feb 2026 14:15:44 +0100 Message-ID: In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 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=pkrempa@redhat.com; helo=us-smtp-delivery-124.mimecast.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, DKIMWL_WL_HIGH=-0.001, 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_H2=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1770210989654154101 Content-Type: text/plain; charset="utf-8" From: Peter Krempa 'hmp_nbd_server_start' uses only the device name from the data returned from 'qmp_query_block', thus no backing file information. Use the new options to suppress asking for the unused parts to save on resources. Signed-off-by: Peter Krempa Reviewed-by: Eric Blake --- block/monitor/block-hmp-cmds.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/block/monitor/block-hmp-cmds.c b/block/monitor/block-hmp-cmds.c index bde25bb588..1fd28d59eb 100644 --- a/block/monitor/block-hmp-cmds.c +++ b/block/monitor/block-hmp-cmds.c @@ -422,7 +422,7 @@ void hmp_nbd_server_start(Monitor *mon, const QDict *qd= ict) /* Then try adding all block devices. If one fails, close all and * exit. */ - block_list =3D qmp_query_block(false, false, NULL); + block_list =3D qmp_query_block(true, true, NULL); for (info =3D block_list; info; info =3D info->next) { if (!info->value->inserted) { --=20 2.52.0