diff options
author | Trond Myklebust <trond.myklebust@primarydata.com> | 2014-08-03 13:03:13 -0400 |
---|---|---|
committer | J. Bruce Fields <bfields@redhat.com> | 2014-08-17 12:00:11 -0400 |
commit | f8d1ff47b6858c1a26a658060c18a778696636db (patch) | |
tree | 8e5f87dd99a3fcc5cc8f3ff0c8be98167e34e779 /net | |
parent | 0c0746d03eac70e12bcb39e7f1c7f0a1dd31123c (diff) |
SUNRPC: Optimise away svc_recv_available
We really do not want to do ioctls in the server's fast path. Instead, let's
use the fact that we managed to read a full record as the indicator that
we should try to read the socket again.
Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Diffstat (limited to 'net')
-rw-r--r-- | net/sunrpc/svcsock.c | 23 |
1 files changed, 6 insertions, 17 deletions
diff --git a/net/sunrpc/svcsock.c b/net/sunrpc/svcsock.c index c24a8ff33f8f..0e8b667337a2 100644 --- a/net/sunrpc/svcsock.c +++ b/net/sunrpc/svcsock.c | |||
@@ -312,19 +312,6 @@ static int svc_one_sock_name(struct svc_sock *svsk, char *buf, int remaining) | |||
312 | } | 312 | } |
313 | 313 | ||
314 | /* | 314 | /* |
315 | * Check input queue length | ||
316 | */ | ||
317 | static int svc_recv_available(struct svc_sock *svsk) | ||
318 | { | ||
319 | struct socket *sock = svsk->sk_sock; | ||
320 | int avail, err; | ||
321 | |||
322 | err = kernel_sock_ioctl(sock, TIOCINQ, (unsigned long) &avail); | ||
323 | |||
324 | return (err >= 0)? avail : err; | ||
325 | } | ||
326 | |||
327 | /* | ||
328 | * Generic recvfrom routine. | 315 | * Generic recvfrom routine. |
329 | */ | 316 | */ |
330 | static int svc_recvfrom(struct svc_rqst *rqstp, struct kvec *iov, int nr, | 317 | static int svc_recvfrom(struct svc_rqst *rqstp, struct kvec *iov, int nr, |
@@ -339,8 +326,14 @@ static int svc_recvfrom(struct svc_rqst *rqstp, struct kvec *iov, int nr, | |||
339 | 326 | ||
340 | rqstp->rq_xprt_hlen = 0; | 327 | rqstp->rq_xprt_hlen = 0; |
341 | 328 | ||
329 | clear_bit(XPT_DATA, &svsk->sk_xprt.xpt_flags); | ||
342 | len = kernel_recvmsg(svsk->sk_sock, &msg, iov, nr, buflen, | 330 | len = kernel_recvmsg(svsk->sk_sock, &msg, iov, nr, buflen, |
343 | msg.msg_flags); | 331 | msg.msg_flags); |
332 | /* If we read a full record, then assume there may be more | ||
333 | * data to read (stream based sockets only!) | ||
334 | */ | ||
335 | if (len == buflen) | ||
336 | set_bit(XPT_DATA, &svsk->sk_xprt.xpt_flags); | ||
344 | 337 | ||
345 | dprintk("svc: socket %p recvfrom(%p, %Zu) = %d\n", | 338 | dprintk("svc: socket %p recvfrom(%p, %Zu) = %d\n", |
346 | svsk, iov[0].iov_base, iov[0].iov_len, len); | 339 | svsk, iov[0].iov_base, iov[0].iov_len, len); |
@@ -980,8 +973,6 @@ static int svc_tcp_recv_record(struct svc_sock *svsk, struct svc_rqst *rqstp) | |||
980 | unsigned int want; | 973 | unsigned int want; |
981 | int len; | 974 | int len; |
982 | 975 | ||
983 | clear_bit(XPT_DATA, &svsk->sk_xprt.xpt_flags); | ||
984 | |||
985 | if (svsk->sk_tcplen < sizeof(rpc_fraghdr)) { | 976 | if (svsk->sk_tcplen < sizeof(rpc_fraghdr)) { |
986 | struct kvec iov; | 977 | struct kvec iov; |
987 | 978 | ||
@@ -1073,8 +1064,6 @@ static int copy_pages_to_kvecs(struct kvec *vec, struct page **pages, int len) | |||
1073 | static void svc_tcp_fragment_received(struct svc_sock *svsk) | 1064 | static void svc_tcp_fragment_received(struct svc_sock *svsk) |
1074 | { | 1065 | { |
1075 | /* If we have more data, signal svc_xprt_enqueue() to try again */ | 1066 | /* If we have more data, signal svc_xprt_enqueue() to try again */ |
1076 | if (svc_recv_available(svsk) > sizeof(rpc_fraghdr)) | ||
1077 | set_bit(XPT_DATA, &svsk->sk_xprt.xpt_flags); | ||
1078 | dprintk("svc: TCP %s record (%d bytes)\n", | 1067 | dprintk("svc: TCP %s record (%d bytes)\n", |
1079 | svc_sock_final_rec(svsk) ? "final" : "nonfinal", | 1068 | svc_sock_final_rec(svsk) ? "final" : "nonfinal", |
1080 | svc_sock_reclen(svsk)); | 1069 | svc_sock_reclen(svsk)); |