From nobody Sun Apr 28 12:04:24 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) 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=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 150790271665754.49768284871766; Fri, 13 Oct 2017 06:51:56 -0700 (PDT) Received: from localhost ([::1]:50426 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e30NN-0000Zy-26 for importer@patchew.org; Fri, 13 Oct 2017 09:51:45 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57679) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e30LN-0007nz-Su for qemu-devel@nongnu.org; Fri, 13 Oct 2017 09:49:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e30LM-0006Se-H0 for qemu-devel@nongnu.org; Fri, 13 Oct 2017 09:49:41 -0400 Received: from mx1.redhat.com ([209.132.183.28]:51192) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1e30LM-0006Rh-7j for qemu-devel@nongnu.org; Fri, 13 Oct 2017 09:49:40 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 111B87F3F0; Fri, 13 Oct 2017 13:49:39 +0000 (UTC) Received: from localhost (unknown [10.36.118.232]) by smtp.corp.redhat.com (Postfix) with ESMTP id B6C3650338; Fri, 13 Oct 2017 13:49:35 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 111B87F3F0 Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=stefanha@redhat.com From: Stefan Hajnoczi To: Date: Fri, 13 Oct 2017 14:49:28 +0100 Message-Id: <20171013134930.20200-2-stefanha@redhat.com> In-Reply-To: <20171013134930.20200-1-stefanha@redhat.com> References: <20171013134930.20200-1-stefanha@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Fri, 13 Oct 2017 13:49:39 +0000 (UTC) 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] [PULL 1/3] block: add bdrv_co_drain_end callback 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: Peter Maydell , Stefan Hajnoczi , Manos Pitsidianakis Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Manos Pitsidianakis BlockDriverState has a bdrv_co_drain() callback but no equivalent for the end of the drain. The throttle driver (block/throttle.c) needs a way to mark the end of the drain in order to toggle io_limits_disabled correctly, thus bdrv_co_drain_end is needed. Signed-off-by: Manos Pitsidianakis Reviewed-by: Stefan Hajnoczi Reviewed-by: Fam Zheng Signed-off-by: Stefan Hajnoczi --- include/block/block_int.h | 11 +++++++++-- block/io.c | 48 +++++++++++++++++++++++++++++++++----------= ---- 2 files changed, 43 insertions(+), 16 deletions(-) diff --git a/include/block/block_int.h b/include/block/block_int.h index 7e8a206239..dd62f4d083 100644 --- a/include/block/block_int.h +++ b/include/block/block_int.h @@ -354,10 +354,17 @@ struct BlockDriver { int (*bdrv_probe_geometry)(BlockDriverState *bs, HDGeometry *geo); =20 /** - * Drain and stop any internal sources of requests in the driver, and - * remain so until next I/O callback (e.g. bdrv_co_writev) is called. + * bdrv_co_drain is called if implemented in the beginning of a + * drain operation to drain and stop any internal sources of requests = in + * the driver. + * bdrv_co_drain_end is called if implemented at the end of the drain. + * + * They should be used by the driver to e.g. manage scheduled I/O + * requests, or toggle an internal state. After the end of the drain n= ew + * requests will continue normally. */ void coroutine_fn (*bdrv_co_drain)(BlockDriverState *bs); + void coroutine_fn (*bdrv_co_drain_end)(BlockDriverState *bs); =20 void (*bdrv_add_child)(BlockDriverState *parent, BlockDriverState *chi= ld, Error **errp); diff --git a/block/io.c b/block/io.c index 8e419070b5..342fb571cf 100644 --- a/block/io.c +++ b/block/io.c @@ -156,6 +156,7 @@ typedef struct { Coroutine *co; BlockDriverState *bs; bool done; + bool begin; } BdrvCoDrainData; =20 static void coroutine_fn bdrv_drain_invoke_entry(void *opaque) @@ -163,18 +164,23 @@ static void coroutine_fn bdrv_drain_invoke_entry(void= *opaque) BdrvCoDrainData *data =3D opaque; BlockDriverState *bs =3D data->bs; =20 - bs->drv->bdrv_co_drain(bs); + if (data->begin) { + bs->drv->bdrv_co_drain(bs); + } else { + bs->drv->bdrv_co_drain_end(bs); + } =20 /* Set data->done before reading bs->wakeup. */ atomic_mb_set(&data->done, true); bdrv_wakeup(bs); } =20 -static void bdrv_drain_invoke(BlockDriverState *bs) +static void bdrv_drain_invoke(BlockDriverState *bs, bool begin) { - BdrvCoDrainData data =3D { .bs =3D bs, .done =3D false }; + BdrvCoDrainData data =3D { .bs =3D bs, .done =3D false, .begin =3D beg= in}; =20 - if (!bs->drv || !bs->drv->bdrv_co_drain) { + if (!bs->drv || (begin && !bs->drv->bdrv_co_drain) || + (!begin && !bs->drv->bdrv_co_drain_end)) { return; } =20 @@ -183,15 +189,16 @@ static void bdrv_drain_invoke(BlockDriverState *bs) BDRV_POLL_WHILE(bs, !data.done); } =20 -static bool bdrv_drain_recurse(BlockDriverState *bs) +static bool bdrv_drain_recurse(BlockDriverState *bs, bool begin) { BdrvChild *child, *tmp; bool waited; =20 - waited =3D BDRV_POLL_WHILE(bs, atomic_read(&bs->in_flight) > 0); - /* Ensure any pending metadata writes are submitted to bs->file. */ - bdrv_drain_invoke(bs); + bdrv_drain_invoke(bs, begin); + + /* Wait for drained requests to finish */ + waited =3D BDRV_POLL_WHILE(bs, atomic_read(&bs->in_flight) > 0); =20 QLIST_FOREACH_SAFE(child, &bs->children, next, tmp) { BlockDriverState *bs =3D child->bs; @@ -208,7 +215,7 @@ static bool bdrv_drain_recurse(BlockDriverState *bs) */ bdrv_ref(bs); } - waited |=3D bdrv_drain_recurse(bs); + waited |=3D bdrv_drain_recurse(bs, begin); if (in_main_loop) { bdrv_unref(bs); } @@ -224,12 +231,18 @@ static void bdrv_co_drain_bh_cb(void *opaque) BlockDriverState *bs =3D data->bs; =20 bdrv_dec_in_flight(bs); - bdrv_drained_begin(bs); + if (data->begin) { + bdrv_drained_begin(bs); + } else { + bdrv_drained_end(bs); + } + data->done =3D true; aio_co_wake(co); } =20 -static void coroutine_fn bdrv_co_yield_to_drain(BlockDriverState *bs) +static void coroutine_fn bdrv_co_yield_to_drain(BlockDriverState *bs, + bool begin) { BdrvCoDrainData data; =20 @@ -242,6 +255,7 @@ static void coroutine_fn bdrv_co_yield_to_drain(BlockDr= iverState *bs) .co =3D qemu_coroutine_self(), .bs =3D bs, .done =3D false, + .begin =3D begin, }; bdrv_inc_in_flight(bs); aio_bh_schedule_oneshot(bdrv_get_aio_context(bs), @@ -256,7 +270,7 @@ static void coroutine_fn bdrv_co_yield_to_drain(BlockDr= iverState *bs) void bdrv_drained_begin(BlockDriverState *bs) { if (qemu_in_coroutine()) { - bdrv_co_yield_to_drain(bs); + bdrv_co_yield_to_drain(bs, true); return; } =20 @@ -265,17 +279,22 @@ void bdrv_drained_begin(BlockDriverState *bs) bdrv_parent_drained_begin(bs); } =20 - bdrv_drain_recurse(bs); + bdrv_drain_recurse(bs, true); } =20 void bdrv_drained_end(BlockDriverState *bs) { + if (qemu_in_coroutine()) { + bdrv_co_yield_to_drain(bs, false); + return; + } assert(bs->quiesce_counter > 0); if (atomic_fetch_dec(&bs->quiesce_counter) > 1) { return; } =20 bdrv_parent_drained_end(bs); + bdrv_drain_recurse(bs, false); aio_enable_external(bdrv_get_aio_context(bs)); } =20 @@ -353,7 +372,7 @@ void bdrv_drain_all_begin(void) aio_context_acquire(aio_context); for (bs =3D bdrv_first(&it); bs; bs =3D bdrv_next(&it)) { if (aio_context =3D=3D bdrv_get_aio_context(bs)) { - waited |=3D bdrv_drain_recurse(bs); + waited |=3D bdrv_drain_recurse(bs, true); } } aio_context_release(aio_context); @@ -374,6 +393,7 @@ void bdrv_drain_all_end(void) aio_context_acquire(aio_context); aio_enable_external(aio_context); bdrv_parent_drained_end(bs); + bdrv_drain_recurse(bs, false); aio_context_release(aio_context); } =20 --=20 2.13.6 From nobody Sun Apr 28 12:04:24 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) 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=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1507902855999706.2246553889273; Fri, 13 Oct 2017 06:54:15 -0700 (PDT) Received: from localhost ([::1]:50435 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e30Pi-0002ZM-9W for importer@patchew.org; Fri, 13 Oct 2017 09:54:10 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57697) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e30LP-0007oO-6D for qemu-devel@nongnu.org; Fri, 13 Oct 2017 09:49:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e30LO-0006Tb-4W for qemu-devel@nongnu.org; Fri, 13 Oct 2017 09:49:43 -0400 Received: from mx1.redhat.com ([209.132.183.28]:51272) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1e30LN-0006T2-S9 for qemu-devel@nongnu.org; Fri, 13 Oct 2017 09:49:42 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id D87D581E18; Fri, 13 Oct 2017 13:49:40 +0000 (UTC) Received: from localhost (unknown [10.36.118.232]) by smtp.corp.redhat.com (Postfix) with ESMTP id 71EF6619A4; Fri, 13 Oct 2017 13:49:40 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com D87D581E18 Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=stefanha@redhat.com From: Stefan Hajnoczi To: Date: Fri, 13 Oct 2017 14:49:29 +0100 Message-Id: <20171013134930.20200-3-stefanha@redhat.com> In-Reply-To: <20171013134930.20200-1-stefanha@redhat.com> References: <20171013134930.20200-1-stefanha@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Fri, 13 Oct 2017 13:49:41 +0000 (UTC) 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] [PULL 2/3] block: rename bdrv_co_drain to bdrv_co_drain_begin 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: Peter Maydell , Stefan Hajnoczi , Manos Pitsidianakis Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Manos Pitsidianakis Reviewed-by: Stefan Hajnoczi Reviewed-by: Fam Zheng Signed-off-by: Manos Pitsidianakis Reviewed-by: Stefan Hajnoczi Signed-off-by: Stefan Hajnoczi --- include/block/block_int.h | 4 ++-- block/io.c | 4 ++-- block/qed.c | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/include/block/block_int.h b/include/block/block_int.h index dd62f4d083..885c08e989 100644 --- a/include/block/block_int.h +++ b/include/block/block_int.h @@ -354,7 +354,7 @@ struct BlockDriver { int (*bdrv_probe_geometry)(BlockDriverState *bs, HDGeometry *geo); =20 /** - * bdrv_co_drain is called if implemented in the beginning of a + * bdrv_co_drain_begin is called if implemented in the beginning of a * drain operation to drain and stop any internal sources of requests = in * the driver. * bdrv_co_drain_end is called if implemented at the end of the drain. @@ -363,7 +363,7 @@ struct BlockDriver { * requests, or toggle an internal state. After the end of the drain n= ew * requests will continue normally. */ - void coroutine_fn (*bdrv_co_drain)(BlockDriverState *bs); + void coroutine_fn (*bdrv_co_drain_begin)(BlockDriverState *bs); void coroutine_fn (*bdrv_co_drain_end)(BlockDriverState *bs); =20 void (*bdrv_add_child)(BlockDriverState *parent, BlockDriverState *chi= ld, diff --git a/block/io.c b/block/io.c index 342fb571cf..0854e0fdac 100644 --- a/block/io.c +++ b/block/io.c @@ -165,7 +165,7 @@ static void coroutine_fn bdrv_drain_invoke_entry(void *= opaque) BlockDriverState *bs =3D data->bs; =20 if (data->begin) { - bs->drv->bdrv_co_drain(bs); + bs->drv->bdrv_co_drain_begin(bs); } else { bs->drv->bdrv_co_drain_end(bs); } @@ -179,7 +179,7 @@ static void bdrv_drain_invoke(BlockDriverState *bs, boo= l begin) { BdrvCoDrainData data =3D { .bs =3D bs, .done =3D false, .begin =3D beg= in}; =20 - if (!bs->drv || (begin && !bs->drv->bdrv_co_drain) || + if (!bs->drv || (begin && !bs->drv->bdrv_co_drain_begin) || (!begin && !bs->drv->bdrv_co_drain_end)) { return; } diff --git a/block/qed.c b/block/qed.c index 28e2ec89e8..821dcaa055 100644 --- a/block/qed.c +++ b/block/qed.c @@ -265,7 +265,7 @@ static bool qed_plug_allocating_write_reqs(BDRVQEDState= *s) assert(!s->allocating_write_reqs_plugged); if (s->allocating_acb !=3D NULL) { /* Another allocating write came concurrently. This cannot happen - * from bdrv_qed_co_drain, but it can happen when the timer runs. + * from bdrv_qed_co_drain_begin, but it can happen when the timer = runs. */ qemu_co_mutex_unlock(&s->table_lock); return false; @@ -358,7 +358,7 @@ static void bdrv_qed_attach_aio_context(BlockDriverStat= e *bs, } } =20 -static void coroutine_fn bdrv_qed_co_drain(BlockDriverState *bs) +static void coroutine_fn bdrv_qed_co_drain_begin(BlockDriverState *bs) { BDRVQEDState *s =3D bs->opaque; =20 @@ -1608,7 +1608,7 @@ static BlockDriver bdrv_qed =3D { .bdrv_check =3D bdrv_qed_check, .bdrv_detach_aio_context =3D bdrv_qed_detach_aio_context, .bdrv_attach_aio_context =3D bdrv_qed_attach_aio_context, - .bdrv_co_drain =3D bdrv_qed_co_drain, + .bdrv_co_drain_begin =3D bdrv_qed_co_drain_begin, }; =20 static void bdrv_qed_init(void) --=20 2.13.6 From nobody Sun Apr 28 12:04:24 2024 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1507902722015199.0161517649334; Fri, 13 Oct 2017 06:52:02 -0700 (PDT) Received: from localhost ([::1]:50427 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e30NU-0000hr-6P for importer@patchew.org; Fri, 13 Oct 2017 09:51:52 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57733) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e30LW-0007rn-Bc for qemu-devel@nongnu.org; Fri, 13 Oct 2017 09:49:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e30LT-0006X4-9F for qemu-devel@nongnu.org; Fri, 13 Oct 2017 09:49:50 -0400 Received: from mx1.redhat.com ([209.132.183.28]:37678) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1e30LT-0006Wa-1y for qemu-devel@nongnu.org; Fri, 13 Oct 2017 09:49:47 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 038E585541; Fri, 13 Oct 2017 13:49:46 +0000 (UTC) Received: from localhost (unknown [10.36.118.232]) by smtp.corp.redhat.com (Postfix) with ESMTP id DB97A18EE7; Fri, 13 Oct 2017 13:49:42 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 038E585541 Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=stefanha@redhat.com From: Stefan Hajnoczi To: Date: Fri, 13 Oct 2017 14:49:30 +0100 Message-Id: <20171013134930.20200-4-stefanha@redhat.com> In-Reply-To: <20171013134930.20200-1-stefanha@redhat.com> References: <20171013134930.20200-1-stefanha@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Fri, 13 Oct 2017 13:49:46 +0000 (UTC) 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] [PULL 3/3] block/throttle.c: add bdrv_co_drain_begin/end callbacks 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: Peter Maydell , Stefan Hajnoczi , Manos Pitsidianakis Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_6 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Manos Pitsidianakis Reviewed-by: Stefan Hajnoczi Reviewed-by: Fam Zheng Signed-off-by: Manos Pitsidianakis Signed-off-by: Stefan Hajnoczi --- block/throttle.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/block/throttle.c b/block/throttle.c index 5bca76300f..833175ac77 100644 --- a/block/throttle.c +++ b/block/throttle.c @@ -197,6 +197,21 @@ static bool throttle_recurse_is_first_non_filter(Block= DriverState *bs, return bdrv_recurse_is_first_non_filter(bs->file->bs, candidate); } =20 +static void coroutine_fn throttle_co_drain_begin(BlockDriverState *bs) +{ + ThrottleGroupMember *tgm =3D bs->opaque; + if (atomic_fetch_inc(&tgm->io_limits_disabled) =3D=3D 0) { + throttle_group_restart_tgm(tgm); + } +} + +static void coroutine_fn throttle_co_drain_end(BlockDriverState *bs) +{ + ThrottleGroupMember *tgm =3D bs->opaque; + assert(tgm->io_limits_disabled); + atomic_dec(&tgm->io_limits_disabled); +} + static BlockDriver bdrv_throttle =3D { .format_name =3D "throttle", .protocol_name =3D "throttle", @@ -226,6 +241,9 @@ static BlockDriver bdrv_throttle =3D { .bdrv_reopen_abort =3D throttle_reopen_abort, .bdrv_co_get_block_status =3D bdrv_co_get_block_status_fro= m_file, =20 + .bdrv_co_drain_begin =3D throttle_co_drain_begin, + .bdrv_co_drain_end =3D throttle_co_drain_end, + .is_filter =3D true, }; =20 --=20 2.13.6