[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH V2 03/12] blockdev: allow BdrvActionOps->commit() to
From: |
Wenchao Xia |
Subject: |
[Qemu-devel] [PATCH V2 03/12] blockdev: allow BdrvActionOps->commit() to be NULL |
Date: |
Fri, 14 Jun 2013 19:39:50 +0800 |
From: Stefan Hajnoczi <address@hidden>
Some QMP 'transaction' types don't need to do anything on .commit().
Make .commit() optional just like .abort().
The "drive-backup" action will take advantage of this, it only needs to
cancel the block job on .abort(). Other block job actions will probably
follow the same pattern, so allow .commit() to be NULL.
Suggested-by: Eric Blake <address@hidden>
Signed-off-by: Stefan Hajnoczi <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
Reviewed-by: Wenchao Xia <address@hidden>
Signed-off-by: Wenchao Xia <address@hidden>
---
blockdev.c | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/blockdev.c b/blockdev.c
index 46a43b0..4bd6cbc 100644
--- a/blockdev.c
+++ b/blockdev.c
@@ -789,7 +789,7 @@ typedef struct BdrvActionOps {
size_t instance_size;
/* Prepare the work, must NOT be NULL. */
void (*prepare)(BlkTransactionState *common, Error **errp);
- /* Commit the changes, must NOT be NULL. */
+ /* Commit the changes, can be NULL. */
void (*commit)(BlkTransactionState *common);
/* Abort the changes on fail, can be NULL. */
void (*abort)(BlkTransactionState *common);
@@ -969,7 +969,9 @@ void qmp_transaction(TransactionActionList *dev_list, Error
**errp)
}
QSIMPLEQ_FOREACH(state, &snap_bdrv_states, entry) {
- state->ops->commit(state);
+ if (state->ops->commit) {
+ state->ops->commit(state);
+ }
}
/* success */
--
1.7.1
- [Qemu-devel] [PATCH V2 00/12] add internal snapshot support at block device level, Wenchao Xia, 2013/06/14
- [Qemu-devel] [PATCH V2 01/12] blockdev: drop redundant proto_drv check, Wenchao Xia, 2013/06/14
- [Qemu-devel] [PATCH V2 03/12] blockdev: allow BdrvActionOps->commit() to be NULL,
Wenchao Xia <=
- [Qemu-devel] [PATCH V2 02/12] blockdev: rename BlkTransactionStates to singular, Wenchao Xia, 2013/06/14
- [Qemu-devel] [PATCH V2 08/12] qmp: add interface blockdev-snapshot-internal-sync, Wenchao Xia, 2013/06/14
- [Qemu-devel] [PATCH V2 07/12] qmp: add internal snapshot support in qmp_transaction, Wenchao Xia, 2013/06/14
- [Qemu-devel] [PATCH V2 12/12] qemu-iotests: add 055 internal snapshot for block device test case, Wenchao Xia, 2013/06/14