[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v2 09/11] blockdev: Block device IO during drive-bac
From: |
Fam Zheng |
Subject: |
[Qemu-devel] [PATCH v2 09/11] blockdev: Block device IO during drive-backup transaction |
Date: |
Wed, 13 May 2015 17:28:17 +0000 |
Signed-off-by: Fam Zheng <address@hidden>
---
blockdev.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/blockdev.c b/blockdev.c
index 923fc90..ae52d27 100644
--- a/blockdev.c
+++ b/blockdev.c
@@ -1575,6 +1575,7 @@ typedef struct DriveBackupState {
BlockDriverState *bs;
AioContext *aio_context;
BlockJob *job;
+ Error *blocker;
} DriveBackupState;
static void drive_backup_prepare(BlkTransactionState *common, Error **errp)
@@ -1599,6 +1600,9 @@ static void drive_backup_prepare(BlkTransactionState
*common, Error **errp)
state->aio_context = bdrv_get_aio_context(bs);
aio_context_acquire(state->aio_context);
+ state->bs = bs;
+ error_setg(&state->blocker, "drive-backup in progress");
+ bdrv_op_block(bs, BLOCK_OP_TYPE_DEVICE_IO, state->blocker);
qmp_drive_backup(backup->device, backup->target,
backup->has_format, backup->format,
backup->sync,
@@ -1613,7 +1617,6 @@ static void drive_backup_prepare(BlkTransactionState
*common, Error **errp)
return;
}
- state->bs = bs;
state->job = state->bs->job;
}
@@ -1632,6 +1635,10 @@ static void drive_backup_clean(BlkTransactionState
*common)
{
DriveBackupState *state = DO_UPCAST(DriveBackupState, common, common);
+ if (state->bs) {
+ bdrv_op_unblock(state->bs, BLOCK_OP_TYPE_DEVICE_IO, state->blocker);
+ error_free(state->blocker);
+ }
if (state->aio_context) {
aio_context_release(state->aio_context);
}
--
2.4.0
- Re: [Qemu-devel] [PATCH v2 01/11] block: Add op blocker type "device IO", (continued)
[Qemu-devel] [PATCH v2 02/11] block: Add op blocker notifier list, Fam Zheng, 2015/05/13
[Qemu-devel] [PATCH v2 04/11] virtio-blk: Move complete_request to 'ops' structure, Fam Zheng, 2015/05/13
[Qemu-devel] [PATCH v2 03/11] block-backend: Add blk_op_blocker_add_notifier, Fam Zheng, 2015/05/13
[Qemu-devel] [PATCH v2 05/11] virtio-blk: Don't handle output when there is "device IO" op blocker, Fam Zheng, 2015/05/13
[Qemu-devel] [PATCH v2 06/11] nbd-server: Clear "can_read" when "device io" blocker is set, Fam Zheng, 2015/05/13
[Qemu-devel] [PATCH v2 07/11] blockdev: Block device IO during internal snapshot transaction, Fam Zheng, 2015/05/13
[Qemu-devel] [PATCH v2 09/11] blockdev: Block device IO during drive-backup transaction,
Fam Zheng <=
[Qemu-devel] [PATCH v2 08/11] blockdev: Block device IO during external snapshot transaction, Fam Zheng, 2015/05/13
[Qemu-devel] [PATCH v2 10/11] blockdev: Block device IO during blockdev-backup transaction, Fam Zheng, 2015/05/13
Re: [Qemu-devel] [PATCH v2 10/11] blockdev: Block device IO during blockdev-backup transaction, Paolo Bonzini, 2015/05/13
[Qemu-devel] [PATCH v2 11/11] block: Block "device IO" during bdrv_drain and bdrv_drain_all, Fam Zheng, 2015/05/13