[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 09/20] blockdev: allow BdrvActionOps->commit() to be
From: |
Kevin Wolf |
Subject: |
[Qemu-devel] [PULL 09/20] blockdev: allow BdrvActionOps->commit() to be NULL |
Date: |
Fri, 28 Jun 2013 16:24:58 +0200 |
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>
Reviewed-by: Eric Blake <address@hidden>
Reviewed-by: Kevin Wolf <address@hidden>
Signed-off-by: Stefan Hajnoczi <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>
---
blockdev.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/blockdev.c b/blockdev.c
index 5312e60..0cf8081 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.8.1.4
- [Qemu-devel] [PULL 00/20] Block patches, Kevin Wolf, 2013/06/28
- [Qemu-devel] [PULL 01/20] raw-posix: Fix /dev/cdrom magic on OS X, Kevin Wolf, 2013/06/28
- [Qemu-devel] [PULL 02/20] notify: add NotiferWithReturn so notifier list can abort, Kevin Wolf, 2013/06/28
- [Qemu-devel] [PULL 03/20] block: add bdrv_add_before_write_notifier(), Kevin Wolf, 2013/06/28
- [Qemu-devel] [PULL 06/20] blockdev: use bdrv_getlength() in qmp_drive_mirror(), Kevin Wolf, 2013/06/28
- [Qemu-devel] [PULL 04/20] block: add basic backup support to block driver, Kevin Wolf, 2013/06/28
- [Qemu-devel] [PULL 05/20] blockdev: drop redundant proto_drv check, Kevin Wolf, 2013/06/28
- [Qemu-devel] [PULL 09/20] blockdev: allow BdrvActionOps->commit() to be NULL,
Kevin Wolf <=
- [Qemu-devel] [PULL 07/20] block: add drive-backup QMP command, Kevin Wolf, 2013/06/28
- [Qemu-devel] [PULL 10/20] blockdev: add DriveBackup transaction, Kevin Wolf, 2013/06/28
- [Qemu-devel] [PULL 08/20] blockdev: rename BlkTransactionStates to singular, Kevin Wolf, 2013/06/28
- [Qemu-devel] [PULL 11/20] blockdev: add Abort transaction, Kevin Wolf, 2013/06/28
- [Qemu-devel] [PULL 12/20] qemu-iotests: extract wait_until_completed() into iotests.py, Kevin Wolf, 2013/06/28
- [Qemu-devel] [PULL 15/20] block/ssh: Set bdrv_has_zero_init according to the file type., Kevin Wolf, 2013/06/28
- [Qemu-devel] [PULL 13/20] qemu-iotests: add 055 drive-backup test case, Kevin Wolf, 2013/06/28
- [Qemu-devel] [PULL 14/20] block: Make BlockJobTypes const, Kevin Wolf, 2013/06/28
- [Qemu-devel] [PULL 16/20] gluster: Return bdrv_has_zero_init = 0, Kevin Wolf, 2013/06/28
- [Qemu-devel] [PULL 18/20] vpc: Implement .bdrv_has_zero_init, Kevin Wolf, 2013/06/28