From: Chuck Lever <chuck.lever@oracle.com>
To: bfields@fieldses.org
Cc: linux-rdma@vger.kernel.org, linux-nfs@vger.kernel.org
Subject: [PATCH RFC2 2/3] SUNRPC: Track current encode position in struct xdr_stream
Date: Fri, 31 Jan 2020 15:41:52 -0500 [thread overview]
Message-ID: <20200131204152.31409.48018.stgit@bazille.1015granger.net> (raw)
In-Reply-To: <20200131203727.31409.63652.stgit@bazille.1015granger.net>
Maintain a byte-offset cursor in struct xdr_stream. This will be
used in a subsequent patch.
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
---
fs/nfsd/nfs4proc.c | 1 +
include/linux/sunrpc/xdr.h | 1 +
net/sunrpc/xdr.c | 2 ++
3 files changed, 4 insertions(+)
diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c
index 4798667af647..9cd610485f7d 100644
--- a/fs/nfsd/nfs4proc.c
+++ b/fs/nfsd/nfs4proc.c
@@ -1904,6 +1904,7 @@ static void svcxdr_init_encode(struct svc_rqst *rqstp,
xdr->iov = head;
xdr->p = head->iov_base + head->iov_len;
xdr->end = head->iov_base + PAGE_SIZE - rqstp->rq_auth_slack;
+ xdr->pos = head->iov_len;
/* Tail and page_len should be zero at this point: */
buf->len = buf->head[0].iov_len;
xdr->scratch.iov_len = 0;
diff --git a/include/linux/sunrpc/xdr.h b/include/linux/sunrpc/xdr.h
index b41f34977995..2ca479b0708e 100644
--- a/include/linux/sunrpc/xdr.h
+++ b/include/linux/sunrpc/xdr.h
@@ -232,6 +232,7 @@ struct xdr_stream {
struct kvec *iov; /* pointer to the current kvec */
struct kvec scratch; /* Scratch buffer */
struct page **page_ptr; /* pointer to the current page */
+ unsigned int pos; /* current encode position */
unsigned int nwords; /* Remaining decode buffer length */
struct rpc_rqst *rqst; /* For debugging */
diff --git a/net/sunrpc/xdr.c b/net/sunrpc/xdr.c
index f3104be8ff5d..b8b78876a9bd 100644
--- a/net/sunrpc/xdr.c
+++ b/net/sunrpc/xdr.c
@@ -542,6 +542,7 @@ void xdr_init_encode(struct xdr_stream *xdr, struct xdr_buf *buf, __be32 *p,
buf->len += len;
iov->iov_len += len;
}
+ xdr->pos = iov->iov_len;
xdr->rqst = rqst;
}
EXPORT_SYMBOL_GPL(xdr_init_encode);
@@ -644,6 +645,7 @@ __be32 * xdr_reserve_space(struct xdr_stream *xdr, size_t nbytes)
else
xdr->buf->page_len += nbytes;
xdr->buf->len += nbytes;
+ xdr->pos += nbytes;
return p;
}
EXPORT_SYMBOL_GPL(xdr_reserve_space);
next prev parent reply other threads:[~2020-01-31 20:41 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-01-31 20:41 [PATCH RFC2 0/3] Follow-up discussion of bug 198053 Chuck Lever
2020-01-31 20:41 ` [PATCH RFC2 1/3] nfsd: Fix NFSv4 READ on RDMA when using readv Chuck Lever
2020-01-31 20:41 ` Chuck Lever [this message]
2020-01-31 21:19 ` [PATCH RFC2 2/3] SUNRPC: Track current encode position in struct xdr_stream Trond Myklebust
2020-01-31 20:41 ` [PATCH RFC2 3/3] NFSD: Enable nfsd4_encode_readv() for NFS/RDMA 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=20200131204152.31409.48018.stgit@bazille.1015granger.net \
--to=chuck.lever@oracle.com \
--cc=bfields@fieldses.org \
--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;
as well as URLs for NNTP newsgroup(s).