22c213
From 27fe3b8d42a2c99de01ce20e4b0727079c12da65 Mon Sep 17 00:00:00 2001
22c213
From: Kevin Wolf <kwolf@redhat.com>
22c213
Date: Mon, 24 Feb 2020 16:57:09 +0000
22c213
Subject: [PATCH 8/9] mirror: Store MirrorOp.co for debuggability
22c213
22c213
RH-Author: Kevin Wolf <kwolf@redhat.com>
22c213
Message-id: <20200224165710.4830-2-kwolf@redhat.com>
22c213
Patchwork-id: 94044
22c213
O-Subject: [RHEL-AV-8.2.0 qemu-kvm PATCH 1/2] mirror: Store MirrorOp.co for debuggability
22c213
Bugzilla: 1794692
22c213
RH-Acked-by: John Snow <jsnow@redhat.com>
22c213
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
22c213
RH-Acked-by: Max Reitz <mreitz@redhat.com>
22c213
22c213
If a coroutine is launched, but the coroutine pointer isn't stored
22c213
anywhere, debugging any problems inside the coroutine is quite hard.
22c213
Let's store the coroutine pointer of a mirror operation in MirrorOp to
22c213
have it available in the debugger.
22c213
22c213
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
22c213
Reviewed-by: Eric Blake <eblake@redhat.com>
22c213
(cherry picked from commit eed325b92c3e68417121ea23f96e33af6a4654ed)
22c213
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
22c213
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
22c213
---
22c213
 block/mirror.c | 2 ++
22c213
 1 file changed, 2 insertions(+)
22c213
22c213
diff --git a/block/mirror.c b/block/mirror.c
22c213
index f0f2d9d..8959e42 100644
22c213
--- a/block/mirror.c
22c213
+++ b/block/mirror.c
22c213
@@ -103,6 +103,7 @@ struct MirrorOp {
22c213
     bool is_pseudo_op;
22c213
     bool is_active_write;
22c213
     CoQueue waiting_requests;
22c213
+    Coroutine *co;
22c213
 
22c213
     QTAILQ_ENTRY(MirrorOp) next;
22c213
 };
22c213
@@ -429,6 +430,7 @@ static unsigned mirror_perform(MirrorBlockJob *s, int64_t offset,
22c213
     default:
22c213
         abort();
22c213
     }
22c213
+    op->co = co;
22c213
 
22c213
     QTAILQ_INSERT_TAIL(&s->ops_in_flight, op, next);
22c213
     qemu_coroutine_enter(co);
22c213
-- 
22c213
1.8.3.1
22c213