All of lore.kernel.org
 help / color / mirror / Atom feed
From: schumaker.anna@gmail.com
To: bfields@redhat.com, linux-nfs@vger.kernel.org
Cc: Anna.Schumaker@Netapp.com
Subject: [PATCH v3 2/6] NFSD: nfsd4_encode_readv() can use xdr_reserve_space_vec()
Date: Mon,  3 Aug 2020 12:59:50 -0400	[thread overview]
Message-ID: <20200803165954.1348263-3-Anna.Schumaker@Netapp.com> (raw)
In-Reply-To: <20200803165954.1348263-1-Anna.Schumaker@Netapp.com>

From: Anna Schumaker <Anna.Schumaker@Netapp.com>

Switch over to the new code so we don't need to reproduce it on the NFSD
side.

Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
---
 fs/nfsd/nfs4xdr.c | 28 +++-------------------------
 1 file changed, 3 insertions(+), 25 deletions(-)

diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c
index 996ac01ee977..6a1c0a7fae05 100644
--- a/fs/nfsd/nfs4xdr.c
+++ b/fs/nfsd/nfs4xdr.c
@@ -3584,36 +3584,14 @@ static __be32 nfsd4_encode_readv(struct nfsd4_compoundres *resp,
 {
 	struct xdr_stream *xdr = &resp->xdr;
 	u32 eof;
-	int v;
 	int starting_len = xdr->buf->len - 8;
-	long len;
-	int thislen;
 	__be32 nfserr;
 	__be32 tmp;
-	__be32 *p;
 	int pad;
 
-	/*
-	 * svcrdma requires every READ payload to start somewhere
-	 * in xdr->pages.
-	 */
-	if (xdr->iov == xdr->buf->head) {
-		xdr->iov = NULL;
-		xdr->end = xdr->p;
-	}
-
-	len = maxcount;
-	v = 0;
-	while (len) {
-		thislen = min_t(long, len, PAGE_SIZE);
-		p = xdr_reserve_space(xdr, thislen);
-		WARN_ON_ONCE(!p);
-		resp->rqstp->rq_vec[v].iov_base = p;
-		resp->rqstp->rq_vec[v].iov_len = thislen;
-		v++;
-		len -= thislen;
-	}
-	read->rd_vlen = v;
+	read->rd_vlen = xdr_reserve_space_vec(xdr, resp->rqstp->rq_vec, maxcount);
+	if (read->rd_vlen < 0)
+		return nfserr_resource;
 
 	nfserr = nfsd_readv(resp->rqstp, read->rd_fhp, file, read->rd_offset,
 			    resp->rqstp->rq_vec, read->rd_vlen, &maxcount,
-- 
2.27.0


  parent reply	other threads:[~2020-08-03 17:00 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-03 16:59 [PATCH v3 0/6] NFSD: Add support for the v4.2 READ_PLUS operation schumaker.anna
2020-08-03 16:59 ` [PATCH v3 1/6] SUNRPC: Implement xdr_reserve_space_vec() schumaker.anna
2020-08-03 19:19   ` Chuck Lever
2020-08-03 19:37     ` Anna Schumaker
2020-08-03 19:44       ` Chuck Lever
2020-08-03 16:59 ` schumaker.anna [this message]
2020-08-03 16:59 ` [PATCH v3 3/6] NFSD: Add READ_PLUS data support schumaker.anna
2020-08-03 19:17   ` Chuck Lever
2020-08-03 19:41     ` Anna Schumaker
2020-08-03 16:59 ` [PATCH v3 4/6] NFSD: Add READ_PLUS hole segment encoding schumaker.anna
2020-08-03 16:59 ` [PATCH v3 5/6] NFSD: Return both a hole and a data segment schumaker.anna
2020-08-03 16:59 ` [PATCH v3 6/6] NFSD: Encode a full READ_PLUS reply schumaker.anna
2020-08-03 19:26 ` [PATCH v3 0/6] NFSD: Add support for the v4.2 READ_PLUS operation Chuck Lever
2020-08-03 19:36   ` Anna Schumaker

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=20200803165954.1348263-3-Anna.Schumaker@Netapp.com \
    --to=schumaker.anna@gmail.com \
    --cc=Anna.Schumaker@Netapp.com \
    --cc=bfields@redhat.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.