[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 18/42] block-migration: document usage of state acro
From: |
Paolo Bonzini |
Subject: |
[Qemu-devel] [PATCH 18/42] block-migration: document usage of state across threads |
Date: |
Fri, 22 Feb 2013 17:36:24 +0100 |
Reviewed-by: Orit Wasserman <address@hidden>
Reviewed-by: Juan Quintela <address@hidden>
Signed-off-by: Paolo Bonzini <address@hidden>
---
block-migration.c | 23 ++++++++++++++++++-----
1 file changed, 18 insertions(+), 5 deletions(-)
diff --git a/block-migration.c b/block-migration.c
index 9a40edd..d62a8b8 100644
--- a/block-migration.c
+++ b/block-migration.c
@@ -43,18 +43,24 @@
#endif
typedef struct BlkMigDevState {
+ /* Written during setup phase. Can be read without a lock. */
BlockDriverState *bs;
- int bulk_completed;
int shared_base;
- int64_t cur_sector;
- int64_t cur_dirty;
- int64_t completed_sectors;
int64_t total_sectors;
QSIMPLEQ_ENTRY(BlkMigDevState) entry;
+
+ /* Only used by migration thread. Does not need a lock. */
+ int bulk_completed;
+ int64_t cur_sector;
+ int64_t cur_dirty;
+
+ /* Protected by iothread lock. */
unsigned long *aio_bitmap;
+ int64_t completed_sectors;
} BlkMigDevState;
typedef struct BlkMigBlock {
+ /* Only used by migration thread. */
uint8_t *buf;
BlkMigDevState *bmds;
int64_t sector;
@@ -62,19 +68,26 @@ typedef struct BlkMigBlock {
struct iovec iov;
QEMUIOVector qiov;
BlockDriverAIOCB *aiocb;
+
+ /* Protected by iothread lock. */
int ret;
QSIMPLEQ_ENTRY(BlkMigBlock) entry;
} BlkMigBlock;
typedef struct BlkMigState {
+ /* Written during setup phase. Can be read without a lock. */
int blk_enable;
int shared_base;
QSIMPLEQ_HEAD(bmds_list, BlkMigDevState) bmds_list;
+ int64_t total_sector_sum;
+
+ /* Protected by iothread lock. */
QSIMPLEQ_HEAD(blk_list, BlkMigBlock) blk_list;
int submitted;
int read_done;
+
+ /* Only used by migration thread. Does not need a lock. */
int transferred;
- int64_t total_sector_sum;
int prev_progress;
int bulk_completed;
} BlkMigState;
--
1.8.1.2
- [Qemu-devel] [PATCH 02/42] migration: always use vm_stop_force_state, (continued)
- [Qemu-devel] [PATCH 02/42] migration: always use vm_stop_force_state, Paolo Bonzini, 2013/02/22
- [Qemu-devel] [PATCH 06/42] qemu-file: pass errno from qemu_fflush via f->last_error, Paolo Bonzini, 2013/02/22
- [Qemu-devel] [PATCH 08/42] qemu-file: temporarily expose qemu_file_set_error and qemu_fflush, Paolo Bonzini, 2013/02/22
- [Qemu-devel] [PATCH 03/42] migration: move more error handling to migrate_fd_cleanup, Paolo Bonzini, 2013/02/22
- [Qemu-devel] [PATCH 11/42] migration: simplify error handling, Paolo Bonzini, 2013/02/22
- [Qemu-devel] [PATCH 09/42] migration: flush all data to fd when buffered_flush is called, Paolo Bonzini, 2013/02/22
- [Qemu-devel] [PATCH 16/42] block-migration: remove variables that are never read, Paolo Bonzini, 2013/02/22
- [Qemu-devel] [PATCH 13/42] migration: add migrate_set_state tracepoint, Paolo Bonzini, 2013/02/22
- [Qemu-devel] [PATCH 12/42] migration: do not nest flushing of device data, Paolo Bonzini, 2013/02/22
- [Qemu-devel] [PATCH 14/42] migration: prepare to access s->state outside critical sections, Paolo Bonzini, 2013/02/22
- [Qemu-devel] [PATCH 18/42] block-migration: document usage of state across threads,
Paolo Bonzini <=
- [Qemu-devel] [PATCH 20/42] migration: reorder SaveVMHandlers members, Paolo Bonzini, 2013/02/22
- [Qemu-devel] [PATCH 22/42] migration: run setup callbacks out of big lock, Paolo Bonzini, 2013/02/22
- [Qemu-devel] [PATCH 21/42] migration: run pending/iterate callbacks out of big lock, Paolo Bonzini, 2013/02/22
- [Qemu-devel] [PATCH 24/42] Rename buffered_ to migration_, Paolo Bonzini, 2013/02/22
- [Qemu-devel] [PATCH 23/42] migration: yay, buffering is gone, Paolo Bonzini, 2013/02/22
- [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