SUNRPC: Consolidate xs_tcp_data_ready and xs_data_ready
authorTrond Myklebust <trond.myklebust@primarydata.com>
Sun, 29 May 2016 14:13:24 +0000 (10:13 -0400)
committerTrond Myklebust <trond.myklebust@primarydata.com>
Mon, 13 Jun 2016 16:35:51 +0000 (12:35 -0400)
The only difference between the two at this point is the reset of
the connection timeout, and since everyone expect tcp ignore that value,
we can just throw it into the generic function.

Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
net/sunrpc/xprtsock.c

index 2f21780277616a62642262441d88f65ebae4a2bf..62b4f5a2a331b8058cc36f0d5edcea4cebf207f8 100644 (file)
@@ -1088,6 +1088,12 @@ static void xs_data_ready(struct sock *sk)
        if (xprt != NULL) {
                struct sock_xprt *transport = container_of(xprt,
                                struct sock_xprt, xprt);
+               transport->old_data_ready(sk);
+               /* Any data means we had a useful conversation, so
+                * then we don't need to delay the next reconnect
+                */
+               if (xprt->reestablish_timeout)
+                       xprt->reestablish_timeout = 0;
                if (!test_and_set_bit(XPRT_SOCK_DATA_READY, &transport->sock_state))
                        queue_work(rpciod_workqueue, &transport->recv_worker);
        }
@@ -1512,36 +1518,6 @@ static void xs_tcp_data_receive_workfn(struct work_struct *work)
        xs_tcp_data_receive(transport);
 }
 
-/**
- * xs_tcp_data_ready - "data ready" callback for TCP sockets
- * @sk: socket with data to read
- *
- */
-static void xs_tcp_data_ready(struct sock *sk)
-{
-       struct sock_xprt *transport;
-       struct rpc_xprt *xprt;
-
-       dprintk("RPC:       xs_tcp_data_ready...\n");
-
-       read_lock_bh(&sk->sk_callback_lock);
-       if (!(xprt = xprt_from_sock(sk)))
-               goto out;
-       transport = container_of(xprt, struct sock_xprt, xprt);
-       if (test_and_set_bit(XPRT_SOCK_DATA_READY, &transport->sock_state))
-               goto out;
-
-       /* Any data means we had a useful conversation, so
-        * the we don't need to delay the next reconnect
-        */
-       if (xprt->reestablish_timeout)
-               xprt->reestablish_timeout = 0;
-       queue_work(rpciod_workqueue, &transport->recv_worker);
-
-out:
-       read_unlock_bh(&sk->sk_callback_lock);
-}
-
 /**
  * xs_tcp_state_change - callback to handle TCP socket state changes
  * @sk: socket whose state has changed
@@ -2263,7 +2239,7 @@ static int xs_tcp_finish_connecting(struct rpc_xprt *xprt, struct socket *sock)
                xs_save_old_callbacks(transport, sk);
 
                sk->sk_user_data = xprt;
-               sk->sk_data_ready = xs_tcp_data_ready;
+               sk->sk_data_ready = xs_data_ready;
                sk->sk_state_change = xs_tcp_state_change;
                sk->sk_write_space = xs_tcp_write_space;
                sock_set_flag(sk, SOCK_FASYNC);