* [PATCH] sunrpc: remove redundant code
@ 2018-12-26 3:24 Kangjie Lu
2018-12-26 17:44 ` Chuck Lever
0 siblings, 1 reply; 2+ messages in thread
From: Kangjie Lu @ 2018-12-26 3:24 UTC (permalink / raw)
To: kjlu
Cc: pakki001, J. Bruce Fields, Jeff Layton, Trond Myklebust,
Anna Schumaker, David S. Miller, Chuck Lever, linux-nfs, netdev,
linux-kernel
If no bytes to decode, just use "xdr->p" instead of calling
xdr_inline_decode to get it. The fix cleans up the code.
Signed-off-by: Kangjie Lu <kjlu@umn.edu>
---
net/sunrpc/xprtrdma/rpc_rdma.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/net/sunrpc/xprtrdma/rpc_rdma.c b/net/sunrpc/xprtrdma/rpc_rdma.c
index 9f53e0240035..2ef86be49bd8 100644
--- a/net/sunrpc/xprtrdma/rpc_rdma.c
+++ b/net/sunrpc/xprtrdma/rpc_rdma.c
@@ -1123,7 +1123,6 @@ rpcrdma_decode_msg(struct rpcrdma_xprt *r_xprt, struct rpcrdma_rep *rep,
{
struct xdr_stream *xdr = &rep->rr_stream;
u32 writelist, replychunk, rpclen;
- char *base;
/* Decode the chunk lists */
if (decode_read_list(xdr))
@@ -1138,10 +1137,9 @@ rpcrdma_decode_msg(struct rpcrdma_xprt *r_xprt, struct rpcrdma_rep *rep,
return -EIO;
/* Build the RPC reply's Payload stream in rqst->rq_rcv_buf */
- base = (char *)xdr_inline_decode(xdr, 0);
rpclen = xdr_stream_remaining(xdr);
r_xprt->rx_stats.fixup_copy_count +=
- rpcrdma_inline_fixup(rqst, base, rpclen, writelist & 3);
+ rpcrdma_inline_fixup(rqst, xdr->p, rpclen, writelist & 3);
r_xprt->rx_stats.total_rdma_reply += writelist;
return rpclen + xdr_align_size(writelist);
--
2.17.2 (Apple Git-113)
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] sunrpc: remove redundant code
2018-12-26 3:24 [PATCH] sunrpc: remove redundant code Kangjie Lu
@ 2018-12-26 17:44 ` Chuck Lever
0 siblings, 0 replies; 2+ messages in thread
From: Chuck Lever @ 2018-12-26 17:44 UTC (permalink / raw)
To: Kangjie Lu
Cc: pakki001, Bruce Fields, Jeff Layton, Trond Myklebust,
Anna Schumaker, David S. Miller, Linux NFS Mailing List, netdev,
linux-kernel
> On Dec 25, 2018, at 10:24 PM, Kangjie Lu <kjlu@umn.edu> wrote:
>
> If no bytes to decode, just use "xdr->p" instead of calling
> xdr_inline_decode to get it. The fix cleans up the code.
>
> Signed-off-by: Kangjie Lu <kjlu@umn.edu>
> ---
> net/sunrpc/xprtrdma/rpc_rdma.c | 4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/net/sunrpc/xprtrdma/rpc_rdma.c b/net/sunrpc/xprtrdma/rpc_rdma.c
> index 9f53e0240035..2ef86be49bd8 100644
> --- a/net/sunrpc/xprtrdma/rpc_rdma.c
> +++ b/net/sunrpc/xprtrdma/rpc_rdma.c
> @@ -1123,7 +1123,6 @@ rpcrdma_decode_msg(struct rpcrdma_xprt *r_xprt, struct rpcrdma_rep *rep,
> {
> struct xdr_stream *xdr = &rep->rr_stream;
> u32 writelist, replychunk, rpclen;
> - char *base;
>
> /* Decode the chunk lists */
> if (decode_read_list(xdr))
> @@ -1138,10 +1137,9 @@ rpcrdma_decode_msg(struct rpcrdma_xprt *r_xprt, struct rpcrdma_rep *rep,
> return -EIO;
>
> /* Build the RPC reply's Payload stream in rqst->rq_rcv_buf */
> - base = (char *)xdr_inline_decode(xdr, 0);
> rpclen = xdr_stream_remaining(xdr);
> r_xprt->rx_stats.fixup_copy_count +=
> - rpcrdma_inline_fixup(rqst, base, rpclen, writelist & 3);
> + rpcrdma_inline_fixup(rqst, xdr->p, rpclen, writelist & 3);
I used xdr_inline_decode(xdr, 0) here because I didn't want to
embed specific knowledge about struct xdr_stream into
rpcrdma_decode_msg. IOW, adhere to the API contract.
Given the need for adding a type cast to this function call, as
reported by the kbuild robot, I don't see that this patch improves
things significantly.
> r_xprt->rx_stats.total_rdma_reply += writelist;
> return rpclen + xdr_align_size(writelist);
> --
> 2.17.2 (Apple Git-113)
>
--
Chuck Lever
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-12-26 17:44 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-26 3:24 [PATCH] sunrpc: remove redundant code Kangjie Lu
2018-12-26 17:44 ` Chuck Lever
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).