linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Chuck Lever <chuck.lever@oracle.com>
To: bfields@fieldses.org
Cc: linux-nfs@vger.kernel.org
Subject: [PATCH RFC 6/8] NFSD: NFSv3 support for automated padding of xdr_buf::pages
Date: Wed, 29 Jan 2020 11:09:58 -0500	[thread overview]
Message-ID: <20200129160958.3024.25842.stgit@bazille.1015granger.net> (raw)
In-Reply-To: <20200129155516.3024.56575.stgit@bazille.1015granger.net>

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
---
 fs/nfsd/nfs3xdr.c |   19 +++----------------
 1 file changed, 3 insertions(+), 16 deletions(-)

diff --git a/fs/nfsd/nfs3xdr.c b/fs/nfsd/nfs3xdr.c
index 195ab7a0fc89..91d96a329033 100644
--- a/fs/nfsd/nfs3xdr.c
+++ b/fs/nfsd/nfs3xdr.c
@@ -709,13 +709,7 @@ void fill_post_wcc(struct svc_fh *fhp)
 	if (resp->status == 0) {
 		*p++ = htonl(resp->len);
 		xdr_ressize_check(rqstp, p);
-		rqstp->rq_res.page_len = resp->len;
-		if (resp->len & 3) {
-			/* need to pad the tail */
-			rqstp->rq_res.tail[0].iov_base = p;
-			*p = 0;
-			rqstp->rq_res.tail[0].iov_len = 4 - (resp->len&3);
-		}
+		xdr_buf_set_pagelen(&rqstp->rq_res, resp->len);
 		return 1;
 	} else
 		return xdr_ressize_check(rqstp, p);
@@ -733,14 +727,7 @@ void fill_post_wcc(struct svc_fh *fhp)
 		*p++ = htonl(resp->eof);
 		*p++ = htonl(resp->count);	/* xdr opaque count */
 		xdr_ressize_check(rqstp, p);
-		/* now update rqstp->rq_res to reflect data as well */
-		rqstp->rq_res.page_len = resp->count;
-		if (resp->count & 3) {
-			/* need to pad the tail */
-			rqstp->rq_res.tail[0].iov_base = p;
-			*p = 0;
-			rqstp->rq_res.tail[0].iov_len = 4 - (resp->count & 3);
-		}
+		xdr_buf_set_pagelen(&rqstp->rq_res, resp->count);
 		return 1;
 	} else
 		return xdr_ressize_check(rqstp, p);
@@ -817,7 +804,7 @@ void fill_post_wcc(struct svc_fh *fhp)
 		xdr_ressize_check(rqstp, p);
 		if (rqstp->rq_res.head[0].iov_len + (2<<2) > PAGE_SIZE)
 			return 1; /*No room for trailer */
-		rqstp->rq_res.page_len = (resp->count) << 2;
+		xdr_buf_set_pagelen(&rqstp->rq_res, resp->count << 2);
 
 		/* add the 'tail' to the end of the 'head' page - page 0. */
 		rqstp->rq_res.tail[0].iov_base = p;


  parent reply	other threads:[~2020-01-29 16:10 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-29 16:09 [PATCH RFC 0/8] For discussion of bug 198053 Chuck Lever
2020-01-29 16:09 ` [PATCH RFC 1/8] nfsd: Fix NFSv4 READ on RDMA when using readv Chuck Lever
2020-01-29 16:09 ` [PATCH RFC 2/8] SUNRPC: Add XDR infrastructure for automatically padding xdr_buf::pages Chuck Lever
2020-01-29 16:09 ` [PATCH RFC 3/8] SUNRPC: TCP transport support for automated padding of xdr_buf::pages Chuck Lever
2020-01-29 16:09 ` [PATCH RFC 4/8] svcrdma: RDMA " Chuck Lever
2020-01-29 16:09 ` [PATCH RFC 5/8] NFSD: NFSv2 " Chuck Lever
2020-01-29 16:09 ` Chuck Lever [this message]
2020-01-29 16:10 ` [PATCH RFC 7/8] sunrpc: Add new contractual constraint on xdr_buf API Chuck Lever
2020-01-29 16:10 ` [PATCH RFC 8/8] SUNRPC: GSS support for automated padding of xdr_buf::pages 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=20200129160958.3024.25842.stgit@bazille.1015granger.net \
    --to=chuck.lever@oracle.com \
    --cc=bfields@fieldses.org \
    --cc=linux-nfs@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;
as well as URLs for NNTP newsgroup(s).