[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH V2 5/5] block: make all steps in qmp_transaction
From: |
Eric Blake |
Subject: |
Re: [Qemu-devel] [PATCH V2 5/5] block: make all steps in qmp_transaction() as callback |
Date: |
Tue, 16 Apr 2013 09:41:06 -0600 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130402 Thunderbird/17.0.5 |
On 04/13/2013 05:11 AM, Wenchao Xia wrote:
> Now qmp_transaction() can be extended with other operation,
> external snapshot or backing chain creation, is just one case it.
This read a bit awkwardly. Might I suggest:
block: use callbacks in qmp_transaction()
Make it easier to add other operations to qmp_transaction() by using
callbacks, with external snapshots serving as an example implementation
of the callbacks.
>
> Signed-off-by: Wenchao Xia <address@hidden>
> ---
> blockdev.c | 68 +++++++++++++++++++++++++++++++++++++++++++++++++++--------
> 1 files changed, 58 insertions(+), 10 deletions(-)
>
> diff --git a/blockdev.c b/blockdev.c
> index 3e69569..9f0acfb 100644
> --- a/blockdev.c
> +++ b/blockdev.c
> @@ -779,14 +779,35 @@ void qmp_blockdev_snapshot_sync(const char *device,
> const char *snapshot_file,
>
>
> /* New and old BlockDriverState structs for group snapshots */
> +
> +/* Only in prepare() it may fail, so roll back just need to take care
> + what is done in prepare(). */
Better might be:
/* Only prepare() may fail. In a single transaction, only one of
commit() or rollback() will be called. */
> +typedef struct BdrvActionOps {
> + /* Prepare the work, must NOT be NULL. */
> + int (*prepare)(BlockdevAction *action, void **p_opaque, Error **errp);
Based on the comments on 1/5, should prepare have a void signature and
just let errp serve to indicate failure?
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature
- [Qemu-devel] [PATCH V2 0/5] block: make qmp_transaction extendable, Wenchao Xia, 2013/04/13
- [Qemu-devel] [PATCH V2 5/5] block: make all steps in qmp_transaction() as callback, Wenchao Xia, 2013/04/13
- [Qemu-devel] [PATCH V2 4/5] block: package rolling back code in qmp_transaction(), Wenchao Xia, 2013/04/13
- [Qemu-devel] [PATCH V2 2/5] block: move input parsing code in qmp_transaction(), Wenchao Xia, 2013/04/13
- [Qemu-devel] [PATCH V2 3/5] block: package committing code in qmp_transaction(), Wenchao Xia, 2013/04/13
- [Qemu-devel] [PATCH V2 1/5] block: package preparation code in qmp_transaction(), Wenchao Xia, 2013/04/13