static int block_save_complete(QEMUFile *f, void *opaque)

{

    int ret;



    DPRINTF("Enter save live complete submitted %d transferred %d\n",

            block_mig_state.submitted, block_mig_state.transferred);



    ret = flush_blks(f);

    if (ret) {

        return ret;

    }



    blk_mig_reset_dirty_cursor();



    /* we know for sure that save bulk is completed and

       all async read completed */

    blk_mig_lock();

    assert(block_mig_state.submitted == 0);

    blk_mig_unlock();



    do {

        ret = blk_mig_save_dirty_block(f, 0);

        if (ret < 0) {

            return ret;

        }

    } while (ret == 0);



    /* report completion */

    qemu_put_be64(f, (100 << BDRV_SECTOR_BITS) | BLK_MIG_FLAG_PROGRESS);



    DPRINTF("Block migration completed\n");



    qemu_put_be64(f, BLK_MIG_FLAG_EOS);



    blk_mig_cleanup();

    return 0;

}

static int block_save_complete(QEMUFile *f, void *opaque)

{

    int ret;



    DPRINTF("Enter save live complete submitted %d transferred %d\n",

            block_mig_state.submitted, block_mig_state.transferred);



    ret = flush_blks(f);

    if (ret) {

        return ret;

    }



    blk_mig_reset_dirty_cursor();



    



    blk_mig_lock();

    assert(block_mig_state.submitted == 0);

    blk_mig_unlock();



    do {

        ret = blk_mig_save_dirty_block(f, 0);

        if (ret < 0) {

            return ret;

        }

    } while (ret == 0);



    

    qemu_put_be64(f, (100 << BDRV_SECTOR_BITS) | BLK_MIG_FLAG_PROGRESS);



    DPRINTF("Block migration completed\n");



    qemu_put_be64(f, BLK_MIG_FLAG_EOS);



    blk_mig_cleanup();

    return 0;

}

static int FUNC_0(QEMUFile *VAR_0, void *VAR_1)

{

    int VAR_2;



    DPRINTF("Enter save live complete submitted %d transferred %d\n",

            block_mig_state.submitted, block_mig_state.transferred);



    VAR_2 = flush_blks(VAR_0);

    if (VAR_2) {

        return VAR_2;

    }



    blk_mig_reset_dirty_cursor();



    



    blk_mig_lock();

    assert(block_mig_state.submitted == 0);

    blk_mig_unlock();



    do {

        VAR_2 = blk_mig_save_dirty_block(VAR_0, 0);

        if (VAR_2 < 0) {

            return VAR_2;

        }

    } while (VAR_2 == 0);



    

    qemu_put_be64(VAR_0, (100 << BDRV_SECTOR_BITS) | BLK_MIG_FLAG_PROGRESS);



    DPRINTF("Block migration completed\n");



    qemu_put_be64(VAR_0, BLK_MIG_FLAG_EOS);



    blk_mig_cleanup();

    return 0;

}

static int FUNC_0(QEMUFile *VAR_0, void *VAR_1)
{ int VAR_2; DPRINTF("Enter save live complete submitted %d transferred %d\n",
block_mig_state.submitted, block_mig_state.transferred); VAR_2 = flush_blks(VAR_0); if (VAR_2) { return VAR_2; } blk_mig_reset_dirty_cursor(); blk_mig_lock(); assert(block_mig_state.submitted == 0); blk_mig_unlock(); do { VAR_2 = blk_mig_save_dirty_block(VAR_0, 0); if (VAR_2 < 0) { return VAR_2; } } while (VAR_2 == 0); qemu_put_be64(VAR_0, (100 << BDRV_SECTOR_BITS) | BLK_MIG_FLAG_PROGRESS); DPRINTF("Block migration completed\n"); qemu_put_be64(VAR_0, BLK_MIG_FLAG_EOS); blk_mig_cleanup(); return 0; }