qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v3 06/15] blockjob: Add .txn_commit and .txn_abo


From: Stefan Hajnoczi
Subject: Re: [Qemu-devel] [PATCH v3 06/15] blockjob: Add .txn_commit and .txn_abort transaction actions
Date: Tue, 14 Jul 2015 09:35:54 +0100
User-agent: Mutt/1.5.23 (2014-03-12)

On Fri, Jul 10, 2015 at 11:46:43AM +0800, Fam Zheng wrote:
> They will be called if the job is part of a transaction, after all jobs in a
> transaction are completed or cancelled, before calling job->cb().
> 
> Signed-off-by: Fam Zheng <address@hidden>
> ---
>  include/block/blockjob.h | 12 ++++++++++++
>  1 file changed, 12 insertions(+)
> 
> diff --git a/include/block/blockjob.h b/include/block/blockjob.h
> index dd9d5e6..a7b7f66 100644
> --- a/include/block/blockjob.h
> +++ b/include/block/blockjob.h
> @@ -50,6 +50,18 @@ typedef struct BlockJobDriver {
>       * manually.
>       */
>      void (*complete)(BlockJob *job, Error **errp);
> +
> +    /**
> +     * Optional callback for job types that can be in a transaction. Called
> +     * when the transaction succeeds.
> +     */
> +    void (*txn_commit)(BlockJob *job);
> +
> +    /**
> +     * Optional callback for job types that can be in a transaction. Call 
> when
> +     * the transaction fails.
> +     */
> +    void (*txn_abort)(BlockJob *job);
>  } BlockJobDriver;

The semantics of transactions aren't fully documented.  My understanding
is that you want:
1. either .txn_commit() or .txn_abort() to be called
2. after all jobs complete (due to success, error, or cancellation).

These two points are important for understanding these interfaces.

Attachment: pgpv0lotp9Ow1.pgp
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]