[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 17/42] block-migration: small preparatory changes fo
From: |
Paolo Bonzini |
Subject: |
[Qemu-devel] [PATCH 17/42] block-migration: small preparatory changes for locking |
Date: |
Fri, 22 Feb 2013 17:36:23 +0100 |
Some small changes that will simplify the positioning of lock/unlock
primitives.
Reviewed-by: Orit Wasserman <address@hidden>
Reviewed-by: Juan Quintela <address@hidden>
Signed-off-by: Paolo Bonzini <address@hidden>
---
block-migration.c | 26 +++++++++++++++-----------
1 file changed, 15 insertions(+), 11 deletions(-)
diff --git a/block-migration.c b/block-migration.c
index e72f322..9a40edd 100644
--- a/block-migration.c
+++ b/block-migration.c
@@ -231,9 +231,10 @@ static int mig_save_device_bulk(QEMUFile *f,
BlkMigDevState *bmds)
blk->iov.iov_len = nr_sectors * BDRV_SECTOR_SIZE;
qemu_iovec_init_external(&blk->qiov, &blk->iov, 1);
+ block_mig_state.submitted++;
+
blk->aiocb = bdrv_aio_readv(bs, cur_sector, &blk->qiov,
nr_sectors, blk_mig_read_cb, blk);
- block_mig_state.submitted++;
bdrv_reset_dirty(bs, cur_sector, nr_sectors);
bmds->cur_sector = cur_sector + nr_sectors;
@@ -440,9 +441,10 @@ static int flush_blks(QEMUFile *f)
ret = blk->ret;
break;
}
- blk_send(f, blk);
QSIMPLEQ_REMOVE_HEAD(&block_mig_state.blk_list, entry);
+ blk_send(f, blk);
+
g_free(blk->buf);
g_free(blk);
@@ -542,15 +544,16 @@ static int block_save_iterate(QEMUFile *f, void *opaque)
/* finished saving bulk on all devices */
block_mig_state.bulk_completed = 1;
}
+ ret = 0;
} else {
ret = blk_mig_save_dirty_block(f, 1);
- if (ret < 0) {
- return ret;
- }
- if (ret != 0) {
- /* no more dirty blocks */
- break;
- }
+ }
+ if (ret < 0) {
+ return ret;
+ }
+ if (ret != 0) {
+ /* no more dirty blocks */
+ break;
}
}
@@ -560,7 +563,6 @@ static int block_save_iterate(QEMUFile *f, void *opaque)
}
qemu_put_be64(f, BLK_MIG_FLAG_EOS);
-
return qemu_ftell(f) - last_ftell;
}
@@ -603,7 +605,9 @@ static int block_save_complete(QEMUFile *f, void *opaque)
static uint64_t block_save_pending(QEMUFile *f, void *opaque, uint64_t
max_size)
{
/* Estimate pending number of bytes to send */
- uint64_t pending = get_remaining_dirty() +
+ uint64_t pending;
+
+ pending = get_remaining_dirty() +
block_mig_state.submitted * BLOCK_SIZE +
block_mig_state.read_done * BLOCK_SIZE;
--
1.8.1.2
- [Qemu-devel] [PATCH 25/42] qemu-file: make qemu_fflush and qemu_file_set_error private again, (continued)
- [Qemu-devel] [PATCH 25/42] qemu-file: make qemu_fflush and qemu_file_set_error private again, Paolo Bonzini, 2013/02/22
- [Qemu-devel] [PATCH 27/42] migration: detect error before sleeping, Paolo Bonzini, 2013/02/22
- [Qemu-devel] [PATCH 28/42] migration: remove useless qemu_file_get_error check, Paolo Bonzini, 2013/02/22
- [Qemu-devel] [PATCH 26/42] migration: eliminate last_round, Paolo Bonzini, 2013/02/22
- [Qemu-devel] [PATCH 39/42] migration: move rate limiting to QEMUFile, Paolo Bonzini, 2013/02/22
- [Qemu-devel] [PATCH 40/42] migration: move contents of migration_close to migrate_fd_cleanup, Paolo Bonzini, 2013/02/22
- [Qemu-devel] [PATCH 42/42] migration: inline migrate_fd_close, Paolo Bonzini, 2013/02/22
- [Qemu-devel] [PATCH 41/42] migration: eliminate s->migration_file, Paolo Bonzini, 2013/02/22
- [Qemu-devel] [PATCH 15/42] migration: cleanup migration (including thread) in the iothread, Paolo Bonzini, 2013/02/22
- [Qemu-devel] [PATCH 31/42] qemu-file: fsync a writable stdio QEMUFile, Paolo Bonzini, 2013/02/22
- [Qemu-devel] [PATCH 17/42] block-migration: small preparatory changes for locking,
Paolo Bonzini <=
- [Qemu-devel] [PATCH 37/42] migration: use qemu_ftell to compute bandwidth, Paolo Bonzini, 2013/02/22
- [Qemu-devel] [PATCH 35/42] migration: use QEMUFile for migration channel lifetime, Paolo Bonzini, 2013/02/22
- [Qemu-devel] [PATCH 07/42] migration: use qemu_file_set_error to pass error codes back to qemu_savevm_state, Paolo Bonzini, 2013/02/22
- [Qemu-devel] [PATCH 29/42] migration: use qemu_file_rate_limit consistently, Paolo Bonzini, 2013/02/22
- [Qemu-devel] [PATCH 33/42] qemu-file: add writable socket QEMUFile, Paolo Bonzini, 2013/02/22
- [Qemu-devel] [PATCH 30/42] migration: merge qemu_popen_cmd with qemu_popen, Paolo Bonzini, 2013/02/22
- [Qemu-devel] [PATCH 19/42] block-migration: add lock, Paolo Bonzini, 2013/02/22
- [Qemu-devel] [PATCH 36/42] migration: use QEMUFile for writing outgoing migration data, Paolo Bonzini, 2013/02/22
- [Qemu-devel] [PATCH 32/42] qemu-file: check exit status when closing a pipe QEMUFile, Paolo Bonzini, 2013/02/22
- [Qemu-devel] [PATCH 10/42] migration: use qemu_file_set_error, Paolo Bonzini, 2013/02/22