mirror: Store MirrorOp.co for debuggability
authorKevin Wolf <kwolf@redhat.com>
Tue, 28 Jan 2020 15:06:41 +0000 (16:06 +0100)
committerKevin Wolf <kwolf@redhat.com>
Tue, 18 Feb 2020 09:53:56 +0000 (10:53 +0100)
If a coroutine is launched, but the coroutine pointer isn't stored
anywhere, debugging any problems inside the coroutine is quite hard.
Let's store the coroutine pointer of a mirror operation in MirrorOp to
have it available in the debugger.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
block/mirror.c

index f0f2d9dff150bea6d40065ff6f92d577af87e628..8959e4255ffaeb39bb4b7334454befc80caa86b0 100644 (file)
@@ -103,6 +103,7 @@ struct MirrorOp {
     bool is_pseudo_op;
     bool is_active_write;
     CoQueue waiting_requests;
+    Coroutine *co;
 
     QTAILQ_ENTRY(MirrorOp) next;
 };
@@ -429,6 +430,7 @@ static unsigned mirror_perform(MirrorBlockJob *s, int64_t offset,
     default:
         abort();
     }
+    op->co = co;
 
     QTAILQ_INSERT_TAIL(&s->ops_in_flight, op, next);
     qemu_coroutine_enter(co);