From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53101) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YH08g-0002yz-JK for qemu-devel@nongnu.org; Thu, 29 Jan 2015 20:12:51 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YH08d-0000oa-DA for qemu-devel@nongnu.org; Thu, 29 Jan 2015 20:12:50 -0500 Received: from resqmta-ch2-01v.sys.comcast.net ([69.252.207.33]:43446) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YH08d-0000oU-8p for qemu-devel@nongnu.org; Thu, 29 Jan 2015 20:12:47 -0500 Message-ID: <54CADA8B.8010707@redhat.com> Date: Thu, 29 Jan 2015 18:12:43 -0700 From: Eric Blake MIME-Version: 1.0 References: <1422300468-16216-1-git-send-email-mreitz@redhat.com> <1422300468-16216-13-git-send-email-mreitz@redhat.com> In-Reply-To: <1422300468-16216-13-git-send-email-mreitz@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="fv1e4LhcxQUStgGm6nP0s3S1S31wkO4uw" Subject: Re: [Qemu-devel] [PATCH 12/21] block: Use BlockBackend more List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Max Reitz , qemu-devel@nongnu.org Cc: Kevin Wolf , Markus Armbruster , Stefan Hajnoczi This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --fv1e4LhcxQUStgGm6nP0s3S1S31wkO4uw Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 01/26/2015 12:27 PM, Max Reitz wrote: > Replace bdrv_drain_all(), bdrv_commmit_all(), bdrv_flush_all(), > bdrv_invalidate_cache_all(), bdrv_next() and occurrences of bdrv_states= > by their BlockBackend equivalents. >=20 > Signed-off-by: Max Reitz > --- > block.c | 22 ++++++++--------- > block/block-backend.c | 8 +++---- > block/qapi.c | 13 ++++++++-- > block/snapshot.c | 3 ++- > blockdev.c | 14 ++++++----- > cpus.c | 7 +++--- > migration/block.c | 10 +++++--- > migration/migration.c | 4 ++-- > monitor.c | 13 ++++++---- > qemu-char.c | 3 ++- > qemu-io.c | 2 +- > qmp.c | 14 +++++------ > savevm.c | 66 ++++++++++++++++++++++++++++++-------------= -------- > xen-mapcache.c | 3 ++- > 14 files changed, 107 insertions(+), 75 deletions(-) >=20 > +++ b/block/qapi.c > @@ -393,15 +393,24 @@ BlockStatsList *qmp_query_blockstats(bool has_que= ry_nodes, > { > BlockStatsList *head =3D NULL, **p_next =3D &head; > BlockDriverState *bs =3D NULL; > + BlockBackend *blk =3D NULL; > =20 > /* Just to be safe if query_nodes is not always initialized */ > query_nodes =3D has_query_nodes && query_nodes; > =20 > - while ((bs =3D query_nodes ? bdrv_next_node(bs) : bdrv_next(bs))) = { > + while (query_nodes ? (bs =3D bdrv_next_node(bs)) !=3D NULL > + : (blk =3D blk_next_inserted(blk)) !=3D NULL) Don't we still want to list empty BBs in the query (that is, intentionally list that there are no stats because there is no medium) rather than silently omitting them? > @@ -348,6 +349,7 @@ static void unset_dirty_tracking(void) > static void init_blk_migration(QEMUFile *f) > { > BlockDriverState *bs; > + BlockBackend *blk =3D NULL; > BlkMigDevState *bmds; > int64_t sectors; > =20 > @@ -359,7 +361,9 @@ static void init_blk_migration(QEMUFile *f) > block_mig_state.bulk_completed =3D 0; > block_mig_state.zero_blocks =3D migrate_zero_blocks(); > =20 > - for (bs =3D bdrv_next(NULL); bs; bs =3D bdrv_next(bs)) { > + while ((blk =3D blk_next_inserted(blk)) !=3D NULL) { > + bs =3D blk_bs(blk); > + What happens if someone initiates a live migration, then inserts the medium? It looks like this will skip over the drive that was empty at the time the migration started. --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --fv1e4LhcxQUStgGm6nP0s3S1S31wkO4uw 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 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJUytqLAAoJEKeha0olJ0NqS2AIAJKWz6EvELUJ0yKEKx8NVR03 3K6+BWXHpE8Cp5fdaHzNpO1uE1etWkKidS49pTNDHXv+45/y/JGT+k4pC3HecGPd hKMLjoSRJV0MQXHd06G/+gK1J4NWVNMDh4Z0C+hZlFI0hwEGRGOodOgvI4AffYvj q1Gk2taZYq9VhHOOrC6nswdxUaCEL+cA5pSHi0Uas0PDCOLLS/mGfOhc+YrLsMjE WiLY7jGs5sGWKZ/dNImKQJYBZFzN9Qqpp9kCBmTBhqvEs2IBH5d8dw/lO1PodaLV a5xCBFIPo3g9RBjUCUJu99YSoTbK416XCAahCV386kBFzslkxAtyN+sThS+3IKI= =SzHE -----END PGP SIGNATURE----- --fv1e4LhcxQUStgGm6nP0s3S1S31wkO4uw--