[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 24/23] block migration: Skip zero-sized disks
From: |
Jan Kiszka |
Subject: |
[Qemu-devel] [PATCH 24/23] block migration: Skip zero-sized disks |
Date: |
Mon, 30 Nov 2009 20:34:55 +0100 |
User-agent: |
Mozilla/5.0 (X11; U; Linux i686 (x86_64); de; rv:1.8.1.12) Gecko/20080226 SUSE/2.0.0.12-1.1 Thunderbird/2.0.0.12 Mnenhy/0.7.5.666 |
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 <address@hidden>
---
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 "
signature.asc
Description: OpenPGP digital signature
- [Qemu-devel] [PATCH 18/23] block migration: Report overall migration progress, (continued)
- [Qemu-devel] [PATCH 18/23] block migration: Report overall migration progress, Jan Kiszka, 2009/11/30
- [Qemu-devel] [PATCH 22/23] block migration: Add support for restore progress reporting, Jan Kiszka, 2009/11/30
- [Qemu-devel] [PATCH 10/23] block migration: Switch device and block lists to QSIMPLEQ, Jan Kiszka, 2009/11/30
- [Qemu-devel] [PATCH 07/23] block migration: Avoid indirection of block_mig_state, Jan Kiszka, 2009/11/30
- [Qemu-devel] [PATCH 11/23] block migration: Initialize remaining BlkMigState fields, Jan Kiszka, 2009/11/30
- [Qemu-devel] [PATCH 20/23] block migration: Fix outgoing progress output, Jan Kiszka, 2009/11/30
- [Qemu-devel] [PATCH 04/23] block migration: Rework constants API, Jan Kiszka, 2009/11/30
- Re: [Qemu-devel] [PATCH 00/23] block migration: Fixes, cleanups and speedups, Anthony Liguori, 2009/11/30
- Re: [Qemu-devel] [PATCH 00/23] block migration: Fixes, cleanups and speedups, Pierre Riteau, 2009/11/30
- Re: [Qemu-devel] [PATCH 00/23] block migration: Fixes, cleanups and speedups, Jan Kiszka, 2009/11/30
- Re: [Qemu-devel] [PATCH 00/23] block migration: Fixes, cleanups and speedups, Pierre Riteau, 2009/11/30
- Re: [Qemu-devel] [PATCH 00/23] block migration: Fixes, cleanups and speedups, Jan Kiszka, 2009/11/30
Re: [Qemu-devel] [PATCH 00/23] block migration: Fixes, cleanups and speedups, Jan Kiszka, 2009/11/30