From nobody Fri May 17 21:21:41 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1693821893; cv=none; d=zohomail.com; s=zohoarc; b=FrNOF4hynT+ihFiPpnonbQ70+afQzktZppsePOEWP35RztwOsKysiHt09VAz8GOE3KaSzTfr8H7GbdTfUv1SXmEIu/gXq9J6Ou308OykD4Oveu0zjE5rscrN60fMxJELciwHLELXVGia5PU+3OTHF4jWP6Rh7LcoupEgO15RX4g= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1693821893; 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=8bF+pbL5tZCJXn2MdnBzudY2ER9D0akSW12zaE/Q7pE=; b=kcYaCfw7ZqeEMOV6KCRRoJINyUbUZVksd3Bd/PuQZMbcL3sRZG4IyVD7FNahdwx6Xk/bCfIFjjke8UGaDWqcQoo+71Vjy7fyYTtzxpv6E9aB4pKBTC5aAfhFDRHzA0pThN2PqmxUkw/hwd0kZtoss/VIcUZB70UH0vhqbPTiinQ= 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 1693821893816183.9809837824074; Mon, 4 Sep 2023 03:04:53 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qd6QR-00012X-4o; Mon, 04 Sep 2023 06:03:19 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qd6QO-00010M-LK for qemu-devel@nongnu.org; Mon, 04 Sep 2023 06:03:16 -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 1qd6QL-0007p0-WE for qemu-devel@nongnu.org; Mon, 04 Sep 2023 06:03:16 -0400 Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-628-QKFL2YmVNwGwJdVq5QR0Yg-1; Mon, 04 Sep 2023 06:03:12 -0400 Received: by mail-wm1-f69.google.com with SMTP id 5b1f17b1804b1-402d1892cecso2137985e9.1 for ; Mon, 04 Sep 2023 03:03:11 -0700 (PDT) Received: from [192.168.10.118] ([2001:b07:6468:f312:5e2c:eb9a:a8b6:fd3e]) by smtp.gmail.com with ESMTPSA id w3-20020a05600c014300b003fefd46df47sm16696378wmm.29.2023.09.04.03.03.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Sep 2023 03:03:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1693821793; 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=8bF+pbL5tZCJXn2MdnBzudY2ER9D0akSW12zaE/Q7pE=; b=TriV+K1yyAn8Wgudq3x0h9u6R/dVYMegJsnRI/KVFQv/4vsULOYrNHsw+/PqZXa/vVKDrC CbcWainqYjCOPPHTQb5MYCIcZJ1dDa80JcBiT5g+Cz6HSPi9lXU4fDYDr8xMcAWcknPow7 wPUh8Jld1m+OYMRizBbm3IOswAFSdRo= X-MC-Unique: QKFL2YmVNwGwJdVq5QR0Yg-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1693821790; x=1694426590; 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=8bF+pbL5tZCJXn2MdnBzudY2ER9D0akSW12zaE/Q7pE=; b=A+Xeb9Xx5dzVWhLR0TkEpuYmVaIDtsCrlIIv/TlXHmO9ztXHCw1FCwYxn1XTHjrlAK cYlqAenUBA0hYRAmAstke45F+O07QgsIu90gPJ64AO5mgcftjpopqED1r2NghFVnvwWe 0kcaLWZq2CfzA4xXeU1l3GUKelGkuJEkb0+jjP85drp7cV1aadD8sqwtP5zVAj8Wth6h fCFDJmYI6gC8FGTMie7o2N3gg5ak8pBpgqMcc/zC7gv1v+YuidJ6PA3C4A+iaIRwn5Q7 dwwo4TbFd99NaW17VC+d7AAMEpzuU2ZMAv546yGDo6AJTpis+2DWpjAKhUg/p258EeES JAVw== X-Gm-Message-State: AOJu0Yyyu6mKlo5tynqYZ8SVf/J9c87l3uqrHrOodgQ8tlzksjMZLvZd QCfWP5YD0HmKWKz8axqN9A1EE36O6LliSbbh+fmlG5HsBq54ngt91/tsjXf8Jc5s5ZCG3zxr4EO WrCYn7mQQbwsWfgM87xXXFdCnrrEkgDkch6yUzlmDgkSW9bn/V9QXNq7ryD7gPOPYoTSNNs2XYg o= X-Received: by 2002:a05:600c:4656:b0:401:b24b:8279 with SMTP id n22-20020a05600c465600b00401b24b8279mr9722145wmo.1.1693821790038; Mon, 04 Sep 2023 03:03:10 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEEpTrxIGJ1QMe3wG2wIf5jcCmDqbkuC3y9ohSuIwOvs3ueFPDTTZhKobkoRIqzuyhItlpdNw== X-Received: by 2002:a05:600c:4656:b0:401:b24b:8279 with SMTP id n22-20020a05600c465600b00401b24b8279mr9722128wmo.1.1693821789807; Mon, 04 Sep 2023 03:03:09 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Cc: eblake@redhat.com, kwolf@redhat.com, qemu-block@nongnu.org Subject: [PATCH v3 1/4] block: rename the bdrv_co_block_status static function Date: Mon, 4 Sep 2023 12:03:03 +0200 Message-ID: <20230904100306.156197-2-pbonzini@redhat.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230904100306.156197-1-pbonzini@redhat.com> References: <20230904100306.156197-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_H4=0.001, RCVD_IN_MSPIKE_WL=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: 1693821894588100001 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_co_do_block_status. Signed-off-by: Paolo Bonzini --- block/io.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/block/io.c b/block/io.c index 76e7df18d81..6b9e39c350d 100644 --- a/block/io.c +++ b/block/io.c @@ -2376,9 +2376,9 @@ 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, - int64_t offset, int64_t bytes, - int64_t *pnum, int64_t *map, BlockDriverState **file) +bdrv_co_do_block_status(BlockDriverState *bs, bool want_zero, + int64_t offset, int64_t bytes, + int64_t *pnum, int64_t *map, BlockDriverState **fi= le) { int64_t total_size; int64_t n; /* bytes */ @@ -2537,8 +2537,8 @@ 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, - *pnum, pnum, &local_map, &local_file); + ret =3D bdrv_co_do_block_status(local_file, want_zero, local_map, + *pnum, pnum, &local_map, &local_file= ); goto out; } =20 @@ -2565,8 +2565,8 @@ 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, - *pnum, &file_pnum, NULL, NULL); + ret2 =3D bdrv_co_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 * is useful but not necessary. @@ -2633,7 +2633,8 @@ 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_co_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; @@ -2649,8 +2650,8 @@ 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, - file); + ret =3D bdrv_co_do_block_status(p, want_zero, offset, bytes, pnum, + map, file); ++*depth; if (ret < 0) { return ret; --=20 2.41.0 From nobody Fri May 17 21:21:41 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; 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=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 16938218525504.932256616524455; Mon, 4 Sep 2023 03:04:12 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qd6QT-00015Y-Mh; Mon, 04 Sep 2023 06:03:21 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qd6QQ-00012a-Hz for qemu-devel@nongnu.org; Mon, 04 Sep 2023 06:03:19 -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 1qd6QN-0007pL-J7 for qemu-devel@nongnu.org; Mon, 04 Sep 2023 06:03:18 -0400 Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-207-g5GNhzx1MYOUoGQWkVJnAQ-1; Mon, 04 Sep 2023 06:03:13 -0400 Received: by mail-wr1-f69.google.com with SMTP id ffacd0b85a97d-31f3cfe7269so637507f8f.2 for ; Mon, 04 Sep 2023 03:03:13 -0700 (PDT) Received: from [192.168.10.118] ([2001:b07:6468:f312:5e2c:eb9a:a8b6:fd3e]) by smtp.gmail.com with ESMTPSA id b4-20020adfde04000000b0031aef72a021sm13913648wrm.86.2023.09.04.03.03.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Sep 2023 03:03:10 -0700 (PDT) X-MC-Unique: g5GNhzx1MYOUoGQWkVJnAQ-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1693821792; x=1694426592; 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=mz4vUlbA1PQ7FFngVck7W+C8qd8hq4R/Gu/3TNbVJB8=; b=A6KabY9yoK4TTKvJdpjeFRSELf5WU7OIgxb8dcluGFB+mG7rsx05975DEvUAHkdoUm k6us13XyqudGY7XUmK86t5gmAVmfARyZIBYENZnQFxK70W15k1vzIqS8gxpibNy5kA0e N7l+Z/9wipPBlapo76dQDEvsb8bwZ1Dh8AjZVDOBL73FXquNe7XxOBLptWXG3yFdKpYL +qWPMREmotNuk60KClHaty7aX9dBREF5D0KQaAurhuBhONSzjOTjxTIWPE5PQAn9rb0L GoNFy2m/eBiChmtFpUlIZ2lcqRgInAzHbHKQC3or54vufZ0DtONtH0Vw+unewFavLJH4 sG4g== X-Gm-Message-State: AOJu0Yw7s8MQMZtRJEMNIEsjNzpk23rwKKCKm32bXEwGBUzTPnn6+D+c P4cuiC+S56pJtYuF3GKwOSK9XCZNgYJYRQoyLDZzv/gbrR2J4IU+tvJWVMiHzTGIDVy8qBpRTRd 6pvfUA0SwC/HBV0Oldny9rEl0e/kY9DdlLre5bFyoY6XT3XVjvVixxc5YQz8c5CX1gWrlKVfzDE g= X-Received: by 2002:a5d:424b:0:b0:31c:4c68:e73a with SMTP id s11-20020a5d424b000000b0031c4c68e73amr6909014wrr.66.1693821791905; Mon, 04 Sep 2023 03:03:11 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE0VqaSTCrngr2UQhgbFhiGKVcdylHC+D9iiKvuWzR5mFmxO4e8PMmPHRzb6q06eppAzfn+Pg== X-Received: by 2002:a5d:424b:0:b0:31c:4c68:e73a with SMTP id s11-20020a5d424b000000b0031c4c68e73amr6908994wrr.66.1693821791548; Mon, 04 Sep 2023 03:03:11 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Cc: eblake@redhat.com, kwolf@redhat.com, qemu-block@nongnu.org Subject: [PATCH v3 2/4] block: complete public block status API Date: Mon, 4 Sep 2023 12:03:04 +0200 Message-ID: <20230904100306.156197-3-pbonzini@redhat.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230904100306.156197-1-pbonzini@redhat.com> References: <20230904100306.156197-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: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=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-ZM-MESSAGEID: 1693821853680100003 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. Reviewed-by: Eric Blake Signed-off-by: Paolo Bonzini --- block/io.c | 18 +++++------------- include/block/block-io.h | 17 +++++++++++------ 2 files changed, 16 insertions(+), 19 deletions(-) diff --git a/block/io.c b/block/io.c index 6b9e39c350d..ea358b6b994 100644 --- a/block/io.c +++ b/block/io.c @@ -2717,21 +2717,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 6db48f2d359..c539aa66945 100644 --- a/include/block/block-io.h +++ b/include/block/block-io.h @@ -128,17 +128,22 @@ int coroutine_fn GRAPH_RDLOCK bdrv_co_zone_append(Blo= ckDriverState *bs, BdrvRequestFlags flags); =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, int64_t offset, int64_t bytes, + int64_t *pnum, int64_t *map, BlockDriverState **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.41.0 From nobody Fri May 17 21:21:41 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1693821907; cv=none; d=zohomail.com; s=zohoarc; b=gCTLXc4ozXk8YSxnxHpVlnYGhzWS4Bty+pbZ4Jk55L08wzYiFv6yat8pCz5vgFrwG8xE0jFv6gQDVZEKNBhl6UHrDQZSw5z16fVbBn4AACGyyeTTXXhF2+G2iHWoo5y10NE6uVPEEa/Cc0IgZBTZkTaazfOR67FQml4kZlxHx40= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1693821907; 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=PiOkxVVgFoVupw9ZTs6y9TPZVi2SdaYNMkB5l50iluo=; b=gFetpkFBECKsAUjEnNiZuZOxlVFTqNdsmvilqwV2ig8QWxpMGrVqZcyv1hw/AYBnVX6kO8mf2m/a6RuYAkLgO7GvIZDK0QtI7MR629TljETLuNwrKIWAEyGGa4Nu0momeoKMKo4H38Yk8tZIdHSpV0rw5I9jeATYhKFk/Nwgceo= 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 1693821907643733.527264520387; Mon, 4 Sep 2023 03:05:07 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qd6QV-00017V-S7; Mon, 04 Sep 2023 06:03: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 1qd6QR-00013L-IV for qemu-devel@nongnu.org; Mon, 04 Sep 2023 06:03:19 -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 1qd6QP-0007pp-98 for qemu-devel@nongnu.org; Mon, 04 Sep 2023 06:03:19 -0400 Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-650-BfVcoHP8O469hfeUltIvWA-1; Mon, 04 Sep 2023 06:03:15 -0400 Received: by mail-wm1-f71.google.com with SMTP id 5b1f17b1804b1-401d8873904so8629035e9.0 for ; Mon, 04 Sep 2023 03:03:15 -0700 (PDT) Received: from [192.168.10.118] ([2001:b07:6468:f312:5e2c:eb9a:a8b6:fd3e]) by smtp.gmail.com with ESMTPSA id l10-20020a5d4bca000000b003180155493esm14026098wrt.67.2023.09.04.03.03.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Sep 2023 03:03:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1693821796; 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=PiOkxVVgFoVupw9ZTs6y9TPZVi2SdaYNMkB5l50iluo=; b=CHqhCk/JYQB4cVB/pUaepy/C55EUL9jken3BQoHPPZqd/QnSydJ8U0te7CwUil/YGGqgcq 2LBvUQKtiMfcs5D5ln2fBwmHiXE/6r50KW7n+L9UB7Dif2KctctSeadPSMzVREVD3kaDqi +VWMm+01TBeihX7wXxQ+0zNoOfLjVGg= X-MC-Unique: BfVcoHP8O469hfeUltIvWA-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1693821793; x=1694426593; 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=PiOkxVVgFoVupw9ZTs6y9TPZVi2SdaYNMkB5l50iluo=; b=hxVfNlCLiooDgtpGu0TgSMP879UBaSuzZdahIoGjlZllxZC0odoDyuWI4kh79Vv8mD pULQ0q2THJM9GzZ7PjBPowsOe2F6iJcJ7OzsU/+QCu19rnEH0GQzvTcSmsLjZPHhqF+z /3ZDr8Yvz1Y4di4jTUFz59u+t5tZum6E++csdutYps7IxDN9khEET01Dshq1yF6QNPZg WfsrvAFT8FB/lFnnUBurIzD7tAyfU1xxA8R5KDSGWqCoN50+iphvmtUe7KbsmmjL+WjG /GGwsTHjcMKDJVHlFr1IedJFLGVfJleVvL+IGnZhVdIA2hocnYla+789XSVC4H9urbqn PjrQ== X-Gm-Message-State: AOJu0Ywz5WFO9LPJtJNdlAWsGu6CEdhqmV9ooNqPU3mFzf24YkA83m4J TdQ1t51pZsaTYUd43WlGuKyMbGwtRP9YlqQKZPLLkysZ4MEChRLacn1VM9GukJrmdubH6y5mdCe MuDzPFFwrdipLkr6+wQAdSMqYvZM2cglDzZewyq9GKFZXwEjcD+lGlnqRhxBNZoSvApQOdvQMoA M= X-Received: by 2002:a5d:55c1:0:b0:31d:c73d:d2ed with SMTP id i1-20020a5d55c1000000b0031dc73dd2edmr7550795wrw.5.1693821793658; Mon, 04 Sep 2023 03:03:13 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHuCfKmZ3/G8wMsND9+7thSTuLP1jGRPkN0bBvoGDhwVj9GozYrGFX/sCSWRehrbgf/EdkF/w== X-Received: by 2002:a5d:55c1:0:b0:31d:c73d:d2ed with SMTP id i1-20020a5d55c1000000b0031dc73dd2edmr7550775wrw.5.1693821793337; Mon, 04 Sep 2023 03:03:13 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Cc: eblake@redhat.com, kwolf@redhat.com, qemu-block@nongnu.org Subject: [PATCH v3 3/4] block: switch to co_wrapper for bdrv_is_allocated_* Date: Mon, 4 Sep 2023 12:03:05 +0200 Message-ID: <20230904100306.156197-4-pbonzini@redhat.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230904100306.156197-1-pbonzini@redhat.com> References: <20230904100306.156197-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_H4=0.001, RCVD_IN_MSPIKE_WL=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: 1693821908918100001 Content-Type: text/plain; charset="utf-8" Reviewed-by: Eric Blake Signed-off-by: Paolo Bonzini --- 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 ea358b6b994..81c9630dac1 100644 --- a/block/io.c +++ b/block/io.c @@ -2770,45 +2770,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] * @@ -2826,18 +2787,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 c539aa66945..2191d49c551 100644 --- a/include/block/block-io.h +++ b/include/block/block-io.h @@ -148,16 +148,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.41.0 From nobody Fri May 17 21:21:41 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1693821881; cv=none; d=zohomail.com; s=zohoarc; b=UoRZuS/PbAoYImW7w6TzmIRGnmAP+pDxCYy57DeBIjGSBY1WufemsF754N1oI1b9ZdBCS2b1wFUiAMGuUcO3wMxRj9+/1A/72UsbV2lBhaEOB3DVDriVIZFvluFsguVfNtNYKNXyFZnAqFgj4DmcmsOTEK9MC+aSeBgFYSkVt/E= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1693821881; 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=qf661RAc5tATpWdnoHy5aGgdaxdT8WeutCYB7FsgzCs=; b=DIxnSw3npVwZa+2tb3GCswydVWkcJR+uecpNyoM26vLECYW+zUzNu9wAIr5/onYNu93Vl/U+uBJUHP5g51mBm63wCanjhifc5yoka5uhW7ENwGBN//8lB2M6oevwVGaVDpRsWhwCTYjrNA9FWfc6bu6pFbhonq62/n1i+3Q69mE= 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 1693821881297543.666590593643; Mon, 4 Sep 2023 03:04:41 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qd6QW-00017l-Pz; Mon, 04 Sep 2023 06:03:24 -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 1qd6QT-00015d-Ko for qemu-devel@nongnu.org; Mon, 04 Sep 2023 06:03:21 -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 1qd6QQ-0007q5-Ng for qemu-devel@nongnu.org; Mon, 04 Sep 2023 06:03:21 -0400 Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-422-IU_igck4Ncyy3rTDTDA3Lw-1; Mon, 04 Sep 2023 06:03:17 -0400 Received: by mail-wr1-f72.google.com with SMTP id ffacd0b85a97d-3172a94b274so722327f8f.0 for ; Mon, 04 Sep 2023 03:03:16 -0700 (PDT) Received: from [192.168.10.118] ([2001:b07:6468:f312:5e2c:eb9a:a8b6:fd3e]) by smtp.gmail.com with ESMTPSA id e13-20020a5d4e8d000000b0031c6cc74882sm14071194wru.107.2023.09.04.03.03.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Sep 2023 03:03:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1693821798; 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=qf661RAc5tATpWdnoHy5aGgdaxdT8WeutCYB7FsgzCs=; b=EGf5FXnUqd3vUqOt+fZUnRfxY9s1TxnDUgj7EN0i1XoAQcwGfIxCVhNogePK6SuKAHc734 wNcuVmtr/VvnL+Sj12vTKwrv6Z57athd1VObixvuNl6gzPODI9deuWpKCpLLFbFC+fZ1jJ wY6pL2UqMVcq3g7sbN9BMfNFYJ3nmHA= X-MC-Unique: IU_igck4Ncyy3rTDTDA3Lw-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1693821795; x=1694426595; 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=qf661RAc5tATpWdnoHy5aGgdaxdT8WeutCYB7FsgzCs=; b=TXia+aizSAwWmJMQVp1vaoJltvzXoYAFcDrsVsVB4PAdpbALG8lvWIH+3OJnpjHLIf AZXCvtUEQyXv8x+gdCL+uC1DZlh669PjkB0uJ6iaf9bNT2K6bNULn3wlB6PSESxRYIuF /byiLV5f6xocmg9exjii7cQ1+gmUaAdZ0TOso0JJMHkoL6uPdozUxHyshlpcNmS3KtWx xjYe6AzIP6ZSqaPfSrntCUQ4rDH+OpCru9qkDG//gb/lyl3t8rUrXTug+ILUpu2z6HK7 0pG8hvksH+BpYPKpapm+uzGNUggjS183BCGmsRanaU7e7vugMdbfWiwJLXBK4HtodwCw AabQ== X-Gm-Message-State: AOJu0YzxJS4G0qmvsdIOyO9UmyJFGXeID9DBuvjPxfTHx4c05r3hyfr4 l9dvKnrAyQP29JxTq2ooB3u8hABWTEYWASKTsNfU6YmRZHphcJp41lb929vjnFK8nu6a6e/nHzn 7WXxSqZaLcvc21UlSKE7DIHdNXorTRkOKifPGT0eU5RNt/EJiVr56TBXHGWGWf4c+RnFRESkbUZ Y= X-Received: by 2002:adf:f98f:0:b0:313:dee2:e052 with SMTP id f15-20020adff98f000000b00313dee2e052mr6413073wrr.26.1693821795465; Mon, 04 Sep 2023 03:03:15 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGSSKgBEB16bS5f8nI9ecDMhN4BvXoBR3mo82mP85kjIYslL86LIrdjV4UuWdfz8VqAIZ1Vzw== X-Received: by 2002:adf:f98f:0:b0:313:dee2:e052 with SMTP id f15-20020adff98f000000b00313dee2e052mr6413053wrr.26.1693821795089; Mon, 04 Sep 2023 03:03:15 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Cc: eblake@redhat.com, kwolf@redhat.com, qemu-block@nongnu.org Subject: [PATCH v3 4/4] block: convert more bdrv_is_allocated* and bdrv_block_status* calls to coroutine versions Date: Mon, 4 Sep 2023 12:03:06 +0200 Message-ID: <20230904100306.156197-5-pbonzini@redhat.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230904100306.156197-1-pbonzini@redhat.com> References: <20230904100306.156197-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_H4=0.001, RCVD_IN_MSPIKE_WL=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: 1693821882390100003 Content-Type: text/plain; charset="utf-8" Reviewed-by: Eric Blake Signed-off-by: Paolo Bonzini --- 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 b866e42271d..2711d95718f 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 b4d6b7efc30..5149fcf63ad 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 81c9630dac1..3349f8d8a04 100644 --- a/block/io.c +++ b/block/io.c @@ -1216,8 +1216,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(align_bytes, max_transfer); } else { - ret =3D bdrv_is_allocated(bs, align_offset, - MIN(align_bytes, max_transfer), &pnum); + ret =3D bdrv_co_is_allocated(bs, align_offset, + MIN(align_bytes, max_transfer), &pn= um); if (ret < 0) { /* * Safe to treat errors in querying allocation as if @@ -1364,7 +1364,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 e213a892dbf..b9753312511 100644 --- a/block/mirror.c +++ b/block/mirror.c @@ -559,9 +559,9 @@ static void coroutine_fn mirror_iteration(MirrorBlockJo= b *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); @@ -875,8 +875,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 b48cd9ce636..f244136095a 100644 --- a/block/qcow2.c +++ b/block/qcow2.c @@ -3986,7 +3986,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; @@ -4007,7 +4008,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 ea4bf1aa801..f44b2631ae0 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 e522bbdec54..f0ef58c8997 100644 --- a/block/stream.c +++ b/block/stream.c @@ -162,7 +162,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) { @@ -170,9 +170,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 0ddc91fc096..5df2d6b1c64 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.41.0