mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-04 16:23:55 -06:00
nbd/client-connection: return only one io channel
block/nbd doesn't need underlying sioc channel anymore. So, we can update nbd/client-connection interface to return only one top-most io channel, which is more straight forward. Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> Reviewed-by: Eric Blake <eblake@redhat.com> Message-Id: <20210610100802.5888-27-vsementsov@virtuozzo.com> [eblake: squash in Vladimir's fixes for uninit usage caught by clang] Signed-off-by: Eric Blake <eblake@redhat.com>
This commit is contained in:
parent
95a078ea3e
commit
43cb34dede
3 changed files with 33 additions and 22 deletions
13
block/nbd.c
13
block/nbd.c
|
@ -360,7 +360,6 @@ static coroutine_fn void nbd_reconnect_attempt(BDRVNBDState *s)
|
|||
{
|
||||
int ret;
|
||||
AioContext *aio_context = bdrv_get_aio_context(s->bs);
|
||||
QIOChannelSocket *sioc;
|
||||
|
||||
if (!nbd_client_connecting(s)) {
|
||||
return;
|
||||
|
@ -399,20 +398,12 @@ static coroutine_fn void nbd_reconnect_attempt(BDRVNBDState *s)
|
|||
s->ioc = NULL;
|
||||
}
|
||||
|
||||
sioc = nbd_co_establish_connection(s->conn, &s->info, &s->ioc, NULL);
|
||||
if (!sioc) {
|
||||
s->ioc = nbd_co_establish_connection(s->conn, &s->info, NULL);
|
||||
if (!s->ioc) {
|
||||
ret = -ECONNREFUSED;
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (s->ioc) {
|
||||
/* sioc is referenced by s->ioc */
|
||||
object_unref(OBJECT(sioc));
|
||||
} else {
|
||||
s->ioc = QIO_CHANNEL(sioc);
|
||||
}
|
||||
sioc = NULL;
|
||||
|
||||
qio_channel_set_blocking(QIO_CHANNEL(s->ioc), false, NULL);
|
||||
qio_channel_attach_aio_context(QIO_CHANNEL(s->ioc), aio_context);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue