From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51515) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Uu6S2-0008FN-Qr for qemu-devel@nongnu.org; Tue, 02 Jul 2013 15:41:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Uu6S1-0004AV-32 for qemu-devel@nongnu.org; Tue, 02 Jul 2013 15:41:22 -0400 Received: from mx1.redhat.com ([209.132.183.28]:58139) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Uu6S0-0004A2-RH for qemu-devel@nongnu.org; Tue, 02 Jul 2013 15:41:21 -0400 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r62JfIEd001903 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 2 Jul 2013 15:41:19 -0400 Message-ID: <51D32CDD.8050307@redhat.com> Date: Tue, 02 Jul 2013 13:41:17 -0600 From: Eric Blake MIME-Version: 1.0 References: <1372744789-997-1-git-send-email-famz@redhat.com> <1372744789-997-2-git-send-email-famz@redhat.com> In-Reply-To: <1372744789-997-2-git-send-email-famz@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="----enig2OBXMJTMNPELWXXXLPRFC" Subject: Re: [Qemu-devel] [PATCH 1/7] block: Convert BlockDriverState.in_use to refcount List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Fam Zheng Cc: kwolf@redhat.com, obarenbo@redhat.com, armbru@redhat.com, roliveri@redhat.com, hbrock@redhat.com, qemu-devel@nongnu.org, rjones@redhat.com, pmyers@redhat.com, imain@redhat.com, stefanha@redhat.com, pbonzini@redhat.com This is an OpenPGP/MIME signed message (RFC 4880 and 3156) ------enig2OBXMJTMNPELWXXXLPRFC Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 07/01/2013 11:59 PM, Fam Zheng wrote: > Use numeric value to replace in_use flag in BDS, this will make > lifecycle management with ref count possible. This patch only replaces > existing uses of bdrv_set_in_use, so no logic change here. >=20 > Signed-off-by: Fam Zheng > --- > block-migration.c | 4 ++-- > block.c | 23 +++++++++++++++-------- > blockjob.c | 6 +++--- > hw/block/dataplane/virtio-blk.c | 4 ++-- > include/block/block.h | 3 ++- > include/block/block_int.h | 2 +- > 6 files changed, 25 insertions(+), 17 deletions(-) >=20 > diff --git a/block-migration.c b/block-migration.c > index 2fd7699..2efb6c0 100644 > --- a/block-migration.c > +++ b/block-migration.c > @@ -321,7 +321,7 @@ static void init_blk_migration_it(void *opaque, Blo= ckDriverState *bs) > bmds->shared_base =3D block_mig_state.shared_base; > alloc_aio_bitmap(bmds); > drive_get_ref(drive_get_by_blockdev(bs)); > - bdrv_set_in_use(bs, 1); > + bdrv_get_ref(bs); The old code sets the flag, the new code gets a ref. > =20 > block_mig_state.total_sector_sum +=3D sectors; > =20 > @@ -557,7 +557,7 @@ static void blk_mig_cleanup(void) > blk_mig_lock(); > while ((bmds =3D QSIMPLEQ_FIRST(&block_mig_state.bmds_list)) !=3D = NULL) { > QSIMPLEQ_REMOVE_HEAD(&block_mig_state.bmds_list, entry); > - bdrv_set_in_use(bmds->bs, 0); > + bdrv_get_ref(bmds->bs); The old code sets the flag, the new code gets a ref. Shouldn't this be clearing a ref, with bdrv_put_ref? --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org ------enig2OBXMJTMNPELWXXXLPRFC Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.13 (GNU/Linux) Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJR0yzdAAoJEKeha0olJ0Nq+PkH+wevLBKJpvT/BQDBE8EfHkxk +6irk0k2dGClIbh2A+dM3wpUWyNSNDwoz/ssmWMd1wsMtVptWuu673owoS/TDsVj A7SrNNp6cm1B4EOfHoh5lNUY/hialw8SFtpiR8AXYrmMrX11X9xoE4C8qb9NDuA+ b81mrc+d1XlsCC2RYJIj/xT2H/IF/We5fIKmGwLhuD4m7cS7CsM/6zYomGDylLTn ZfAIQ3MgczTcJ3Cm7JFxeb1C7kDaPotqhiMM9z3EkcwMgOwqRkOl0BfFj/CF/IvB pF7BPauUwEYFuLSylXzqNcu7IVKOrmluoSVzZPLWYFRImn/XBe0x0nHMi2RHsH4= =l5DA -----END PGP SIGNATURE----- ------enig2OBXMJTMNPELWXXXLPRFC--