From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38046) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YuNF5-0008Cr-U8 for qemu-devel@nongnu.org; Mon, 18 May 2015 11:46:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YuNF5-0005d9-1y for qemu-devel@nongnu.org; Mon, 18 May 2015 11:46:11 -0400 Date: Mon, 18 May 2015 16:45:59 +0100 From: Stefan Hajnoczi Message-ID: <20150518154559.GB27654@stefanha-thinkpad.redhat.com> References: <1431385466-4868-1-git-send-email-jsnow@redhat.com> <1431385466-4868-7-git-send-email-jsnow@redhat.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="neYutvxvOLaeuPCA" Content-Disposition: inline In-Reply-To: <1431385466-4868-7-git-send-email-jsnow@redhat.com> Subject: Re: [Qemu-devel] [PATCH v4 06/11] block: add refcount to Job object List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: John Snow Cc: kwolf@redhat.com, famz@redhat.com, qemu-block@nongnu.org, qemu-devel@nongnu.org, mreitz@redhat.com, vsementsov@parallels.com --neYutvxvOLaeuPCA Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, May 11, 2015 at 07:04:21PM -0400, John Snow wrote: > If we want to get at the job after the life of the job, > we'll need a refcount for this object. >=20 > This may occur for example if we wish to inspect the actions > taken by a particular job after a transactional group of jobs > runs, and further actions are required. >=20 > Signed-off-by: John Snow > Reviewed-by: Max Reitz > --- > blockjob.c | 18 ++++++++++++++++-- > include/block/blockjob.h | 21 +++++++++++++++++++++ > 2 files changed, 37 insertions(+), 2 deletions(-) I think the only reason for this refcount is so that backup_transaction_complete() can be called. It accesses BackupBlockJob->sync_bitmap so the BackupBlockJob instance needs to be alive. The bitmap refcount is incremented in blockdev.c, not block/backup.c, so it is fine to drop backup_transaction_complete() and decrement the bitmap refcount in blockdev.c instead. If you do that then there is no need to add a refcount to block job. This would simplify things. --neYutvxvOLaeuPCA Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQEcBAEBAgAGBQJVWgk3AAoJEJykq7OBq3PI4LsH+weqy1GODcAC1fOj3SrozMaD +7pmlcvsiya+bYtwlXwesRAZ2M54RRHNETaotagJ5KQCnAm3luGBwdH1FBA72Kaw Zir1AlvzfVZaJKBqntKT5GNo0NEVQTFhXIGt1YEUk/wpDK+eSorkwrYIawFzLn7d Y0xwYvUeXZeO+A4iRHSTtEzFv590leGrq7IvPi4+lvtYCsFAjiuixANLpfdCvdvv lFLRWSDN7Jyn7GgJZ4P11ctV1onWPXgLE3uow3BONgkuHKWPGeT/J31q0RhjiTIX IgsXBEj0IQAecRqeATFdEnlqaNsP9gxWEQRweY8Yj9FC0F9UDC+2Wnntn0oJrVo= =QQhs -----END PGP SIGNATURE----- --neYutvxvOLaeuPCA--