From nobody Sat Apr 12 11:55:23 2025 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=1687961844; cv=none; d=zohomail.com; s=zohoarc; b=MyjGnhJDbSqwus6IWkfGFxHOSVeNrp0QSLeGKLlQ+PXgB9PLfvZGVwg3lu1AZ6mRmk0EeuIVjPMIBT4fOiabElr0HotoLNnVlft3nQVmqj6V4u3+fZsEGz3X/030uD1mT73pBLqfRUpy8/eh/ybrvhEJZgIXXhYGO21dP4me0to= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1687961844; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=LREAmbiCaAcrea5MbzOl3rlWDJdAWltW49/x0gkOMfA=; b=Q7v6wFFCmFhUe1+IW74AYkEnRy4VcIF14aPpQ5unTs6Dv9l0Xo9oStJeWeU3oC08GNFWzmpk5mTS6tPV4dQyVhdowojkuc832lSftWzROUJJyKKp7/jpqZWIyH9fzR13OmTnUy2oXPOs55mmPBf+joaVLXn35IAcOzdQCUB2Gko= 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 1687961844135504.5994468120027; Wed, 28 Jun 2023 07:17:24 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qEVyB-0000IM-RI; Wed, 28 Jun 2023 10:16: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 1qEVxu-0008JH-Kr for qemu-devel@nongnu.org; Wed, 28 Jun 2023 10:16:20 -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 1qEVxn-0005HY-V1 for qemu-devel@nongnu.org; Wed, 28 Jun 2023 10:16:12 -0400 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-544-0YNfy_9VOUyNOonoPM17FQ-1; Wed, 28 Jun 2023 10:16:01 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 5A33F1C4769E; Wed, 28 Jun 2023 14:15:52 +0000 (UTC) Received: from merkur.redhat.com (unknown [10.39.195.21]) by smtp.corp.redhat.com (Postfix) with ESMTP id A6E8440C2063; Wed, 28 Jun 2023 14:15:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1687961766; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=LREAmbiCaAcrea5MbzOl3rlWDJdAWltW49/x0gkOMfA=; b=G/MjhC96r+382lMIMdU0IkIiodnTnzKdhW6GXuKeOLQriM3bad2uLx1XnnXYhkXu0slT9q EfbVs8uGuCP0CPcjzR6t5sQBAsJqi5ry4PAMhLb2wlFAR/wCj2CMeZtHPq2Z9hyiIKFXA5 l5Z5yWBcNsduAAAsSCHZ9jORkjHlJI4= X-MC-Unique: 0YNfy_9VOUyNOonoPM17FQ-1 From: Kevin Wolf To: qemu-block@nongnu.org Cc: kwolf@redhat.com, richard.henderson@linaro.org, qemu-devel@nongnu.org Subject: [PULL 12/23] file-posix: remove incorrect coroutine_fn calls Date: Wed, 28 Jun 2023 16:15:15 +0200 Message-ID: <20230628141526.293104-13-kwolf@redhat.com> In-Reply-To: <20230628141526.293104-1-kwolf@redhat.com> References: <20230628141526.293104-1-kwolf@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 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=kwolf@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_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1687961846370100003 Content-Type: text/plain; charset="utf-8" From: Paolo Bonzini raw_co_getlength is called by handle_aiocb_write_zeroes, which is not a cor= outine function. This is harmless because raw_co_getlength does not actually susp= end, but in the interest of clarity make it a non-coroutine_fn that is just wrap= ped by the coroutine_fn raw_co_getlength. Likewise, check_cache_dropped was on= ly a coroutine_fn because it called raw_co_getlength, so it can be made non-co= routine as well. Signed-off-by: Paolo Bonzini Message-ID: <20230601115145.196465-2-pbonzini@redhat.com> Reviewed-by: Kevin Wolf Signed-off-by: Kevin Wolf --- block/file-posix.c | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/block/file-posix.c b/block/file-posix.c index ac1ed54811..9e8e3d8ca5 100644 --- a/block/file-posix.c +++ b/block/file-posix.c @@ -193,7 +193,7 @@ static int fd_open(BlockDriverState *bs) return -EIO; } =20 -static int64_t coroutine_fn raw_co_getlength(BlockDriverState *bs); +static int64_t raw_getlength(BlockDriverState *bs); =20 typedef struct RawPosixAIOData { BlockDriverState *bs; @@ -1974,7 +1974,7 @@ static int handle_aiocb_write_zeroes(void *opaque) #ifdef CONFIG_FALLOCATE /* Last resort: we are trying to extend the file with zeroed data. This * can be done via fallocate(fd, 0) */ - len =3D raw_co_getlength(aiocb->bs); + len =3D raw_getlength(aiocb->bs); if (s->has_fallocate && len >=3D 0 && aiocb->aio_offset >=3D len) { int ret =3D do_fallocate(s->fd, 0, aiocb->aio_offset, aiocb->aio_n= bytes); if (ret =3D=3D 0 || ret !=3D -ENOTSUP) { @@ -2666,7 +2666,7 @@ static int coroutine_fn raw_co_truncate(BlockDriverSt= ate *bs, int64_t offset, } =20 if (S_ISCHR(st.st_mode) || S_ISBLK(st.st_mode)) { - int64_t cur_length =3D raw_co_getlength(bs); + int64_t cur_length =3D raw_getlength(bs); =20 if (offset !=3D cur_length && exact) { error_setg(errp, "Cannot resize device files"); @@ -2684,7 +2684,7 @@ static int coroutine_fn raw_co_truncate(BlockDriverSt= ate *bs, int64_t offset, } =20 #ifdef __OpenBSD__ -static int64_t coroutine_fn raw_co_getlength(BlockDriverState *bs) +static int64_t raw_getlength(BlockDriverState *bs) { BDRVRawState *s =3D bs->opaque; int fd =3D s->fd; @@ -2703,7 +2703,7 @@ static int64_t coroutine_fn raw_co_getlength(BlockDri= verState *bs) return st.st_size; } #elif defined(__NetBSD__) -static int64_t coroutine_fn raw_co_getlength(BlockDriverState *bs) +static int64_t raw_getlength(BlockDriverState *bs) { BDRVRawState *s =3D bs->opaque; int fd =3D s->fd; @@ -2728,7 +2728,7 @@ static int64_t coroutine_fn raw_co_getlength(BlockDri= verState *bs) return st.st_size; } #elif defined(__sun__) -static int64_t coroutine_fn raw_co_getlength(BlockDriverState *bs) +static int64_t raw_getlength(BlockDriverState *bs) { BDRVRawState *s =3D bs->opaque; struct dk_minfo minfo; @@ -2759,7 +2759,7 @@ static int64_t coroutine_fn raw_co_getlength(BlockDri= verState *bs) return size; } #elif defined(CONFIG_BSD) -static int64_t coroutine_fn raw_co_getlength(BlockDriverState *bs) +static int64_t raw_getlength(BlockDriverState *bs) { BDRVRawState *s =3D bs->opaque; int fd =3D s->fd; @@ -2831,7 +2831,7 @@ again: return size; } #else -static int64_t coroutine_fn raw_co_getlength(BlockDriverState *bs) +static int64_t raw_getlength(BlockDriverState *bs) { BDRVRawState *s =3D bs->opaque; int ret; @@ -2850,6 +2850,11 @@ static int64_t coroutine_fn raw_co_getlength(BlockDr= iverState *bs) } #endif =20 +static int64_t coroutine_fn raw_co_getlength(BlockDriverState *bs) +{ + return raw_getlength(bs); +} + static int64_t coroutine_fn raw_co_get_allocated_file_size(BlockDriverStat= e *bs) { struct stat st; @@ -3215,7 +3220,7 @@ static int coroutine_fn raw_co_block_status(BlockDriv= erState *bs, * round up if necessary. */ if (!QEMU_IS_ALIGNED(*pnum, bs->bl.request_alignment)) { - int64_t file_length =3D raw_co_getlength(bs); + int64_t file_length =3D raw_getlength(bs); if (file_length > 0) { /* Ignore errors, this is just a safeguard */ assert(hole =3D=3D file_length); @@ -3237,7 +3242,7 @@ static int coroutine_fn raw_co_block_status(BlockDriv= erState *bs, =20 #if defined(__linux__) /* Verify that the file is not in the page cache */ -static void coroutine_fn check_cache_dropped(BlockDriverState *bs, Error *= *errp) +static void check_cache_dropped(BlockDriverState *bs, Error **errp) { const size_t window_size =3D 128 * 1024 * 1024; BDRVRawState *s =3D bs->opaque; @@ -3252,7 +3257,7 @@ static void coroutine_fn check_cache_dropped(BlockDri= verState *bs, Error **errp) page_size =3D sysconf(_SC_PAGESIZE); vec =3D g_malloc(DIV_ROUND_UP(window_size, page_size)); =20 - end =3D raw_co_getlength(bs); + end =3D raw_getlength(bs); =20 for (offset =3D 0; offset < end; offset +=3D window_size) { void *new_window; @@ -4468,7 +4473,7 @@ static int cdrom_reopen(BlockDriverState *bs) =20 static bool coroutine_fn cdrom_co_is_inserted(BlockDriverState *bs) { - return raw_co_getlength(bs) > 0; + return raw_getlength(bs) > 0; } =20 static void coroutine_fn cdrom_co_eject(BlockDriverState *bs, bool eject_f= lag) --=20 2.41.0