From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50242) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZEwU5-0003CF-QN for qemu-devel@nongnu.org; Tue, 14 Jul 2015 05:26:42 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZEwU0-0004D9-7g for qemu-devel@nongnu.org; Tue, 14 Jul 2015 05:26:41 -0400 Received: from mx1.redhat.com ([209.132.183.28]:42877) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZEwU0-0004D4-2R for qemu-devel@nongnu.org; Tue, 14 Jul 2015 05:26:36 -0400 Date: Tue, 14 Jul 2015 17:26:33 +0800 From: Fam Zheng Message-ID: <20150714092633.GC27873@ad.nay.redhat.com> References: <1436500012-32593-1-git-send-email-famz@redhat.com> <1436500012-32593-7-git-send-email-famz@redhat.com> <20150714083554.GD17927@stefanha-thinkpad.redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20150714083554.GD17927@stefanha-thinkpad.redhat.com> Subject: Re: [Qemu-devel] [PATCH v3 06/15] blockjob: Add .txn_commit and .txn_abort transaction actions List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stefan Hajnoczi Cc: Kevin Wolf , Jeff Cody , qemu-devel@nongnu.org, Max Reitz , vsementsov@parallels.com, John Snow On Tue, 07/14 09:35, Stefan Hajnoczi wrote: > 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 > > --- > > 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. Yes, I'll add document these. Fam