[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 12/15] block: limit bdrv_co_yield_to_drain to drain_begin
From: |
Paolo Bonzini |
Subject: |
[PATCH 12/15] block: limit bdrv_co_yield_to_drain to drain_begin |
Date: |
Mon, 12 Dec 2022 13:59:17 +0100 |
Since bdrv_drained_end does not poll anymore, it need not jump out of
coroutine context. This in turn enables the removal of the "begin"
field in BdrvCoDrainData.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
block/io.c | 19 +++----------------
1 file changed, 3 insertions(+), 16 deletions(-)
diff --git a/block/io.c b/block/io.c
index f4444b7777d9..695c8f3f5faa 100644
--- a/block/io.c
+++ b/block/io.c
@@ -233,7 +233,6 @@ typedef struct {
Coroutine *co;
BlockDriverState *bs;
bool done;
- bool begin;
bool poll;
BdrvChild *parent;
} BdrvCoDrainData;
@@ -275,15 +274,9 @@ static void bdrv_co_drain_bh_cb(void *opaque)
AioContext *ctx = bdrv_get_aio_context(bs);
aio_context_acquire(ctx);
bdrv_dec_in_flight(bs);
- if (data->begin) {
- bdrv_do_drained_begin(bs, data->parent, data->poll);
- } else {
- assert(!data->poll);
- bdrv_do_drained_end(bs, data->parent);
- }
+ bdrv_do_drained_begin(bs, data->parent, data->poll);
aio_context_release(ctx);
} else {
- assert(data->begin);
bdrv_drain_all_begin();
}
@@ -292,7 +285,6 @@ static void bdrv_co_drain_bh_cb(void *opaque)
}
static void coroutine_fn bdrv_co_yield_to_drain(BlockDriverState *bs,
- bool begin,
BdrvChild *parent,
bool poll)
{
@@ -309,7 +301,6 @@ static void coroutine_fn
bdrv_co_yield_to_drain(BlockDriverState *bs,
.co = self,
.bs = bs,
.done = false,
- .begin = begin,
.parent = parent,
.poll = poll,
};
@@ -348,7 +339,7 @@ static void bdrv_do_drained_begin(BlockDriverState *bs,
BdrvChild *parent,
IO_OR_GS_CODE();
if (qemu_in_coroutine()) {
- bdrv_co_yield_to_drain(bs, true, parent, poll);
+ bdrv_co_yield_to_drain(bs, parent, poll);
return;
}
@@ -394,10 +385,6 @@ static void bdrv_do_drained_end(BlockDriverState *bs,
BdrvChild *parent)
{
int old_quiesce_counter;
- if (qemu_in_coroutine()) {
- bdrv_co_yield_to_drain(bs, false, parent, false);
- return;
- }
assert(bs->quiesce_counter > 0);
/* Re-enable things in child-to-parent order */
@@ -472,7 +459,7 @@ void bdrv_drain_all_begin(void)
GLOBAL_STATE_CODE();
if (qemu_in_coroutine()) {
- bdrv_co_yield_to_drain(NULL, true, NULL, true);
+ bdrv_co_yield_to_drain(NULL, NULL, true);
return;
}
--
2.38.1
- [PATCH 02/15] Revert "block: Don't poll in bdrv_replace_child_noperm()", (continued)
- [PATCH 02/15] Revert "block: Don't poll in bdrv_replace_child_noperm()", Paolo Bonzini, 2022/12/12
- [PATCH 03/15] block: Pull polling out of bdrv_parent_drained_begin_single(), Paolo Bonzini, 2022/12/12
- [PATCH 04/15] test-bdrv-drain.c: remove test_detach_by_parent_cb(), Paolo Bonzini, 2022/12/12
- [PATCH 05/15] tests/unit/test-bdrv-drain.c: graph setup functions can't run in coroutines, Paolo Bonzini, 2022/12/12
- [PATCH 06/15] tests/qemu-iotests/030: test_stream_parallel should use auto_finalize=False, Paolo Bonzini, 2022/12/12
- [PATCH 07/15] block-backend: enter aio coroutine only after drain, Paolo Bonzini, 2022/12/12
- [PATCH 08/15] nbd: a BlockExport always has a BlockBackend, Paolo Bonzini, 2022/12/12
- [PATCH 09/15] block-backend: make global properties write-once, Paolo Bonzini, 2022/12/12
- [PATCH 11/15] block-backend: make queued_requests thread-safe, Paolo Bonzini, 2022/12/12
- [PATCH 10/15] block-backend: always wait for drain before starting operation, Paolo Bonzini, 2022/12/12
- [PATCH 12/15] block: limit bdrv_co_yield_to_drain to drain_begin,
Paolo Bonzini <=
- [PATCH 15/15] block: only get out of coroutine context for polling, Paolo Bonzini, 2022/12/12
- [PATCH 13/15] block: second argument of bdrv_do_drained_end is always NULL, Paolo Bonzini, 2022/12/12
- [PATCH 14/15] block: second argument of bdrv_do_drained_begin and bdrv_drain_poll is always NULL, Paolo Bonzini, 2022/12/12