qemu-block
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 03/13] block: Revert .bdrv_drained_begin/end to non-coroutine


From: Vladimir Sementsov-Ogievskiy
Subject: Re: [PATCH 03/13] block: Revert .bdrv_drained_begin/end to non-coroutine_fn
Date: Wed, 9 Nov 2022 17:29:22 +0300
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.2.2

On 11/8/22 15:37, Kevin Wolf wrote:
Polling during bdrv_drained_end() can be problematic (and in the future,
we may get cases for bdrv_drained_begin() where polling is forbidden,
and we don't care about already in-flight requests, but just want to
prevent new requests from arriving).

The .bdrv_drained_begin/end callbacks running in a coroutine is the only
reason why we have to do this polling, so make them non-coroutine
callbacks again. None of the callers actually yield any more.

This means that bdrv_drained_end() effectively doesn't poll any more,
even if AIO_WAIT_WHILE() loops are still there (their condition is false
from the beginning). This is generally not a problem, but in
test-bdrv-drain, some additional explicit aio_poll() calls need to be
added because the test case wants to verify the final state after BHs
have executed.

So, drained_end_counter is always zero since this commit (and is removed in the 
next one).


Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
  include/block/block_int-common.h | 10 ++++---
  block.c                          |  4 +--
  block/io.c                       | 49 +++++---------------------------
  block/qed.c                      |  4 +--
  block/throttle.c                 |  6 ++--
  tests/unit/test-bdrv-drain.c     | 18 ++++++------
  6 files changed, 30 insertions(+), 61 deletions(-)


[..]

--- a/block/qed.c
+++ b/block/qed.c
@@ -365,7 +365,7 @@ static void bdrv_qed_attach_aio_context(BlockDriverState 
*bs,
      }
  }
-static void coroutine_fn bdrv_qed_co_drain_begin(BlockDriverState *bs)
+static void bdrv_qed_co_drain_begin(BlockDriverState *bs)
  {
      BDRVQEDState *s = bs->opaque;
@@ -1661,7 +1661,7 @@ static BlockDriver bdrv_qed = {
      .bdrv_co_check            = bdrv_qed_co_check,
      .bdrv_detach_aio_context  = bdrv_qed_detach_aio_context,
      .bdrv_attach_aio_context  = bdrv_qed_attach_aio_context,
-    .bdrv_co_drain_begin      = bdrv_qed_co_drain_begin,
+    .bdrv_drain_begin         = bdrv_qed_co_drain_begin,

Rename to bdrv_qed_drain_begin without _co_, as for tests ?


  };
static void bdrv_qed_init(void)
diff --git a/block/throttle.c b/block/throttle.c
index 131eba3ab4..6e3ae1b355 100644
--- a/block/throttle.c
+++ b/block/throttle.c
@@ -214,7 +214,7 @@ static void throttle_reopen_abort(BDRVReopenState 
*reopen_state)
      reopen_state->opaque = NULL;
  }
-static void coroutine_fn throttle_co_drain_begin(BlockDriverState *bs)
+static void throttle_co_drain_begin(BlockDriverState *bs)

and here.

And you didn't drop coroutine_fn for throttle_co_drain_end

with that fixed:

Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>

--
Best regards,
Vladimir




reply via email to

[Prev in Thread] Current Thread [Next in Thread]