All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Kiszka <jan.kiszka@web.de>
To: Pierre Riteau <Pierre.Riteau@irisa.fr>
Cc: Liran Schour <lirans@il.ibm.com>, qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH 24/23] block migration: Skip zero-sized disks
Date: Mon, 30 Nov 2009 20:34:55 +0100	[thread overview]
Message-ID: <4B141E5F.1060609@web.de> (raw)
In-Reply-To: <230914FA-4454-42D3-BB0B-89119735289B@irisa.fr>

[-- Attachment #1: Type: text/plain, Size: 3160 bytes --]

Pierre Riteau wrote:
> On 30 nov. 2009, at 19:50, Pierre Riteau wrote:
> 
>> 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:port" doesn't, although "help migrate" doesn't really specify ordering as important. But anyway I think Liran is working on a new version of the command.
>> - 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, especially if this interface is used by libvirt to report VM stats (and draw graphs 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 = completed_sector_sum * 100 / block_mig_state.total_sector_sum;"
>>
>> Apart from that, it works quite fine. Still a few things to cleanup (e.g. 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.
> 
> 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.
> 

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 <jan.kiszka@siemens.com>
---

 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;
 
     block_mig_state.submitted = 0;
     block_mig_state.read_done = 0;
@@ -231,14 +232,19 @@ static void init_blk_migration(Monitor *mon, QEMUFile *f)
 
     for (bs = bdrv_first; bs != NULL; bs = bs->next) {
         if (bs->type == BDRV_TYPE_HD) {
+            sectors = bdrv_getlength(bs) >> BDRV_SECTOR_BITS;
+            if (sectors == 0) {
+                continue;
+            }
+
             bmds = qemu_mallocz(sizeof(BlkMigDevState));
             bmds->bs = bs;
             bmds->bulk_completed = 0;
-            bmds->total_sectors = bdrv_getlength(bs) >> BDRV_SECTOR_BITS;
+            bmds->total_sectors = sectors;
             bmds->completed_sectors = 0;
             bmds->shared_base = block_mig_state.shared_base;
 
-            block_mig_state.total_sector_sum += bmds->total_sectors;
+            block_mig_state.total_sector_sum += sectors;
 
             if (bmds->shared_base) {
                 monitor_printf(mon, "Start migration for %s with shared base "


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 257 bytes --]

  reply	other threads:[~2009-11-30 19:35 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-30 17:21 [Qemu-devel] [PATCH 00/23] block migration: Fixes, cleanups and speedups Jan Kiszka
2009-11-30 17:21 ` [Qemu-devel] [PATCH 04/23] block migration: Rework constants API Jan Kiszka
2009-11-30 17:21 ` [Qemu-devel] [PATCH 03/23] block migration: Fix coding style and whitespaces Jan Kiszka
2009-11-30 17:21 ` [Qemu-devel] [PATCH 01/23] migration: Fix use of file after release Jan Kiszka
2009-11-30 17:21 ` [Qemu-devel] [PATCH 02/23] migration: Catch multiple start commands Jan Kiszka
2009-11-30 17:21 ` [Qemu-devel] [PATCH 05/23] block migration: Cleanup dirty tracking code Jan Kiszka
2009-11-30 17:21 ` [Qemu-devel] [PATCH 06/23] block migration: Avoid large stack buffer Jan Kiszka
2009-11-30 17:21 ` [Qemu-devel] [PATCH 07/23] block migration: Avoid indirection of block_mig_state Jan Kiszka
2009-11-30 17:21 ` [Qemu-devel] [PATCH 13/23] block migration: Consolidate mig_read_device_bulk into mig_save_device_bulk Jan Kiszka
2009-11-30 17:21 ` [Qemu-devel] [PATCH 10/23] block migration: Switch device and block lists to QSIMPLEQ Jan Kiszka
2009-11-30 17:21 ` [Qemu-devel] [PATCH 08/23] block migration: Drop dead code Jan Kiszka
2009-11-30 17:21 ` [Qemu-devel] [PATCH 12/23] block migration: Clean up use of total_sectors Jan Kiszka
2009-11-30 17:21 ` [Qemu-devel] [PATCH 11/23] block migration: Initialize remaining BlkMigState fields Jan Kiszka
2009-11-30 17:21 ` [Qemu-devel] [PATCH 09/23] Import a simple queue implementation from NetBSD Jan Kiszka
2009-11-30 17:21 ` [Qemu-devel] [PATCH 15/23] block migration: Add error handling/propagation Jan Kiszka
2009-11-30 17:21 ` [Qemu-devel] [PATCH 20/23] block migration: Fix outgoing progress output Jan Kiszka
2009-11-30 17:21 ` [Qemu-devel] [PATCH 17/23] live migration: Allow cleanup after cancellation or error Jan Kiszka
2009-11-30 17:21 ` [Qemu-devel] [PATCH 22/23] block migration: Add support for restore progress reporting Jan Kiszka
2009-12-01 14:20   ` [Qemu-devel] [PATCH v2 " Jan Kiszka
2009-12-01 17:01     ` [Qemu-devel] " Pierre Riteau
2009-12-01 17:17       ` Jan Kiszka
2009-11-30 17:21 ` [Qemu-devel] [PATCH 18/23] block migration: Report overall migration progress Jan Kiszka
2009-11-30 17:21 ` [Qemu-devel] [PATCH 14/23] block migration: Consolidate block transmission Jan Kiszka
2009-11-30 17:21 ` [Qemu-devel] [PATCH 19/23] live migration: Propagate output monitor to callback handler Jan Kiszka
2009-11-30 17:21 ` [Qemu-devel] [PATCH 21/23] block migration: Report progress also via info migration Jan Kiszka
2009-11-30 17:21 ` [Qemu-devel] [PATCH 16/23] ram migration: Stop loading on error Jan Kiszka
2009-11-30 17:21 ` [Qemu-devel] [PATCH 23/23] block migration: Increase dirty chunk size to 1M Jan Kiszka
2009-11-30 18:34 ` [Qemu-devel] [PATCH 00/23] block migration: Fixes, cleanups and speedups Anthony Liguori
2009-11-30 18:50   ` Pierre Riteau
2009-11-30 19:23     ` Pierre Riteau
2009-11-30 19:34       ` Jan Kiszka [this message]
2009-11-30 19:25     ` Jan Kiszka
2009-11-30 19:34       ` Pierre Riteau
2009-11-30 19:44         ` Jan Kiszka
2009-11-30 18:50   ` Jan Kiszka

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4B141E5F.1060609@web.de \
    --to=jan.kiszka@web.de \
    --cc=Pierre.Riteau@irisa.fr \
    --cc=lirans@il.ibm.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.