block/nbd-client: refactor nbd_co_receive_reply

Pass handle parameter directly, as the whole request isn't needed.

Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-Id: <20171012095319.136610-3-vsementsov@virtuozzo.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
This commit is contained in:
Vladimir Sementsov-Ogievskiy 2017-10-12 12:53:08 +03:00 committed by Eric Blake
parent 4bfe4478d1
commit ed397b2fe7

View File

@ -180,11 +180,11 @@ err:
}
static int nbd_co_receive_reply(NBDClientSession *s,
NBDRequest *request,
uint64_t handle,
QEMUIOVector *qiov)
{
int ret;
int i = HANDLE_TO_INDEX(s, request->handle);
int i = HANDLE_TO_INDEX(s, handle);
/* Wait until we're woken up by nbd_read_reply_entry. */
s->requests[i].receiving = true;
@ -193,7 +193,7 @@ static int nbd_co_receive_reply(NBDClientSession *s,
if (!s->ioc || s->quit) {
ret = -EIO;
} else {
assert(s->reply.handle == request->handle);
assert(s->reply.handle == handle);
ret = -s->reply.error;
if (qiov && s->reply.error == 0) {
if (qio_channel_readv_all(s->ioc, qiov->iov, qiov->niov,
@ -241,7 +241,7 @@ static int nbd_co_request(BlockDriverState *bs,
return ret;
}
return nbd_co_receive_reply(client, request,
return nbd_co_receive_reply(client, request->handle,
request->type == NBD_CMD_READ ? qiov : NULL);
}