From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NFC1W-0004Ty-TV for qemu-devel@nongnu.org; Mon, 30 Nov 2009 14:35:02 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NFC1S-0004Q7-OZ for qemu-devel@nongnu.org; Mon, 30 Nov 2009 14:35:02 -0500 Received: from [199.232.76.173] (port=42488 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NFC1S-0004Ps-7m for qemu-devel@nongnu.org; Mon, 30 Nov 2009 14:34:58 -0500 Received: from fmmailgate01.web.de ([217.72.192.221]:37616) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NFC1R-0002Wv-Jt for qemu-devel@nongnu.org; Mon, 30 Nov 2009 14:34:57 -0500 Message-ID: <4B141E5F.1060609@web.de> Date: Mon, 30 Nov 2009 20:34:55 +0100 From: Jan Kiszka MIME-Version: 1.0 References: <20091130172119.22889.28114.stgit@mchn012c.ww002.siemens.net> <4B141038.2030909@codemonkey.ws> <5D82F732-EB1C-46D7-B179-33CD69732F12@irisa.fr> <230914FA-4454-42D3-BB0B-89119735289B@irisa.fr> In-Reply-To: <230914FA-4454-42D3-BB0B-89119735289B@irisa.fr> Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enig706FFE80C1C9C436C0B5E67C" Sender: jan.kiszka@web.de Subject: [Qemu-devel] [PATCH 24/23] block migration: Skip zero-sized disks List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Pierre Riteau Cc: Liran Schour , qemu-devel@nongnu.org This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig706FFE80C1C9C436C0B5E67C Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Pierre Riteau wrote: > On 30 nov. 2009, at 19:50, Pierre Riteau wrote: >=20 >> I'm currently testing these patches. Here are a few issues I noticed, = before I forget about them. >> >> - "migrate -d -b tcp:dest:port" works, but "migrate -b -d tcp:dest:por= t" doesn't, although "help migrate" doesn't really specify ordering as im= portant. But anyway I think Liran is working on a new version of the comm= and. >> - We use bdrv_aio_readv() to read blocks from the disk. This function = increments rd_bytes and rd_ops, which are reported by "info blockstats". = I don't think this read operations should appear in VM activity, especial= ly if this interface is used by libvirt to report VM stats (and draw grap= hs in virt-manager, etc.). Same for write stats. >> - We may need to call bdrv_reset_dirty() _before_ sending the data, to= be sure the block is not rewritten in the meantime (maybe it's an issue = only with kvm?) >> - I seem to remember that disk images with 0 size are now possible. I'= m afraid we will hit a divide by zero in this case: "progress =3D complet= ed_sector_sum * 100 / block_mig_state.total_sector_sum;" >> >> Apart from that, it works quite fine. Still a few things to cleanup (e= =2Eg. unused constants) but much better than before. >> However, I haven't tested the incremental transfer support at all yet.= It's on my todo list. >=20 > BTW, of these four issues, only the last one is related to Jan changes.= The others were there before. > This is for saying that I strongly agree with the patch series. >=20 That should catch it (yet untested, though). Jan -----> block migration: Skip zero-sized disks No need to migrate emptiness (risking divide by zero later on). Signed-off-by: Jan Kiszka --- block-migration.c | 10 ++++++++-- 1 files changed, 8 insertions(+), 2 deletions(-) diff --git a/block-migration.c b/block-migration.c index a5735b7..98f36a4 100644 --- a/block-migration.c +++ b/block-migration.c @@ -222,6 +222,7 @@ static void init_blk_migration(Monitor *mon, QEMUFile= *f) { BlkMigDevState *bmds; BlockDriverState *bs; + int64_t sectors; =20 block_mig_state.submitted =3D 0; block_mig_state.read_done =3D 0; @@ -231,14 +232,19 @@ static void init_blk_migration(Monitor *mon, QEMUFi= le *f) =20 for (bs =3D bdrv_first; bs !=3D NULL; bs =3D bs->next) { if (bs->type =3D=3D BDRV_TYPE_HD) { + sectors =3D bdrv_getlength(bs) >> BDRV_SECTOR_BITS; + if (sectors =3D=3D 0) { + continue; + } + bmds =3D qemu_mallocz(sizeof(BlkMigDevState)); bmds->bs =3D bs; bmds->bulk_completed =3D 0; - bmds->total_sectors =3D bdrv_getlength(bs) >> BDRV_SECTOR_BI= TS; + bmds->total_sectors =3D sectors; bmds->completed_sectors =3D 0; bmds->shared_base =3D block_mig_state.shared_base; =20 - block_mig_state.total_sector_sum +=3D bmds->total_sectors; + block_mig_state.total_sector_sum +=3D sectors; =20 if (bmds->shared_base) { monitor_printf(mon, "Start migration for %s with shared = base " --------------enig706FFE80C1C9C436C0B5E67C 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 iEYEARECAAYFAksUHl8ACgkQitSsb3rl5xQE7ACfZhv+L0ZKaGIgLKHD3/YhEwIo qFwAoNu3/SsQhxKv+otCNXYq+8W9a6vA =PGPZ -----END PGP SIGNATURE----- --------------enig706FFE80C1C9C436C0B5E67C--