[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-block] [PATCH 13/18] replication: pass BlockDriverState to reopen_
From: |
Paolo Bonzini |
Subject: |
[Qemu-block] [PATCH 13/18] replication: pass BlockDriverState to reopen_backing_file |
Date: |
Thu, 13 Oct 2016 19:34:17 +0200 |
This will be needed in the next patch to retrieve the AioContext.
Signed-off-by: Paolo Bonzini <address@hidden>
---
block/replication.c | 21 ++++++++++++---------
1 file changed, 12 insertions(+), 9 deletions(-)
diff --git a/block/replication.c b/block/replication.c
index 5231a00..af47479 100644
--- a/block/replication.c
+++ b/block/replication.c
@@ -317,9 +317,10 @@ static void secondary_do_checkpoint(BDRVReplicationState
*s, Error **errp)
}
}
-static void reopen_backing_file(BDRVReplicationState *s, bool writable,
+static void reopen_backing_file(BlockDriverState *bs, bool writable,
Error **errp)
{
+ BDRVReplicationState *s = bs->opaque;
BlockReopenQueue *reopen_queue = NULL;
int orig_hidden_flags, orig_secondary_flags;
int new_hidden_flags, new_secondary_flags;
@@ -359,8 +360,9 @@ static void reopen_backing_file(BDRVReplicationState *s,
bool writable,
}
}
-static void backup_job_cleanup(BDRVReplicationState *s)
+static void backup_job_cleanup(BlockDriverState *bs)
{
+ BDRVReplicationState *s = bs->opaque;
BlockDriverState *top_bs;
top_bs = bdrv_lookup_bs(s->top_id, s->top_id, NULL);
@@ -369,19 +371,20 @@ static void backup_job_cleanup(BDRVReplicationState *s)
}
bdrv_op_unblock_all(top_bs, s->blocker);
error_free(s->blocker);
- reopen_backing_file(s, false, NULL);
+ reopen_backing_file(bs, false, NULL);
}
static void backup_job_completed(void *opaque, int ret)
{
- BDRVReplicationState *s = opaque;
+ BlockDriverState *bs = opaque;
+ BDRVReplicationState *s = bs->opaque;
if (s->replication_state != BLOCK_REPLICATION_FAILOVER) {
/* The backup job is cancelled unexpectedly */
s->error = -EIO;
}
- backup_job_cleanup(s);
+ backup_job_cleanup(bs);
}
static bool check_top_bs(BlockDriverState *top_bs, BlockDriverState *bs)
@@ -477,7 +480,7 @@ static void replication_start(ReplicationState *rs,
ReplicationMode mode,
}
/* reopen the backing file in r/w mode */
- reopen_backing_file(s, true, &local_err);
+ reopen_backing_file(bs, true, &local_err);
if (local_err) {
error_propagate(errp, local_err);
aio_context_release(aio_context);
@@ -492,7 +495,7 @@ static void replication_start(ReplicationState *rs,
ReplicationMode mode,
if (!top_bs || !bdrv_is_root_node(top_bs) ||
!check_top_bs(top_bs, bs)) {
error_setg(errp, "No top_bs or it is invalid");
- reopen_backing_file(s, false, NULL);
+ reopen_backing_file(bs, false, NULL);
aio_context_release(aio_context);
return;
}
@@ -502,10 +505,10 @@ static void replication_start(ReplicationState *rs,
ReplicationMode mode,
backup_start("replication-backup", s->secondary_disk->bs,
s->hidden_disk->bs, 0, MIRROR_SYNC_MODE_NONE, NULL, false,
BLOCKDEV_ON_ERROR_REPORT, BLOCKDEV_ON_ERROR_REPORT,
- backup_job_completed, s, NULL, &local_err);
+ backup_job_completed, bs, NULL, &local_err);
if (local_err) {
error_propagate(errp, local_err);
- backup_job_cleanup(s);
+ backup_job_cleanup(bs);
aio_context_release(aio_context);
return;
}
--
2.7.4
- Re: [Qemu-block] [PATCH 07/18] block: introduce bdrv_poll_while and bdrv_wakeup, (continued)
- [Qemu-block] [PATCH 08/18] nfs: move nfs_set_events out of the while loops, Paolo Bonzini, 2016/10/13
- [Qemu-block] [PATCH 09/18] nfs: use bdrv_poll_while and bdrv_wakeup, Paolo Bonzini, 2016/10/13
- [Qemu-block] [PATCH 11/18] aio: introduce qemu_get_current_aio_context, Paolo Bonzini, 2016/10/13
- [Qemu-block] [PATCH 10/18] sheepdog: use bdrv_poll_while and bdrv_wakeup, Paolo Bonzini, 2016/10/13
- [Qemu-block] [PATCH 13/18] replication: pass BlockDriverState to reopen_backing_file,
Paolo Bonzini <=
- [Qemu-block] [PATCH 12/18] iothread: detach all block devices before stopping them, Paolo Bonzini, 2016/10/13
- [Qemu-block] [PATCH 14/18] block: prepare bdrv_reopen_multiple to release AioContext, Paolo Bonzini, 2016/10/13
- [Qemu-block] [PATCH 15/18] block: only call aio_poll on the current thread's AioContext, Paolo Bonzini, 2016/10/13