On 17.07.20 17:24, Vladimir Sementsov-Ogievskiy wrote: > 17.07.2020 17:00, Max Reitz wrote: >> On 01.06.20 20:11, Vladimir Sementsov-Ogievskiy wrote: >>> We'll need async block-copy invocation to use in backup directly. >>> >>> Signed-off-by: Vladimir Sementsov-Ogievskiy >>> --- >>>   include/block/block-copy.h | 13 +++++++++++++ >>>   block/block-copy.c         | 40 ++++++++++++++++++++++++++++++++++++++ >>>   2 files changed, 53 insertions(+) [...] >>> +BlockCopyCallState *block_copy_async(BlockCopyState *s, >>> +                                     int64_t offset, int64_t bytes, >>> +                                     bool ratelimit, int max_workers, >>> +                                     int64_t max_chunk, >>> +                                     BlockCopyAsyncCallbackFunc cb) >>> +{ >>> +    BlockCopyCallState *call_state = g_new(BlockCopyCallState, 1); >>> +    Coroutine *co = qemu_coroutine_create(block_copy_async_co_entry, >>> +                                          call_state); >>> + >>> +    *call_state = (BlockCopyCallState) { >>> +        .s = s, >>> +        .offset = offset, >>> +        .bytes = bytes, >>> +        .cb = cb, >>> +    }; >>> + >>> +    qemu_coroutine_enter(co); >> >> Do we need/want any already-in-coroutine shenanigans here? >> > > No: the aim of the function is to start a new coroutine in parallel, > independently of are we already in some other coroutine or not. OK, that makes sense.