From: schumaker.anna@gmail.com
To: linux-nfs@vger.kernel.org
Cc: Anna.Schumaker@Netapp.com
Subject: [PATCH v4 02/10] SUNRPC: Implement a xdr_page_pos() function
Date: Mon, 17 Aug 2020 12:53:19 -0400 [thread overview]
Message-ID: <20200817165327.354181-3-Anna.Schumaker@Netapp.com> (raw)
In-Reply-To: <20200817165327.354181-1-Anna.Schumaker@Netapp.com>
From: Anna Schumaker <Anna.Schumaker@Netapp.com>
I'll need this for READ_PLUS to help figure out the offset where page
data is stored at, but it might also be useful for other things.
Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
---
include/linux/sunrpc/xdr.h | 1 +
net/sunrpc/xdr.c | 13 +++++++++++++
2 files changed, 14 insertions(+)
diff --git a/include/linux/sunrpc/xdr.h b/include/linux/sunrpc/xdr.h
index bac459584dd0..40318ff97c83 100644
--- a/include/linux/sunrpc/xdr.h
+++ b/include/linux/sunrpc/xdr.h
@@ -242,6 +242,7 @@ extern int xdr_restrict_buflen(struct xdr_stream *xdr, int newbuflen);
extern void xdr_write_pages(struct xdr_stream *xdr, struct page **pages,
unsigned int base, unsigned int len);
extern unsigned int xdr_stream_pos(const struct xdr_stream *xdr);
+extern unsigned int xdr_page_pos(const struct xdr_stream *xdr);
extern void xdr_init_decode(struct xdr_stream *xdr, struct xdr_buf *buf,
__be32 *p, struct rpc_rqst *rqst);
extern void xdr_init_decode_pages(struct xdr_stream *xdr, struct xdr_buf *buf,
diff --git a/net/sunrpc/xdr.c b/net/sunrpc/xdr.c
index c62b0882c0d8..8d29450fdce5 100644
--- a/net/sunrpc/xdr.c
+++ b/net/sunrpc/xdr.c
@@ -505,6 +505,19 @@ unsigned int xdr_stream_pos(const struct xdr_stream *xdr)
}
EXPORT_SYMBOL_GPL(xdr_stream_pos);
+/**
+ * xdr_page_pos - Return the current offset from the start of the xdr pages
+ * @xdr: pointer to struct xdr_stream
+ */
+unsigned int xdr_page_pos(const struct xdr_stream *xdr)
+{
+ unsigned int pos = xdr_stream_pos(xdr);
+
+ WARN_ON(pos < xdr->buf->head[0].iov_len);
+ return pos - xdr->buf->head[0].iov_len;
+}
+EXPORT_SYMBOL_GPL(xdr_page_pos);
+
/**
* xdr_init_encode - Initialize a struct xdr_stream for sending data.
* @xdr: pointer to xdr_stream struct
--
2.28.0
next prev parent reply other threads:[~2020-08-17 17:33 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-08-17 16:53 [PATCH v4 00/10] NFS: Add support for the v4.2 READ_PLUS operation schumaker.anna
2020-08-17 16:53 ` [PATCH v4 01/10] SUNRPC: Split out a function for setting current page schumaker.anna
2020-08-17 16:53 ` schumaker.anna [this message]
2020-08-17 16:53 ` [PATCH v4 03/10] NFS: Use xdr_page_pos() in NFSv4 decode_getacl() schumaker.anna
2020-08-17 16:53 ` [PATCH v4 04/10] NFS: Add READ_PLUS data segment support schumaker.anna
2020-08-17 16:53 ` [PATCH v4 05/10] SUNRPC: Split out xdr_realign_pages() from xdr_align_pages() schumaker.anna
2020-08-17 16:53 ` [PATCH v4 06/10] SUNRPC: Split out _shift_data_right_tail() schumaker.anna
2020-08-17 16:53 ` [PATCH v4 07/10] SUNRPC: Add the ability to expand holes in data pages schumaker.anna
2020-08-17 16:53 ` [PATCH v4 08/10] NFS: Add READ_PLUS hole segment decoding schumaker.anna
2020-08-17 16:53 ` [PATCH v4 09/10] SUNRPC: Add an xdr_align_data() function schumaker.anna
2020-08-17 16:53 ` [PATCH v4 10/10] NFS: Decode a full READ_PLUS reply schumaker.anna
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=20200817165327.354181-3-Anna.Schumaker@Netapp.com \
--to=schumaker.anna@gmail.com \
--cc=Anna.Schumaker@Netapp.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox