Skip to content

Commit

Permalink
block/nbd-client: refactor nbd_co_receive_reply
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Vladimir Sementsov-Ogievskiy authored and ebblake committed Oct 12, 2017
1 parent 4bfe447 commit ed397b2
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions block/nbd-client.c
Expand Up @@ -180,11 +180,11 @@ static int nbd_co_send_request(BlockDriverState *bs,
}

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;
Expand All @@ -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,
Expand Down Expand Up @@ -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);
}

Expand Down

0 comments on commit ed397b2

Please sign in to comment.