Skip to content

Commit

Permalink
block-migration: Switch meaning of return value
Browse files Browse the repository at this point in the history
Make consistent the result of blk_mig_save_dirty_block() and
mig_save_device_dirty()

Signed-off-by: Juan Quintela <quintela@redhat.com>

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
  • Loading branch information
Juan Quintela committed Oct 17, 2012
1 parent 59feec4 commit ceb2bd0
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions block-migration.c
Expand Up @@ -429,14 +429,18 @@ static int mig_save_device_dirty(QEMUFile *f, BlkMigDevState *bmds,
return 0;
}

/* return value:
* 0: too much data for max_downtime
* 1: few enough data for max_downtime
*/
static int blk_mig_save_dirty_block(QEMUFile *f, int is_async)
{
BlkMigDevState *bmds;
int ret = 0;
int ret = 1;

QSIMPLEQ_FOREACH(bmds, &block_mig_state.bmds_list, entry) {
if (mig_save_device_dirty(f, bmds, is_async) == 0) {
ret = 1;
ret = mig_save_device_dirty(f, bmds, is_async);
if (ret == 0) {
break;
}
}
Expand Down Expand Up @@ -596,7 +600,7 @@ static int block_save_iterate(QEMUFile *f, void *opaque)
block_mig_state.bulk_completed = 1;
}
} else {
if (blk_mig_save_dirty_block(f, 1) == 0) {
if (blk_mig_save_dirty_block(f, 1) != 0) {
/* no more dirty blocks */
break;
}
Expand Down Expand Up @@ -633,7 +637,7 @@ static int block_save_complete(QEMUFile *f, void *opaque)
all async read completed */
assert(block_mig_state.submitted == 0);

while (blk_mig_save_dirty_block(f, 0) != 0) {
while (blk_mig_save_dirty_block(f, 0) == 0) {
/* Do nothing */
}
blk_mig_cleanup();
Expand Down

0 comments on commit ceb2bd0

Please sign in to comment.