From nobody Thu Nov 6 22:44:30 2025 Delivered-To: importer@patchew.org Received-SPF: temperror (zoho.com: Error in retrieving data from DNS) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=temperror (zoho.com: Error in retrieving data from DNS) 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 (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1544700354610460.70729349541955; Thu, 13 Dec 2018 03:25:54 -0800 (PST) Received: from localhost ([::1]:51791 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gXP7i-0003CW-86 for importer@patchew.org; Thu, 13 Dec 2018 06:25:46 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45883) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gXP6s-0002mK-HR for qemu-devel@nongnu.org; Thu, 13 Dec 2018 06:24:55 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gXP6r-0000vn-KO for qemu-devel@nongnu.org; Thu, 13 Dec 2018 06:24:54 -0500 Received: from mx1.redhat.com ([209.132.183.28]:54166) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gXP6j-0000oj-TS; Thu, 13 Dec 2018 06:24:47 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C288A2D7F7; Thu, 13 Dec 2018 11:24:42 +0000 (UTC) Received: from localhost (ovpn-117-126.ams2.redhat.com [10.36.117.126]) by smtp.corp.redhat.com (Postfix) with ESMTP id 360DB5D6A9; Thu, 13 Dec 2018 11:24:35 +0000 (UTC) From: Stefan Hajnoczi To: Date: Thu, 13 Dec 2018 11:24:34 +0000 Message-Id: <20181213112434.20039-1-stefanha@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Thu, 13 Dec 2018 11:24:42 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH] block/mirror: add missing coroutine_fn annotations X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , qemu-block@nongnu.org, Jeff Cody , Max Reitz , Stefan Hajnoczi , John Snow Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" Marking a function coroutine_fn currently has no effect on the compiler, but it documents that this function must be called from coroutine context and it may yield. This is important information for the programmer. Also, if we ever transition to a stackless coroutine implementation, then it's likely that the annotation will become mandatory so the compiler can use the correct calling convention for coroutine functions. Cc: Max Reitz Cc: John Snow Signed-off-by: Stefan Hajnoczi --- block/mirror.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/block/mirror.c b/block/mirror.c index 8f52c6215d..408c49248f 100644 --- a/block/mirror.c +++ b/block/mirror.c @@ -277,7 +277,8 @@ static int mirror_cow_align(MirrorBlockJob *s, int64_t = *offset, return ret; } =20 -static inline void mirror_wait_for_any_operation(MirrorBlockJob *s, bool a= ctive) +static inline void coroutine_fn +mirror_wait_for_any_operation(MirrorBlockJob *s, bool active) { MirrorOp *op; =20 @@ -295,7 +296,8 @@ static inline void mirror_wait_for_any_operation(Mirror= BlockJob *s, bool active) abort(); } =20 -static inline void mirror_wait_for_free_in_flight_slot(MirrorBlockJob *s) +static inline void coroutine_fn +mirror_wait_for_free_in_flight_slot(MirrorBlockJob *s) { /* Only non-active operations use up in-flight slots */ mirror_wait_for_any_operation(s, false); @@ -598,7 +600,7 @@ static void mirror_free_init(MirrorBlockJob *s) * mirror_resume() because mirror_run() will begin iterating again * when the job is resumed. */ -static void mirror_wait_for_all_io(MirrorBlockJob *s) +static void coroutine_fn mirror_wait_for_all_io(MirrorBlockJob *s) { while (s->in_flight > 0) { mirror_wait_for_free_in_flight_slot(s); @@ -731,7 +733,7 @@ static void mirror_abort(Job *job) assert(ret =3D=3D 0); } =20 -static void mirror_throttle(MirrorBlockJob *s) +static void coroutine_fn mirror_throttle(MirrorBlockJob *s) { int64_t now =3D qemu_clock_get_ns(QEMU_CLOCK_REALTIME); =20 @@ -1106,7 +1108,7 @@ static void mirror_complete(Job *job, Error **errp) job_enter(job); } =20 -static void mirror_pause(Job *job) +static void coroutine_fn mirror_pause(Job *job) { MirrorBlockJob *s =3D container_of(job, MirrorBlockJob, common.job); =20 @@ -1177,9 +1179,10 @@ static const BlockJobDriver commit_active_job_driver= =3D { .drain =3D mirror_drain, }; =20 -static void do_sync_target_write(MirrorBlockJob *job, MirrorMethod method, - uint64_t offset, uint64_t bytes, - QEMUIOVector *qiov, int flags) +static void coroutine_fn +do_sync_target_write(MirrorBlockJob *job, MirrorMethod method, + uint64_t offset, uint64_t bytes, + QEMUIOVector *qiov, int flags) { BdrvDirtyBitmapIter *iter; QEMUIOVector target_qiov; --=20 2.19.2