Commit b760b313 authored by Trond Myklebust's avatar Trond Myklebust

SUNRPC: Remove open coded stream position calculation in xdr_read_pages

Use xdr_stream_pos() instead.
Signed-off-by: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
parent 1aecca3e
...@@ -764,6 +764,7 @@ unsigned int xdr_read_pages(struct xdr_stream *xdr, unsigned int len) ...@@ -764,6 +764,7 @@ unsigned int xdr_read_pages(struct xdr_stream *xdr, unsigned int len)
struct kvec *iov; struct kvec *iov;
ssize_t shift; ssize_t shift;
unsigned int nwords = XDR_QUADLEN(len); unsigned int nwords = XDR_QUADLEN(len);
unsigned int cur = xdr_stream_pos(xdr);
unsigned int end; unsigned int end;
int padding; int padding;
...@@ -775,9 +776,8 @@ unsigned int xdr_read_pages(struct xdr_stream *xdr, unsigned int len) ...@@ -775,9 +776,8 @@ unsigned int xdr_read_pages(struct xdr_stream *xdr, unsigned int len)
} }
/* Realign pages to current pointer position */ /* Realign pages to current pointer position */
iov = buf->head; iov = buf->head;
shift = iov->iov_len + (char *)iov->iov_base - (char *)xdr->p; if (iov->iov_len > cur)
if (shift > 0) xdr_shrink_bufhead(buf, iov->iov_len - cur);
xdr_shrink_bufhead(buf, shift);
/* Truncate page data and move it into the tail */ /* Truncate page data and move it into the tail */
if (buf->page_len > len) if (buf->page_len > len)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment