SUNRPC: xdr_read_pages should return the amount of XDR encoded page data
Callers of xdr_read_pages() will want to know exactly how much XDR
data is encoded in the pages after the data realignment.
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
diff --git a/net/sunrpc/xdr.c b/net/sunrpc/xdr.c
index 5643feb..80d5186 100644
--- a/net/sunrpc/xdr.c
+++ b/net/sunrpc/xdr.c
@@ -745,8 +745,10 @@
* Moves data beyond the current pointer position from the XDR head[] buffer
* into the page list. Any data that lies beyond current position + "len"
* bytes is moved into the XDR tail[].
+ *
+ * Returns the number of XDR encoded bytes now contained in the pages
*/
-void xdr_read_pages(struct xdr_stream *xdr, unsigned int len)
+unsigned int xdr_read_pages(struct xdr_stream *xdr, unsigned int len)
{
struct xdr_buf *buf = xdr->buf;
struct kvec *iov;
@@ -756,7 +758,7 @@
int padding;
if (xdr->nwords == 0)
- return;
+ return 0;
if (nwords > xdr->nwords) {
nwords = xdr->nwords;
len = nwords << 2;
@@ -787,6 +789,7 @@
xdr->end = (__be32 *)((char *)iov->iov_base + end);
xdr->page_ptr = NULL;
xdr->nwords = XDR_QUADLEN(end - padding);
+ return len;
}
EXPORT_SYMBOL_GPL(xdr_read_pages);
@@ -802,7 +805,7 @@
*/
void xdr_enter_page(struct xdr_stream *xdr, unsigned int len)
{
- xdr_read_pages(xdr, len);
+ len = xdr_read_pages(xdr, len);
/*
* Position current pointer at beginning of tail, and
* set remaining message length.