Commit cdd518d5 authored by Pavel Emelyanov's avatar Pavel Emelyanov Committed by J. Bruce Fields

sunrpc: Remove TCP worker wrappers

The v4 and the v6 wrappers only pass the respective family
to the xs_tcp_setup_socket. This family can be taken from the
xprt's sockaddr.
Signed-off-by: default avatarPavel Emelyanov <xemul@openvz.org>
Reviewed-by: default avatarChuck Lever <chuck.lever@oracle.com>
Signed-off-by: default avatarJ. Bruce Fields <bfields@redhat.com>
parent 7dfe1fc3
...@@ -1826,8 +1826,10 @@ static int xs_tcp_finish_connecting(struct rpc_xprt *xprt, struct socket *sock) ...@@ -1826,8 +1826,10 @@ static int xs_tcp_finish_connecting(struct rpc_xprt *xprt, struct socket *sock)
* *
* Invoked by a work queue tasklet. * Invoked by a work queue tasklet.
*/ */
static void xs_tcp_setup_socket(struct sock_xprt *transport, int family) static void xs_tcp_setup_socket(struct work_struct *work)
{ {
struct sock_xprt *transport =
container_of(work, struct sock_xprt, connect_worker.work);
struct socket *sock = transport->sock; struct socket *sock = transport->sock;
struct rpc_xprt *xprt = &transport->xprt; struct rpc_xprt *xprt = &transport->xprt;
int status = -EIO; int status = -EIO;
...@@ -1837,7 +1839,8 @@ static void xs_tcp_setup_socket(struct sock_xprt *transport, int family) ...@@ -1837,7 +1839,8 @@ static void xs_tcp_setup_socket(struct sock_xprt *transport, int family)
if (!sock) { if (!sock) {
clear_bit(XPRT_CONNECTION_ABORT, &xprt->state); clear_bit(XPRT_CONNECTION_ABORT, &xprt->state);
sock = xs_create_sock(xprt, transport, family, SOCK_STREAM, IPPROTO_TCP); sock = xs_create_sock(xprt, transport,
xs_addr(xprt)->sa_family, SOCK_STREAM, IPPROTO_TCP);
if (IS_ERR(sock)) { if (IS_ERR(sock)) {
status = PTR_ERR(sock); status = PTR_ERR(sock);
goto out; goto out;
...@@ -1897,34 +1900,6 @@ static void xs_tcp_setup_socket(struct sock_xprt *transport, int family) ...@@ -1897,34 +1900,6 @@ static void xs_tcp_setup_socket(struct sock_xprt *transport, int family)
xprt_wake_pending_tasks(xprt, status); xprt_wake_pending_tasks(xprt, status);
} }
/**
* xs_tcp_connect_worker4 - connect a TCP socket to a remote endpoint
* @work: RPC transport to connect
*
* Invoked by a work queue tasklet.
*/
static void xs_tcp_connect_worker4(struct work_struct *work)
{
struct sock_xprt *transport =
container_of(work, struct sock_xprt, connect_worker.work);
xs_tcp_setup_socket(transport, PF_INET);
}
/**
* xs_tcp_connect_worker6 - connect a TCP socket to a remote endpoint
* @work: RPC transport to connect
*
* Invoked by a work queue tasklet.
*/
static void xs_tcp_connect_worker6(struct work_struct *work)
{
struct sock_xprt *transport =
container_of(work, struct sock_xprt, connect_worker.work);
xs_tcp_setup_socket(transport, PF_INET6);
}
/** /**
* xs_connect - connect a socket to a remote endpoint * xs_connect - connect a socket to a remote endpoint
* @task: address of RPC task that manages state of connect request * @task: address of RPC task that manages state of connect request
...@@ -2328,7 +2303,7 @@ static struct rpc_xprt *xs_setup_tcp(struct xprt_create *args) ...@@ -2328,7 +2303,7 @@ static struct rpc_xprt *xs_setup_tcp(struct xprt_create *args)
xprt_set_bound(xprt); xprt_set_bound(xprt);
INIT_DELAYED_WORK(&transport->connect_worker, INIT_DELAYED_WORK(&transport->connect_worker,
xs_tcp_connect_worker4); xs_tcp_setup_socket);
xs_format_peer_addresses(xprt, "tcp", RPCBIND_NETID_TCP); xs_format_peer_addresses(xprt, "tcp", RPCBIND_NETID_TCP);
break; break;
case AF_INET6: case AF_INET6:
...@@ -2336,7 +2311,7 @@ static struct rpc_xprt *xs_setup_tcp(struct xprt_create *args) ...@@ -2336,7 +2311,7 @@ static struct rpc_xprt *xs_setup_tcp(struct xprt_create *args)
xprt_set_bound(xprt); xprt_set_bound(xprt);
INIT_DELAYED_WORK(&transport->connect_worker, INIT_DELAYED_WORK(&transport->connect_worker,
xs_tcp_connect_worker6); xs_tcp_setup_socket);
xs_format_peer_addresses(xprt, "tcp", RPCBIND_NETID_TCP6); xs_format_peer_addresses(xprt, "tcp", RPCBIND_NETID_TCP6);
break; break;
default: default:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment