forked from luck/tmp_suning_uos_patched
SUNRPC: Clean up - rename xs_tcp_data_receive() to xs_stream_data_receive()
In preparation for sharing with AF_LOCAL. Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
This commit is contained in:
parent
277e4ab7d5
commit
c50b8ee02f
|
@ -470,14 +470,14 @@ TRACE_EVENT(xprt_ping,
|
|||
__get_str(addr), __get_str(port), __entry->status)
|
||||
);
|
||||
|
||||
TRACE_EVENT(xs_tcp_data_ready,
|
||||
TP_PROTO(struct rpc_xprt *xprt, int err, unsigned int total),
|
||||
TRACE_EVENT(xs_stream_read_data,
|
||||
TP_PROTO(struct rpc_xprt *xprt, ssize_t err, size_t total),
|
||||
|
||||
TP_ARGS(xprt, err, total),
|
||||
|
||||
TP_STRUCT__entry(
|
||||
__field(int, err)
|
||||
__field(unsigned int, total)
|
||||
__field(ssize_t, err)
|
||||
__field(size_t, total)
|
||||
__string(addr, xprt ? xprt->address_strings[RPC_DISPLAY_ADDR] :
|
||||
"(null)")
|
||||
__string(port, xprt ? xprt->address_strings[RPC_DISPLAY_PORT] :
|
||||
|
@ -493,11 +493,11 @@ TRACE_EVENT(xs_tcp_data_ready,
|
|||
xprt->address_strings[RPC_DISPLAY_PORT] : "(null)");
|
||||
),
|
||||
|
||||
TP_printk("peer=[%s]:%s err=%d total=%u", __get_str(addr),
|
||||
TP_printk("peer=[%s]:%s err=%zd total=%zu", __get_str(addr),
|
||||
__get_str(port), __entry->err, __entry->total)
|
||||
);
|
||||
|
||||
TRACE_EVENT(xs_tcp_data_recv,
|
||||
TRACE_EVENT(xs_stream_read_request,
|
||||
TP_PROTO(struct sock_xprt *xs),
|
||||
|
||||
TP_ARGS(xs),
|
||||
|
@ -508,7 +508,7 @@ TRACE_EVENT(xs_tcp_data_recv,
|
|||
__field(u32, xid)
|
||||
__field(unsigned long, copied)
|
||||
__field(unsigned int, reclen)
|
||||
__field(unsigned long, offset)
|
||||
__field(unsigned int, offset)
|
||||
),
|
||||
|
||||
TP_fast_assign(
|
||||
|
@ -520,7 +520,7 @@ TRACE_EVENT(xs_tcp_data_recv,
|
|||
__entry->offset = xs->recv.offset;
|
||||
),
|
||||
|
||||
TP_printk("peer=[%s]:%s xid=0x%08x copied=%lu reclen=%u offset=%lu",
|
||||
TP_printk("peer=[%s]:%s xid=0x%08x copied=%lu reclen=%u offset=%u",
|
||||
__get_str(addr), __get_str(port), __entry->xid,
|
||||
__entry->copied, __entry->reclen, __entry->offset)
|
||||
);
|
||||
|
|
|
@ -626,7 +626,7 @@ xs_read_stream(struct sock_xprt *transport, int flags)
|
|||
return -EAGAIN;
|
||||
}
|
||||
if (xs_read_stream_request_done(transport)) {
|
||||
trace_xs_tcp_data_recv(transport);
|
||||
trace_xs_stream_read_request(transport);
|
||||
transport->recv.copied = 0;
|
||||
}
|
||||
transport->recv.offset = 0;
|
||||
|
@ -642,6 +642,34 @@ xs_read_stream(struct sock_xprt *transport, int flags)
|
|||
return ret;
|
||||
}
|
||||
|
||||
static void xs_stream_data_receive(struct sock_xprt *transport)
|
||||
{
|
||||
size_t read = 0;
|
||||
ssize_t ret = 0;
|
||||
|
||||
mutex_lock(&transport->recv_mutex);
|
||||
if (transport->sock == NULL)
|
||||
goto out;
|
||||
clear_bit(XPRT_SOCK_DATA_READY, &transport->sock_state);
|
||||
for (;;) {
|
||||
ret = xs_read_stream(transport, MSG_DONTWAIT);
|
||||
if (ret <= 0)
|
||||
break;
|
||||
read += ret;
|
||||
cond_resched();
|
||||
}
|
||||
out:
|
||||
mutex_unlock(&transport->recv_mutex);
|
||||
trace_xs_stream_read_data(&transport->xprt, ret, read);
|
||||
}
|
||||
|
||||
static void xs_stream_data_receive_workfn(struct work_struct *work)
|
||||
{
|
||||
struct sock_xprt *transport =
|
||||
container_of(work, struct sock_xprt, recv_worker);
|
||||
xs_stream_data_receive(transport);
|
||||
}
|
||||
|
||||
#define XS_SENDMSG_FLAGS (MSG_DONTWAIT | MSG_NOSIGNAL)
|
||||
|
||||
static int xs_send_kvec(struct socket *sock, struct sockaddr *addr, int addrlen, struct kvec *vec, unsigned int base, int more)
|
||||
|
@ -1498,45 +1526,6 @@ static size_t xs_tcp_bc_maxpayload(struct rpc_xprt *xprt)
|
|||
}
|
||||
#endif /* CONFIG_SUNRPC_BACKCHANNEL */
|
||||
|
||||
static void xs_tcp_data_receive(struct sock_xprt *transport)
|
||||
{
|
||||
struct rpc_xprt *xprt = &transport->xprt;
|
||||
struct sock *sk;
|
||||
size_t read = 0;
|
||||
ssize_t ret = 0;
|
||||
|
||||
restart:
|
||||
mutex_lock(&transport->recv_mutex);
|
||||
sk = transport->inet;
|
||||
if (sk == NULL)
|
||||
goto out;
|
||||
|
||||
for (;;) {
|
||||
clear_bit(XPRT_SOCK_DATA_READY, &transport->sock_state);
|
||||
ret = xs_read_stream(transport, MSG_DONTWAIT | MSG_NOSIGNAL);
|
||||
if (ret < 0)
|
||||
break;
|
||||
read += ret;
|
||||
if (need_resched()) {
|
||||
mutex_unlock(&transport->recv_mutex);
|
||||
cond_resched();
|
||||
goto restart;
|
||||
}
|
||||
}
|
||||
if (test_bit(XPRT_SOCK_DATA_READY, &transport->sock_state))
|
||||
queue_work(xprtiod_workqueue, &transport->recv_worker);
|
||||
out:
|
||||
mutex_unlock(&transport->recv_mutex);
|
||||
trace_xs_tcp_data_ready(xprt, ret, read);
|
||||
}
|
||||
|
||||
static void xs_tcp_data_receive_workfn(struct work_struct *work)
|
||||
{
|
||||
struct sock_xprt *transport =
|
||||
container_of(work, struct sock_xprt, recv_worker);
|
||||
xs_tcp_data_receive(transport);
|
||||
}
|
||||
|
||||
/**
|
||||
* xs_tcp_state_change - callback to handle TCP socket state changes
|
||||
* @sk: socket whose state has changed
|
||||
|
@ -3066,7 +3055,7 @@ static struct rpc_xprt *xs_setup_tcp(struct xprt_create *args)
|
|||
xprt->connect_timeout = xprt->timeout->to_initval *
|
||||
(xprt->timeout->to_retries + 1);
|
||||
|
||||
INIT_WORK(&transport->recv_worker, xs_tcp_data_receive_workfn);
|
||||
INIT_WORK(&transport->recv_worker, xs_stream_data_receive_workfn);
|
||||
INIT_DELAYED_WORK(&transport->connect_worker, xs_tcp_setup_socket);
|
||||
|
||||
switch (addr->sa_family) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user