Commit fc20f19b authored by Chuck Lever's avatar Chuck Lever

svcrdma: Update synopsis of svc_rdma_build_read_segment()

Since the RDMA Read I/O state is now contained in the recv_ctxt,
svc_rdma_build_read_segment() can use the recv_ctxt to derive that
information rather than the other way around. This removes one usage
of the ri_readctxt field, enabling its removal in a subsequent
patch.

At the same time, the use of ri_rqst can similarly be replaced with
a passed-in function parameter.

Start with build_read_segment() because it is a common utility
function at the bottom of the Read chunk path.
Signed-off-by: default avatarChuck Lever <chuck.lever@oracle.com>
parent 919f6e79
...@@ -116,6 +116,13 @@ struct svcxprt_rdma { ...@@ -116,6 +116,13 @@ struct svcxprt_rdma {
/* sc_flags */ /* sc_flags */
#define RDMAXPRT_CONN_PENDING 3 #define RDMAXPRT_CONN_PENDING 3
static inline struct svcxprt_rdma *svc_rdma_rqst_rdma(struct svc_rqst *rqstp)
{
struct svc_xprt *xprt = rqstp->rq_xprt;
return container_of(xprt, struct svcxprt_rdma, sc_xprt);
}
/* /*
* Default connection parameters * Default connection parameters
*/ */
......
...@@ -681,8 +681,8 @@ int svc_rdma_send_reply_chunk(struct svcxprt_rdma *rdma, ...@@ -681,8 +681,8 @@ int svc_rdma_send_reply_chunk(struct svcxprt_rdma *rdma,
/** /**
* svc_rdma_build_read_segment - Build RDMA Read WQEs to pull one RDMA segment * svc_rdma_build_read_segment - Build RDMA Read WQEs to pull one RDMA segment
* @rdma: controlling transport * @rqstp: RPC transaction context
* @info: context for ongoing I/O * @head: context for ongoing I/O
* @segment: co-ordinates of remote memory to be read * @segment: co-ordinates of remote memory to be read
* *
* Returns: * Returns:
...@@ -691,13 +691,12 @@ int svc_rdma_send_reply_chunk(struct svcxprt_rdma *rdma, ...@@ -691,13 +691,12 @@ int svc_rdma_send_reply_chunk(struct svcxprt_rdma *rdma,
* %-ENOMEM: allocating a local resources failed * %-ENOMEM: allocating a local resources failed
* %-EIO: a DMA mapping error occurred * %-EIO: a DMA mapping error occurred
*/ */
static int svc_rdma_build_read_segment(struct svcxprt_rdma *rdma, static int svc_rdma_build_read_segment(struct svc_rqst *rqstp,
struct svc_rdma_read_info *info, struct svc_rdma_recv_ctxt *head,
const struct svc_rdma_segment *segment) const struct svc_rdma_segment *segment)
{ {
struct svc_rdma_recv_ctxt *head = info->ri_readctxt; struct svcxprt_rdma *rdma = svc_rdma_rqst_rdma(rqstp);
struct svc_rdma_chunk_ctxt *cc = &head->rc_cc; struct svc_rdma_chunk_ctxt *cc = &head->rc_cc;
struct svc_rqst *rqstp = info->ri_rqst;
unsigned int sge_no, seg_len, len; unsigned int sge_no, seg_len, len;
struct svc_rdma_rw_ctxt *ctxt; struct svc_rdma_rw_ctxt *ctxt;
struct scatterlist *sg; struct scatterlist *sg;
...@@ -770,7 +769,8 @@ static int svc_rdma_build_read_chunk(struct svcxprt_rdma *rdma, ...@@ -770,7 +769,8 @@ static int svc_rdma_build_read_chunk(struct svcxprt_rdma *rdma,
ret = -EINVAL; ret = -EINVAL;
pcl_for_each_segment(segment, chunk) { pcl_for_each_segment(segment, chunk) {
ret = svc_rdma_build_read_segment(rdma, info, segment); ret = svc_rdma_build_read_segment(info->ri_rqst,
info->ri_readctxt, segment);
if (ret < 0) if (ret < 0)
break; break;
head->rc_readbytes += segment->rs_length; head->rc_readbytes += segment->rs_length;
...@@ -989,7 +989,8 @@ static int svc_rdma_read_chunk_range(struct svcxprt_rdma *rdma, ...@@ -989,7 +989,8 @@ static int svc_rdma_read_chunk_range(struct svcxprt_rdma *rdma,
dummy.rs_length = min_t(u32, length, segment->rs_length) - offset; dummy.rs_length = min_t(u32, length, segment->rs_length) - offset;
dummy.rs_offset = segment->rs_offset + offset; dummy.rs_offset = segment->rs_offset + offset;
ret = svc_rdma_build_read_segment(rdma, info, &dummy); ret = svc_rdma_build_read_segment(info->ri_rqst,
info->ri_readctxt, &dummy);
if (ret < 0) if (ret < 0)
break; break;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment