提交 323920c4 编写于 作者: P Paolo Bonzini 提交者: Juan Quintela

block-migration: document usage of state across threads

Reviewed-by: NOrit Wasserman <owasserm@redhat.com>
Reviewed-by: NJuan Quintela <quintela@redhat.com>
Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
Signed-off-by: NJuan Quintela <quintela@redhat.com>
上级 13197e3c
...@@ -43,18 +43,24 @@ ...@@ -43,18 +43,24 @@
#endif #endif
typedef struct BlkMigDevState { typedef struct BlkMigDevState {
/* Written during setup phase. Can be read without a lock. */
BlockDriverState *bs; BlockDriverState *bs;
int bulk_completed;
int shared_base; int shared_base;
int64_t cur_sector;
int64_t cur_dirty;
int64_t completed_sectors;
int64_t total_sectors; int64_t total_sectors;
QSIMPLEQ_ENTRY(BlkMigDevState) entry; 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; unsigned long *aio_bitmap;
int64_t completed_sectors;
} BlkMigDevState; } BlkMigDevState;
typedef struct BlkMigBlock { typedef struct BlkMigBlock {
/* Only used by migration thread. */
uint8_t *buf; uint8_t *buf;
BlkMigDevState *bmds; BlkMigDevState *bmds;
int64_t sector; int64_t sector;
...@@ -62,19 +68,26 @@ typedef struct BlkMigBlock { ...@@ -62,19 +68,26 @@ typedef struct BlkMigBlock {
struct iovec iov; struct iovec iov;
QEMUIOVector qiov; QEMUIOVector qiov;
BlockDriverAIOCB *aiocb; BlockDriverAIOCB *aiocb;
/* Protected by iothread lock. */
int ret; int ret;
QSIMPLEQ_ENTRY(BlkMigBlock) entry; QSIMPLEQ_ENTRY(BlkMigBlock) entry;
} BlkMigBlock; } BlkMigBlock;
typedef struct BlkMigState { typedef struct BlkMigState {
/* Written during setup phase. Can be read without a lock. */
int blk_enable; int blk_enable;
int shared_base; int shared_base;
QSIMPLEQ_HEAD(bmds_list, BlkMigDevState) bmds_list; QSIMPLEQ_HEAD(bmds_list, BlkMigDevState) bmds_list;
int64_t total_sector_sum;
/* Protected by iothread lock. */
QSIMPLEQ_HEAD(blk_list, BlkMigBlock) blk_list; QSIMPLEQ_HEAD(blk_list, BlkMigBlock) blk_list;
int submitted; int submitted;
int read_done; int read_done;
/* Only used by migration thread. Does not need a lock. */
int transferred; int transferred;
int64_t total_sector_sum;
int prev_progress; int prev_progress;
int bulk_completed; int bulk_completed;
} BlkMigState; } BlkMigState;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册