From patchwork Thu Jun 1 11:51:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 13263561 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 8B110C7EE23 for ; Thu, 1 Jun 2023 11:53:16 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q4gqD-0007tW-P8; Thu, 01 Jun 2023 07:51:41 -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 1q4gqB-0007mf-OJ for qemu-devel@nongnu.org; Thu, 01 Jun 2023 07:51:39 -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 1q4gq9-0000EN-Vb for qemu-devel@nongnu.org; Thu, 01 Jun 2023 07:51:39 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1685620297; 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=agn07WgIImGe8WSxC+U2NsXZbn2bSqLwFUCX6cHFBXY=; b=aDNm/HsYXZ4Mx3WJyHPR+/wcgvK71EUfDkvf2birRS6uRVO8TdvF6kG1WQU5LV1XvZtmRU 7kODdcQixlDpJIWj8HdVVhnnvtvBdIzKAWb9su7D4k7NlyCc/tmnEtQyc5+zsQTcopKFKz AFoEcUjeGai5Euzs6UfdhXioS90nCqA= Received: from mail-ej1-f70.google.com (mail-ej1-f70.google.com [209.85.218.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-79-1QgUmw0MN-yEwd_prlFlwg-1; Thu, 01 Jun 2023 07:51:36 -0400 X-MC-Unique: 1QgUmw0MN-yEwd_prlFlwg-1 Received: by mail-ej1-f70.google.com with SMTP id a640c23a62f3a-973c263d727so56142666b.0 for ; Thu, 01 Jun 2023 04:51:35 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685620294; x=1688212294; 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=agn07WgIImGe8WSxC+U2NsXZbn2bSqLwFUCX6cHFBXY=; b=lVVHz5F837XQ1rykZI7+V6jLFnr2itW5hPjmmrShBz0kT18DxmKjnPGn6grMnjeyvd zKK/P283V1reZ0Ern1QxnS0SKjYrci3kUL5e5skusk0SjN5DTSFQsZBw2QcO86ap6Ohl NZuZwMx7U9GWm7rBz+J2o76rMOR28u5IDloKaB5frXLU49svHmRsvOHPbLFtUN8HDdhy Ac2+5Z+2IV9cKytPw2KI4QFJWuZKG0YtXccG6gof/3lwO+WmCpnQHLRRFmtG5/ovPCyb t3EFuKEWWROAs3gGzkCPydVt3Qhu6XwLxR+hHxt6eHTCTCcKzdVOEG86Yh//2QmllXts WR3g== X-Gm-Message-State: AC+VfDwsQV8QkTNwyndqXraaq8FMj3viQwr8GNberbyxOYCraTn6EB// yF/rmHzg+1fYG5Tg55mJU5KwfLJet8gmsoCHgcbJx3JZgdGr5T9O2muBgqkdh4fy9Jxo4ousCIy ITJ9vFRyUPmHNsU4ANeVPp4Px/cS8ufkuLZTvtPr2YvipxTScZU+LoZ3Jif+mTyHXpQOS2u+PH8 I= X-Received: by 2002:a17:907:3602:b0:94e:46ef:1361 with SMTP id bk2-20020a170907360200b0094e46ef1361mr7843836ejc.34.1685620294369; Thu, 01 Jun 2023 04:51:34 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5CxWUnIMyY7PwyrJXxpJImXtRi2XLLqvKQ96huJwj8AWKzT1FnS6pkP+Xgvv5pLtzzNqIVYw== X-Received: by 2002:a17:907:3602:b0:94e:46ef:1361 with SMTP id bk2-20020a170907360200b0094e46ef1361mr7843815ejc.34.1685620294034; Thu, 01 Jun 2023 04:51:34 -0700 (PDT) Received: from [192.168.10.118] ([2001:b07:6468:f312:5e2c:eb9a:a8b6:fd3e]) by smtp.gmail.com with ESMTPSA id w5-20020aa7dcc5000000b0050d83a39e6fsm7107585edu.4.2023.06.01.04.51.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Jun 2023 04:51:33 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Cc: kwolf@redhat.com, qemu-block@nongnu.org Subject: [PATCH v2 1/4] block: rename the bdrv_co_block_status static function Date: Thu, 1 Jun 2023 13:51:28 +0200 Message-Id: <20230601115131.196234-2-pbonzini@redhat.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230601115131.196234-1-pbonzini@redhat.com> References: <20230601115131.196234-1-pbonzini@redhat.com> MIME-Version: 1.0 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: -22 X-Spam_score: -2.3 X-Spam_bar: -- X-Spam_report: (-2.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.166, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org 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 Reviewed-by: Eric Blake --- block/io.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/block/io.c b/block/io.c index 540bf8d26dff..2c2c9656853c 100644 --- a/block/io.c +++ b/block/io.c @@ -2236,9 +2236,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 **file) { int64_t total_size; int64_t n; /* bytes */ @@ -2397,8 +2397,8 @@ bdrv_co_block_status(BlockDriverState *bs, bool want_zero, if (ret & BDRV_BLOCK_RAW) { assert(ret & BDRV_BLOCK_OFFSET_VALID && local_file); - ret = bdrv_co_block_status(local_file, want_zero, local_map, - *pnum, pnum, &local_map, &local_file); + ret = bdrv_co_do_block_status(local_file, want_zero, local_map, + *pnum, pnum, &local_map, &local_file); goto out; } @@ -2425,8 +2425,8 @@ bdrv_co_block_status(BlockDriverState *bs, bool want_zero, int64_t file_pnum; int ret2; - ret2 = bdrv_co_block_status(local_file, want_zero, local_map, - *pnum, &file_pnum, NULL, NULL); + ret2 = bdrv_co_do_block_status(local_file, want_zero, local_map, + *pnum, &file_pnum, NULL, NULL); if (ret2 >= 0) { /* Ignore errors. This is just providing extra information, it * is useful but not necessary. @@ -2493,7 +2493,7 @@ bdrv_co_common_block_status_above(BlockDriverState *bs, return 0; } - ret = bdrv_co_block_status(bs, want_zero, offset, bytes, pnum, map, file); + ret = bdrv_co_do_block_status(bs, want_zero, offset, bytes, pnum, map, file); ++*depth; if (ret < 0 || *pnum == 0 || ret & BDRV_BLOCK_ALLOCATED || bs == base) { return ret; @@ -2509,8 +2509,7 @@ bdrv_co_common_block_status_above(BlockDriverState *bs, for (p = bdrv_filter_or_cow_bs(bs); include_base || p != base; p = bdrv_filter_or_cow_bs(p)) { - ret = bdrv_co_block_status(p, want_zero, offset, bytes, pnum, map, - file); + ret = bdrv_co_do_block_status(p, want_zero, offset, bytes, pnum, map, file); ++*depth; if (ret < 0) { return ret; From patchwork Thu Jun 1 11:51:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 13263565 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 607FDC7EE23 for ; Thu, 1 Jun 2023 11:53:54 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q4gqG-00084G-4W; Thu, 01 Jun 2023 07:51:44 -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 1q4gqE-0007wE-B9 for qemu-devel@nongnu.org; Thu, 01 Jun 2023 07:51:42 -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 1q4gqB-0000Er-Ou for qemu-devel@nongnu.org; Thu, 01 Jun 2023 07:51:42 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1685620299; 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=Ag5pNhrb5hTB5gn6ymSBOVwkjeLkC2szXKGwtyFkPow=; b=NnW9IvTSc4LA5q58VY2dOoiDFPk5fjT7osTTHEiqlVgAPfifefrBeVkyB21QgTMWRrE4/L tv3KyAWZfri99MQiUttIIFs+DjOzgY/kheCWnOhMtfQh0DaV3DkF9RbQJGHtcZVAdNt5xU oxKdy7dO6bolXPzZxBqDuz2gj02qLMc= Received: from mail-ej1-f71.google.com (mail-ej1-f71.google.com [209.85.218.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-425-mzk0J0HSOT-Q8AU2fxfmsA-1; Thu, 01 Jun 2023 07:51:37 -0400 X-MC-Unique: mzk0J0HSOT-Q8AU2fxfmsA-1 Received: by mail-ej1-f71.google.com with SMTP id a640c23a62f3a-96f6fee8123so51944266b.0 for ; Thu, 01 Jun 2023 04:51:37 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685620296; x=1688212296; 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=Ag5pNhrb5hTB5gn6ymSBOVwkjeLkC2szXKGwtyFkPow=; b=FZIvUeUPUiPwFV4DqZ8oChs080xgmm01G75Yj/ETiLjKKp59qMhj5weNMHJWtp5hfR CvOl5QN7A/PlPn2E+lrY94YT/43V2dKEMCbiBNnOxwYZOPyPySL7UNEQp9xo67T8LLZZ BvZhW7rOsLpYKSnswMHa5uBUqivZZBlLoaNA0pra+Kk16InLKhHf4fAukE/oCc9Ymxdz aO2PyYCwdPbEfnDFARaBloYivThjiM4fNbaJ9zt2mWGZLYTr8LFlSGBFlK0PqpP+d/Fa LZUzOgO3BcUmjONvTYAqUNrnEFM4u2vJDuaz3vhnX/ZXIUhlScRSO0j1ibwzJMOmj8A8 qlNQ== X-Gm-Message-State: AC+VfDzgFyCsagQSzMc1UcQsuQcfQ3feJ5qG11aCKyTQpnvrv+Kuq2uD PtmG6MTcWf47kPdN8UwyDG98UflfgL6XXXMLrdLFOGlGBDQveT4gjlUjdx6AW0G94O5rZcT6ESG BY1Whg9m5zLkXPi9VUoz2bbhFd8wHeNd4V8NXrw0zJRPiexsLBmPlsHa/GTmUxEC0CWFHaN2C5l 4= X-Received: by 2002:a17:907:d1d:b0:96a:ec5c:685b with SMTP id gn29-20020a1709070d1d00b0096aec5c685bmr7806141ejc.29.1685620296061; Thu, 01 Jun 2023 04:51:36 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6aClUuurx2rNZetou/Ey1r5BgQT95HtRcYNSJQdyhhY1zNWnKblw1oxtlgabqBK6Obj1zbpg== X-Received: by 2002:a17:907:d1d:b0:96a:ec5c:685b with SMTP id gn29-20020a1709070d1d00b0096aec5c685bmr7806095ejc.29.1685620295672; Thu, 01 Jun 2023 04:51:35 -0700 (PDT) Received: from [192.168.10.118] ([2001:b07:6468:f312:5e2c:eb9a:a8b6:fd3e]) by smtp.gmail.com with ESMTPSA id v10-20020a170906488a00b0096f6a910ab7sm10455046ejq.190.2023.06.01.04.51.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Jun 2023 04:51:35 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Cc: kwolf@redhat.com, qemu-block@nongnu.org, Eric Blake Subject: [PATCH v2 2/4] block: complete public block status API Date: Thu, 1 Jun 2023 13:51:29 +0200 Message-Id: <20230601115131.196234-3-pbonzini@redhat.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230601115131.196234-1-pbonzini@redhat.com> References: <20230601115131.196234-1-pbonzini@redhat.com> MIME-Version: 1.0 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: -22 X-Spam_score: -2.3 X-Spam_bar: -- X-Spam_report: (-2.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.166, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org 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 | 18 ++++++++++++------ 2 files changed, 17 insertions(+), 19 deletions(-) diff --git a/block/io.c b/block/io.c index 2c2c9656853c..806715a5bbe3 100644 --- a/block/io.c +++ b/block/io.c @@ -2575,21 +2575,13 @@ int coroutine_fn bdrv_co_block_status_above(BlockDriverState *bs, bytes, pnum, map, file, NULL); } -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 **file) { IO_CODE(); - return bdrv_common_block_status_above(bs, base, false, true, offset, bytes, - 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); } /* diff --git a/include/block/block-io.h b/include/block/block-io.h index a27e471a87b6..ce75ff5ddde8 100644 --- a/include/block/block-io.h +++ b/include/block/block-io.h @@ -128,17 +128,23 @@ int coroutine_fn GRAPH_RDLOCK bdrv_co_zone_append(BlockDriverState *bs, BdrvRequestFlags flags); 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); 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); int coroutine_fn GRAPH_RDLOCK bdrv_co_is_allocated(BlockDriverState *bs, int64_t offset, int64_t bytes, From patchwork Thu Jun 1 11:51:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 13263558 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A845DC77B7A for ; Thu, 1 Jun 2023 11:52:53 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q4gqH-00088q-3G; Thu, 01 Jun 2023 07:51:45 -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 1q4gqF-0007z6-1x for qemu-devel@nongnu.org; Thu, 01 Jun 2023 07:51:43 -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 1q4gqD-0000FD-G9 for qemu-devel@nongnu.org; Thu, 01 Jun 2023 07:51:42 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1685620301; 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=FRC33n8j//iR7nSBERN/NX8JHJFnLAbHE6VHVE/3Ilo=; b=I18jcmUNSm3lMY3WBiCtenEJAtltOdKXNHiHtLuGRye6n/onb0XxqYvbpj0G1xS9cexSno P2I/TkuqOJvGxmoeBj+XuKYOCXs6swj3zts+juWEzxVLe4BC43ly6fRW6qw75n1EbRtFpu jQ+6SSFaTGw/P59lWwVht1kmGkaUrKc= Received: from mail-ej1-f69.google.com (mail-ej1-f69.google.com [209.85.218.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-320-xquwKWE0OtmJoy76TX3rxg-1; Thu, 01 Jun 2023 07:51:39 -0400 X-MC-Unique: xquwKWE0OtmJoy76TX3rxg-1 Received: by mail-ej1-f69.google.com with SMTP id a640c23a62f3a-94a34a0b75eso49154466b.1 for ; Thu, 01 Jun 2023 04:51:39 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685620298; x=1688212298; 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=FRC33n8j//iR7nSBERN/NX8JHJFnLAbHE6VHVE/3Ilo=; b=GedxkOz0KLAUBBVm0o9DBPzq1xGEN4vKSXIwCUIjrI6MteR0AxvsNxgbZyIEkBus96 b4Mqoc+PyGkss3beJgID0LuWvJvzrTCUPNr9bqbMPiWN3LhrRRt2CjOLnj+0c5z0M2vP U97gHTT/uWWM4yoFzsOy7BiCYOdK9ugTgHYhfXqmrh5adxbSatK23c+TAsTrm5e3E2RN fhsN07eVHFIGlbpyzZLAmQsjuB2Hg3myj+pvAJQwelmIyakTcL8xbK1wshn0FFq701Jz mgl0D43Gs4K3r3zTZRxqG06jNZvJhmvQEsRvIfameZbe3ZXXb7gFt674I8JHL0ANbrJ0 BbPw== X-Gm-Message-State: AC+VfDzwcMkE3oeWOX6DzJIT14geKrq5Uoa7D6KIPf3dXqamvd8ClEB/ nHJSh6vMvlozjPbde+8CzUmkASrsbB5DpjwqMgZOKQJ20qN45wh57vj3/q4k2pu3Zm7tv1hMR7F S9QblKbjiHvMyLKtBLp83shzDx2m3DtgiaZoTwaPU1NzlYXiYCuhVrHT20k46W9f7fCy8LSXnOc Q= X-Received: by 2002:a17:907:724b:b0:96a:316f:8abf with SMTP id ds11-20020a170907724b00b0096a316f8abfmr8015501ejc.20.1685620297806; Thu, 01 Jun 2023 04:51:37 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7/CNmYMR9Ra2287B91nXdfGHzvB6wj3r+dQlZkr8oS8IS+UESm9G11E78q140PngdSVjHsAQ== X-Received: by 2002:a17:907:724b:b0:96a:316f:8abf with SMTP id ds11-20020a170907724b00b0096a316f8abfmr8015481ejc.20.1685620297455; Thu, 01 Jun 2023 04:51:37 -0700 (PDT) Received: from [192.168.10.118] ([2001:b07:6468:f312:5e2c:eb9a:a8b6:fd3e]) by smtp.gmail.com with ESMTPSA id a6-20020a170906244600b00965b416585bsm10411489ejb.118.2023.06.01.04.51.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Jun 2023 04:51:37 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Cc: kwolf@redhat.com, qemu-block@nongnu.org, Eric Blake Subject: [PATCH v2 3/4] block: switch to co_wrapper for bdrv_is_allocated_* Date: Thu, 1 Jun 2023 13:51:30 +0200 Message-Id: <20230601115131.196234-4-pbonzini@redhat.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230601115131.196234-1-pbonzini@redhat.com> References: <20230601115131.196234-1-pbonzini@redhat.com> MIME-Version: 1.0 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: -22 X-Spam_score: -2.3 X-Spam_bar: -- X-Spam_report: (-2.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.166, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org 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 806715a5bbe3..2fae64ad1eb6 100644 --- a/block/io.c +++ b/block/io.c @@ -2628,45 +2628,6 @@ int coroutine_fn bdrv_co_is_allocated(BlockDriverState *bs, int64_t offset, return !!(ret & BDRV_BLOCK_ALLOCATED); } -int bdrv_is_allocated(BlockDriverState *bs, int64_t offset, int64_t bytes, - int64_t *pnum) -{ - int ret; - int64_t dummy; - IO_CODE(); - - ret = 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 offset, - int64_t bytes, int64_t *pnum) -{ - int depth; - int ret; - IO_CODE(); - - ret = bdrv_co_common_block_status_above(top, base, include_base, false, - offset, bytes, pnum, NULL, NULL, - &depth); - if (ret < 0) { - return ret; - } - - if (ret & BDRV_BLOCK_ALLOCATED) { - return depth; - } - return 0; -} - /* * Given an image chain: ... -> [BASE] -> [INTER1] -> [INTER2] -> [TOP] * @@ -2684,18 +2645,18 @@ int coroutine_fn bdrv_co_is_allocated_above(BlockDriverState *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 offset, + int64_t bytes, int64_t *pnum) { int depth; int ret; IO_CODE(); - ret = bdrv_common_block_status_above(top, base, include_base, false, - offset, bytes, pnum, NULL, NULL, - &depth); + ret = bdrv_co_common_block_status_above(bs, base, include_base, false, + offset, bytes, pnum, NULL, NULL, + &depth); if (ret < 0) { return ret; } diff --git a/include/block/block-io.h b/include/block/block-io.h index ce75ff5ddde8..3946bbefc5c2 100644 --- a/include/block/block-io.h +++ b/include/block/block-io.h @@ -149,16 +149,18 @@ bdrv_block_status_above(BlockDriverState *bs, BlockDriverState *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); int coroutine_fn GRAPH_RDLOCK bdrv_co_is_allocated_above(BlockDriverState *top, BlockDriverState *base, bool include_base, int64_t offset, int64_t bytes, int64_t *pnum); -int bdrv_is_allocated_above(BlockDriverState *top, BlockDriverState *base, - bool include_base, int64_t offset, int64_t bytes, - 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); int coroutine_fn GRAPH_RDLOCK bdrv_co_is_zero_fast(BlockDriverState *bs, int64_t offset, int64_t bytes); From patchwork Thu Jun 1 11:51:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 13263566 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 488D9C7EE23 for ; Thu, 1 Jun 2023 11:53:58 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q4gqI-0008Di-PU; Thu, 01 Jun 2023 07:51:46 -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 1q4gqG-00087U-It for qemu-devel@nongnu.org; Thu, 01 Jun 2023 07:51:44 -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 1q4gqE-0000Fj-Pg for qemu-devel@nongnu.org; Thu, 01 Jun 2023 07:51:44 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1685620302; 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=f1UBhFw34ApEps/B/fnqpGUx59SAnlUvm0IN7PFtPoA=; b=YldsEvPoplUOeE6DHqTBMlbgsGBdEGWGLAvDqlev7njgh2O68LO9X292f1XmXJJkDmfhce 0Z3oAdIxvqlXx5OyIGXbBFyhVXFYmTXOQ7GBH/hTLUtLvtmxRxzcPVdmBaSm0B19tLjlEx oUZMtq6Te+zhEJSKi5MjsNXlcgK7Wdg= Received: from mail-ej1-f71.google.com (mail-ej1-f71.google.com [209.85.218.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-422-DcD6s_cANpKwoJ-bI5N7pA-1; Thu, 01 Jun 2023 07:51:41 -0400 X-MC-Unique: DcD6s_cANpKwoJ-bI5N7pA-1 Received: by mail-ej1-f71.google.com with SMTP id a640c23a62f3a-9715654ab36so51570566b.0 for ; Thu, 01 Jun 2023 04:51:40 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685620299; x=1688212299; 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=f1UBhFw34ApEps/B/fnqpGUx59SAnlUvm0IN7PFtPoA=; b=TuUOh1q7cjgmq/Uq15qaLdHbtur5I8XV5zGluPsjNSKJQKGBtBBSyg2ZEiFqZRsnn2 +GsOZdYd5T3l6b1JdRWMMvp1mmh13+Kv2EBr/AxwPIwgEs9TXGLYmBUgvs5QuZ0q+DPg X90+MkFTF/9EYpvgj2zc4necgqKD53stNxXs+JGrQLjcXPwLwK25C+UJmDLYrgpETERf iochNptOzGO1aOfzoj2zvsP5SAFgpbew7k/+kg6qy0BSMmaLUvSsB0cjeU/i+X7LF7LN kshfwneDRw6vWb1fxysekx2W/0T9DaHKiZaGUUf1h9gO+y+vP3Vzp+S2W/L7epIqgUnr q81w== X-Gm-Message-State: AC+VfDy8gwLnONhAe1NJRMpj0L8Hl4JyEFrB21QaPjY8RTlnpIuWxHAI BE8gXn+DMf3TGB6TCmBzmfNkYsh9EYDyDec7cXJ9s82oMy9CSdAKbSTJqGIYBBhpBBpCRFpiX2I w1yADy4pwKeGV8BTC6VPx0wRILtmu0/dSdbDb26o6HXXM7j6yxxjm/rEW7E2+PIv/jpghvS+Anr Q= X-Received: by 2002:a17:907:7d9f:b0:974:1c92:a7aa with SMTP id oz31-20020a1709077d9f00b009741c92a7aamr6919767ejc.5.1685620299361; Thu, 01 Jun 2023 04:51:39 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5WKuMh+Vs6vfSJM0DlEW+/hzmT+yeNFwP1vFpiTMUFYKdckm/evOKTQT2c2KMPKDsqRCLzMA== X-Received: by 2002:a17:907:7d9f:b0:974:1c92:a7aa with SMTP id oz31-20020a1709077d9f00b009741c92a7aamr6919754ejc.5.1685620299061; Thu, 01 Jun 2023 04:51:39 -0700 (PDT) Received: from [192.168.10.118] ([2001:b07:6468:f312:5e2c:eb9a:a8b6:fd3e]) by smtp.gmail.com with ESMTPSA id kq12-20020a170906abcc00b009596e7e0dbasm10446252ejb.162.2023.06.01.04.51.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Jun 2023 04:51:38 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Cc: kwolf@redhat.com, qemu-block@nongnu.org, Eric Blake Subject: [PATCH v2 4/4] block: convert more bdrv_is_allocated* and bdrv_block_status* calls to coroutine versions Date: Thu, 1 Jun 2023 13:51:31 +0200 Message-Id: <20230601115131.196234-5-pbonzini@redhat.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230601115131.196234-1-pbonzini@redhat.com> References: <20230601115131.196234-1-pbonzini@redhat.com> MIME-Version: 1.0 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: -22 X-Spam_score: -2.3 X-Spam_bar: -- X-Spam_report: (-2.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.166, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org 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 b866e42271d0..2711d95718f7 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; } - ret = bdrv_block_status(child->bs, offset, cur_bytes, pnum, map, file); + ret = bdrv_co_block_status(child->bs, offset, cur_bytes, pnum, map, file); if (child == 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 b4d6b7efc30f..5149fcf63adc 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 offset, int64_t bytes, local_flags = flags; /* In case of failure, try to copy-on-read anyway */ - ret = bdrv_is_allocated(bs->file->bs, offset, bytes, &n); + ret = bdrv_co_is_allocated(bs->file->bs, offset, bytes, &n); if (ret <= 0) { - ret = bdrv_is_allocated_above(bdrv_backing_chain_next(bs->file->bs), - state->bottom_bs, true, offset, - n, &n); + ret = bdrv_co_is_allocated_above(bdrv_backing_chain_next(bs->file->bs), + state->bottom_bs, true, offset, + n, &n); if (ret > 0 || ret < 0) { local_flags |= BDRV_REQ_COPY_ON_READ; } diff --git a/block/io.c b/block/io.c index 2fae64ad1eb6..3bd4c7de97f0 100644 --- a/block/io.c +++ b/block/io.c @@ -1216,8 +1216,8 @@ bdrv_co_do_copy_on_readv(BdrvChild *child, int64_t offset, int64_t bytes, ret = 1; /* "already allocated", so nothing will be copied */ pnum = MIN(cluster_bytes, max_transfer); } else { - ret = bdrv_is_allocated(bs, cluster_offset, - MIN(cluster_bytes, max_transfer), &pnum); + ret = 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 @@ -1364,7 +1364,7 @@ bdrv_aligned_preadv(BdrvChild *child, BdrvTrackedRequest *req, /* The flag BDRV_REQ_COPY_ON_READ has reached its addressee */ flags &= ~BDRV_REQ_COPY_ON_READ; - ret = bdrv_is_allocated(bs, offset, bytes, &pnum); + ret = bdrv_co_is_allocated(bs, offset, bytes, &pnum); if (ret < 0) { goto out; } diff --git a/block/mirror.c b/block/mirror.c index d3cacd170860..c0f40e696072 100644 --- a/block/mirror.c +++ b/block/mirror.c @@ -559,9 +559,9 @@ static void coroutine_fn mirror_iteration(MirrorBlockJob *s) assert(!(offset % s->granularity)); WITH_GRAPH_RDLOCK_GUARD() { - ret = bdrv_block_status_above(source, NULL, offset, - nb_chunks * s->granularity, - &io_bytes, NULL, NULL); + ret = bdrv_co_block_status_above(source, NULL, offset, + nb_chunks * s->granularity, + &io_bytes, NULL, NULL); } if (ret < 0) { io_bytes = MIN(nb_chunks * s->granularity, max_io_bytes); @@ -875,8 +875,8 @@ static int coroutine_fn mirror_dirty_init(MirrorBlockJob *s) } WITH_GRAPH_RDLOCK_GUARD() { - ret = bdrv_is_allocated_above(bs, s->base_overlay, true, offset, - bytes, &count); + ret = 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 7f3948360d05..5a27740223b4 100644 --- a/block/qcow2.c +++ b/block/qcow2.c @@ -3968,7 +3968,8 @@ finish: } -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; @@ -3989,7 +3990,7 @@ static bool is_zero(BlockDriverState *bs, int64_t offset, int64_t bytes) * backing file. So, we need a loop. */ do { - res = bdrv_block_status_above(bs, NULL, offset, bytes, &nr, NULL, NULL); + res = bdrv_co_block_status_above(bs, NULL, offset, bytes, &nr, NULL, NULL); offset += nr; bytes -= nr; } while (res >= 0 && (res & BDRV_BLOCK_ZERO) && nr && bytes); diff --git a/block/replication.c b/block/replication.c index ea4bf1aa8012..f44b2631ae00 100644 --- a/block/replication.c +++ b/block/replication.c @@ -276,10 +276,10 @@ replication_co_writev(BlockDriverState *bs, int64_t sector_num, while (remaining_sectors > 0) { int64_t count; - ret = bdrv_is_allocated_above(top->bs, base->bs, false, - sector_num * BDRV_SECTOR_SIZE, - remaining_sectors * BDRV_SECTOR_SIZE, - &count); + ret = bdrv_co_is_allocated_above(top->bs, base->bs, false, + sector_num * BDRV_SECTOR_SIZE, + remaining_sectors * BDRV_SECTOR_SIZE, + &count); if (ret < 0) { goto out1; } diff --git a/block/stream.c b/block/stream.c index e522bbdec547..f0ef58c8997b 100644 --- a/block/stream.c +++ b/block/stream.c @@ -162,7 +162,7 @@ static int coroutine_fn stream_run(Job *job, Error **errp) copy = false; WITH_GRAPH_RDLOCK_GUARD() { - ret = bdrv_is_allocated(unfiltered_bs, offset, STREAM_CHUNK, &n); + ret = bdrv_co_is_allocated(unfiltered_bs, offset, STREAM_CHUNK, &n); if (ret == 1) { /* Allocated in the top, no need to copy. */ } else if (ret >= 0) { @@ -170,9 +170,9 @@ static int coroutine_fn stream_run(Job *job, Error **errp) * Copy if allocated in the intermediate images. Limit to the * known-unallocated area [offset, offset+n*BDRV_SECTOR_SIZE). */ - ret = bdrv_is_allocated_above(bdrv_cow_bs(unfiltered_bs), - s->base_overlay, true, - offset, n, &n); + ret = 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 == 0 && n == 0) { n = 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 = bdrv_is_allocated(s->qcow->bs, sector_num * BDRV_SECTOR_SIZE, - (nb_sectors - i) * BDRV_SECTOR_SIZE, &n); + ret = bdrv_co_is_allocated(s->qcow->bs, sector_num * BDRV_SECTOR_SIZE, + (nb_sectors - i) * BDRV_SECTOR_SIZE, &n); if (ret < 0) { return ret; } @@ -1807,10 +1807,10 @@ cluster_was_modified(BDRVVVFATState *s, uint32_t cluster_num) } for (i = 0; !was_modified && i < s->sectors_per_cluster; i++) { - was_modified = bdrv_is_allocated(s->qcow->bs, - (cluster2sector(s, cluster_num) + - i) * BDRV_SECTOR_SIZE, - BDRV_SECTOR_SIZE, NULL); + was_modified = bdrv_co_is_allocated(s->qcow->bs, + (cluster2sector(s, cluster_num) + + i) * BDRV_SECTOR_SIZE, + BDRV_SECTOR_SIZE, NULL); } /* @@ -1968,9 +1968,9 @@ get_cluster_count_for_direntry(BDRVVVFATState* s, direntry_t* direntry, const ch for (i = 0; i < s->sectors_per_cluster; i++) { int res; - res = bdrv_is_allocated(s->qcow->bs, - (offset + i) * BDRV_SECTOR_SIZE, - BDRV_SECTOR_SIZE, NULL); + res = bdrv_co_is_allocated(s->qcow->bs, + (offset + i) * BDRV_SECTOR_SIZE, + BDRV_SECTOR_SIZE, NULL); if (res < 0) { return -1; }