nbd: mark more coroutine_fns, do not use co_wrappers

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
This commit is contained in:
Paolo Bonzini 2023-03-09 09:44:51 +01:00 committed by Kevin Wolf
parent 26bef102e3
commit d2223cddce

View File

@ -1409,7 +1409,7 @@ nbd_read_eof(NBDClient *client, void *buffer, size_t size, Error **errp)
return 1; return 1;
} }
static int nbd_receive_request(NBDClient *client, NBDRequest *request, static int coroutine_fn nbd_receive_request(NBDClient *client, NBDRequest *request,
Error **errp) Error **errp)
{ {
uint8_t buf[NBD_REQUEST_SIZE]; uint8_t buf[NBD_REQUEST_SIZE];
@ -1893,7 +1893,7 @@ static inline void set_be_simple_reply(NBDSimpleReply *reply, uint64_t error,
stq_be_p(&reply->handle, handle); stq_be_p(&reply->handle, handle);
} }
static int nbd_co_send_simple_reply(NBDClient *client, static int coroutine_fn nbd_co_send_simple_reply(NBDClient *client,
uint64_t handle, uint64_t handle,
uint32_t error, uint32_t error,
void *data, void *data,
@ -2036,7 +2036,7 @@ static int coroutine_fn nbd_co_send_sparse_read(NBDClient *client,
stl_be_p(&chunk.length, pnum); stl_be_p(&chunk.length, pnum);
ret = nbd_co_send_iov(client, iov, 1, errp); ret = nbd_co_send_iov(client, iov, 1, errp);
} else { } else {
ret = blk_pread(exp->common.blk, offset + progress, pnum, ret = blk_co_pread(exp->common.blk, offset + progress, pnum,
data + progress, 0); data + progress, 0);
if (ret < 0) { if (ret < 0) {
error_setg_errno(errp, -ret, "reading from file failed"); error_setg_errno(errp, -ret, "reading from file failed");
@ -2196,8 +2196,8 @@ static int coroutine_fn blockalloc_to_extents(BlockBackend *blk,
* @ea is converted to BE by the function * @ea is converted to BE by the function
* @last controls whether NBD_REPLY_FLAG_DONE is sent. * @last controls whether NBD_REPLY_FLAG_DONE is sent.
*/ */
static int nbd_co_send_extents(NBDClient *client, uint64_t handle, static int coroutine_fn
NBDExtentArray *ea, nbd_co_send_extents(NBDClient *client, uint64_t handle, NBDExtentArray *ea,
bool last, uint32_t context_id, Error **errp) bool last, uint32_t context_id, Error **errp)
{ {
NBDStructuredMeta chunk; NBDStructuredMeta chunk;
@ -2275,7 +2275,7 @@ static void bitmap_to_extents(BdrvDirtyBitmap *bitmap,
bdrv_dirty_bitmap_unlock(bitmap); bdrv_dirty_bitmap_unlock(bitmap);
} }
static int nbd_co_send_bitmap(NBDClient *client, uint64_t handle, static int coroutine_fn nbd_co_send_bitmap(NBDClient *client, uint64_t handle,
BdrvDirtyBitmap *bitmap, uint64_t offset, BdrvDirtyBitmap *bitmap, uint64_t offset,
uint32_t length, bool dont_fragment, bool last, uint32_t length, bool dont_fragment, bool last,
uint32_t context_id, Error **errp) uint32_t context_id, Error **errp)
@ -2295,7 +2295,7 @@ static int nbd_co_send_bitmap(NBDClient *client, uint64_t handle,
* to the client (although the caller may still need to disconnect after * to the client (although the caller may still need to disconnect after
* reporting the error). * reporting the error).
*/ */
static int nbd_co_receive_request(NBDRequestData *req, NBDRequest *request, static int coroutine_fn nbd_co_receive_request(NBDRequestData *req, NBDRequest *request,
Error **errp) Error **errp)
{ {
NBDClient *client = req->client; NBDClient *client = req->client;
@ -2444,7 +2444,7 @@ static coroutine_fn int nbd_do_cmd_read(NBDClient *client, NBDRequest *request,
data, request->len, errp); data, request->len, errp);
} }
ret = blk_pread(exp->common.blk, request->from, request->len, data, 0); ret = blk_co_pread(exp->common.blk, request->from, request->len, data, 0);
if (ret < 0) { if (ret < 0) {
return nbd_send_generic_reply(client, request->handle, ret, return nbd_send_generic_reply(client, request->handle, ret,
"reading from file failed", errp); "reading from file failed", errp);
@ -2511,7 +2511,7 @@ static coroutine_fn int nbd_handle_request(NBDClient *client,
if (request->flags & NBD_CMD_FLAG_FUA) { if (request->flags & NBD_CMD_FLAG_FUA) {
flags |= BDRV_REQ_FUA; flags |= BDRV_REQ_FUA;
} }
ret = blk_pwrite(exp->common.blk, request->from, request->len, data, ret = blk_co_pwrite(exp->common.blk, request->from, request->len, data,
flags); flags);
return nbd_send_generic_reply(client, request->handle, ret, return nbd_send_generic_reply(client, request->handle, ret,
"writing to file failed", errp); "writing to file failed", errp);
@ -2527,7 +2527,7 @@ static coroutine_fn int nbd_handle_request(NBDClient *client,
if (request->flags & NBD_CMD_FLAG_FAST_ZERO) { if (request->flags & NBD_CMD_FLAG_FAST_ZERO) {
flags |= BDRV_REQ_NO_FALLBACK; flags |= BDRV_REQ_NO_FALLBACK;
} }
ret = blk_pwrite_zeroes(exp->common.blk, request->from, request->len, ret = blk_co_pwrite_zeroes(exp->common.blk, request->from, request->len,
flags); flags);
return nbd_send_generic_reply(client, request->handle, ret, return nbd_send_generic_reply(client, request->handle, ret,
"writing to file failed", errp); "writing to file failed", errp);