uring: Change the location of spdk_uring_sock_group_impl_remove_sock

Purpose: prepare for the next patch

Signed-off-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/2048 (master)

(cherry picked from commit 15a415461c)
Change-Id: Iae6a3d7a2c90a78c7dd1e510e718e4e1c07b3f32
Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/2082
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
This commit is contained in:
Ziye Yang 2020-04-28 05:27:29 +08:00 committed by Tomasz Zawadzki
parent 3f2d3a6ff2
commit 9d04c1d2f7

View File

@ -1162,37 +1162,6 @@ spdk_uring_sock_group_impl_add_sock(struct spdk_sock_group_impl *_group,
return 0;
}
static int
spdk_uring_sock_group_impl_remove_sock(struct spdk_sock_group_impl *_group,
struct spdk_sock *_sock)
{
struct spdk_uring_sock *sock = __uring_sock(_sock);
struct spdk_uring_sock_group_impl *group = __uring_group_impl(_group);
if (sock->write_task.status != SPDK_URING_SOCK_TASK_NOT_IN_USE) {
sock->outstanding_io++;
}
if (sock->pollin_task.status != SPDK_URING_SOCK_TASK_NOT_IN_USE) {
sock->outstanding_io++;
}
if (sock->recv_pipe != NULL) {
if (spdk_pipe_reader_bytes_available(sock->recv_pipe) > 0) {
TAILQ_REMOVE(&group->pending_recv, sock, link);
sock->pending_recv = false;
}
assert(sock->pending_recv == false);
}
if (!sock->outstanding_io) {
sock->group = NULL;
}
return 0;
}
static int
spdk_uring_sock_group_impl_poll(struct spdk_sock_group_impl *_group, int max_events,
struct spdk_sock **socks)
@ -1231,6 +1200,37 @@ spdk_uring_sock_group_impl_poll(struct spdk_sock_group_impl *_group, int max_eve
return count;
}
static int
spdk_uring_sock_group_impl_remove_sock(struct spdk_sock_group_impl *_group,
struct spdk_sock *_sock)
{
struct spdk_uring_sock *sock = __uring_sock(_sock);
struct spdk_uring_sock_group_impl *group = __uring_group_impl(_group);
if (sock->write_task.status != SPDK_URING_SOCK_TASK_NOT_IN_USE) {
sock->outstanding_io++;
}
if (sock->pollin_task.status != SPDK_URING_SOCK_TASK_NOT_IN_USE) {
sock->outstanding_io++;
}
if (sock->recv_pipe != NULL) {
if (spdk_pipe_reader_bytes_available(sock->recv_pipe) > 0) {
TAILQ_REMOVE(&group->pending_recv, sock, link);
sock->pending_recv = false;
}
assert(sock->pending_recv == false);
}
if (!sock->outstanding_io) {
sock->group = NULL;
}
return 0;
}
static int
spdk_uring_sock_group_impl_close(struct spdk_sock_group_impl *_group)
{