[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 31/41] nbd/server: remove NBDClientNewData
From: |
Paolo Bonzini |
Subject: |
[Qemu-devel] [PULL 31/41] nbd/server: remove NBDClientNewData |
Date: |
Thu, 15 Jun 2017 12:52:51 +0200 |
From: Vladimir Sementsov-Ogievskiy <address@hidden>
"co" field of NBDClientNewData has never been used, all the way back to
its declaration in commit 1a6245a5. So let's just use client pointer
instead of extra structure.
Signed-off-by: Vladimir Sementsov-Ogievskiy <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
Message-Id: <address@hidden>
Signed-off-by: Paolo Bonzini <address@hidden>
---
nbd/server.c | 25 +++++++------------------
1 file changed, 7 insertions(+), 18 deletions(-)
diff --git a/nbd/server.c b/nbd/server.c
index 9fb03ce..d526827 100644
--- a/nbd/server.c
+++ b/nbd/server.c
@@ -535,14 +535,8 @@ static int nbd_negotiate_options(NBDClient *client)
}
}
-typedef struct {
- NBDClient *client;
- Coroutine *co;
-} NBDClientNewData;
-
-static coroutine_fn int nbd_negotiate(NBDClientNewData *data)
+static coroutine_fn int nbd_negotiate(NBDClient *client)
{
- NBDClient *client = data->client;
char buf[8 + 8 + 8 + 128];
int rc;
const uint16_t myflags = (NBD_FLAG_HAS_FLAGS | NBD_FLAG_SEND_TRIM |
@@ -1268,8 +1262,7 @@ static void nbd_client_receive_next_request(NBDClient
*client)
static coroutine_fn void nbd_co_client_start(void *opaque)
{
- NBDClientNewData *data = opaque;
- NBDClient *client = data->client;
+ NBDClient *client = opaque;
NBDExport *exp = client->exp;
if (exp) {
@@ -1278,15 +1271,12 @@ static coroutine_fn void nbd_co_client_start(void
*opaque)
}
qemu_co_mutex_init(&client->send_lock);
- if (nbd_negotiate(data)) {
+ if (nbd_negotiate(client)) {
client_close(client, false);
- goto out;
+ return;
}
nbd_client_receive_next_request(client);
-
-out:
- g_free(data);
}
/*
@@ -1302,7 +1292,7 @@ void nbd_client_new(NBDExport *exp,
void (*close_fn)(NBDClient *, bool))
{
NBDClient *client;
- NBDClientNewData *data = g_new(NBDClientNewData, 1);
+ Coroutine *co;
client = g_malloc0(sizeof(NBDClient));
client->refcount = 1;
@@ -1318,7 +1308,6 @@ void nbd_client_new(NBDExport *exp,
object_ref(OBJECT(client->ioc));
client->close_fn = close_fn;
- data->client = client;
- data->co = qemu_coroutine_create(nbd_co_client_start, data);
- qemu_coroutine_enter(data->co);
+ co = qemu_coroutine_create(nbd_co_client_start, client);
+ qemu_coroutine_enter(co);
}
--
1.8.3.1
- [Qemu-devel] [PULL 29/41] nbd/server: get rid of EAGAIN dead code, (continued)
- [Qemu-devel] [PULL 29/41] nbd/server: get rid of EAGAIN dead code, Paolo Bonzini, 2017/06/15
- [Qemu-devel] [PULL 35/41] nbd/server: refactor nbd_trip, Paolo Bonzini, 2017/06/15
- [Qemu-devel] [PULL 10/41] megasas: do not read DCMD opcode more than once from frame, Paolo Bonzini, 2017/06/15
- [Qemu-devel] [PULL 11/41] megasas: do not read command more than once from frame, Paolo Bonzini, 2017/06/15
- [Qemu-devel] [PULL 05/41] ivshmem: use ram_from_fd(), Paolo Bonzini, 2017/06/15
- [Qemu-devel] [PULL 18/41] nbd: Fix regression on resiliency to port scan, Paolo Bonzini, 2017/06/15
- [Qemu-devel] [PULL 07/41] megasas: add qtest, Paolo Bonzini, 2017/06/15
- [Qemu-devel] [PULL 24/41] nbd: rename read_sync and friends, Paolo Bonzini, 2017/06/15
- [Qemu-devel] [PULL 30/41] nbd/server: refactor nbd_co_receive_request, Paolo Bonzini, 2017/06/15
- [Qemu-devel] [PULL 34/41] nbd/server: rename rc to ret, Paolo Bonzini, 2017/06/15
- [Qemu-devel] [PULL 31/41] nbd/server: remove NBDClientNewData,
Paolo Bonzini <=
- [Qemu-devel] [PULL 32/41] nbd/server: nbd_negotiate: fix error path, Paolo Bonzini, 2017/06/15
- [Qemu-devel] [PULL 36/41] include/exec/poison: Add missing TARGET defines, Paolo Bonzini, 2017/06/15
- [Qemu-devel] [PULL 33/41] nbd/server: get rid of fail: return rc, Paolo Bonzini, 2017/06/15
- [Qemu-devel] [PULL 37/41] include/exec/poison: Mark some CONFIG defines as poisoned, too, Paolo Bonzini, 2017/06/15
- [Qemu-devel] [PULL 38/41] docs: create interop/ subdirectory, Paolo Bonzini, 2017/06/15
- [Qemu-devel] [PULL 39/41] qemu-doc: include version number, Paolo Bonzini, 2017/06/15
- [Qemu-devel] [PULL 40/41] vhost-user-scsi: Introduce vhost-user-scsi host device, Paolo Bonzini, 2017/06/15
- [Qemu-devel] [PULL 41/41] vhost-user-scsi: Introduce a vhost-user-scsi sample application, Paolo Bonzini, 2017/06/15
- Re: [Qemu-devel] [PULL 00/41] Misc patches for 2017-06-15, Peter Maydell, 2017/06/20