提交 ed397b2f 编写于 作者: V Vladimir Sementsov-Ogievskiy 提交者: Eric Blake

block/nbd-client: refactor nbd_co_receive_reply

Pass handle parameter directly, as the whole request isn't needed.
Signed-off-by: NVladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Reviewed-by: NEric Blake <eblake@redhat.com>
Message-Id: <20171012095319.136610-3-vsementsov@virtuozzo.com>
Signed-off-by: NEric Blake <eblake@redhat.com>
上级 4bfe4478
......@@ -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);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册