From nobody Wed Feb 11 03:48:36 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=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1680690819; cv=none; d=zohomail.com; s=zohoarc; b=dFdr7SQO8MQMgDPdNIxGKSaQS8A1bAILWPjL1yPudMYKQYXmNqVmHnohVOe4u45B/upkuzpEgyOGgJID/6PIe50bzviGT6EOPoeRTPBQyVbrKmgEZEjOVR4y7N44RJ+gmkeR09ycxLUYt8AWQWv7RBP1XRvT3Kek3UlIvxmjsBU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1680690819; 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=mdKtTCDBgF2Xg2cUKGIiCmE72BwPaSPWYrcU4MbXnj0=; b=BWQFZ1izXmT53EjmG3V353UVV8CWa++M7/+6trnxd0ts73aqcZHLG89tgMjOUn5nmrzGwLpx8Xk7QHFLn1e4gJu1/0ie8g8GnXAWkKhy6NiCDwhhBrkkwkYs4wrluUsYN4XfbA91xgqqDIBmuUKf4oc1aMfFhy3FkcAA/d4B4gA= 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 1680690819458472.70636550966606; Wed, 5 Apr 2023 03:33:39 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pk0RH-0000zU-1t; Wed, 05 Apr 2023 06:32:27 -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 1pk0RF-0000yB-1y for qemu-devel@nongnu.org; Wed, 05 Apr 2023 06:32:25 -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 1pk0RD-0007TZ-8G for qemu-devel@nongnu.org; Wed, 05 Apr 2023 06:32:24 -0400 Received: from mail-ed1-f69.google.com (mail-ed1-f69.google.com [209.85.208.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-310-O79WWdF-PoeYweYgldHq4w-1; Wed, 05 Apr 2023 06:32:21 -0400 Received: by mail-ed1-f69.google.com with SMTP id 4fb4d7f45d1cf-4f9e6d2cc4bso1183554a12.1 for ; Wed, 05 Apr 2023 03:32:21 -0700 (PDT) Received: from [192.168.10.118] ([2001:b07:6468:f312:9af8:e5f5:7516:fa89]) by smtp.gmail.com with ESMTPSA id y93-20020a50bb66000000b004fb30fc1dabsm7087774ede.96.2023.04.05.03.32.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Apr 2023 03:32:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1680690742; 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=mdKtTCDBgF2Xg2cUKGIiCmE72BwPaSPWYrcU4MbXnj0=; b=XEVRE8Gj5Rt6sABZ3M62h/+oqxXU8pvRLotiUSMHO4GqhSKMoKx4ONseDeEnR9OS9HQ1sk dbQV4bPMZt+NawIrB+s0shumFDLHK3mwUlAMAVQzh8N/qaUUn+I0+dEOW6gqq68KCOgmZh Q+Fvt2biG7s1/GoauJKFe5ih8dHEqTM= X-MC-Unique: O79WWdF-PoeYweYgldHq4w-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680690739; x=1683282739; 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=mdKtTCDBgF2Xg2cUKGIiCmE72BwPaSPWYrcU4MbXnj0=; b=av6l3K/d0UOLMcpHu9ayX9/03IjLX2SCYkobOvsbsT5mbQbtARJB7+Y9gyuIIGhEWV tSgTUoYo1Aa4RyuH9Y9SgWZR/VtpLW+LiMsbMLN8u93ZE+A/IFJeuueRfKAk5W1/XAJl UR7EFlCJ6jsOVBl98syn2Nhep34uwbVAOqT9Girq0JWXsYmevRtpzzjWnK3hhD+q953f gFbHEyAGC18dJMhe4cyn0JEkWA7leyUhkLstOW6bapWOWgUu14nrAQef2mZ6yPxL7kmM Oord+nkqpaZkzqbVzJ/mIDuv/4kSDRkp/SUAs3a2g/7XxMknkrNa9hNf1In2UOBvqOva 1Jkw== X-Gm-Message-State: AAQBX9fsoqxsyV8kv8e4yVJ4auIhhVOkZ+s/LEhlCMKKV3Y6o02u81bO 7emZklbugsmBYzAIQ4nu8lPxYP8+EfgvqaMj8v2ujsHKOdcYUkly9evnzHJmJYc3Oa+TNruuG3/ dsCVAj0nON9dU0/9fFwRa3AhdfYSA+TP2mVV6bLok1IDA8+wUC2QNZ+0aZoxP5ERL3f859xUbhw s= X-Received: by 2002:a05:6402:2813:b0:500:58cb:3afd with SMTP id h19-20020a056402281300b0050058cb3afdmr1043447ede.3.1680690739672; Wed, 05 Apr 2023 03:32:19 -0700 (PDT) X-Google-Smtp-Source: AKy350YZTHMgm6e0qzhPp3Ab8X6VFy8ERXAmvxxXaRDUuUZbnKpjydjshH8974vWQ/ZhmCLWzkkMGQ== X-Received: by 2002:a05:6402:2813:b0:500:58cb:3afd with SMTP id h19-20020a056402281300b0050058cb3afdmr1043436ede.3.1680690739425; Wed, 05 Apr 2023 03:32:19 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Cc: qemu-block@nongnu.org Subject: [PATCH 1/4] block: rename the bdrv_co_block_status static function Date: Wed, 5 Apr 2023 12:32:13 +0200 Message-Id: <20230405103216.128103-2-pbonzini@redhat.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230405103216.128103-1-pbonzini@redhat.com> References: <20230405103216.128103-1-pbonzini@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=pbonzini@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, 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: 1680690820098100001 Content-Type: text/plain; charset="utf-8" bdrv_block_status exists as a wrapper for bdrv_block_status_above, but the name of the (hypothetical) coroutine version, bdrv_co_block_status, is squatted by a random static function. Rename it to bdrv_do_block_status. Signed-off-by: Paolo Bonzini --- block/io.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/block/io.c b/block/io.c index db438c765757..e86090b7692b 100644 --- a/block/io.c +++ b/block/io.c @@ -2230,7 +2230,7 @@ int bdrv_flush_all(void) * set to the host mapping and BDS corresponding to the guest offset. */ static int coroutine_fn GRAPH_RDLOCK -bdrv_co_block_status(BlockDriverState *bs, bool want_zero, +bdrv_do_block_status(BlockDriverState *bs, bool want_zero, int64_t offset, int64_t bytes, int64_t *pnum, int64_t *map, BlockDriverState **file) { @@ -2391,7 +2391,7 @@ bdrv_co_block_status(BlockDriverState *bs, bool want_= zero, =20 if (ret & BDRV_BLOCK_RAW) { assert(ret & BDRV_BLOCK_OFFSET_VALID && local_file); - ret =3D bdrv_co_block_status(local_file, want_zero, local_map, + ret =3D bdrv_do_block_status(local_file, want_zero, local_map, *pnum, pnum, &local_map, &local_file); goto out; } @@ -2419,7 +2419,7 @@ bdrv_co_block_status(BlockDriverState *bs, bool want_= zero, int64_t file_pnum; int ret2; =20 - ret2 =3D bdrv_co_block_status(local_file, want_zero, local_map, + ret2 =3D bdrv_do_block_status(local_file, want_zero, local_map, *pnum, &file_pnum, NULL, NULL); if (ret2 >=3D 0) { /* Ignore errors. This is just providing extra information, it @@ -2487,7 +2487,7 @@ bdrv_co_common_block_status_above(BlockDriverState *b= s, return 0; } =20 - ret =3D bdrv_co_block_status(bs, want_zero, offset, bytes, pnum, map, = file); + ret =3D bdrv_do_block_status(bs, want_zero, offset, bytes, pnum, map, = file); ++*depth; if (ret < 0 || *pnum =3D=3D 0 || ret & BDRV_BLOCK_ALLOCATED || bs =3D= =3D base) { return ret; @@ -2503,7 +2503,7 @@ bdrv_co_common_block_status_above(BlockDriverState *b= s, for (p =3D bdrv_filter_or_cow_bs(bs); include_base || p !=3D base; p =3D bdrv_filter_or_cow_bs(p)) { - ret =3D bdrv_co_block_status(p, want_zero, offset, bytes, pnum, ma= p, + ret =3D bdrv_do_block_status(p, want_zero, offset, bytes, pnum, ma= p, file); ++*depth; if (ret < 0) { --=20 2.39.2 From nobody Wed Feb 11 03:48:36 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=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1680690800; cv=none; d=zohomail.com; s=zohoarc; b=l6T140xAsAymag5JzVP4vJBxc1gCgp9769DgyLda6omGUHU/69gth6u8fAFEsH4buK8bQ7tRemW5ttDGYVocDKDQcz9BA1sNf+4CxXQsNm7hJbuKbfagEQtrsUZ4jOWC1Ek9HMsSNn58hkiotfNnf+lD4D8mjTxb9duwheRIaXg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1680690800; 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=C3/yLuMDLEQfKKDnIdznpsuaR1dlmr0vVoCd8UJaffQ=; b=M+FSRnRPTpH/dP/HwdR1jRosWKqDsSQSiGOWLOqQB9IMZom4AAAjjDucJAOC0g6JDT2ntcMHyeHy5JeUauhjteIK9XCK8ZhoD/lUQeO3rghCfELa/6vsUM1YsA4Qt5xn1e2napOXFS2c4eGbsG5NZJTaOyRcM2zta0ABfrV+lVc= 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 1680690800898765.9601371704151; Wed, 5 Apr 2023 03:33:20 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pk0RI-0000zk-7i; Wed, 05 Apr 2023 06:32: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 1pk0RG-0000zO-OB for qemu-devel@nongnu.org; Wed, 05 Apr 2023 06:32:26 -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 1pk0RF-0007US-44 for qemu-devel@nongnu.org; Wed, 05 Apr 2023 06:32:26 -0400 Received: from mail-ed1-f69.google.com (mail-ed1-f69.google.com [209.85.208.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-303-O_V_mvuFNh2Z9udNI8t2cw-1; Wed, 05 Apr 2023 06:32:22 -0400 Received: by mail-ed1-f69.google.com with SMTP id v1-20020a50d581000000b0050291cda08aso16012577edi.15 for ; Wed, 05 Apr 2023 03:32:22 -0700 (PDT) Received: from [192.168.10.118] ([2001:b07:6468:f312:9af8:e5f5:7516:fa89]) by smtp.gmail.com with ESMTPSA id z9-20020a17090665c900b0093fa8c2e877sm7108168ejn.80.2023.04.05.03.32.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Apr 2023 03:32:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1680690744; 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=C3/yLuMDLEQfKKDnIdznpsuaR1dlmr0vVoCd8UJaffQ=; b=R9YfwDi0NzO9uo7e1NL/zU67qpYFUXr/UEflcctPbAb28QAaRkh9Ak6NKWEYcZ0L3x+O+9 v6/eh2QLtlQDby+dQGSblCBC1R151chppsWWd7NDgl5KdPtBq3G7iWxpMjsDgohcVchbx4 sWeIYu/ime3sfYh3+XFXiAScvNwC8bQ= X-MC-Unique: O_V_mvuFNh2Z9udNI8t2cw-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680690741; x=1683282741; 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=C3/yLuMDLEQfKKDnIdznpsuaR1dlmr0vVoCd8UJaffQ=; b=7uPMnBB8dd4ltu8OIyJxZDVC2qhfELSg6HgtT/o7g6w499GP9yoYtI8AOChvrrhFFK eE7WG1YTXXKZVpYU8UZanjm+96DGQlkJM2TX2lHPnYS32sipUChkP1n7STxpssTr5HRE D7QyzuEJBQfSSa/n6jgnCo/04VdF87l4oO5hvEInXq/DlhiI6X0nsqjxhW2bXzGULYmH 43IiXGYUkDTDlDfqJcJFlHCFaYEUqkvCcWQ/ojkjPjjutwvkSZU81rTFiIui3YopJeOp PcZRUKpQl5ECzG8fyswxVZJUff6B4WKGaqfk3o78Q6oW6SEYWzdVbLU7wEJcmzc8Qoyi x68A== X-Gm-Message-State: AAQBX9fTvCMy7tBDtzQ2rRjnS/YurUB3c50/xZ2xvWbQwC+yyYHw1SsV enQVSIr0LHel4/pBnVW8Ncrd6yr125i84bDxxQzOLQXy+LenRaNN5/tulHnnW+lqDy8dlzm6Rsa j+MKPDX4nNBeMtf+N43eYkBKlX6WASR/+mEvAOkviheMgEveJyIyEUMgA5+dxl7LoojlZEjfJlW w= X-Received: by 2002:a17:906:9441:b0:92b:7e6a:bca0 with SMTP id z1-20020a170906944100b0092b7e6abca0mr2545662ejx.14.1680690741314; Wed, 05 Apr 2023 03:32:21 -0700 (PDT) X-Google-Smtp-Source: AKy350bjUEdH5DRouKJ+lA/UPftTwxyAFDa/4a6cLs7lbzWkKsb7MojtR0RgeLyfmr26Ig4jf+yJ9g== X-Received: by 2002:a17:906:9441:b0:92b:7e6a:bca0 with SMTP id z1-20020a170906944100b0092b7e6abca0mr2545647ejx.14.1680690740994; Wed, 05 Apr 2023 03:32:20 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Cc: qemu-block@nongnu.org Subject: [PATCH 2/4] block: complete public block status API Date: Wed, 5 Apr 2023 12:32:14 +0200 Message-Id: <20230405103216.128103-3-pbonzini@redhat.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230405103216.128103-1-pbonzini@redhat.com> References: <20230405103216.128103-1-pbonzini@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=pbonzini@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, 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: 1680690802384100002 Content-Type: text/plain; charset="utf-8" Include both coroutine and non-coroutine versions, the latter being co_wrapper_mixed_bdrv_rdlock of the former. Signed-off-by: Paolo Bonzini Reviewed-by: Eric Blake --- block/io.c | 18 +++++------------- include/block/block-io.h | 18 ++++++++++++------ 2 files changed, 17 insertions(+), 19 deletions(-) diff --git a/block/io.c b/block/io.c index e86090b7692b..0aad0f57d8c7 100644 --- a/block/io.c +++ b/block/io.c @@ -2570,21 +2570,13 @@ int coroutine_fn bdrv_co_block_status_above(BlockDr= iverState *bs, bytes, pnum, map, file, NULL); } =20 -int bdrv_block_status_above(BlockDriverState *bs, BlockDriverState *base, - int64_t offset, int64_t bytes, int64_t *pnum, - int64_t *map, BlockDriverState **file) +int coroutine_fn bdrv_co_block_status(BlockDriverState *bs, int64_t offset, + int64_t bytes, int64_t *pnum, + int64_t *map, BlockDriverState **fil= e) { IO_CODE(); - return bdrv_common_block_status_above(bs, base, false, true, offset, b= ytes, - pnum, map, file, NULL); -} - -int bdrv_block_status(BlockDriverState *bs, int64_t offset, int64_t bytes, - int64_t *pnum, int64_t *map, BlockDriverState **file) -{ - IO_CODE(); - return bdrv_block_status_above(bs, bdrv_filter_or_cow_bs(bs), - offset, bytes, pnum, map, file); + return bdrv_co_block_status_above(bs, bdrv_filter_or_cow_bs(bs), + offset, bytes, pnum, map, file); } =20 /* diff --git a/include/block/block-io.h b/include/block/block-io.h index 5da99d4d60ff..0947f83d9ac7 100644 --- a/include/block/block-io.h +++ b/include/block/block-io.h @@ -113,17 +113,23 @@ int coroutine_fn GRAPH_RDLOCK bdrv_co_pdiscard(BdrvCh= ild *child, int64_t offset, int64_t bytes); =20 bool bdrv_can_write_zeroes_with_unmap(BlockDriverState *bs); -int bdrv_block_status(BlockDriverState *bs, int64_t offset, - int64_t bytes, int64_t *pnum, int64_t *map, - BlockDriverState **file); + +int coroutine_fn GRAPH_RDLOCK +bdrv_co_block_status(BlockDriverState *bs, int64_t offset, + int64_t bytes, int64_t *pnum, + int64_t *map, BlockDriverState **file); +int co_wrapper_mixed_bdrv_rdlock bdrv_block_status(BlockDriverState *bs, i= nt64_t offset, + int64_t bytes, int64_t = *pnum, + int64_t *map, BlockDriv= erState **file); =20 int coroutine_fn GRAPH_RDLOCK bdrv_co_block_status_above(BlockDriverState *bs, BlockDriverState *base, int64_t offset, int64_t bytes, int64_t *pnum, int64_t *map, BlockDriverState **file); -int bdrv_block_status_above(BlockDriverState *bs, BlockDriverState *base, - int64_t offset, int64_t bytes, int64_t *pnum, - int64_t *map, BlockDriverState **file); +int co_wrapper_mixed_bdrv_rdlock +bdrv_block_status_above(BlockDriverState *bs, BlockDriverState *base, + int64_t offset, int64_t bytes, int64_t *pnum, + int64_t *map, BlockDriverState **file); =20 int coroutine_fn GRAPH_RDLOCK bdrv_co_is_allocated(BlockDriverState *bs, int64_t offset, int64_t bytes, --=20 2.39.2 From nobody Wed Feb 11 03:48:36 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=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1680690838; cv=none; d=zohomail.com; s=zohoarc; b=IxtNoxTBxhd8Le+p4U0f97rhb2VjSDQSpnbl6UGlRLASjYg0UonUxEeEUsZTk/80oGrT76lCio89ve29KUjle7C3Pc0BrOqfggJqQhHn7sGCx4rgMhIdW5qD9dpCVKN8bwLx471rZ9IjAQ5XaAEoJJ0cwrj1dPnivNO8cDiCqeQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1680690838; 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=cWCmqRJ7FD5WGIGTqakMZCDpKu840VhqTlbHYtjTE2g=; b=lhUA9jEk66ynp9Zi3g4w8w2w2h8XTYDh+DAHkJ5RtEBs+788XJHuV+5gg6TveLr/R9Sf/1dOIg6XKoMCrkxpLPKoVDjujaTqZacrQEHup5i5WQFFVAxvdaicF3BaQ4A+XvOSnpR325QhthxbaIUrXLstxkz8+YI1ZwrAB6DXdPI= 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 1680690838439399.0548417574727; Wed, 5 Apr 2023 03:33:58 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pk0RL-000125-E8; Wed, 05 Apr 2023 06:32:31 -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 1pk0RJ-00010d-Hb for qemu-devel@nongnu.org; Wed, 05 Apr 2023 06:32:29 -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 1pk0RG-0007bF-Ib for qemu-devel@nongnu.org; Wed, 05 Apr 2023 06:32:29 -0400 Received: from mail-ed1-f70.google.com (mail-ed1-f70.google.com [209.85.208.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-121-xvS3sSGNMHyyUUHXssV7Gw-1; Wed, 05 Apr 2023 06:32:24 -0400 Received: by mail-ed1-f70.google.com with SMTP id 4fb4d7f45d1cf-4fd22779a36so267412a12.3 for ; Wed, 05 Apr 2023 03:32:24 -0700 (PDT) Received: from [192.168.10.118] ([2001:b07:6468:f312:9af8:e5f5:7516:fa89]) by smtp.gmail.com with ESMTPSA id q18-20020a170906941200b009316783c92csm7274644ejx.12.2023.04.05.03.32.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Apr 2023 03:32:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1680690745; 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=cWCmqRJ7FD5WGIGTqakMZCDpKu840VhqTlbHYtjTE2g=; b=gSDSTKcoaekl3g9EIBNUj7slEhwNjf2v6OoG7j6k9QDS3UM8+yUKaub/rF9HqtqY7kUSKQ FBM55QQ1fegZqUXfvaNDYfKWBv+ZE2MdDNSk1lG8fTAilktHiIIBf+qRkei5T2vjVstRoC h8r0EMV1ddhBE7T90wi0gf9++ZLPhd8= X-MC-Unique: xvS3sSGNMHyyUUHXssV7Gw-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680690743; x=1683282743; 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=cWCmqRJ7FD5WGIGTqakMZCDpKu840VhqTlbHYtjTE2g=; b=qeic/Y8eEQ0K86ZxYpIbTeMzmB9T4xJwuPxrUlfGhDadEBKBwnYsZb810uxSLpssPk vxlX9AZ3bw2yTc6EmbM2nMyUwmrtGhPAp4J/VQfpnRHhnN5+XSdsXXkwQd65NL46NSHn 2yJTonwCny7Z6l+PwD7uB+W62m9H0Lg5Wj04hKvND3+2cWKlXFVwrsA9/7XoDoQvwsIu gTcY2WqnzNgN7bHLjvNhawrgsd3fv1TETQAKkrCU67Fvt+3jcFrziVStbSUZyj+bNkt0 FVhDAwD7FpOx1fMYw+BiHm6M5re9o4p8KDAmIH9akoe66wsSnDYY5S7ELSCAwrr5JvlV vg0Q== X-Gm-Message-State: AAQBX9fSTE70QpHto8LS/cDDMZNVPXG2mT/7nGdlAbhoZGnYjB/PSj66 iMI1QFjywYy9Mbufo9O9Zh4uxDOHruS6VyI4ZcXFMsfyre7JLTvjZhAARhz/9lHmr5Nyl/v68UL Ja9yru421XNYEkuQ7zgoX0CU/p/EFxTLOgxCBySkWhkYg618KQoSHgJ3VUpcHH5BpQjfTaGXFyB U= X-Received: by 2002:aa7:c543:0:b0:4fb:54b7:50ea with SMTP id s3-20020aa7c543000000b004fb54b750eamr1433870edr.21.1680690743048; Wed, 05 Apr 2023 03:32:23 -0700 (PDT) X-Google-Smtp-Source: AKy350b0rg5p0Cl9n98ZI7d/lDa3/gfirXsgoIjBA4gSPVlqEQmb5hG+updwio92bxUWLbi2blypVg== X-Received: by 2002:aa7:c543:0:b0:4fb:54b7:50ea with SMTP id s3-20020aa7c543000000b004fb54b750eamr1433847edr.21.1680690742662; Wed, 05 Apr 2023 03:32:22 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Cc: qemu-block@nongnu.org Subject: [PATCH 3/4] block: switch to co_wrapper for bdrv_is_allocated_* Date: Wed, 5 Apr 2023 12:32:15 +0200 Message-Id: <20230405103216.128103-4-pbonzini@redhat.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230405103216.128103-1-pbonzini@redhat.com> References: <20230405103216.128103-1-pbonzini@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=pbonzini@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, 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: 1680690840230100003 Content-Type: text/plain; charset="utf-8" Signed-off-by: Paolo Bonzini Reviewed-by: Eric Blake --- block/io.c | 53 ++++++---------------------------------- include/block/block-io.h | 12 +++++---- 2 files changed, 14 insertions(+), 51 deletions(-) diff --git a/block/io.c b/block/io.c index 0aad0f57d8c7..cacde79a3e98 100644 --- a/block/io.c +++ b/block/io.c @@ -2623,45 +2623,6 @@ int coroutine_fn bdrv_co_is_allocated(BlockDriverSta= te *bs, int64_t offset, return !!(ret & BDRV_BLOCK_ALLOCATED); } =20 -int bdrv_is_allocated(BlockDriverState *bs, int64_t offset, int64_t bytes, - int64_t *pnum) -{ - int ret; - int64_t dummy; - IO_CODE(); - - ret =3D bdrv_common_block_status_above(bs, bs, true, false, offset, - bytes, pnum ? pnum : &dummy, NULL, - NULL, NULL); - if (ret < 0) { - return ret; - } - return !!(ret & BDRV_BLOCK_ALLOCATED); -} - -/* See bdrv_is_allocated_above for documentation */ -int coroutine_fn bdrv_co_is_allocated_above(BlockDriverState *top, - BlockDriverState *base, - bool include_base, int64_t off= set, - int64_t bytes, int64_t *pnum) -{ - int depth; - int ret; - IO_CODE(); - - ret =3D bdrv_co_common_block_status_above(top, base, include_base, fal= se, - offset, bytes, pnum, NULL, NUL= L, - &depth); - if (ret < 0) { - return ret; - } - - if (ret & BDRV_BLOCK_ALLOCATED) { - return depth; - } - return 0; -} - /* * Given an image chain: ... -> [BASE] -> [INTER1] -> [INTER2] -> [TOP] * @@ -2679,18 +2640,18 @@ int coroutine_fn bdrv_co_is_allocated_above(BlockDr= iverState *top, * words, the result is not necessarily the maximum possible range); * but 'pnum' will only be 0 when end of file is reached. */ -int bdrv_is_allocated_above(BlockDriverState *top, - BlockDriverState *base, - bool include_base, int64_t offset, - int64_t bytes, int64_t *pnum) +int coroutine_fn bdrv_co_is_allocated_above(BlockDriverState *bs, + BlockDriverState *base, + bool include_base, int64_t off= set, + int64_t bytes, int64_t *pnum) { int depth; int ret; IO_CODE(); =20 - ret =3D bdrv_common_block_status_above(top, base, include_base, false, - offset, bytes, pnum, NULL, NULL, - &depth); + ret =3D bdrv_co_common_block_status_above(bs, base, include_base, fals= e, + offset, bytes, pnum, NULL, NUL= L, + &depth); if (ret < 0) { return ret; } diff --git a/include/block/block-io.h b/include/block/block-io.h index 0947f83d9ac7..9e179861895c 100644 --- a/include/block/block-io.h +++ b/include/block/block-io.h @@ -134,16 +134,18 @@ bdrv_block_status_above(BlockDriverState *bs, BlockDr= iverState *base, int coroutine_fn GRAPH_RDLOCK bdrv_co_is_allocated(BlockDriverState *bs, int64_t offset, int64_t bytes, int64_t *pnum); -int bdrv_is_allocated(BlockDriverState *bs, int64_t offset, int64_t bytes, - int64_t *pnum); +int co_wrapper_mixed_bdrv_rdlock +bdrv_is_allocated(BlockDriverState *bs, int64_t offset, + int64_t bytes, int64_t *pnum); =20 int coroutine_fn GRAPH_RDLOCK bdrv_co_is_allocated_above(BlockDriverState *top, BlockDriverState *base, bool include_base, int64_t offset, int64_t byte= s, int64_t *pnum); -int bdrv_is_allocated_above(BlockDriverState *top, BlockDriverState *base, - bool include_base, int64_t offset, int64_t byt= es, - int64_t *pnum); +int co_wrapper_mixed_bdrv_rdlock +bdrv_is_allocated_above(BlockDriverState *bs, BlockDriverState *base, + bool include_base, int64_t offset, + int64_t bytes, int64_t *pnum); =20 int coroutine_fn GRAPH_RDLOCK bdrv_co_is_zero_fast(BlockDriverState *bs, int64_t offset, int64_t bytes); --=20 2.39.2 From nobody Wed Feb 11 03:48:36 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=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1680690820; cv=none; d=zohomail.com; s=zohoarc; b=I8TGWy0G8geapLrk7jm3LMxRDSiQ+24r4xGJbbGFobuBoFL/VyrA4qrQMt0PPl4K6gm1uYFe+8MewLRIWRAVH6zoUHV9bYNZIzyhbijVPfT1r3vBb/6Rm54m3shHTE/EIgnzAYKd5PWisTS67wOsKl5Qx/YYaYynTJm0Tg7gv9E= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1680690820; 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=kkESQVtv/MgXRVmpuCvbJqBLRbuLYc8sOwwtcOcWjkg=; b=EXQESchvxF7Y9L6DCjjgHiYCBnCtjZpx21uTq1iJxsGmvOXK/9HZrSHPpMM+jeSLdVqxujFHzhCbwvWbBjBwEYRXZwxF6LssB4B8q9b5LSCn/PQTGiQsJfhtqwadWqGD6HmHxMB7xrvpfPerjdwD/INJJtCXnmYwdlttZ+vOCB8= 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 1680690819941974.0928830940582; Wed, 5 Apr 2023 03:33:39 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pk0RM-00013p-GC; Wed, 05 Apr 2023 06:32: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 1pk0RK-00011a-Tw for qemu-devel@nongnu.org; Wed, 05 Apr 2023 06:32:30 -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 1pk0RI-0007jI-Aa for qemu-devel@nongnu.org; Wed, 05 Apr 2023 06:32:30 -0400 Received: from mail-ed1-f72.google.com (mail-ed1-f72.google.com [209.85.208.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-175-VK3MR2-MMiGcSGRhtrMn7w-1; Wed, 05 Apr 2023 06:32:26 -0400 Received: by mail-ed1-f72.google.com with SMTP id x35-20020a50baa6000000b005021d1b1e9eso49905399ede.13 for ; Wed, 05 Apr 2023 03:32:26 -0700 (PDT) Received: from [192.168.10.118] ([2001:b07:6468:f312:9af8:e5f5:7516:fa89]) by smtp.gmail.com with ESMTPSA id 29-20020a170906009d00b008ca52f7fbcbsm7183108ejc.1.2023.04.05.03.32.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Apr 2023 03:32:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1680690747; 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=kkESQVtv/MgXRVmpuCvbJqBLRbuLYc8sOwwtcOcWjkg=; b=SOwun3GQK/brwHTSG1VwC/8Lxj5yOaUzNHipBWsNexO4lmEZc1WLHfMynIUYxQwJGK5msV CLJ7kN8OVtxdIZ4BQ1eKamguHEbAAblcBV5/ipmP00UF3Y/p7w4PM+u7PB/pzCqoWVNO9H zIHusGpke8ySN2kMGBP6Eo7cT6zoVD0= X-MC-Unique: VK3MR2-MMiGcSGRhtrMn7w-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680690745; x=1683282745; 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=kkESQVtv/MgXRVmpuCvbJqBLRbuLYc8sOwwtcOcWjkg=; b=4gSmulGuZJcMjWmzG/8RD2jv0U2ZQL+UVjY1ZnHDknvrQoMKjPwXJkeehm86W7cJa8 WkysHD4RGKXRYKZnbeYNADwipAB4jHn4snPNtFXu+SDNc+2fHN0xAj7lcQ2IIlV+0Wpk 5hKXrEByIf1qTdK/XZfy25X0fSnlULRr0LFT9ablSxaSUNYF61HWfhKJcsmZcxMrToH5 B8IqfUZHdmojk/NwxNFB/oDaGeZ97mGg/dLJSWBmlCmVi/WqgVOKUL/ItIkAJcULIxUO 5oIGFJnykcb05v7VVJHwXschRnhkMXhf9RRowZdOnedaB7GWb3jRPOsrF7p0yCeik9Gd 6F3w== X-Gm-Message-State: AAQBX9clHMea+Wn2mn1e8gh+3AAKM9NU47fIUWFYD2S9JhQh7oqFJMjk SnqNjI1333/0xUW7RiWLNfq6LQGn1oA3N8+d8zdAD+7D5e/57qeSaQIjjVluOBC3HofaREOSqtj xx7xs1VYdzUXrZNXs6PfrOdjozsWrSZWEN9xoz+AOaHUcK6sTiBj66m1vQAjra2lhWQuDII0xLx o= X-Received: by 2002:a17:906:f88f:b0:92f:5f00:db9c with SMTP id lg15-20020a170906f88f00b0092f5f00db9cmr2455636ejb.23.1680690744819; Wed, 05 Apr 2023 03:32:24 -0700 (PDT) X-Google-Smtp-Source: AKy350Y2DGejES7hrAl1lhz+QkEGx4G5csLe14O8CEAw7VupO1CyVggKDUNfrAWQmZWLAaBzsPGLUw== X-Received: by 2002:a17:906:f88f:b0:92f:5f00:db9c with SMTP id lg15-20020a170906f88f00b0092f5f00db9cmr2455624ejb.23.1680690744492; Wed, 05 Apr 2023 03:32:24 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Cc: qemu-block@nongnu.org Subject: [PATCH 4/4] block: convert more bdrv_is_allocated* and bdrv_block_status* calls to coroutine versions Date: Wed, 5 Apr 2023 12:32:16 +0200 Message-Id: <20230405103216.128103-5-pbonzini@redhat.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230405103216.128103-1-pbonzini@redhat.com> References: <20230405103216.128103-1-pbonzini@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=pbonzini@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, 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: 1680690822127100007 Content-Type: text/plain; charset="utf-8" Signed-off-by: Paolo Bonzini Reviewed-by: Eric Blake --- block/copy-before-write.c | 2 +- block/copy-on-read.c | 8 ++++---- block/io.c | 6 +++--- block/mirror.c | 10 +++++----- block/qcow2.c | 5 +++-- block/replication.c | 8 ++++---- block/stream.c | 8 ++++---- block/vvfat.c | 18 +++++++++--------- 8 files changed, 33 insertions(+), 32 deletions(-) diff --git a/block/copy-before-write.c b/block/copy-before-write.c index 646d8227a461..20c227cd8f8d 100644 --- a/block/copy-before-write.c +++ b/block/copy-before-write.c @@ -305,7 +305,7 @@ cbw_co_snapshot_block_status(BlockDriverState *bs, return -EACCES; } =20 - ret =3D bdrv_block_status(child->bs, offset, cur_bytes, pnum, map, fil= e); + ret =3D bdrv_co_block_status(child->bs, offset, cur_bytes, pnum, map, = file); if (child =3D=3D s->target) { /* * We refer to s->target only for areas that we've written to it. diff --git a/block/copy-on-read.c b/block/copy-on-read.c index cc0f848b0f10..d7881abd69d9 100644 --- a/block/copy-on-read.c +++ b/block/copy-on-read.c @@ -146,11 +146,11 @@ cor_co_preadv_part(BlockDriverState *bs, int64_t offs= et, int64_t bytes, local_flags =3D flags; =20 /* In case of failure, try to copy-on-read anyway */ - ret =3D bdrv_is_allocated(bs->file->bs, offset, bytes, &n); + ret =3D bdrv_co_is_allocated(bs->file->bs, offset, bytes, &n); if (ret <=3D 0) { - ret =3D bdrv_is_allocated_above(bdrv_backing_chain_next(bs->fi= le->bs), - state->bottom_bs, true, offset, - n, &n); + ret =3D bdrv_co_is_allocated_above(bdrv_backing_chain_next(bs-= >file->bs), + state->bottom_bs, true, offse= t, + n, &n); if (ret > 0 || ret < 0) { local_flags |=3D BDRV_REQ_COPY_ON_READ; } diff --git a/block/io.c b/block/io.c index cacde79a3e98..b0f6a49dc5df 100644 --- a/block/io.c +++ b/block/io.c @@ -1210,8 +1210,8 @@ bdrv_co_do_copy_on_readv(BdrvChild *child, int64_t of= fset, int64_t bytes, ret =3D 1; /* "already allocated", so nothing will be copied */ pnum =3D MIN(cluster_bytes, max_transfer); } else { - ret =3D bdrv_is_allocated(bs, cluster_offset, - MIN(cluster_bytes, max_transfer), &pnu= m); + ret =3D bdrv_co_is_allocated(bs, cluster_offset, + MIN(cluster_bytes, max_transfer), &= pnum); if (ret < 0) { /* * Safe to treat errors in querying allocation as if @@ -1358,7 +1358,7 @@ bdrv_aligned_preadv(BdrvChild *child, BdrvTrackedRequ= est *req, /* The flag BDRV_REQ_COPY_ON_READ has reached its addressee */ flags &=3D ~BDRV_REQ_COPY_ON_READ; =20 - ret =3D bdrv_is_allocated(bs, offset, bytes, &pnum); + ret =3D bdrv_co_is_allocated(bs, offset, bytes, &pnum); if (ret < 0) { goto out; } diff --git a/block/mirror.c b/block/mirror.c index af9bbd23d4cf..1c46ad51bf50 100644 --- a/block/mirror.c +++ b/block/mirror.c @@ -560,9 +560,9 @@ static uint64_t coroutine_fn mirror_iteration(MirrorBlo= ckJob *s) =20 assert(!(offset % s->granularity)); WITH_GRAPH_RDLOCK_GUARD() { - ret =3D bdrv_block_status_above(source, NULL, offset, - nb_chunks * s->granularity, - &io_bytes, NULL, NULL); + ret =3D bdrv_co_block_status_above(source, NULL, offset, + nb_chunks * s->granularity, + &io_bytes, NULL, NULL); } if (ret < 0) { io_bytes =3D MIN(nb_chunks * s->granularity, max_io_bytes); @@ -867,8 +867,8 @@ static int coroutine_fn mirror_dirty_init(MirrorBlockJo= b *s) } =20 WITH_GRAPH_RDLOCK_GUARD() { - ret =3D bdrv_is_allocated_above(bs, s->base_overlay, true, off= set, - bytes, &count); + ret =3D bdrv_co_is_allocated_above(bs, s->base_overlay, true, = offset, + bytes, &count); } if (ret < 0) { return ret; diff --git a/block/qcow2.c b/block/qcow2.c index fe5def438e15..f8ea03a34515 100644 --- a/block/qcow2.c +++ b/block/qcow2.c @@ -3951,7 +3951,8 @@ finish: } =20 =20 -static bool is_zero(BlockDriverState *bs, int64_t offset, int64_t bytes) +static bool coroutine_fn GRAPH_RDLOCK +is_zero(BlockDriverState *bs, int64_t offset, int64_t bytes) { int64_t nr; int res; @@ -3972,7 +3973,7 @@ static bool is_zero(BlockDriverState *bs, int64_t off= set, int64_t bytes) * backing file. So, we need a loop. */ do { - res =3D bdrv_block_status_above(bs, NULL, offset, bytes, &nr, NULL= , NULL); + res =3D bdrv_co_block_status_above(bs, NULL, offset, bytes, &nr, N= ULL, NULL); offset +=3D nr; bytes -=3D nr; } while (res >=3D 0 && (res & BDRV_BLOCK_ZERO) && nr && bytes); diff --git a/block/replication.c b/block/replication.c index de01f9618467..c0758841888e 100644 --- a/block/replication.c +++ b/block/replication.c @@ -276,10 +276,10 @@ replication_co_writev(BlockDriverState *bs, int64_t s= ector_num, while (remaining_sectors > 0) { int64_t count; =20 - ret =3D bdrv_is_allocated_above(top->bs, base->bs, false, - sector_num * BDRV_SECTOR_SIZE, - remaining_sectors * BDRV_SECTOR_SIZE, - &count); + ret =3D bdrv_co_is_allocated_above(top->bs, base->bs, false, + sector_num * BDRV_SECTOR_SIZE, + remaining_sectors * BDRV_SECTOR_S= IZE, + &count); if (ret < 0) { goto out1; } diff --git a/block/stream.c b/block/stream.c index 7f9e1ecdbb41..d92a4c99d359 100644 --- a/block/stream.c +++ b/block/stream.c @@ -163,7 +163,7 @@ static int coroutine_fn stream_run(Job *job, Error **er= rp) copy =3D false; =20 WITH_GRAPH_RDLOCK_GUARD() { - ret =3D bdrv_is_allocated(unfiltered_bs, offset, STREAM_CHUNK,= &n); + ret =3D bdrv_co_is_allocated(unfiltered_bs, offset, STREAM_CHU= NK, &n); if (ret =3D=3D 1) { /* Allocated in the top, no need to copy. */ } else if (ret >=3D 0) { @@ -171,9 +171,9 @@ static int coroutine_fn stream_run(Job *job, Error **er= rp) * Copy if allocated in the intermediate images. Limit to= the * known-unallocated area [offset, offset+n*BDRV_SECTOR_SI= ZE). */ - ret =3D bdrv_is_allocated_above(bdrv_cow_bs(unfiltered_bs), - s->base_overlay, true, - offset, n, &n); + ret =3D bdrv_co_is_allocated_above(bdrv_cow_bs(unfiltered_= bs), + s->base_overlay, true, + offset, n, &n); /* Finish early if end of backing file has been reached */ if (ret =3D=3D 0 && n =3D=3D 0) { n =3D len - offset; diff --git a/block/vvfat.c b/block/vvfat.c index 0ddc91fc096a..5df2d6b1c64d 100644 --- a/block/vvfat.c +++ b/block/vvfat.c @@ -1481,8 +1481,8 @@ vvfat_read(BlockDriverState *bs, int64_t sector_num, = uint8_t *buf, int nb_sector if (s->qcow) { int64_t n; int ret; - ret =3D bdrv_is_allocated(s->qcow->bs, sector_num * BDRV_SECTO= R_SIZE, - (nb_sectors - i) * BDRV_SECTOR_SIZE, &= n); + ret =3D bdrv_co_is_allocated(s->qcow->bs, sector_num * BDRV_SE= CTOR_SIZE, + (nb_sectors - i) * BDRV_SECTOR_SIZE= , &n); if (ret < 0) { return ret; } @@ -1807,10 +1807,10 @@ cluster_was_modified(BDRVVVFATState *s, uint32_t cl= uster_num) } =20 for (i =3D 0; !was_modified && i < s->sectors_per_cluster; i++) { - was_modified =3D bdrv_is_allocated(s->qcow->bs, - (cluster2sector(s, cluster_num) + - i) * BDRV_SECTOR_SIZE, - BDRV_SECTOR_SIZE, NULL); + was_modified =3D bdrv_co_is_allocated(s->qcow->bs, + (cluster2sector(s, cluster_num= ) + + i) * BDRV_SECTOR_SIZE, + BDRV_SECTOR_SIZE, NULL); } =20 /* @@ -1968,9 +1968,9 @@ get_cluster_count_for_direntry(BDRVVVFATState* s, dir= entry_t* direntry, const ch for (i =3D 0; i < s->sectors_per_cluster; i++) { int res; =20 - res =3D bdrv_is_allocated(s->qcow->bs, - (offset + i) * BDRV_SECTOR_SIZ= E, - BDRV_SECTOR_SIZE, NULL); + res =3D bdrv_co_is_allocated(s->qcow->bs, + (offset + i) * BDRV_SECTOR_= SIZE, + BDRV_SECTOR_SIZE, NULL); if (res < 0) { return -1; } --=20 2.39.2