From nobody Sat May 18 03:46:23 2024 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=none dis=none) header.from=suse.de ARC-Seal: i=1; a=rsa-sha256; t=1684878055; cv=none; d=zohomail.com; s=zohoarc; b=VBaZnBkryBydQ0Bi6NJGluTcVmnVeyPyDlgCSYAkCIMuo74G8g8VMOOsFxatDvwD95MetDOfKqsTHpG3AR0OK+G67nZ1n6ts56pWYedC51oDMxDmStquFBt4323FJ/dIvYmQEJ4WJJ4k705WL2o4bEoWfHC47CzJ0h2sHM/iVQ8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1684878055; 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=nu4XEIgIikhgA/W/+uLWgdX+OIPEQni+cYXERvD8oYk=; b=cMOPiUxK4AgoBIbTRhL/fEzB6VSY806HMIVxx94A9fJ0HMj3TYQMqyE7vBBfMoEVMEIq8/r7bFgpwQqD7yXVUSLIzie8hOXTlWBmeWkY2BywloY7/AlOobwJ9KWcBQnsTCCEj4Jj8t8uIR464q/MfrgW6/h2JVWznySNGrejPrE= 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=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 168487805503368.81423953297258; Tue, 23 May 2023 14:40:55 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q1Ziu-0000MM-LF; Tue, 23 May 2023 17:39:16 -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 1q1Zit-0000I8-5P; Tue, 23 May 2023 17:39:15 -0400 Received: from smtp-out1.suse.de ([195.135.220.28]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1q1Zir-0004dA-Ln; Tue, 23 May 2023 17:39:14 -0400 Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id AD81E21C42; Tue, 23 May 2023 21:39:11 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 1755813588; Tue, 23 May 2023 21:39:08 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id gPeyNHwybWQ7CwAAMHmgww (envelope-from ); Tue, 23 May 2023 21:39:08 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1684877951; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=nu4XEIgIikhgA/W/+uLWgdX+OIPEQni+cYXERvD8oYk=; b=v+XfrDR3au5D5pb3V7FBsZbQkU3c5xNTbi480WcCMXKm0/6E/cqtkmq6P3nVVa9jGmVwq3 ALS7wIUYVo5XSNXuI/o7ku/rIRYRKwd//rp2d0OmFs5MTzA24AdeIL30n0wwnsxbgW/0f+ 8HjXEMZeIqm8lwP4rYeqRtaRENG32pQ= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1684877951; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=nu4XEIgIikhgA/W/+uLWgdX+OIPEQni+cYXERvD8oYk=; b=DtuY59Cbi/AqZH2db2xOM5KswC2mJdwWnWU1OFhJhnaD7ISIMRjnMKY9pU4QdYuLCTP3SP +sCw5mLRGdmh4HCw== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, Kevin Wolf , Hanna Reitz , Markus Armbruster , =?UTF-8?q?Jo=C3=A3o=20Silva?= , Lin Ma , Claudio Fontana , Dario Faggioli , Eric Blake Subject: [RFC PATCH 1/6] block: Remove bdrv_query_block_node_info Date: Tue, 23 May 2023 18:38:58 -0300 Message-Id: <20230523213903.18418-2-farosas@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20230523213903.18418-1-farosas@suse.de> References: <20230523213903.18418-1-farosas@suse.de> 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=195.135.220.28; envelope-from=farosas@suse.de; helo=smtp-out1.suse.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 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_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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 @suse.de) X-ZM-MESSAGEID: 1684878056467100002 Content-Type: text/plain; charset="utf-8" The last call site of this function has been removed by commit c04d0ab026 ("qemu-img: Let info print block graph"). Signed-off-by: Fabiano Rosas Reviewed-by: Claudio Fontana --- block/qapi.c | 27 --------------------------- include/block/qapi.h | 3 --- 2 files changed, 30 deletions(-) diff --git a/block/qapi.c b/block/qapi.c index f34f95e0ef..79bf80c503 100644 --- a/block/qapi.c +++ b/block/qapi.c @@ -309,33 +309,6 @@ out: aio_context_release(bdrv_get_aio_context(bs)); } =20 -/** - * bdrv_query_block_node_info: - * @bs: block node to examine - * @p_info: location to store node information - * @errp: location to store error information - * - * Store image information about @bs in @p_info. - * - * @p_info will be set only on success. On error, store error in @errp. - */ -void bdrv_query_block_node_info(BlockDriverState *bs, - BlockNodeInfo **p_info, - Error **errp) -{ - BlockNodeInfo *info; - ERRP_GUARD(); - - info =3D g_new0(BlockNodeInfo, 1); - bdrv_do_query_node_info(bs, info, errp); - if (*errp) { - qapi_free_BlockNodeInfo(info); - return; - } - - *p_info =3D info; -} - /** * bdrv_query_image_info: * @bs: block node to examine diff --git a/include/block/qapi.h b/include/block/qapi.h index 18d48ddb70..8663971c58 100644 --- a/include/block/qapi.h +++ b/include/block/qapi.h @@ -36,9 +36,6 @@ BlockDeviceInfo *bdrv_block_device_info(BlockBackend *blk, int bdrv_query_snapshot_info_list(BlockDriverState *bs, SnapshotInfoList **p_list, Error **errp); -void bdrv_query_block_node_info(BlockDriverState *bs, - BlockNodeInfo **p_info, - Error **errp); void bdrv_query_image_info(BlockDriverState *bs, ImageInfo **p_info, bool flat, --=20 2.35.3 From nobody Sat May 18 03:46:23 2024 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=none dis=none) header.from=suse.de ARC-Seal: i=1; a=rsa-sha256; t=1684878021; cv=none; d=zohomail.com; s=zohoarc; b=gjNSRDK1/XwnrvKFMCkr96UC5G0rTo9VlSYy5ogBug2AE8LJVVsP1quJ24j3sXcgTRIsRRqTastdM4Z9jV4l0Ynm96e48ymQDmZKCdPxr4rdskMaiZfpEu03mQ0h379TekxRXHlmkBXax41YofY0TgN4kMQNpwP+ybDCPkRPUO4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1684878021; 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=0Pqxkh+UqJz8d819PPN1K8WPCbsTUsWPaKk2eD138Ss=; b=W9F8ZNggeUHnZ5R2JxsxKC20iVF9tpMouX+LoWYKg4X7JHdOF/DY8N1/WKytTTm3OzC8og0s2OB90+RqZokPw5GBJsvgSfONFYm8bfaaZMY+pzHVJZNWnwIv40WAzoyT3u3Ca+vLJ9Qu/hntZo2OCakthyCbuiPAyU7d70Fs/w0= 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=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1684878021494438.97616348529664; Tue, 23 May 2023 14:40:21 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q1Zj3-0000Wp-6M; Tue, 23 May 2023 17:39:25 -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 1q1Zj1-0000Ur-Tv; Tue, 23 May 2023 17:39:23 -0400 Received: from smtp-out1.suse.de ([2001:67c:2178:6::1c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1q1Ziu-0004dY-JH; Tue, 23 May 2023 17:39:23 -0400 Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id BB2C121DA9; Tue, 23 May 2023 21:39:14 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 2484A13588; Tue, 23 May 2023 21:39:11 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id SE2wN38ybWQ7CwAAMHmgww (envelope-from ); Tue, 23 May 2023 21:39:11 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1684877954; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=0Pqxkh+UqJz8d819PPN1K8WPCbsTUsWPaKk2eD138Ss=; b=EM73MyjxjyBz6SUyFbqL1E7gOupknS5jXQZGNk22ktZsgf4o/NjENUVzufyRw51Wp/6btQ T8BIMpAYvqQk0AA2ST69pgzK1hj4o/AIbIUZM9ep+AQsPDu8kjDN/1kJY1XGmJ46QRsgPz clgxnEHjSY/rDGoeIU1Qa/8iLwLjmcM= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1684877954; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=0Pqxkh+UqJz8d819PPN1K8WPCbsTUsWPaKk2eD138Ss=; b=Ca1X4rNaSGhvhvrMYoV3a4x4qnqu+WGRBZV5k1Is9Y/O/XUuvKCftCBFLiLNDzdar3bds/ x+hQbVFE4rYFH6Cw== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, Kevin Wolf , Hanna Reitz , Markus Armbruster , =?UTF-8?q?Jo=C3=A3o=20Silva?= , Lin Ma , Claudio Fontana , Dario Faggioli , Eric Blake Subject: [RFC PATCH 2/6] block: Mark bdrv_co_get_allocated_file_size() as mixed Date: Tue, 23 May 2023 18:38:59 -0300 Message-Id: <20230523213903.18418-3-farosas@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20230523213903.18418-1-farosas@suse.de> References: <20230523213903.18418-1-farosas@suse.de> 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=2001:67c:2178:6::1c; envelope-from=farosas@suse.de; helo=smtp-out1.suse.de 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, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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 @suse.de) X-ZM-MESSAGEID: 1684878023609100003 Content-Type: text/plain; charset="utf-8" Some callers of this function are about to be converted to use coroutines, so allow it to be executed both inside and outside a coroutine. Signed-off-by: Fabiano Rosas Reviewed-by: Eric Blake --- include/block/block-io.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/block/block-io.h b/include/block/block-io.h index a27e471a87..c1f96faca5 100644 --- a/include/block/block-io.h +++ b/include/block/block-io.h @@ -87,7 +87,7 @@ int64_t co_wrapper_mixed_bdrv_rdlock bdrv_getlength(Block= DriverState *bs); int64_t coroutine_fn GRAPH_RDLOCK bdrv_co_get_allocated_file_size(BlockDriverState *bs); =20 -int64_t co_wrapper_bdrv_rdlock +int64_t co_wrapper_mixed_bdrv_rdlock bdrv_get_allocated_file_size(BlockDriverState *bs); =20 BlockMeasureInfo *bdrv_measure(BlockDriver *drv, QemuOpts *opts, --=20 2.35.3 From nobody Sat May 18 03:46:23 2024 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=none dis=none) header.from=suse.de ARC-Seal: i=1; a=rsa-sha256; t=1684878045; cv=none; d=zohomail.com; s=zohoarc; b=iK9ELBFRNlZrjSBB8YKIRTq1BehmRRg+4oIWGVwSYQPEDNSYc4XeO14/Wi4394jNNO6F/yLXLn8br7i3KZpRhMl1Q3yyz7y64YxeMZgiS76yC1qOziB3nJZMXe88LaVM20KbAwQD5Bla9d+gbXgUaQUkP0PGo5OJEFqSmRu1dvc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1684878045; 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=swEfq52Qjpfe+UyjVleJjf81uw2SsrlMeRYlYVeV//M=; b=hyzLA9OFjm6UDoNy+gpU2K0lBXolXHJmjT8RMJ8OG9+cNWfua/KUYbrwSr8mzaXj/npFlEgDluOOWCJ2bW+oWiDiPAKePcceVdxHmK0Fi2l7vwDp/Hrft5NItI6Ig91PLRORRez1bbyVHBCrlLw8OChR3HiqJmgBsIvrjtt8nHw= 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=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1684878045431587.2200778085698; Tue, 23 May 2023 14:40:45 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q1Zj1-0000S3-Bh; Tue, 23 May 2023 17:39:23 -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 1q1Ziz-0000Pi-Oi; Tue, 23 May 2023 17:39:21 -0400 Received: from smtp-out2.suse.de ([2001:67c:2178:6::1d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1q1Ziy-0004fD-6d; Tue, 23 May 2023 17:39:21 -0400 Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 1690A1FDC5; Tue, 23 May 2023 21:39:18 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 3A9D813588; Tue, 23 May 2023 21:39:15 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id uPGkAYMybWQ7CwAAMHmgww (envelope-from ); Tue, 23 May 2023 21:39:15 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1684877958; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=swEfq52Qjpfe+UyjVleJjf81uw2SsrlMeRYlYVeV//M=; b=tSVf03BoAVCWMhz+vfPndDmzDonwkJVSs07zoCLT7SJSz6yleQHKIaV8aqmTuMkNAFP5Ew 3paIS9uWCShcf4Hzp4R/zvP+8ofa/NVoj8z791MQNxL4R1QoLn/n1GMmIS/ub3MrH/6jv0 x1vxcBfJLW8+65afMNwz7NfJZ5xbHhs= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1684877958; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=swEfq52Qjpfe+UyjVleJjf81uw2SsrlMeRYlYVeV//M=; b=7Bdiu9IlU3Q2ePvZi474EBh7bnOo+h1dxEH/f/CQKQlYVXoZWERbCU0kO7SovucJ4zyC9Y buuTpjicrwB/LbDA== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, Kevin Wolf , Hanna Reitz , Markus Armbruster , =?UTF-8?q?Jo=C3=A3o=20Silva?= , Lin Ma , Claudio Fontana , Dario Faggioli , Eric Blake , "Dr. David Alan Gilbert" Subject: [RFC PATCH 3/6] Convert query-block/info_block to coroutine Date: Tue, 23 May 2023 18:39:00 -0300 Message-Id: <20230523213903.18418-4-farosas@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20230523213903.18418-1-farosas@suse.de> References: <20230523213903.18418-1-farosas@suse.de> 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=2001:67c:2178:6::1d; envelope-from=farosas@suse.de; helo=smtp-out2.suse.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 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_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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 @suse.de) X-ZM-MESSAGEID: 1684878046357100002 Content-Type: text/plain; charset="utf-8" From: Lin Ma Sometimes the query-block performs time-consuming I/O(say waiting for the fstat of NFS complete), So let's make this QMP handler runs in a coroutine. The following patch moves the fstat() into a thread pool. Signed-off-by: Lin Ma Signed-off-by: Fabiano Rosas --- block/monitor/block-hmp-cmds.c | 2 +- block/qapi.c | 2 +- hmp-commands-info.hx | 1 + include/block/block-hmp-cmds.h | 2 +- qapi/block-core.json | 2 +- 5 files changed, 5 insertions(+), 4 deletions(-) diff --git a/block/monitor/block-hmp-cmds.c b/block/monitor/block-hmp-cmds.c index ca2599de44..4b704010bc 100644 --- a/block/monitor/block-hmp-cmds.c +++ b/block/monitor/block-hmp-cmds.c @@ -738,7 +738,7 @@ static void print_block_info(Monitor *mon, BlockInfo *i= nfo, } } =20 -void hmp_info_block(Monitor *mon, const QDict *qdict) +void coroutine_fn hmp_info_block(Monitor *mon, const QDict *qdict) { BlockInfoList *block_list, *info; BlockDeviceInfoList *blockdev_list, *blockdev; diff --git a/block/qapi.c b/block/qapi.c index 79bf80c503..ae6cd1c2ff 100644 --- a/block/qapi.c +++ b/block/qapi.c @@ -667,7 +667,7 @@ bdrv_query_bds_stats(BlockDriverState *bs, bool blk_lev= el) return s; } =20 -BlockInfoList *qmp_query_block(Error **errp) +BlockInfoList *coroutine_fn qmp_query_block(Error **errp) { BlockInfoList *head =3D NULL, **p_next =3D &head; BlockBackend *blk; diff --git a/hmp-commands-info.hx b/hmp-commands-info.hx index 47d63d26db..996895f417 100644 --- a/hmp-commands-info.hx +++ b/hmp-commands-info.hx @@ -65,6 +65,7 @@ ERST .help =3D "show info of one block device or all block device= s " "(-n: show named nodes; -v: show details)", .cmd =3D hmp_info_block, + .coroutine =3D true, }, =20 SRST diff --git a/include/block/block-hmp-cmds.h b/include/block/block-hmp-cmds.h index 71113cd7ef..6d9152318f 100644 --- a/include/block/block-hmp-cmds.h +++ b/include/block/block-hmp-cmds.h @@ -48,7 +48,7 @@ void hmp_eject(Monitor *mon, const QDict *qdict); =20 void hmp_qemu_io(Monitor *mon, const QDict *qdict); =20 -void hmp_info_block(Monitor *mon, const QDict *qdict); +void coroutine_fn hmp_info_block(Monitor *mon, const QDict *qdict); void hmp_info_blockstats(Monitor *mon, const QDict *qdict); void hmp_info_block_jobs(Monitor *mon, const QDict *qdict); void hmp_info_snapshots(Monitor *mon, const QDict *qdict); diff --git a/qapi/block-core.json b/qapi/block-core.json index 98d9116dae..da95fe456c 100644 --- a/qapi/block-core.json +++ b/qapi/block-core.json @@ -838,7 +838,7 @@ # } ## { 'command': 'query-block', 'returns': ['BlockInfo'], - 'allow-preconfig': true } + 'allow-preconfig': true, 'coroutine': true } =20 ## # @BlockDeviceTimedStats: --=20 2.35.3 From nobody Sat May 18 03:46:23 2024 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=none dis=none) header.from=suse.de ARC-Seal: i=1; a=rsa-sha256; t=1684878046; cv=none; d=zohomail.com; s=zohoarc; b=AGC/HEX9irvd2jBKaU9HkXppDqXHuJMPEIvJg8JlNXysQ9S7v1x535wJqUx+5MGTDlffwUZcQMmiL2GTeQpq9SJO7O5hIOmfIAw1Sy5kN8dNWOLE6Tm2YtNIcmROb9rnVsRJ9nLiBCptYyBAx2R9a/qo++cTyjdff04E+XbumkQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1684878046; 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=sE8uQW9/c5L7j6pxID4MOVzXCAwl4cvJMoDUBD3pipY=; b=OGxHnAvMLOZc3KowPagevGtKpjAV1z6locdSj70/1MO1fVWgFEaoLjFWhcHM7CKiTSX0uWMc1tmYaJ4zUimo4J+SoMjHCu6I5c22fC7IaABEtBJnTG6KTymMq6F76oSwwUJgq7lREjzGamQjDZvsl8OMOasppPEJm2TKppVJPDA= 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=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1684878046532617.6965153827006; Tue, 23 May 2023 14:40:46 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q1Zj4-0000a2-1c; Tue, 23 May 2023 17:39:26 -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 1q1Zj2-0000VO-0q; Tue, 23 May 2023 17:39:24 -0400 Received: from smtp-out1.suse.de ([195.135.220.28]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1q1Zj0-0004fZ-I4; Tue, 23 May 2023 17:39:23 -0400 Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 105122230F; Tue, 23 May 2023 21:39:21 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 76CFF13588; Tue, 23 May 2023 21:39:18 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id CAhTEIYybWQ7CwAAMHmgww (envelope-from ); Tue, 23 May 2023 21:39:18 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1684877961; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=sE8uQW9/c5L7j6pxID4MOVzXCAwl4cvJMoDUBD3pipY=; b=gDYlhJ9ZGivbaxXz5WIkRag9ik3c5JTxvGPi1c3UB4TQ81/MpgUcLyYoZTebmQOhlMu6/0 5M9K1jQS7Ttao/HKc1TGPuiL3+CKJWCs5IOiiEOjLCT9AKYG+zqU/gDNghrP0QAE+qOaUO uoDwmrdNKSyKj7VtUYntTCpBqf5nt3g= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1684877961; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=sE8uQW9/c5L7j6pxID4MOVzXCAwl4cvJMoDUBD3pipY=; b=dnxYUTLsXRvyQ+yLzw9VRuYcm4cAw7gfnrgIj0rTGpiQZCEwUKZmE+Kc80gI+YguvhwocZ y+q1gGgeub5wzGAQ== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, Kevin Wolf , Hanna Reitz , Markus Armbruster , =?UTF-8?q?Jo=C3=A3o=20Silva?= , Lin Ma , Claudio Fontana , Dario Faggioli , Eric Blake Subject: [RFC PATCH 4/6] Convert query-block/info_block to coroutine Date: Tue, 23 May 2023 18:39:01 -0300 Message-Id: <20230523213903.18418-5-farosas@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20230523213903.18418-1-farosas@suse.de> References: <20230523213903.18418-1-farosas@suse.de> 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=195.135.220.28; envelope-from=farosas@suse.de; helo=smtp-out1.suse.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 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_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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 @suse.de) X-ZM-MESSAGEID: 1684878047747100005 Content-Type: text/plain; charset="utf-8" From: Lin Ma Sometimes the query-block performs time-consuming I/O(say waiting for the fstat of NFS complete), So let's make this QMP handler runs in a coroutine. The following patch moves the fstat() into a thread pool. Signed-off-by: Lin Ma Signed-off-by: Fabiano Rosas --- blockdev.c | 6 +++--- qapi/block-core.json | 3 ++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/blockdev.c b/blockdev.c index 5d56b79df4..6412548662 100644 --- a/blockdev.c +++ b/blockdev.c @@ -2804,9 +2804,9 @@ void qmp_drive_backup(DriveBackup *backup, Error **er= rp) blockdev_do_action(&action, errp); } =20 -BlockDeviceInfoList *qmp_query_named_block_nodes(bool has_flat, - bool flat, - Error **errp) +BlockDeviceInfoList *coroutine_fn qmp_query_named_block_nodes(bool has_fla= t, + bool flat, + Error **errp) { bool return_flat =3D has_flat && flat; =20 diff --git a/qapi/block-core.json b/qapi/block-core.json index da95fe456c..0559c38412 100644 --- a/qapi/block-core.json +++ b/qapi/block-core.json @@ -1972,7 +1972,8 @@ { 'command': 'query-named-block-nodes', 'returns': [ 'BlockDeviceInfo' ], 'data': { '*flat': 'bool' }, - 'allow-preconfig': true } + 'allow-preconfig': true, + 'coroutine': true} =20 ## # @XDbgBlockGraphNodeType: --=20 2.35.3 From nobody Sat May 18 03:46:23 2024 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=none dis=none) header.from=suse.de ARC-Seal: i=1; a=rsa-sha256; t=1684878036; cv=none; d=zohomail.com; s=zohoarc; b=U9wbj8mwzr6pS/tuaPYWlj4l6+zDIlCdNR3tjrWzpj9y54mUcUT9+AYfF2KrywoJMdHZCvX79PeuLpr7fE+JupPrNUqE+K+ESiVNvZO6GMHJbOsOpBiMU4ryPVEoCxgnxYgn7zhIoYe37h67NFxdyu0fsR3xbCgd1vICO3167PY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1684878036; 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=MZRkBMV9CBMUFXLX/xkNC4zvHhFkiT+22nxJpPXJ7Lk=; b=YzNAMomYKCFps4k+6vFvJwWy2IH1syq7awXbxOwhbcTFkFkMSZeb7cZ3TevUdFkO9z7q/EMX+xI/M/EffPkLoA0xv+tbO/Vc031YSdJ9yPg5o9vKg8CFbJKWU3W18pVuZZy1QI90zNdBVaxBNRC/436yzxqpUhdMJwp5MmfG8sU= 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=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1684878036183957.9824901030034; Tue, 23 May 2023 14:40:36 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q1Zj6-0000b9-JB; Tue, 23 May 2023 17:39:28 -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 1q1Zj5-0000aa-1k; Tue, 23 May 2023 17:39:27 -0400 Received: from smtp-out1.suse.de ([2001:67c:2178:6::1c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1q1Zj3-0004gE-HY; Tue, 23 May 2023 17:39:26 -0400 Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 15A3422557; Tue, 23 May 2023 21:39:24 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 7A9A913588; Tue, 23 May 2023 21:39:21 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id iEE5EYkybWQ7CwAAMHmgww (envelope-from ); Tue, 23 May 2023 21:39:21 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1684877964; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=MZRkBMV9CBMUFXLX/xkNC4zvHhFkiT+22nxJpPXJ7Lk=; b=Dg57z3XPQmfXOiDWsAqw2d8WXR+A2o4vC+KdPEPl4l1l8eemDiCB6wp0Y9xZCa8TBc3BWz 0LfCyEkqAyNIHKHgShs6gWk7nNDy+3sn9N9mOoHvVfgQIr9EChAklOZVzZzymuefpdQ5Ws r9slKaMncw4qO10ybr3Pq+MTqcsZlRU= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1684877964; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=MZRkBMV9CBMUFXLX/xkNC4zvHhFkiT+22nxJpPXJ7Lk=; b=LCXhv7PLaXGnpztF8uCdM9T76Xiix3D9Im+gOIl4P+iIHSdFbggXn3GZ7jcQFoPimdIbTZ M8ZsPOSXEIB61TBA== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, Kevin Wolf , Hanna Reitz , Markus Armbruster , =?UTF-8?q?Jo=C3=A3o=20Silva?= , Lin Ma , Claudio Fontana , Dario Faggioli , Eric Blake Subject: [RFC PATCH 5/6] block: Allow bdrv_get_allocated_file_size to run in bdrv context Date: Tue, 23 May 2023 18:39:02 -0300 Message-Id: <20230523213903.18418-6-farosas@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20230523213903.18418-1-farosas@suse.de> References: <20230523213903.18418-1-farosas@suse.de> 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=2001:67c:2178:6::1c; envelope-from=farosas@suse.de; helo=smtp-out1.suse.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 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_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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 @suse.de) X-ZM-MESSAGEID: 1684878038396100007 Content-Type: text/plain; charset="utf-8" We're about to move calls to 'fstat' into the thread-pool to avoid blocking VCPU threads should the system call take too long. To achieve that we first need to make sure none of its callers is holding the aio_context lock, otherwise yielding before scheduling the aiocb handler would result in a deadlock when the qemu_global_mutex is released and another thread tries to acquire the aio_context. Signed-off-by: Fabiano Rosas --- block/qapi.c | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/block/qapi.c b/block/qapi.c index ae6cd1c2ff..cd197abf1f 100644 --- a/block/qapi.c +++ b/block/qapi.c @@ -222,6 +222,26 @@ int bdrv_query_snapshot_info_list(BlockDriverState *bs, return 0; } =20 +static int64_t bdrv_get_actual_size(BlockDriverState *bs) +{ + int64_t size; + AioContext *old_ctx =3D NULL; + + if (qemu_in_coroutine()) { + aio_context_release(bdrv_get_aio_context(bs)); + old_ctx =3D bdrv_co_enter(bs); + } + + size =3D bdrv_get_allocated_file_size(bs); + + if (qemu_in_coroutine() && old_ctx) { + bdrv_co_leave(bs, old_ctx); + aio_context_acquire(bdrv_get_aio_context(bs)); + } + + return size; +} + /** * Helper function for other query info functions. Store information abou= t @bs * in @info, setting @errp on error. @@ -250,7 +270,7 @@ static void bdrv_do_query_node_info(BlockDriverState *b= s, info->filename =3D g_strdup(bs->filename); info->format =3D g_strdup(bdrv_get_format_name(bs)); info->virtual_size =3D size; - info->actual_size =3D bdrv_get_allocated_file_size(bs); + info->actual_size =3D bdrv_get_actual_size(bs); info->has_actual_size =3D info->actual_size >=3D 0; if (bs->encrypted) { info->encrypted =3D true; --=20 2.35.3 From nobody Sat May 18 03:46:23 2024 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=none dis=none) header.from=suse.de ARC-Seal: i=1; a=rsa-sha256; t=1684878025; cv=none; d=zohomail.com; s=zohoarc; b=hTXvLwEVU6Ea+on9EZ0zxI7jUISEi3bsM7CWwR0zZy5YCsfG3lOuFgKU3ZxrAKIYoSmJIKThibnTM89J7njU3kK794JxhgwfjqlO0LYBBHXa6ebBJa4u9VXdPnKTFTGYAQx/HTVIS9pSSkZlowYvWyyiv+t3PyCnbqe1lkXrmI0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1684878025; 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=8UtTA4VS+v6RK2oMpfABPplNec6WNdoTQcTTtAspvnQ=; b=LTk/ZyHmssubBjp99DFacj3AVXN8wF60yNxht7BLQiLTIpv4iOb2NFvcZ1nOnIRdrwWhPf/fR7iJfNl9OrEN1XTeyjR4AEd6I4+VVHJLuHY0qDtqn6w8Hc9ojLIDeAzFNRnmRwjbOptes90+i9Zs1smOJ4LiJ2Okfni4XctSvn0= 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=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1684878025685874.0139473972666; Tue, 23 May 2023 14:40:25 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q1ZjA-0000c2-7M; Tue, 23 May 2023 17:39:32 -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 1q1Zj8-0000bS-6w; Tue, 23 May 2023 17:39:30 -0400 Received: from smtp-out2.suse.de ([2001:67c:2178:6::1d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1q1Zj6-0004gg-IV; Tue, 23 May 2023 17:39:29 -0400 Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 1B6DA1FDCB; Tue, 23 May 2023 21:39:27 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 8241413588; Tue, 23 May 2023 21:39:24 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id aDshE4wybWQ7CwAAMHmgww (envelope-from ); Tue, 23 May 2023 21:39:24 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1684877967; h=from:from:reply-to: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=8UtTA4VS+v6RK2oMpfABPplNec6WNdoTQcTTtAspvnQ=; b=ZFN45fZ8pNmgR39ZjjnpZOXw63X4QHuDxlraulPSEdmbwpyNBjan6nyjuIlz9y+NZZujKp MKpcM9axn0OiqNzhHwi7ZGMXCfline18ToIEtVdE44gzTTFuN58ev1zU5BHbM17TNTEvDq 2z5kCJ7woZ24LtRPhYbjqZoJDrfMWv0= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1684877967; h=from:from:reply-to: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=8UtTA4VS+v6RK2oMpfABPplNec6WNdoTQcTTtAspvnQ=; b=6V1fACaHflbVjqW1vmCNkItt+YcjBXhkjBWFnetDu6HejqKvv3KUY1KN/Rqip+Duida0Ah pJ0pCYHpHxsOAjAA== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, Kevin Wolf , Hanna Reitz , Markus Armbruster , =?UTF-8?q?Jo=C3=A3o=20Silva?= , Lin Ma , Claudio Fontana , Dario Faggioli , Eric Blake Subject: [RFC PATCH 6/6] block: Add a thread-pool version of fstat Date: Tue, 23 May 2023 18:39:03 -0300 Message-Id: <20230523213903.18418-7-farosas@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20230523213903.18418-1-farosas@suse.de> References: <20230523213903.18418-1-farosas@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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=2001:67c:2178:6::1d; envelope-from=farosas@suse.de; helo=smtp-out2.suse.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 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_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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 @suse.de) X-ZM-MESSAGEID: 1684878027874100003 From: Jo=C3=A3o Silva The fstat call can take a long time to finish when running over NFS. Add a version of it that runs in the thread pool. Adapt one of its users, raw_co_get_allocated_file size to use the new version. That function is called via QMP under the qemu_global_mutex so it has a large chance of blocking VCPU threads in case it takes too long to finish. Signed-off-by: Jo=C3=A3o Silva Signed-off-by: Fabiano Rosas Reviewed-by: Claudio Fontana --- block/file-posix.c | 40 +++++++++++++++++++++++++++++++++++++--- include/block/raw-aio.h | 4 +++- 2 files changed, 40 insertions(+), 4 deletions(-) diff --git a/block/file-posix.c b/block/file-posix.c index 0ab158efba..0a29a6cc43 100644 --- a/block/file-posix.c +++ b/block/file-posix.c @@ -227,6 +227,9 @@ typedef struct RawPosixAIOData { struct { unsigned long op; } zone_mgmt; + struct { + struct stat *st; + } fstat; }; } RawPosixAIOData; =20 @@ -2644,6 +2647,34 @@ static void raw_close(BlockDriverState *bs) } } =20 +static int handle_aiocb_fstat(void *opaque) +{ + RawPosixAIOData *aiocb =3D opaque; + + if (fstat(aiocb->aio_fildes, aiocb->fstat.st) < 0) { + return -errno; + } + + return 0; +} + +static int coroutine_fn raw_co_fstat(BlockDriverState *bs, struct stat *st) +{ + BDRVRawState *s =3D bs->opaque; + RawPosixAIOData acb; + + acb =3D (RawPosixAIOData) { + .bs =3D bs, + .aio_fildes =3D s->fd, + .aio_type =3D QEMU_AIO_FSTAT, + .fstat =3D { + .st =3D st, + }, + }; + + return raw_thread_pool_submit(handle_aiocb_fstat, &acb); +} + /** * Truncates the given regular file @fd to @offset and, when growing, fill= s the * new space according to @prealloc. @@ -2883,11 +2914,14 @@ static int64_t coroutine_fn raw_co_getlength(BlockD= riverState *bs) static int64_t coroutine_fn raw_co_get_allocated_file_size(BlockDriverStat= e *bs) { struct stat st; - BDRVRawState *s =3D bs->opaque; + int ret; =20 - if (fstat(s->fd, &st) < 0) { - return -errno; + ret =3D raw_co_fstat(bs, &st); + + if (ret) { + return ret; } + return (int64_t)st.st_blocks * 512; } =20 diff --git a/include/block/raw-aio.h b/include/block/raw-aio.h index 0fe85ade77..7dc6d24e21 100644 --- a/include/block/raw-aio.h +++ b/include/block/raw-aio.h @@ -31,6 +31,7 @@ #define QEMU_AIO_ZONE_REPORT 0x0100 #define QEMU_AIO_ZONE_MGMT 0x0200 #define QEMU_AIO_ZONE_APPEND 0x0400 +#define QEMU_AIO_FSTAT 0x0800 #define QEMU_AIO_TYPE_MASK \ (QEMU_AIO_READ | \ QEMU_AIO_WRITE | \ @@ -42,7 +43,8 @@ QEMU_AIO_TRUNCATE | \ QEMU_AIO_ZONE_REPORT | \ QEMU_AIO_ZONE_MGMT | \ - QEMU_AIO_ZONE_APPEND) + QEMU_AIO_ZONE_APPEND | \ + QEMU_AIO_FSTAT) =20 /* AIO flags */ #define QEMU_AIO_MISALIGNED 0x1000 --=20 2.35.3