From: Eric Blake <eblake@redhat.com>
To: Wenchao Xia <xiawenc@linux.vnet.ibm.com>
Cc: kwolf@redhat.com, pbonzini@redhat.com, stefanha@gmail.com,
qemu-devel@nongnu.org, dietmar@proxmox.com
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 [thread overview]
Message-ID: <516D7112.9000503@redhat.com> (raw)
In-Reply-To: <1365851501-3037-6-git-send-email-xiawenc@linux.vnet.ibm.com>
[-- Attachment #1: Type: text/plain, Size: 1584 bytes --]
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 <xiawenc@linux.vnet.ibm.com>
> ---
> 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
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 621 bytes --]
prev parent reply other threads:[~2013-04-16 15:41 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-04-13 11:11 [Qemu-devel] [PATCH V2 0/5] block: make qmp_transaction extendable Wenchao Xia
2013-04-13 11:11 ` [Qemu-devel] [PATCH V2 1/5] block: package preparation code in qmp_transaction() Wenchao Xia
2013-04-16 13:19 ` Kevin Wolf
2013-04-16 14:56 ` Eric Blake
2013-04-13 11:11 ` [Qemu-devel] [PATCH V2 2/5] block: move input parsing " Wenchao Xia
2013-04-16 15:15 ` Eric Blake
2013-04-13 11:11 ` [Qemu-devel] [PATCH V2 3/5] block: package committing " Wenchao Xia
2013-04-16 15:26 ` Eric Blake
2013-04-13 11:11 ` [Qemu-devel] [PATCH V2 4/5] block: package rolling back " Wenchao Xia
2013-04-16 15:27 ` Eric Blake
2013-04-13 11:11 ` [Qemu-devel] [PATCH V2 5/5] block: make all steps in qmp_transaction() as callback Wenchao Xia
2013-04-16 13:52 ` Kevin Wolf
2013-04-17 3:59 ` Wenchao Xia
2013-04-16 15:41 ` Eric Blake [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=516D7112.9000503@redhat.com \
--to=eblake@redhat.com \
--cc=dietmar@proxmox.com \
--cc=kwolf@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@gmail.com \
--cc=xiawenc@linux.vnet.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).