Move code from nbd_coroutine_end into nbd_co_request. The function nbd_coroutine_end is not needed separately, also it is better to have in_flight-- in nbd_co_request as in_flight++ lives in nbd_co_request too.
Signed-off-by: Vladimir Sementsov-Ogievskiy <vsement...@virtuozzo.com> --- block/nbd-client.c | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/block/nbd-client.c b/block/nbd-client.c index db1d7025fa..d6965d24db 100644 --- a/block/nbd-client.c +++ b/block/nbd-client.c @@ -112,9 +112,6 @@ static coroutine_fn void nbd_read_reply_entry(void *opaque) s->read_reply_co = NULL; } -static void nbd_coroutine_end(BlockDriverState *bs, - NBDRequest *request); - static int nbd_co_request(BlockDriverState *bs, NBDRequest *request, QEMUIOVector *qiov) @@ -193,16 +190,6 @@ static int nbd_co_request(BlockDriverState *bs, rc = -reply.error; out: - nbd_coroutine_end(bs, request); - return rc; -} - -static void nbd_coroutine_end(BlockDriverState *bs, - NBDRequest *request) -{ - NBDClientSession *s = nbd_get_client_session(bs); - int i = HANDLE_TO_INDEX(s, request->handle); - s->recv_coroutine[i] = NULL; /* Kick the read_reply_co to get the next reply. */ @@ -214,6 +201,7 @@ static void nbd_coroutine_end(BlockDriverState *bs, s->in_flight--; qemu_co_queue_next(&s->free_sema); qemu_co_mutex_unlock(&s->send_mutex); + return rc; } int nbd_client_co_preadv(BlockDriverState *bs, uint64_t offset, -- 2.11.1