[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-block] [PULL 52/61] qed: Use a coroutine for need_check_timer
From: |
Kevin Wolf |
Subject: |
[Qemu-block] [PULL 52/61] qed: Use a coroutine for need_check_timer |
Date: |
Fri, 23 Jun 2017 18:21:50 +0200 |
This fixes the last place where we degraded from AIO to actual blocking
synchronous I/O requests. Putting it into a coroutine means that instead
of blocking, the coroutine simply yields while doing I/O.
Signed-off-by: Kevin Wolf <address@hidden>
Reviewed-by: Stefan Hajnoczi <address@hidden>
---
block/qed.c | 33 +++++++++++++++++----------------
1 file changed, 17 insertions(+), 16 deletions(-)
diff --git a/block/qed.c b/block/qed.c
index e53f6b5..eac8c2f 100644
--- a/block/qed.c
+++ b/block/qed.c
@@ -264,11 +264,23 @@ static void qed_unplug_allocating_write_reqs(BDRVQEDState
*s)
qemu_co_enter_next(&s->allocating_write_reqs);
}
-static void qed_clear_need_check(void *opaque, int ret)
+static void qed_need_check_timer_entry(void *opaque)
{
BDRVQEDState *s = opaque;
+ int ret;
- if (ret) {
+ /* The timer should only fire when allocating writes have drained */
+ assert(!s->allocating_acb);
+
+ trace_qed_need_check_timer_cb(s);
+
+ qed_acquire(s);
+ qed_plug_allocating_write_reqs(s);
+
+ /* Ensure writes are on disk before clearing flag */
+ ret = bdrv_co_flush(s->bs->file->bs);
+ qed_release(s);
+ if (ret < 0) {
qed_unplug_allocating_write_reqs(s);
return;
}
@@ -279,25 +291,14 @@ static void qed_clear_need_check(void *opaque, int ret)
qed_unplug_allocating_write_reqs(s);
- ret = bdrv_flush(s->bs);
+ ret = bdrv_co_flush(s->bs);
(void) ret;
}
static void qed_need_check_timer_cb(void *opaque)
{
- BDRVQEDState *s = opaque;
-
- /* The timer should only fire when allocating writes have drained */
- assert(!s->allocating_acb);
-
- trace_qed_need_check_timer_cb(s);
-
- qed_acquire(s);
- qed_plug_allocating_write_reqs(s);
-
- /* Ensure writes are on disk before clearing flag */
- bdrv_aio_flush(s->bs->file->bs, qed_clear_need_check, s);
- qed_release(s);
+ Coroutine *co = qemu_coroutine_create(qed_need_check_timer_entry, opaque);
+ qemu_coroutine_enter(co);
}
void qed_acquire(BDRVQEDState *s)
--
1.8.3.1
- [Qemu-block] [PULL 47/61] qed: Remove ret argument from qed_aio_next_io(), (continued)
- [Qemu-block] [PULL 47/61] qed: Remove ret argument from qed_aio_next_io(), Kevin Wolf, 2017/06/23
- [Qemu-block] [PULL 44/61] qed: Add return value to qed_aio_write_cow(), Kevin Wolf, 2017/06/23
- [Qemu-block] [PULL 50/61] qed: Use CoQueue for serialising allocations, Kevin Wolf, 2017/06/23
- [Qemu-block] [PULL 43/61] qed: Add return value to qed_aio_write_main(), Kevin Wolf, 2017/06/23
- [Qemu-block] [PULL 51/61] qed: Simplify request handling, Kevin Wolf, 2017/06/23
- [Qemu-block] [PULL 45/61] qed: Add return value to qed_aio_write_inplace/alloc(), Kevin Wolf, 2017/06/23
- [Qemu-block] [PULL 46/61] qed: Add return value to qed_aio_read/write_data(), Kevin Wolf, 2017/06/23
- [Qemu-block] [PULL 48/61] qed: Remove recursion in qed_aio_next_io(), Kevin Wolf, 2017/06/23
- [Qemu-block] [PULL 49/61] qed: Implement .bdrv_co_readv/writev, Kevin Wolf, 2017/06/23
- [Qemu-block] [PULL 53/61] qed: Add coroutine_fn to I/O path functions, Kevin Wolf, 2017/06/23
- [Qemu-block] [PULL 52/61] qed: Use a coroutine for need_check_timer,
Kevin Wolf <=
- [Qemu-block] [PULL 54/61] qed: Use bdrv_co_* for coroutine_fns, Kevin Wolf, 2017/06/23
- [Qemu-block] [PULL 55/61] block: Remove bdrv_aio_readv/writev/flush(), Kevin Wolf, 2017/06/23
- [Qemu-block] [PULL 57/61] fix: avoid an infinite loop or a dangling pointer problem in img_commit, Kevin Wolf, 2017/06/23
- [Qemu-block] [PULL 58/61] blkdebug: Catch bs->exact_filename overflow, Kevin Wolf, 2017/06/23
- [Qemu-block] [PULL 61/61] qemu-img: don't shadow opts variable in img_dd(), Kevin Wolf, 2017/06/23
- [Qemu-block] [PULL 59/61] blkverify: Catch bs->exact_filename overflow, Kevin Wolf, 2017/06/23
- [Qemu-block] [PULL 60/61] block: Do not strcmp() with NULL uri->scheme, Kevin Wolf, 2017/06/23
- [Qemu-block] [PULL 56/61] block: change variable names in BlockDriverState, Kevin Wolf, 2017/06/23
- Re: [Qemu-block] [Qemu-devel] [PULL 00/61] Block layer patches, Peter Maydell, 2017/06/26