[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 14/18] block/mirror: Distinguish active from passive
From: |
Max Reitz |
Subject: |
[Qemu-devel] [PATCH 14/18] block/mirror: Distinguish active from passive ops |
Date: |
Wed, 13 Sep 2017 20:19:06 +0200 |
Currently, the mirror block job only knows passive operations. But once
we introduce active writes, we need to distinguish between the two; for
example, mirror_wait_for_free_in_flight_slot() should wait for a passive
operation because active writes will not use the same in-flight slots.
Signed-off-by: Max Reitz <address@hidden>
---
block/mirror.c | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/block/mirror.c b/block/mirror.c
index 612fab660e..8fea619a68 100644
--- a/block/mirror.c
+++ b/block/mirror.c
@@ -96,6 +96,7 @@ struct MirrorOp {
/* Set by mirror_co_read() before yielding for the first time */
uint64_t bytes_copied;
+ bool is_active_write;
CoQueue waiting_requests;
QTAILQ_ENTRY(MirrorOp) next;
@@ -286,9 +287,14 @@ static inline void
mirror_wait_for_free_in_flight_slot(MirrorBlockJob *s)
{
MirrorOp *op;
- op = QTAILQ_FIRST(&s->ops_in_flight);
- assert(op);
- qemu_co_queue_wait(&op->waiting_requests, NULL);
+ QTAILQ_FOREACH(op, &s->ops_in_flight, next) {
+ if (!op->is_active_write) {
+ /* Only non-active operations use up in-flight slots */
+ qemu_co_queue_wait(&op->waiting_requests, NULL);
+ return;
+ }
+ }
+ abort();
}
/* Submit async read while handling COW.
--
2.13.5
- Re: [Qemu-devel] [PATCH 05/18] block/mirror: Convert to coroutines, (continued)
- [Qemu-devel] [PATCH 06/18] block/mirror: Use CoQueue to wait on in-flight ops, Max Reitz, 2017/09/13
- [Qemu-devel] [PATCH 07/18] block/mirror: Wait for in-flight op conflicts, Max Reitz, 2017/09/13
- [Qemu-devel] [PATCH 08/18] block/mirror: Use source as a BdrvChild, Max Reitz, 2017/09/13
- [Qemu-devel] [PATCH 09/18] block: Generalize should_update_child() rule, Max Reitz, 2017/09/13
- [Qemu-devel] [PATCH 10/18] block/mirror: Make source the file child, Max Reitz, 2017/09/13
- [Qemu-devel] [PATCH 11/18] hbitmap: Add @advance param to hbitmap_iter_next(), Max Reitz, 2017/09/13
- [Qemu-devel] [PATCH 12/18] block/dirty-bitmap: Add bdrv_dirty_iter_next_area, Max Reitz, 2017/09/13
- [Qemu-devel] [PATCH 13/18] block/mirror: Keep write perm for pending writes, Max Reitz, 2017/09/13
- [Qemu-devel] [PATCH 14/18] block/mirror: Distinguish active from passive ops,
Max Reitz <=
- [Qemu-devel] [PATCH 15/18] block/mirror: Add active mirroring, Max Reitz, 2017/09/13
- Re: [Qemu-devel] [PATCH 15/18] block/mirror: Add active mirroring, Stefan Hajnoczi, 2017/09/14
- Re: [Qemu-devel] [PATCH 15/18] block/mirror: Add active mirroring, Max Reitz, 2017/09/16
- Re: [Qemu-devel] [Qemu-block] [PATCH 15/18] block/mirror: Add active mirroring, Stefan Hajnoczi, 2017/09/18
- Re: [Qemu-devel] [Qemu-block] [PATCH 15/18] block/mirror: Add active mirroring, Max Reitz, 2017/09/18
- Re: [Qemu-devel] [Qemu-block] [PATCH 15/18] block/mirror: Add active mirroring, Stefan Hajnoczi, 2017/09/19
- Re: [Qemu-devel] [Qemu-block] [PATCH 15/18] block/mirror: Add active mirroring, Daniel P. Berrange, 2017/09/19
- Re: [Qemu-devel] [Qemu-block] [PATCH 15/18] block/mirror: Add active mirroring, Stefan Hajnoczi, 2017/09/20
[Qemu-devel] [PATCH 16/18] block/mirror: Add copy mode QAPI interface, Max Reitz, 2017/09/13
[Qemu-devel] [PATCH 17/18] qemu-io: Add background write, Max Reitz, 2017/09/13