nbd/server: refactor nbd_co_send_reply
As nbd_write never returns value > 0, we can get rid of extra ret. Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> Reviewed-by: Eric Blake <eblake@redhat.com> Message-Id: <20170602150150.258222-6-vsementsov@virtuozzo.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
parent
a0dc63a6b7
commit
572b97e722
|
@ -972,7 +972,7 @@ void nbd_export_close_all(void)
|
||||||
static int nbd_co_send_reply(NBDRequestData *req, NBDReply *reply, int len)
|
static int nbd_co_send_reply(NBDRequestData *req, NBDReply *reply, int len)
|
||||||
{
|
{
|
||||||
NBDClient *client = req->client;
|
NBDClient *client = req->client;
|
||||||
int rc, ret;
|
int rc;
|
||||||
|
|
||||||
g_assert(qemu_in_coroutine());
|
g_assert(qemu_in_coroutine());
|
||||||
qemu_co_mutex_lock(&client->send_lock);
|
qemu_co_mutex_lock(&client->send_lock);
|
||||||
|
@ -983,9 +983,9 @@ static int nbd_co_send_reply(NBDRequestData *req, NBDReply *reply, int len)
|
||||||
} else {
|
} else {
|
||||||
qio_channel_set_cork(client->ioc, true);
|
qio_channel_set_cork(client->ioc, true);
|
||||||
rc = nbd_send_reply(client->ioc, reply);
|
rc = nbd_send_reply(client->ioc, reply);
|
||||||
if (rc >= 0) {
|
if (rc == 0) {
|
||||||
ret = nbd_write(client->ioc, req->data, len, NULL);
|
rc = nbd_write(client->ioc, req->data, len, NULL);
|
||||||
if (ret < 0) {
|
if (rc < 0) {
|
||||||
rc = -EIO;
|
rc = -EIO;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue