diff options
author | Chuck Lever <chuck.lever@oracle.com> | 2016-06-29 13:54:49 -0400 |
---|---|---|
committer | Anna Schumaker <Anna.Schumaker@Netapp.com> | 2016-07-11 15:50:43 -0400 |
commit | cfabe2c634e617765af39ea1cb2920bdcbc5bb7e (patch) | |
tree | 8be76e009f224a217432ced4bef5151e018bc5f6 /net | |
parent | cb0ae1fbb2f5e0cec250ba19c0525dde2b6c0160 (diff) |
xprtrdma: Update only specific fields in private receive buffer
Now that rpcrdma_inline_fixup() updates only two fields in
rq_rcv_buf, a full memcpy of that structure to rq_private_buf is
unwarranted. Updating rq_private_buf fields only where needed also
better documents what is going on.
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Tested-by: Steve Wise <swise@opengridcomputing.com>
Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
Diffstat (limited to 'net')
-rw-r--r-- | net/sunrpc/xprtrdma/rpc_rdma.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/net/sunrpc/xprtrdma/rpc_rdma.c b/net/sunrpc/xprtrdma/rpc_rdma.c index d018eb7814e7..a0e811dd7b84 100644 --- a/net/sunrpc/xprtrdma/rpc_rdma.c +++ b/net/sunrpc/xprtrdma/rpc_rdma.c | |||
@@ -750,6 +750,11 @@ rpcrdma_count_chunks(struct rpcrdma_rep *rep, int wrchunk, __be32 **iptrp) | |||
750 | * The upper layer has set the maximum number of bytes it can | 750 | * The upper layer has set the maximum number of bytes it can |
751 | * receive in each component of rq_rcv_buf. These values are set in | 751 | * receive in each component of rq_rcv_buf. These values are set in |
752 | * the head.iov_len, page_len, tail.iov_len, and buflen fields. | 752 | * the head.iov_len, page_len, tail.iov_len, and buflen fields. |
753 | * | ||
754 | * Unlike the TCP equivalent (xdr_partial_copy_from_skb), in | ||
755 | * many cases this function simply updates iov_base pointers in | ||
756 | * rq_rcv_buf to point directly to the received reply data, to | ||
757 | * avoid copying reply data. | ||
753 | */ | 758 | */ |
754 | static void | 759 | static void |
755 | rpcrdma_inline_fixup(struct rpc_rqst *rqst, char *srcp, int copy_len, int pad) | 760 | rpcrdma_inline_fixup(struct rpc_rqst *rqst, char *srcp, int copy_len, int pad) |
@@ -763,6 +768,7 @@ rpcrdma_inline_fixup(struct rpc_rqst *rqst, char *srcp, int copy_len, int pad) | |||
763 | * in the receive buffer, to avoid a memcopy. | 768 | * in the receive buffer, to avoid a memcopy. |
764 | */ | 769 | */ |
765 | rqst->rq_rcv_buf.head[0].iov_base = srcp; | 770 | rqst->rq_rcv_buf.head[0].iov_base = srcp; |
771 | rqst->rq_private_buf.head[0].iov_base = srcp; | ||
766 | 772 | ||
767 | /* The contents of the receive buffer that follow | 773 | /* The contents of the receive buffer that follow |
768 | * head.iov_len bytes are copied into the page list. | 774 | * head.iov_len bytes are copied into the page list. |
@@ -822,16 +828,15 @@ rpcrdma_inline_fixup(struct rpc_rqst *rqst, char *srcp, int copy_len, int pad) | |||
822 | /* The tail iovec is redirected to the remaining data | 828 | /* The tail iovec is redirected to the remaining data |
823 | * in the receive buffer, to avoid a memcopy. | 829 | * in the receive buffer, to avoid a memcopy. |
824 | */ | 830 | */ |
825 | if (copy_len || pad) | 831 | if (copy_len || pad) { |
826 | rqst->rq_rcv_buf.tail[0].iov_base = srcp; | 832 | rqst->rq_rcv_buf.tail[0].iov_base = srcp; |
833 | rqst->rq_private_buf.tail[0].iov_base = srcp; | ||
834 | } | ||
827 | 835 | ||
828 | if (copy_len) | 836 | if (copy_len) |
829 | dprintk("RPC: %s: %d bytes in" | 837 | dprintk("RPC: %s: %d bytes in" |
830 | " %d extra segments (%d lost)\n", | 838 | " %d extra segments (%d lost)\n", |
831 | __func__, olen, i, copy_len); | 839 | __func__, olen, i, copy_len); |
832 | |||
833 | /* TBD avoid a warning from call_decode() */ | ||
834 | rqst->rq_private_buf = rqst->rq_rcv_buf; | ||
835 | } | 840 | } |
836 | 841 | ||
837 | void | 842 | void |