[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 26/35] block/mirror: Use source as a BdrvChild
From: |
Kevin Wolf |
Subject: |
[Qemu-devel] [PULL 26/35] block/mirror: Use source as a BdrvChild |
Date: |
Mon, 18 Jun 2018 18:44:55 +0200 |
From: Max Reitz <address@hidden>
With this, the mirror_top_bs is no longer just a technically required
node in the BDS graph but actually represents the block job operation.
Also, drop MirrorBlockJob.source, as we can reach it through
mirror_top_bs->backing.
Signed-off-by: Max Reitz <address@hidden>
Reviewed-by: Fam Zheng <address@hidden>
Reviewed-by: Alberto Garcia <address@hidden>
Message-id: address@hidden
Signed-off-by: Max Reitz <address@hidden>
---
block/mirror.c | 14 ++++++--------
1 file changed, 6 insertions(+), 8 deletions(-)
diff --git a/block/mirror.c b/block/mirror.c
index 5df6515731..abf231c478 100644
--- a/block/mirror.c
+++ b/block/mirror.c
@@ -41,7 +41,6 @@ typedef struct MirrorBlockJob {
BlockJob common;
BlockBackend *target;
BlockDriverState *mirror_top_bs;
- BlockDriverState *source;
BlockDriverState *base;
/* The name of the graph node to replace */
@@ -299,7 +298,6 @@ static void coroutine_fn mirror_co_read(void *opaque)
{
MirrorOp *op = opaque;
MirrorBlockJob *s = op->s;
- BlockBackend *source = s->common.blk;
int nb_chunks;
uint64_t ret;
uint64_t max_bytes;
@@ -349,7 +347,8 @@ static void coroutine_fn mirror_co_read(void *opaque)
s->bytes_in_flight += op->bytes;
trace_mirror_one_iteration(s, op->offset, op->bytes);
- ret = blk_co_preadv(source, op->offset, op->bytes, &op->qiov, 0);
+ ret = bdrv_co_preadv(s->mirror_top_bs->backing, op->offset, op->bytes,
+ &op->qiov, 0);
mirror_read_complete(op, ret);
}
@@ -427,7 +426,7 @@ static unsigned mirror_perform(MirrorBlockJob *s, int64_t
offset,
static uint64_t coroutine_fn mirror_iteration(MirrorBlockJob *s)
{
- BlockDriverState *source = s->source;
+ BlockDriverState *source = s->mirror_top_bs->backing->bs;
MirrorOp *pseudo_op;
int64_t offset;
uint64_t delay_ns = 0, ret = 0;
@@ -601,7 +600,7 @@ static void mirror_exit(Job *job, void *opaque)
BlockJob *bjob = &s->common;
MirrorExitData *data = opaque;
AioContext *replace_aio_context = NULL;
- BlockDriverState *src = s->source;
+ BlockDriverState *src = s->mirror_top_bs->backing->bs;
BlockDriverState *target_bs = blk_bs(s->target);
BlockDriverState *mirror_top_bs = s->mirror_top_bs;
Error *local_err = NULL;
@@ -716,7 +715,7 @@ static int coroutine_fn mirror_dirty_init(MirrorBlockJob *s)
{
int64_t offset;
BlockDriverState *base = s->base;
- BlockDriverState *bs = s->source;
+ BlockDriverState *bs = s->mirror_top_bs->backing->bs;
BlockDriverState *target_bs = blk_bs(s->target);
int ret;
int64_t count;
@@ -798,7 +797,7 @@ static void coroutine_fn mirror_run(void *opaque)
{
MirrorBlockJob *s = opaque;
MirrorExitData *data;
- BlockDriverState *bs = s->source;
+ BlockDriverState *bs = s->mirror_top_bs->backing->bs;
BlockDriverState *target_bs = blk_bs(s->target);
bool need_drain = true;
int64_t length;
@@ -1293,7 +1292,6 @@ static void mirror_start_job(const char *job_id,
BlockDriverState *bs,
/* The block job now has a reference to this node */
bdrv_unref(mirror_top_bs);
- s->source = bs;
s->mirror_top_bs = mirror_top_bs;
/* No resize for the target either; while the mirror is still running, a
--
2.13.6
- [Qemu-devel] [PULL 17/35] block: Move bdrv_drain_all_begin() out of coroutine context, (continued)
- [Qemu-devel] [PULL 17/35] block: Move bdrv_drain_all_begin() out of coroutine context, Kevin Wolf, 2018/06/18
- [Qemu-devel] [PULL 16/35] block: Allow AIO_WAIT_WHILE with NULL ctx, Kevin Wolf, 2018/06/18
- [Qemu-devel] [PULL 20/35] test-bdrv-drain: Test graph changes in drain_all section, Kevin Wolf, 2018/06/18
- [Qemu-devel] [PULL 21/35] block: fix QEMU crash with scsi-hd and drive_del, Kevin Wolf, 2018/06/18
- [Qemu-devel] [PULL 18/35] block: ignore_bds_parents parameter for drain functions, Kevin Wolf, 2018/06/18
- [Qemu-devel] [PULL 19/35] block: Allow graph changes in bdrv_drain_all_begin/end sections, Kevin Wolf, 2018/06/18
- [Qemu-devel] [PULL 22/35] block/mirror: Pull out mirror_perform(), Kevin Wolf, 2018/06/18
- [Qemu-devel] [PULL 25/35] block/mirror: Wait for in-flight op conflicts, Kevin Wolf, 2018/06/18
- [Qemu-devel] [PULL 24/35] block/mirror: Use CoQueue to wait on in-flight ops, Kevin Wolf, 2018/06/18
- [Qemu-devel] [PULL 23/35] block/mirror: Convert to coroutines, Kevin Wolf, 2018/06/18
- [Qemu-devel] [PULL 26/35] block/mirror: Use source as a BdrvChild,
Kevin Wolf <=
- [Qemu-devel] [PULL 27/35] block: Generalize should_update_child() rule, Kevin Wolf, 2018/06/18
- [Qemu-devel] [PULL 28/35] hbitmap: Add @advance param to hbitmap_iter_next(), Kevin Wolf, 2018/06/18
- [Qemu-devel] [PULL 29/35] test-hbitmap: Add non-advancing iter_next tests, Kevin Wolf, 2018/06/18
- [Qemu-devel] [PULL 32/35] job: Add job_progress_increase_remaining(), Kevin Wolf, 2018/06/18
- [Qemu-devel] [PULL 31/35] block/mirror: Add MirrorBDSOpaque, Kevin Wolf, 2018/06/18
- [Qemu-devel] [PULL 30/35] block/dirty-bitmap: Add bdrv_dirty_iter_next_area, Kevin Wolf, 2018/06/18
- [Qemu-devel] [PULL 34/35] block/mirror: Add copy mode QAPI interface, Kevin Wolf, 2018/06/18
- [Qemu-devel] [PULL 33/35] block/mirror: Add active mirroring, Kevin Wolf, 2018/06/18
- [Qemu-devel] [PULL 35/35] iotests: Add test for active mirroring, Kevin Wolf, 2018/06/18
- Re: [Qemu-devel] [PULL 00/35] Block layer patches, no-reply, 2018/06/18