From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42354) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZaT9S-00032Z-DB for qemu-devel@nongnu.org; Fri, 11 Sep 2015 14:34:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZaT9O-0005hO-9E for qemu-devel@nongnu.org; Fri, 11 Sep 2015 14:34:22 -0400 Received: from mx1.redhat.com ([209.132.183.28]:48242) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZaT9O-0005hK-1s for qemu-devel@nongnu.org; Fri, 11 Sep 2015 14:34:18 -0400 References: <1441611277-24596-1-git-send-email-famz@redhat.com> <1441611277-24596-10-git-send-email-famz@redhat.com> From: Max Reitz Message-ID: <55F31EA4.80203@redhat.com> Date: Fri, 11 Sep 2015 20:34:12 +0200 MIME-Version: 1.0 In-Reply-To: <1441611277-24596-10-git-send-email-famz@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="pumokEJInTphoPnefqVJOn9mLKQx9gNRv" Subject: Re: [Qemu-devel] [PATCH v5 09/14] block: Add block job transactions List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Fam Zheng , qemu-devel@nongnu.org Cc: Kevin Wolf , Jeff Cody , vsementsov@parallels.com, stefanha@redhat.com, John Snow This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --pumokEJInTphoPnefqVJOn9mLKQx9gNRv Content-Type: text/plain; charset=iso-8859-15 Content-Transfer-Encoding: quoted-printable On 07.09.2015 09:34, Fam Zheng wrote: > Sometimes block jobs must execute as a transaction group. Finishing > jobs wait until all other jobs are ready to complete successfully. > Failure or cancellation of one job cancels the other jobs in the group.= >=20 > Signed-off-by: Stefan Hajnoczi > [Rewrite the implementation which is now contained in block_job_complet= ed. > --Fam] > Signed-off-by: Fam Zheng > --- > blockjob.c | 134 +++++++++++++++++++++++++++++++++++++++= +++++++- > include/block/block.h | 1 + > include/block/blockjob.h | 38 ++++++++++++++ > 3 files changed, 171 insertions(+), 2 deletions(-) >=20 [snip] > diff --git a/include/block/block.h b/include/block/block.h > index e619b99..f80d984 100644 > --- a/include/block/block.h > +++ b/include/block/block.h [snip] > @@ -395,4 +398,39 @@ void block_job_defer_to_main_loop(BlockJob *job, > BlockJobDeferToMainLoopFn *fn, > void *opaque); > =20 > +/** > + * block_job_txn_new: > + * > + * Allocate and return a new block job transaction. Jobs can be added= to the > + * transaction using block_job_txn_add_job(). > + * > + * The transaction is automatically freed when the last job completes = or is > + * cancelled. > + * > + * All jobs in the transaction either complete successfully or fail/ca= ncel as a > + * group. Jobs wait for each other before completing. Cancelling one= job > + * cancels all jobs in the transaction. > + */ > +BlockJobTxn *block_job_txn_new(void); > + > +/** > + * block_job_txn_unref: > + * > + * Release a reference that was previously acquired with block_job_txn= _add_job > + * or block_job_txn_new. If it's the last reference to the object, it = will be > + * freed. > + */ > +void block_job_txn_unref(BlockJobTxn *txn); > + > +/** > + * block_job_txn_add_job: > + * @txn: The transaction (may be NULL) > + * @job: Job to add to the transaction > + * > + * Add @job to the transaction. The @job must not already be in a tra= nsaction. > + * The block job driver must call block_job_txn_prepare_to_complete() = before > + * final cleanup and completion. This comment still needs a fixup (block_job_txn_prepare_to_complete() does not exist). Looks good other than that. Max > + */ > +void block_job_txn_add_job(BlockJobTxn *txn, BlockJob *job); > + > #endif >=20 --pumokEJInTphoPnefqVJOn9mLKQx9gNRv Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQEcBAEBCAAGBQJV8x6kAAoJEDuxQgLoOKytguwH/3J/YfT6R3lV9M9vISURlepN kkuu7Q6jUuYvgSoi6XTkPUYmm7naVurIbVskAAcPs3cxISE8Gmxco5/rWmw90FLN vBu8RG4r0w1GjTbvBGGJ35lS9JKsh+rOzfx0FA6Cdf3q9YszDtv8U5KhavmPwZNe +pr9BZqNz4TS9pWyB5L4nWp3aBvJ4f4JIR23smKcNVDXMvEaq3D8T7t+/eAXzoQZ 0MvgZ8pT3cO8bb7QtKHicJslV0YbMaHt56RC+lZnHfMYYQPrL91gNVi4cSAw93XA vJxWlkrEjwDyaytFSe2sKb37mKiuVL+xlL1eY3yNhUU7P/IaGkY6ihg4i9A1jk4= =MGxM -----END PGP SIGNATURE----- --pumokEJInTphoPnefqVJOn9mLKQx9gNRv--