mirror of https://github.com/xemu-project/xemu.git
block/vmdk: add coroutine_fn annotations
These functions end up calling bdrv_create() implemented as generated_co_wrapper functions. In addition, they also happen to be always called in coroutine context, meaning all callers are coroutine_fn. This means that the g_c_w function will enter the qemu_in_coroutine() case and eventually suspend (or in other words call qemu_coroutine_yield()). Therefore we can mark such functions coroutine_fn too. Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru> Message-Id: <20221128142337.657646-6-eesposit@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
This commit is contained in:
parent
ff7e261bb9
commit
f7f93a478a
36
block/vmdk.c
36
block/vmdk.c
|
@ -2285,10 +2285,11 @@ exit:
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int vmdk_create_extent(const char *filename, int64_t filesize,
|
static int coroutine_fn vmdk_create_extent(const char *filename,
|
||||||
bool flat, bool compress, bool zeroed_grain,
|
int64_t filesize, bool flat,
|
||||||
BlockBackend **pbb,
|
bool compress, bool zeroed_grain,
|
||||||
QemuOpts *opts, Error **errp)
|
BlockBackend **pbb,
|
||||||
|
QemuOpts *opts, Error **errp)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
BlockBackend *blk = NULL;
|
BlockBackend *blk = NULL;
|
||||||
|
@ -2366,14 +2367,14 @@ static int filename_decompose(const char *filename, char *path, char *prefix,
|
||||||
* non-split format.
|
* non-split format.
|
||||||
* idx >= 1: get the n-th extent if in a split subformat
|
* idx >= 1: get the n-th extent if in a split subformat
|
||||||
*/
|
*/
|
||||||
typedef BlockBackend *(*vmdk_create_extent_fn)(int64_t size,
|
typedef BlockBackend * coroutine_fn (*vmdk_create_extent_fn)(int64_t size,
|
||||||
int idx,
|
int idx,
|
||||||
bool flat,
|
bool flat,
|
||||||
bool split,
|
bool split,
|
||||||
bool compress,
|
bool compress,
|
||||||
bool zeroed_grain,
|
bool zeroed_grain,
|
||||||
void *opaque,
|
void *opaque,
|
||||||
Error **errp);
|
Error **errp);
|
||||||
|
|
||||||
static void vmdk_desc_add_extent(GString *desc,
|
static void vmdk_desc_add_extent(GString *desc,
|
||||||
const char *extent_line_fmt,
|
const char *extent_line_fmt,
|
||||||
|
@ -2616,7 +2617,7 @@ typedef struct {
|
||||||
QemuOpts *opts;
|
QemuOpts *opts;
|
||||||
} VMDKCreateOptsData;
|
} VMDKCreateOptsData;
|
||||||
|
|
||||||
static BlockBackend *vmdk_co_create_opts_cb(int64_t size, int idx,
|
static BlockBackend * coroutine_fn vmdk_co_create_opts_cb(int64_t size, int idx,
|
||||||
bool flat, bool split, bool compress,
|
bool flat, bool split, bool compress,
|
||||||
bool zeroed_grain, void *opaque,
|
bool zeroed_grain, void *opaque,
|
||||||
Error **errp)
|
Error **errp)
|
||||||
|
@ -2768,10 +2769,11 @@ exit:
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static BlockBackend *vmdk_co_create_cb(int64_t size, int idx,
|
static BlockBackend * coroutine_fn vmdk_co_create_cb(int64_t size, int idx,
|
||||||
bool flat, bool split, bool compress,
|
bool flat, bool split,
|
||||||
bool zeroed_grain, void *opaque,
|
bool compress,
|
||||||
Error **errp)
|
bool zeroed_grain,
|
||||||
|
void *opaque, Error **errp)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
BlockDriverState *bs;
|
BlockDriverState *bs;
|
||||||
|
|
Loading…
Reference in New Issue