From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57331) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZEvh3-0001ra-Bo for qemu-devel@nongnu.org; Tue, 14 Jul 2015 04:36:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZEvgz-0004tO-Gy for qemu-devel@nongnu.org; Tue, 14 Jul 2015 04:36:01 -0400 Received: from mx1.redhat.com ([209.132.183.28]:37481) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZEvgz-0004tD-CL for qemu-devel@nongnu.org; Tue, 14 Jul 2015 04:35:57 -0400 Date: Tue, 14 Jul 2015 09:35:54 +0100 From: Stefan Hajnoczi Message-ID: <20150714083554.GD17927@stefanha-thinkpad.redhat.com> References: <1436500012-32593-1-git-send-email-famz@redhat.com> <1436500012-32593-7-git-send-email-famz@redhat.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="n/aVsWSeQ4JHkrmm" Content-Disposition: inline In-Reply-To: <1436500012-32593-7-git-send-email-famz@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: Fam Zheng Cc: Kevin Wolf , Jeff Cody , qemu-devel@nongnu.org, Max Reitz , vsementsov@parallels.com, John Snow --n/aVsWSeQ4JHkrmm Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable 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 i= n a > transaction are completed or cancelled, before calling job->cb(). >=20 > Signed-off-by: Fam Zheng > --- > include/block/blockjob.h | 12 ++++++++++++ > 1 file changed, 12 insertions(+) >=20 > 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. Cal= led > + * when the transaction succeeds. > + */ > + void (*txn_commit)(BlockJob *job); > + > + /** > + * Optional callback for job types that can be in a transaction. Cal= l 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. --n/aVsWSeQ4JHkrmm Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQEcBAEBAgAGBQJVpMnqAAoJEJykq7OBq3PIh0wH/2NaNp8G+h1vKuNQ9eI2UQSf zg+tH6P2Oc1VbtKjNoOVgegpe2VAL8wIkhlSfyO4/GrGPgoGwAN1OT8Zi2MXilux Tm3gjSvjkS+por6PxnayuJckuFeB/RgIGisywERcLyh2ORTIuDeLB93wCoiCbru3 DCWZ8J3MR0zOiV9uDlp+KeAezTWQzBdO3AlaWh7pNnFPinIo4Dqvs7qfWrg400IX 6dPxQfKiJi1pl8IUQjlqZtOWSgGrrqrKA0Cphgmrt+C8O29SL/KSg3PREngruArY jdBxuH1i2FuSd6FeSdObI1EvokLMjWM4lCadI+p5Ea/VOTYo6OeosIHNIN5pOqc= =5lMJ -----END PGP SIGNATURE----- --n/aVsWSeQ4JHkrmm--