[Qemu-devel] [PATCH 11/17] mirror: Inline mirror_write_complete(), part 1

Max Reitz posted 17 patches 7 years, 2 months ago
[Qemu-devel] [PATCH 11/17] mirror: Inline mirror_write_complete(), part 1
Posted by Max Reitz 7 years, 2 months ago
Eventually, we want to inline mirror_write_complete() fully into
mirror_co_perform().  This patch does the inlining, but we cannot remove
the function yet, as it is still required by mirror_co_read().

Signed-off-by: Max Reitz <mreitz@redhat.com>
---
 block/mirror.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/block/mirror.c b/block/mirror.c
index 2a131d8b99..66746cf075 100644
--- a/block/mirror.c
+++ b/block/mirror.c
@@ -407,7 +407,17 @@ static void coroutine_fn mirror_co_perform(void *opaque)
         abort();
     }
 
-    mirror_write_complete(op, ret);
+    if (ret < 0) {
+        BlockErrorAction action;
+
+        bdrv_set_dirty_bitmap(s->dirty_bitmap, op->offset, op->bytes);
+        action = mirror_error_action(s, false, -ret);
+        if (action == BLOCK_ERROR_ACTION_REPORT && s->ret >= 0) {
+            s->ret = ret;
+        }
+    }
+
+    mirror_iteration_done(op, ret);
 
 done:
     aio_context_release(aio_context);
-- 
2.17.1