From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1ND4Ix-0003JO-8L for qemu-devel@nongnu.org; Tue, 24 Nov 2009 17:56:15 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1ND4Is-0003Ej-3z for qemu-devel@nongnu.org; Tue, 24 Nov 2009 17:56:14 -0500 Received: from [199.232.76.173] (port=34214 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1ND4Ir-0003EU-OF for qemu-devel@nongnu.org; Tue, 24 Nov 2009 17:56:09 -0500 Received: from fmmailgate02.web.de ([217.72.192.227]:54963) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1ND4Iq-00015h-Vf for qemu-devel@nongnu.org; Tue, 24 Nov 2009 17:56:09 -0500 Message-ID: <4B0C647D.6090709@web.de> Date: Tue, 24 Nov 2009 23:55:57 +0100 From: Jan Kiszka MIME-Version: 1.0 References: <1257169258297-git-send-email-lirans@il.ibm.com> In-Reply-To: <1257169258297-git-send-email-lirans@il.ibm.com> Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enig6A7A0E223ACD05E8E2CABFA4" Sender: jan.kiszka@web.de Subject: [Qemu-devel] Re: [PATCH 2/3 v5] Block live migration List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: lirans@il.ibm.com Cc: qemu-devel@nongnu.org This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig6A7A0E223ACD05E8E2CABFA4 Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: quoted-printable Hi Liran, trying to understand the code and fixing some cosmetic issues around progress reporting, one potentially performance-relevant question popped = up: lirans@il.ibm.com wrote: > diff --git a/block-migration.c b/block-migration.c > new file mode 100644 > index 0000000..4b4eddf > --- /dev/null > +++ b/block-migration.c =2E.. > +static int mig_read_device_bulk(QEMUFile *f, BlkMigDevState *bms) > +{=20 > + int nr_sectors; > + int64_t total_sectors, cur_sector =3D 0; > + BlockDriverState *bs =3D bms->bs; > + BlkMigBlock *blk; > + =20 > + blk =3D qemu_malloc(sizeof(BlkMigBlock)); > + blk->buf =3D qemu_malloc(BLOCK_SIZE); > + =20 > + cur_sector =3D bms->cur_sector; > + total_sectors =3D bdrv_getlength(bs) >> SECTOR_BITS; Why re-calculating total_sectors here? Specifically bdrv_getlength() can be a non-trivial I/O operation. And what is the difference to bms->total_sectors which looks a lot like..= =2E [...] > + > +static void init_blk_migration(QEMUFile *f) > +{ > + BlkMigDevState **pbmds, *bmds; > + BlockDriverState *bs; > + =20 > + for (bs =3D bdrv_first; bs !=3D NULL; bs =3D bs->next) { > + if(bs->type =3D=3D BDRV_TYPE_HD) { > + bmds =3D qemu_mallocz(sizeof(BlkMigDevState)); > + bmds->bs =3D bs; > + bmds->bulk_completed =3D 0; > + bmds->total_sectors =3D bdrv_getlength(bs) >> SECTOR_BITS;= =2E..it already contains all the information we need? Jan --------------enig6A7A0E223ACD05E8E2CABFA4 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.0.9 (GNU/Linux) Comment: Using GnuPG with SUSE - http://enigmail.mozdev.org iEYEARECAAYFAksMZIUACgkQitSsb3rl5xRMYQCfTt8SAGx0tTa0Z6c8+CtC7AZr FvoAn3nf8rSoRSyG9wvo2Rc0uLipTUaj =t0xs -----END PGP SIGNATURE----- --------------enig6A7A0E223ACD05E8E2CABFA4--