static void mirror_start_job(const char *job_id, BlockDriverState *bs,

                             BlockDriverState *target, const char *replaces,

                             int64_t speed, uint32_t granularity,

                             int64_t buf_size,

                             BlockMirrorBackingMode backing_mode,

                             BlockdevOnError on_source_error,

                             BlockdevOnError on_target_error,

                             bool unmap,

                             BlockCompletionFunc *cb,

                             void *opaque, Error **errp,

                             const BlockJobDriver *driver,

                             bool is_none_mode, BlockDriverState *base)

{

    MirrorBlockJob *s;



    if (granularity == 0) {

        granularity = bdrv_get_default_bitmap_granularity(target);

    }



    assert ((granularity & (granularity - 1)) == 0);



    if (buf_size < 0) {

        error_setg(errp, "Invalid parameter 'buf-size'");

        return;

    }



    if (buf_size == 0) {

        buf_size = DEFAULT_MIRROR_BUF_SIZE;

    }



    s = block_job_create(job_id, driver, bs, speed, cb, opaque, errp);

    if (!s) {

        return;

    }



    s->target = blk_new();

    blk_insert_bs(s->target, target);



    s->replaces = g_strdup(replaces);

    s->on_source_error = on_source_error;

    s->on_target_error = on_target_error;

    s->is_none_mode = is_none_mode;

    s->backing_mode = backing_mode;

    s->base = base;

    s->granularity = granularity;

    s->buf_size = ROUND_UP(buf_size, granularity);

    s->unmap = unmap;



    s->dirty_bitmap = bdrv_create_dirty_bitmap(bs, granularity, NULL, errp);

    if (!s->dirty_bitmap) {

        g_free(s->replaces);

        blk_unref(s->target);

        block_job_unref(&s->common);

        return;

    }



    bdrv_op_block_all(target, s->common.blocker);



    s->common.co = qemu_coroutine_create(mirror_run, s);

    trace_mirror_start(bs, s, s->common.co, opaque);

    qemu_coroutine_enter(s->common.co);

}

static void mirror_start_job(const char *job_id, BlockDriverState *bs,

                             BlockDriverState *target, const char *replaces,

                             int64_t speed, uint32_t granularity,

                             int64_t buf_size,

                             BlockMirrorBackingMode backing_mode,

                             BlockdevOnError on_source_error,

                             BlockdevOnError on_target_error,

                             bool unmap,

                             BlockCompletionFunc *cb,

                             void *opaque, Error **errp,

                             const BlockJobDriver *driver,

                             bool is_none_mode, BlockDriverState *base)

{

    MirrorBlockJob *s;



    if (granularity == 0) {

        granularity = bdrv_get_default_bitmap_granularity(target);

    }



    assert ((granularity & (granularity - 1)) == 0);



    if (buf_size < 0) {

        error_setg(errp, "Invalid parameter 'buf-size'");

        return;

    }



    if (buf_size == 0) {

        buf_size = DEFAULT_MIRROR_BUF_SIZE;

    }



    s = block_job_create(job_id, driver, bs, speed, cb, opaque, errp);

    if (!s) {

        return;

    }



    s->target = blk_new();

    blk_insert_bs(s->target, target);



    s->replaces = g_strdup(replaces);

    s->on_source_error = on_source_error;

    s->on_target_error = on_target_error;

    s->is_none_mode = is_none_mode;

    s->backing_mode = backing_mode;

    s->base = base;

    s->granularity = granularity;

    s->buf_size = ROUND_UP(buf_size, granularity);

    s->unmap = unmap;



    s->dirty_bitmap = bdrv_create_dirty_bitmap(bs, granularity, NULL, errp);

    if (!s->dirty_bitmap) {

        g_free(s->replaces);

        blk_unref(s->target);

        block_job_unref(&s->common);

        return;

    }



    bdrv_op_block_all(target, s->common.blocker);



    s->common.co = qemu_coroutine_create(mirror_run, s);

    trace_mirror_start(bs, s, s->common.co, opaque);

    qemu_coroutine_enter(s->common.co);

}

static void FUNC_0(const char *VAR_0, BlockDriverState *VAR_1,

                             BlockDriverState *VAR_2, const char *VAR_3,

                             int64_t VAR_4, uint32_t VAR_5,

                             int64_t VAR_6,

                             BlockMirrorBackingMode VAR_7,

                             BlockdevOnError VAR_8,

                             BlockdevOnError VAR_9,

                             bool VAR_10,

                             BlockCompletionFunc *VAR_11,

                             void *VAR_12, Error **VAR_13,

                             const BlockJobDriver *VAR_14,

                             bool VAR_15, BlockDriverState *VAR_16)

{

    MirrorBlockJob *s;



    if (VAR_5 == 0) {

        VAR_5 = bdrv_get_default_bitmap_granularity(VAR_2);

    }



    assert ((VAR_5 & (VAR_5 - 1)) == 0);



    if (VAR_6 < 0) {

        error_setg(VAR_13, "Invalid parameter 'buf-size'");

        return;

    }



    if (VAR_6 == 0) {

        VAR_6 = DEFAULT_MIRROR_BUF_SIZE;

    }



    s = block_job_create(VAR_0, VAR_14, VAR_1, VAR_4, VAR_11, VAR_12, VAR_13);

    if (!s) {

        return;

    }



    s->VAR_2 = blk_new();

    blk_insert_bs(s->VAR_2, VAR_2);



    s->VAR_3 = g_strdup(VAR_3);

    s->VAR_8 = VAR_8;

    s->VAR_9 = VAR_9;

    s->VAR_15 = VAR_15;

    s->VAR_7 = VAR_7;

    s->VAR_16 = VAR_16;

    s->VAR_5 = VAR_5;

    s->VAR_6 = ROUND_UP(VAR_6, VAR_5);

    s->VAR_10 = VAR_10;



    s->dirty_bitmap = bdrv_create_dirty_bitmap(VAR_1, VAR_5, NULL, VAR_13);

    if (!s->dirty_bitmap) {

        g_free(s->VAR_3);

        blk_unref(s->VAR_2);

        block_job_unref(&s->common);

        return;

    }



    bdrv_op_block_all(VAR_2, s->common.blocker);



    s->common.co = qemu_coroutine_create(mirror_run, s);

    trace_mirror_start(VAR_1, s, s->common.co, VAR_12);

    qemu_coroutine_enter(s->common.co);

}

static void FUNC_0(const char *VAR_0, BlockDriverState *VAR_1,
BlockDriverState *VAR_2, const char *VAR_3,
int64_t VAR_4, uint32_t VAR_5,
int64_t VAR_6,
BlockMirrorBackingMode VAR_7,
BlockdevOnError VAR_8,
BlockdevOnError VAR_9,
bool VAR_10,
BlockCompletionFunc *VAR_11,
void *VAR_12, Error **VAR_13,
const BlockJobDriver *VAR_14,
bool VAR_15, BlockDriverState *VAR_16)
{ MirrorBlockJob *s; if (VAR_5 == 0) { VAR_5 = bdrv_get_default_bitmap_granularity(VAR_2); } assert ((VAR_5 & (VAR_5 - 1)) == 0); if (VAR_6 < 0) { error_setg(VAR_13, "Invalid parameter 'buf-size'"); return; } if (VAR_6 == 0) { VAR_6 = DEFAULT_MIRROR_BUF_SIZE; } s = block_job_create(VAR_0, VAR_14, VAR_1, VAR_4, VAR_11, VAR_12, VAR_13); if (!s) { return; } s->VAR_2 = blk_new(); blk_insert_bs(s->VAR_2, VAR_2); s->VAR_3 = g_strdup(VAR_3); s->VAR_8 = VAR_8; s->VAR_9 = VAR_9; s->VAR_15 = VAR_15; s->VAR_7 = VAR_7; s->VAR_16 = VAR_16; s->VAR_5 = VAR_5; s->VAR_6 = ROUND_UP(VAR_6, VAR_5); s->VAR_10 = VAR_10; s->dirty_bitmap = bdrv_create_dirty_bitmap(VAR_1, VAR_5, NULL, VAR_13); if (!s->dirty_bitmap) { g_free(s->VAR_3); blk_unref(s->VAR_2); block_job_unref(&s->common); return; } bdrv_op_block_all(VAR_2, s->common.blocker); s->common.co = qemu_coroutine_create(mirror_run, s); trace_mirror_start(VAR_1, s, s->common.co, VAR_12); qemu_coroutine_enter(s->common.co); }