diff options
author | Chuck Lever <chuck.lever@oracle.com> | 2016-05-04 10:53:39 -0400 |
---|---|---|
committer | J. Bruce Fields <bfields@redhat.com> | 2016-05-13 15:53:06 -0400 |
commit | 84f225c23d8906c9371d0749e062975c018ef6c4 (patch) | |
tree | f52e441efe08cd9e7f53d442246226bf3ee1a794 | |
parent | 76ee8fd64ac9af36b03b68912c18b3d3cd5c99de (diff) |
svcrdma: Eliminate code duplication in svc_rdma_recvfrom()
Clean up.
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
-rw-r--r-- | net/sunrpc/xprtrdma/svc_rdma_recvfrom.c | 26 |
1 files changed, 5 insertions, 21 deletions
diff --git a/net/sunrpc/xprtrdma/svc_rdma_recvfrom.c b/net/sunrpc/xprtrdma/svc_rdma_recvfrom.c index 12e78997bf19..1b72f351fbd3 100644 --- a/net/sunrpc/xprtrdma/svc_rdma_recvfrom.c +++ b/net/sunrpc/xprtrdma/svc_rdma_recvfrom.c | |||
@@ -508,11 +508,10 @@ static int rdma_read_chunks(struct svcxprt_rdma *xprt, | |||
508 | return ret; | 508 | return ret; |
509 | } | 509 | } |
510 | 510 | ||
511 | static int rdma_read_complete(struct svc_rqst *rqstp, | 511 | static void rdma_read_complete(struct svc_rqst *rqstp, |
512 | struct svc_rdma_op_ctxt *head) | 512 | struct svc_rdma_op_ctxt *head) |
513 | { | 513 | { |
514 | int page_no; | 514 | int page_no; |
515 | int ret; | ||
516 | 515 | ||
517 | /* Copy RPC pages */ | 516 | /* Copy RPC pages */ |
518 | for (page_no = 0; page_no < head->count; page_no++) { | 517 | for (page_no = 0; page_no < head->count; page_no++) { |
@@ -548,23 +547,6 @@ static int rdma_read_complete(struct svc_rqst *rqstp, | |||
548 | rqstp->rq_arg.tail[0] = head->arg.tail[0]; | 547 | rqstp->rq_arg.tail[0] = head->arg.tail[0]; |
549 | rqstp->rq_arg.len = head->arg.len; | 548 | rqstp->rq_arg.len = head->arg.len; |
550 | rqstp->rq_arg.buflen = head->arg.buflen; | 549 | rqstp->rq_arg.buflen = head->arg.buflen; |
551 | |||
552 | /* Free the context */ | ||
553 | svc_rdma_put_context(head, 0); | ||
554 | |||
555 | /* XXX: What should this be? */ | ||
556 | rqstp->rq_prot = IPPROTO_MAX; | ||
557 | svc_xprt_copy_addrs(rqstp, rqstp->rq_xprt); | ||
558 | |||
559 | ret = rqstp->rq_arg.head[0].iov_len | ||
560 | + rqstp->rq_arg.page_len | ||
561 | + rqstp->rq_arg.tail[0].iov_len; | ||
562 | dprintk("svcrdma: deferred read ret=%d, rq_arg.len=%u, " | ||
563 | "rq_arg.head[0].iov_base=%p, rq_arg.head[0].iov_len=%zu\n", | ||
564 | ret, rqstp->rq_arg.len, rqstp->rq_arg.head[0].iov_base, | ||
565 | rqstp->rq_arg.head[0].iov_len); | ||
566 | |||
567 | return ret; | ||
568 | } | 550 | } |
569 | 551 | ||
570 | /* By convention, backchannel calls arrive via rdma_msg type | 552 | /* By convention, backchannel calls arrive via rdma_msg type |
@@ -622,7 +604,8 @@ int svc_rdma_recvfrom(struct svc_rqst *rqstp) | |||
622 | dto_q); | 604 | dto_q); |
623 | list_del_init(&ctxt->dto_q); | 605 | list_del_init(&ctxt->dto_q); |
624 | spin_unlock_bh(&rdma_xprt->sc_rq_dto_lock); | 606 | spin_unlock_bh(&rdma_xprt->sc_rq_dto_lock); |
625 | return rdma_read_complete(rqstp, ctxt); | 607 | rdma_read_complete(rqstp, ctxt); |
608 | goto complete; | ||
626 | } else if (!list_empty(&rdma_xprt->sc_rq_dto_q)) { | 609 | } else if (!list_empty(&rdma_xprt->sc_rq_dto_q)) { |
627 | ctxt = list_entry(rdma_xprt->sc_rq_dto_q.next, | 610 | ctxt = list_entry(rdma_xprt->sc_rq_dto_q.next, |
628 | struct svc_rdma_op_ctxt, | 611 | struct svc_rdma_op_ctxt, |
@@ -680,6 +663,7 @@ int svc_rdma_recvfrom(struct svc_rqst *rqstp) | |||
680 | return 0; | 663 | return 0; |
681 | } | 664 | } |
682 | 665 | ||
666 | complete: | ||
683 | ret = rqstp->rq_arg.head[0].iov_len | 667 | ret = rqstp->rq_arg.head[0].iov_len |
684 | + rqstp->rq_arg.page_len | 668 | + rqstp->rq_arg.page_len |
685 | + rqstp->rq_arg.tail[0].iov_len; | 669 | + rqstp->rq_arg.tail[0].iov_len; |