提交 05ed690e 编写于 作者: N NeilBrown 提交者: Linus Torvalds

knfsd: simplify a 'while' condition in svcsock.c

This while loop has an overly complex condition, which performs a couple of
assignments.  This hurts readability.

We don't really need a loop at all.  We can just return -EAGAIN and (providing
we set SK_DATA), the function will be called again.

So discard the loop, make the complex conditional become a few clear function
calls, and hopefully improve readability.
Signed-off-by: NNeil Brown <neilb@suse.de>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 c5e434c9
...@@ -788,15 +788,20 @@ svc_udp_recvfrom(struct svc_rqst *rqstp) ...@@ -788,15 +788,20 @@ svc_udp_recvfrom(struct svc_rqst *rqstp)
} }
clear_bit(SK_DATA, &svsk->sk_flags); clear_bit(SK_DATA, &svsk->sk_flags);
while ((err = kernel_recvmsg(svsk->sk_sock, &msg, NULL, skb = NULL;
0, 0, MSG_PEEK | MSG_DONTWAIT)) < 0 || err = kernel_recvmsg(svsk->sk_sock, &msg, NULL,
(skb = skb_recv_datagram(svsk->sk_sk, 0, 1, &err)) == NULL) { 0, 0, MSG_PEEK | MSG_DONTWAIT);
if (err == -EAGAIN) { if (err >= 0)
svc_sock_received(svsk); skb = skb_recv_datagram(svsk->sk_sk, 0, 1, &err);
return err;
} if (skb == NULL) {
if (err != -EAGAIN) {
/* possibly an icmp error */ /* possibly an icmp error */
dprintk("svc: recvfrom returned error %d\n", -err); dprintk("svc: recvfrom returned error %d\n", -err);
set_bit(SK_DATA, &svsk->sk_flags);
}
svc_sock_received(svsk);
return -EAGAIN;
} }
rqstp->rq_addrlen = sizeof(rqstp->rq_addr); rqstp->rq_addrlen = sizeof(rqstp->rq_addr);
if (skb->tstamp.tv64 == 0) { if (skb->tstamp.tv64 == 0) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册