Received: from eggs.gnu.org ([2001:4830:134:3::10]:39311) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z9xS6-0000hW-IT for qemu-devel@nongnu.org; Tue, 30 Jun 2015 11:28:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Z9xS2-0007WY-HW for qemu-devel@nongnu.org; Tue, 30 Jun 2015 11:28:02 -0400 Received: from mx1.redhat.com ([209.132.183.28]:43596) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z9xS2-0007WS-A0 for qemu-devel@nongnu.org; Tue, 30 Jun 2015 11:27:58 -0400 Date: Tue, 30 Jun 2015 16:27:55 +0100 From: Stefan Hajnoczi Message-ID: <20150630152755.GF31899@stefanha-thinkpad.redhat.com> References: <1435234332-581-1-git-send-email-stefanha@redhat.com> <1435234332-581-8-git-send-email-stefanha@redhat.com> <5591C90C.4020902@redhat.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="dWYAkE0V1FpFQHQ3" Content-Disposition: inline In-Reply-To: <5591C90C.4020902@redhat.com> Subject: Re: [Qemu-devel] [PATCH 07/10] block/backup: support block job transactions List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: John Snow Cc: Kevin Wolf , famz@redhat.com, Jeff Cody , qemu-devel@nongnu.org, mreitz@redhat.com, vsementsov@parallels.com --dWYAkE0V1FpFQHQ3 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Jun 29, 2015 at 06:39:08PM -0400, John Snow wrote: >=20 >=20 > On 06/25/2015 08:12 AM, Stefan Hajnoczi wrote: > > Join the transaction when the backup block job is in incremental backup > > mode. > >=20 > > This ensures that the sync bitmap is not thrown away if another block > > job in the transaction is cancelled or fails. This is critical so > > incremental backup with multiple disks can be retried in case of > > cancellation/failure. > >=20 > > Signed-off-by: Stefan Hajnoczi > > --- > > block/backup.c | 7 +++++- > > blockdev.c | 73 ++++++++++++++++++++++++++++++++++++++++++--------= -------- > > 2 files changed, 59 insertions(+), 21 deletions(-) > >=20 > > diff --git a/block/backup.c b/block/backup.c > > index ddf8424..fa86b0e 100644 > > --- a/block/backup.c > > +++ b/block/backup.c > > @@ -429,6 +429,8 @@ static void coroutine_fn backup_run(void *opaque) > > qemu_co_rwlock_wrlock(&job->flush_rwlock); > > qemu_co_rwlock_unlock(&job->flush_rwlock); > > =20 > > + block_job_txn_prepare_to_complete(job->common.txn, &job->common, r= et); > > + > > if (job->sync_bitmap) { > > BdrvDirtyBitmap *bm; > > if (ret < 0 || block_job_is_cancelled(&job->common)) { > > @@ -457,7 +459,7 @@ void backup_start(BlockDriverState *bs, BlockDriver= State *target, > > BlockdevOnError on_source_error, > > BlockdevOnError on_target_error, > > BlockCompletionFunc *cb, void *opaque, > > - Error **errp) > > + BlockJobTxn *txn, Error **errp) > > { > > int64_t len; > > =20 > > @@ -537,6 +539,9 @@ void backup_start(BlockDriverState *bs, BlockDriver= State *target, > > job->sync_mode =3D sync_mode; > > job->sync_bitmap =3D sync_mode =3D=3D MIRROR_SYNC_MODE_DIRTY_BITMA= P ? > > sync_bitmap : NULL; > > + if (job->sync_bitmap) { > > + block_job_txn_add_job(txn, &job->common); > > + } >=20 > Hmm, is this what we want? This will add backup jobs to a transaction > only if they have a bitmap attached to the job. >=20 > However, if we're doing a mixture of full and incremental backups, we > may still want to roll back the incremental backups if the full backups > failed as part of the transaction. >=20 > The (admittedly more complicated) design I submitted will always add a > job to the transactional group, whether it has a bitmap or not. The > membership test was only if it was launched by the backup transaction > action. The bitmap is only checked for purposes of refcounting and > cleanup mechanics. >=20 > Maybe that wasn't what we wanted either, but this is a difference in how > our series will behave. The 'backup' operation was added to the QMP 'transaction' command in QEMU 1.6. If we add non-incremental backup commands to the transaction then behavior changes. Perhaps DriveBackup and BlockdevBackup QAPI structures should take an optional 'transaction' bool argument. That way the caller decides which behavior to use. --dWYAkE0V1FpFQHQ3 Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQEcBAEBAgAGBQJVkrV7AAoJEJykq7OBq3PIYUIIAKTsC5FCCaJ68GcpjN0J9zCg EaURrbKj8HwTSkjaiqQNoHGZlF/aATjSjQWxtFBJ+Eq1U1a1el7asLeaOODa7HjA QMeUdmXTWvFghZGst3swg84f3sE/lLgaOfzPDtUh+6wpdCFIvVhfVpUIDjMXgGiM WDTr6FVrK7xnQRNdQj6YLpZblyabAvOoqKUMKjglJDparP8YgfGAtTojy9gY8YmC SDPvwNM1ywABAmVCnqVqIIn4PRbgUfsvDssgSVSVTFWms6Vi+Wkn/nxXhW8AJpa3 f2VqCr76SVOKDnEDRW7BOkZgZbfPFh446aQCe4wqNJJJOp79q7Q9bbZ27iuEnKc= =HE5k -----END PGP SIGNATURE----- --dWYAkE0V1FpFQHQ3--