[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v5 11/13] blockdev: Block device IO during blockdev-
From: |
Fam Zheng |
Subject: |
[Qemu-devel] [PATCH v5 11/13] blockdev: Block device IO during blockdev-backup transaction |
Date: |
Wed, 20 May 2015 14:16:14 +0800 |
Signed-off-by: Fam Zheng <address@hidden>
---
blockdev.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/blockdev.c b/blockdev.c
index ae52d27..bd28183 100644
--- a/blockdev.c
+++ b/blockdev.c
@@ -1649,6 +1649,7 @@ typedef struct BlockdevBackupState {
BlockDriverState *bs;
BlockJob *job;
AioContext *aio_context;
+ Error *blocker;
} BlockdevBackupState;
static void blockdev_backup_prepare(BlkTransactionState *common, Error **errp)
@@ -1685,6 +1686,10 @@ static void blockdev_backup_prepare(BlkTransactionState
*common, Error **errp)
}
aio_context_acquire(state->aio_context);
+ state->bs = bs;
+ error_setg(&state->blocker, "blockdev-backup in progress");
+ bdrv_op_block(bs, BLOCK_OP_TYPE_DEVICE_IO, state->blocker);
+
qmp_blockdev_backup(backup->device, backup->target,
backup->sync,
backup->has_speed, backup->speed,
@@ -1696,7 +1701,6 @@ static void blockdev_backup_prepare(BlkTransactionState
*common, Error **errp)
return;
}
- state->bs = bs;
state->job = state->bs->job;
}
@@ -1715,6 +1719,10 @@ static void blockdev_backup_clean(BlkTransactionState
*common)
{
BlockdevBackupState *state = DO_UPCAST(BlockdevBackupState, 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.1
- [Qemu-devel] [PATCH v5 06/13] virtio-scsi-dataplane: Add "device IO" op blocker listener, (continued)
- [Qemu-devel] [PATCH v5 06/13] virtio-scsi-dataplane: Add "device IO" op blocker listener, Fam Zheng, 2015/05/20
- [Qemu-devel] [PATCH v5 07/13] nbd-server: Clear "can_read" when "device io" blocker is set, Fam Zheng, 2015/05/20
- [Qemu-devel] [PATCH v5 08/13] blockdev: Block device IO during internal snapshot transaction, Fam Zheng, 2015/05/20
- [Qemu-devel] [PATCH v5 09/13] blockdev: Block device IO during external snapshot transaction, Fam Zheng, 2015/05/20
- [Qemu-devel] [PATCH v5 10/13] blockdev: Block device IO during drive-backup transaction, Fam Zheng, 2015/05/20
- [Qemu-devel] [PATCH v5 11/13] blockdev: Block device IO during blockdev-backup transaction,
Fam Zheng <=
- [Qemu-devel] [PATCH v5 12/13] block: Block "device IO" during bdrv_drain and bdrv_drain_all, Fam Zheng, 2015/05/20
- [Qemu-devel] [PATCH v5 13/13] block/mirror: Block "device IO" during mirror exit, Fam Zheng, 2015/05/20