@@ -374,16 +374,13 @@ static int coroutine_fn mirror_co_zero(MirrorBlockJob *s,
s->unmap ? BDRV_REQ_MAY_UNMAP : 0);
}
-static void coroutine_fn mirror_co_discard(void *opaque)
+static int coroutine_fn mirror_co_discard(MirrorBlockJob *s,
+ int64_t offset, int64_t bytes)
{
- MirrorOp *op = opaque;
- int ret;
-
- op->s->in_flight++;
- op->s->bytes_in_flight += op->bytes;
+ s->in_flight++;
+ s->bytes_in_flight += bytes;
- ret = blk_co_pdiscard(op->s->target, op->offset, op->bytes);
- mirror_write_complete(op, ret);
+ return blk_co_pdiscard(s->target, offset, bytes);
}
static void coroutine_fn mirror_co_perform(void *opaque)
@@ -400,8 +397,8 @@ static void coroutine_fn mirror_co_perform(void *opaque)
ret = mirror_co_zero(s, op->offset, op->bytes);
break;
case MIRROR_METHOD_DISCARD:
- mirror_co_discard(opaque);
- return;
+ ret = mirror_co_discard(s, op->offset, op->bytes);
+ break;
default:
abort();
}
Signed-off-by: Max Reitz <mreitz@redhat.com> --- block/mirror.c | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-)