block: add missing coroutine_fn annotations

Callers of coroutine_fn must be coroutine_fn themselves, or the call
must be within "if (qemu_in_coroutine())".  Apply coroutine_fn to
functions where this holds.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Message-Id: <20220922084924.201610-3-pbonzini@redhat.com>
[kwolf: Fixed up coding style]
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
This commit is contained in:
Paolo Bonzini 2022-09-22 10:49:00 +02:00 committed by Kevin Wolf
parent 82c45371ba
commit 881a4c553c
3 changed files with 20 additions and 19 deletions

View File

@ -631,9 +631,10 @@ static int64_t create_file_fallback_truncate(BlockBackend *blk,
* Helper function for bdrv_create_file_fallback(): Zero the first * Helper function for bdrv_create_file_fallback(): Zero the first
* sector to remove any potentially pre-existing image header. * sector to remove any potentially pre-existing image header.
*/ */
static int create_file_fallback_zero_first_sector(BlockBackend *blk, static int coroutine_fn
int64_t current_size, create_file_fallback_zero_first_sector(BlockBackend *blk,
Error **errp) int64_t current_size,
Error **errp)
{ {
int64_t bytes_to_clear; int64_t bytes_to_clear;
int ret; int ret;

View File

@ -1546,7 +1546,7 @@ static BlockAIOCB *blk_aio_prwv(BlockBackend *blk, int64_t offset,
return &acb->common; return &acb->common;
} }
static void blk_aio_read_entry(void *opaque) static void coroutine_fn blk_aio_read_entry(void *opaque)
{ {
BlkAioEmAIOCB *acb = opaque; BlkAioEmAIOCB *acb = opaque;
BlkRwCo *rwco = &acb->rwco; BlkRwCo *rwco = &acb->rwco;
@ -1558,7 +1558,7 @@ static void blk_aio_read_entry(void *opaque)
blk_aio_complete(acb); blk_aio_complete(acb);
} }
static void blk_aio_write_entry(void *opaque) static void coroutine_fn blk_aio_write_entry(void *opaque)
{ {
BlkAioEmAIOCB *acb = opaque; BlkAioEmAIOCB *acb = opaque;
BlkRwCo *rwco = &acb->rwco; BlkRwCo *rwco = &acb->rwco;
@ -1669,7 +1669,7 @@ int coroutine_fn blk_co_ioctl(BlockBackend *blk, unsigned long int req,
return ret; return ret;
} }
static void blk_aio_ioctl_entry(void *opaque) static void coroutine_fn blk_aio_ioctl_entry(void *opaque)
{ {
BlkAioEmAIOCB *acb = opaque; BlkAioEmAIOCB *acb = opaque;
BlkRwCo *rwco = &acb->rwco; BlkRwCo *rwco = &acb->rwco;
@ -1703,7 +1703,7 @@ blk_co_do_pdiscard(BlockBackend *blk, int64_t offset, int64_t bytes)
return bdrv_co_pdiscard(blk->root, offset, bytes); return bdrv_co_pdiscard(blk->root, offset, bytes);
} }
static void blk_aio_pdiscard_entry(void *opaque) static void coroutine_fn blk_aio_pdiscard_entry(void *opaque)
{ {
BlkAioEmAIOCB *acb = opaque; BlkAioEmAIOCB *acb = opaque;
BlkRwCo *rwco = &acb->rwco; BlkRwCo *rwco = &acb->rwco;
@ -1747,7 +1747,7 @@ static int coroutine_fn blk_co_do_flush(BlockBackend *blk)
return bdrv_co_flush(blk_bs(blk)); return bdrv_co_flush(blk_bs(blk));
} }
static void blk_aio_flush_entry(void *opaque) static void coroutine_fn blk_aio_flush_entry(void *opaque)
{ {
BlkAioEmAIOCB *acb = opaque; BlkAioEmAIOCB *acb = opaque;
BlkRwCo *rwco = &acb->rwco; BlkRwCo *rwco = &acb->rwco;

View File

@ -751,11 +751,11 @@ static void coroutine_fn tracked_request_end(BdrvTrackedRequest *req)
/** /**
* Add an active request to the tracked requests list * Add an active request to the tracked requests list
*/ */
static void tracked_request_begin(BdrvTrackedRequest *req, static void coroutine_fn tracked_request_begin(BdrvTrackedRequest *req,
BlockDriverState *bs, BlockDriverState *bs,
int64_t offset, int64_t offset,
int64_t bytes, int64_t bytes,
enum BdrvTrackedRequestType type) enum BdrvTrackedRequestType type)
{ {
bdrv_check_request(offset, bytes, &error_abort); bdrv_check_request(offset, bytes, &error_abort);
@ -794,7 +794,7 @@ static bool tracked_request_overlaps(BdrvTrackedRequest *req,
} }
/* Called with self->bs->reqs_lock held */ /* Called with self->bs->reqs_lock held */
static BdrvTrackedRequest * static coroutine_fn BdrvTrackedRequest *
bdrv_find_conflicting_request(BdrvTrackedRequest *self) bdrv_find_conflicting_request(BdrvTrackedRequest *self)
{ {
BdrvTrackedRequest *req; BdrvTrackedRequest *req;
@ -1635,10 +1635,10 @@ static bool bdrv_init_padding(BlockDriverState *bs,
return true; return true;
} }
static int bdrv_padding_rmw_read(BdrvChild *child, static coroutine_fn int bdrv_padding_rmw_read(BdrvChild *child,
BdrvTrackedRequest *req, BdrvTrackedRequest *req,
BdrvRequestPadding *pad, BdrvRequestPadding *pad,
bool zero_middle) bool zero_middle)
{ {
QEMUIOVector local_qiov; QEMUIOVector local_qiov;
BlockDriverState *bs = child->bs; BlockDriverState *bs = child->bs;
@ -3159,7 +3159,7 @@ out:
return ret; return ret;
} }
int bdrv_co_ioctl(BlockDriverState *bs, int req, void *buf) int coroutine_fn bdrv_co_ioctl(BlockDriverState *bs, int req, void *buf)
{ {
BlockDriver *drv = bs->drv; BlockDriver *drv = bs->drv;
CoroutineIOCompletion co = { CoroutineIOCompletion co = {