From: Chuck Lever <chuck.lever@oracle.com>
To: linux-nfs@vger.kernel.org, linux-rdma@vger.kernel.org
Subject: [PATCH RFC 05/11] svcrdma: Clean up svc_rdma_encode_reply_chunk()
Date: Thu, 19 Mar 2020 11:20:49 -0400 [thread overview]
Message-ID: <20200319152049.16298.55010.stgit@klimt.1015granger.net> (raw)
In-Reply-To: <20200319150136.16298.68813.stgit@klimt.1015granger.net>
Clean up: Match the control flow of svc_rdma_encode_write_list().
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
---
net/sunrpc/xprtrdma/svc_rdma_rw.c | 3 +++
net/sunrpc/xprtrdma/svc_rdma_sendto.c | 25 ++++++++++++-------------
2 files changed, 15 insertions(+), 13 deletions(-)
diff --git a/net/sunrpc/xprtrdma/svc_rdma_rw.c b/net/sunrpc/xprtrdma/svc_rdma_rw.c
index 065dfd8b5b22..080a55456911 100644
--- a/net/sunrpc/xprtrdma/svc_rdma_rw.c
+++ b/net/sunrpc/xprtrdma/svc_rdma_rw.c
@@ -610,6 +610,9 @@ int svc_rdma_send_reply_chunk(struct svcxprt_rdma *rdma,
struct svc_rdma_write_info *info;
int consumed, ret;
+ if (!rctxt->rc_reply_chunk)
+ return 0;
+
info = svc_rdma_write_info_alloc(rdma, rctxt->rc_reply_chunk);
if (!info)
return -ENOMEM;
diff --git a/net/sunrpc/xprtrdma/svc_rdma_sendto.c b/net/sunrpc/xprtrdma/svc_rdma_sendto.c
index 94adeb2a43cf..89bc8db0289e 100644
--- a/net/sunrpc/xprtrdma/svc_rdma_sendto.c
+++ b/net/sunrpc/xprtrdma/svc_rdma_sendto.c
@@ -507,7 +507,10 @@ svc_rdma_encode_reply_chunk(const struct svc_rdma_recv_ctxt *rctxt,
.rp_length = length,
};
- return svc_rdma_encode_write_chunk(sctxt, &payload);
+ if (!rctxt->rc_reply_chunk)
+ return xdr_stream_encode_item_absent(&sctxt->sc_stream);
+ else
+ return svc_rdma_encode_write_chunk(sctxt, &payload);
}
static int svc_rdma_dma_map_page(struct svcxprt_rdma *rdma,
@@ -868,7 +871,6 @@ int svc_rdma_sendto(struct svc_rqst *rqstp)
container_of(xprt, struct svcxprt_rdma, sc_xprt);
struct svc_rdma_recv_ctxt *rctxt = rqstp->rq_xprt_ctxt;
__be32 *rdma_argp = rctxt->rc_recv_buf;
- __be32 *rp_ch = rctxt->rc_reply_chunk;
struct svc_rdma_send_ctxt *sctxt;
__be32 *p;
int ret;
@@ -888,25 +890,22 @@ int svc_rdma_sendto(struct svc_rqst *rqstp)
rpcrdma_fixed_maxsz * sizeof(*p));
if (!p)
goto err0;
+
+ ret = svc_rdma_send_reply_chunk(rdma, rctxt, &rqstp->rq_res);
+ if (ret < 0)
+ goto err2;
+
*p++ = *rdma_argp;
*p++ = *(rdma_argp + 1);
*p++ = rdma->sc_fc_credits;
- *p = rp_ch ? rdma_nomsg : rdma_msg;
+ *p = rctxt->rc_reply_chunk ? rdma_nomsg : rdma_msg;
if (svc_rdma_encode_read_list(sctxt) < 0)
goto err0;
if (svc_rdma_encode_write_list(rctxt, sctxt) < 0)
goto err0;
- if (rp_ch) {
- ret = svc_rdma_send_reply_chunk(rdma, rctxt, &rqstp->rq_res);
- if (ret < 0)
- goto err2;
- if (svc_rdma_encode_reply_chunk(rctxt, sctxt, ret) < 0)
- goto err0;
- } else {
- if (xdr_stream_encode_item_absent(&sctxt->sc_stream) < 0)
- goto err0;
- }
+ if (svc_rdma_encode_reply_chunk(rctxt, sctxt, ret) < 0)
+ goto err0;
ret = svc_rdma_send_reply_msg(rdma, sctxt, rctxt, rqstp);
if (ret < 0)
next prev parent reply other threads:[~2020-03-19 15:20 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-19 15:20 [PATCH RFC 00/11] Linux NFS server support for multiple Write chunks Chuck Lever
2020-03-19 15:20 ` [PATCH RFC 01/11] SUNRPC: Adjust synopsis of xdr_buf_subsegment() Chuck Lever
2020-03-19 15:20 ` [PATCH RFC 02/11] svcrdma: Clean up RDMA Write path Chuck Lever
2020-03-19 15:20 ` [PATCH RFC 03/11] NFSD: Invoke svc_encode_read_payload in "read" NFSD encoders Chuck Lever
2020-03-19 15:20 ` [PATCH RFC 04/11] svcrdma: Post RDMA Writes while XDR encoding replies Chuck Lever
2020-03-19 15:20 ` Chuck Lever [this message]
2020-03-19 15:20 ` [PATCH RFC 06/11] svcrdma: Cache number of Write chunks Chuck Lever
2020-03-19 15:21 ` [PATCH RFC 07/11] svcrdma: Add a data structure to track READ payloads Chuck Lever
2020-03-19 15:21 ` [PATCH RFC 08/11] svcrdma: Add svc_rdma_skip_payloads() Chuck Lever
2020-03-19 15:21 ` [PATCH RFC 09/11] svcrdma: Support multiple READ payloads when pulling up Chuck Lever
2020-03-19 15:21 ` [PATCH RFC 10/11] svcrdma: Support multiple READ payloads in svc_rdma_map_reply_msg() Chuck Lever
2020-03-19 15:21 ` [PATCH RFC 11/11] svcrdma: Support multiple Write chunks in svc_rdma_send_reply_chunk Chuck Lever
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200319152049.16298.55010.stgit@klimt.1015granger.net \
--to=chuck.lever@oracle.com \
--cc=linux-nfs@vger.kernel.org \
--cc=linux-rdma@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox