Skip to content

Commit 586a078

Browse files
chuckleveramschuma-ntap
authored andcommitted
xprtrdma: Clean up rpcrdma_prepare_readch()
Since commit 9ed5af2 ("SUNRPC: Clean up the handling of page padding in rpc_prepare_reply_pages()") [Dec 2020] the NFS client passes payload data to the transport with the padding in xdr->pages instead of in the send buffer's tail kvec. There's no need for the extra logic to advance the base of the tail kvec because the upper layer no longer places XDR padding there. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
1 parent c30f259 commit 586a078

File tree

1 file changed

+9
-18
lines changed

1 file changed

+9
-18
lines changed

net/sunrpc/xprtrdma/rpc_rdma.c

+9-18
Original file line numberDiff line numberDiff line change
@@ -628,9 +628,8 @@ static bool rpcrdma_prepare_pagelist(struct rpcrdma_req *req,
628628
return false;
629629
}
630630

631-
/* The tail iovec may include an XDR pad for the page list,
632-
* as well as additional content, and may not reside in the
633-
* same page as the head iovec.
631+
/* The tail iovec might not reside in the same page as the
632+
* head iovec.
634633
*/
635634
static bool rpcrdma_prepare_tail_iov(struct rpcrdma_req *req,
636635
struct xdr_buf *xdr,
@@ -748,27 +747,19 @@ static bool rpcrdma_prepare_readch(struct rpcrdma_xprt *r_xprt,
748747
struct rpcrdma_req *req,
749748
struct xdr_buf *xdr)
750749
{
750+
struct kvec *tail = &xdr->tail[0];
751+
751752
if (!rpcrdma_prepare_head_iov(r_xprt, req, xdr->head[0].iov_len))
752753
return false;
753754

754-
/* If there is a Read chunk, the page list is being handled
755+
/* If there is a Read chunk, the page list is handled
755756
* via explicit RDMA, and thus is skipped here.
756757
*/
757758

758-
/* Do not include the tail if it is only an XDR pad */
759-
if (xdr->tail[0].iov_len > 3) {
760-
unsigned int page_base, len;
761-
762-
/* If the content in the page list is an odd length,
763-
* xdr_write_pages() adds a pad at the beginning of
764-
* the tail iovec. Force the tail's non-pad content to
765-
* land at the next XDR position in the Send message.
766-
*/
767-
page_base = offset_in_page(xdr->tail[0].iov_base);
768-
len = xdr->tail[0].iov_len;
769-
page_base += len & 3;
770-
len -= len & 3;
771-
if (!rpcrdma_prepare_tail_iov(req, xdr, page_base, len))
759+
if (tail->iov_len) {
760+
if (!rpcrdma_prepare_tail_iov(req, xdr,
761+
offset_in_page(tail->iov_base),
762+
tail->iov_len))
772763
return false;
773764
kref_get(&req->rl_kref);
774765
}

0 commit comments

Comments
 (0)