aboutsummaryrefslogtreecommitdiffstats
path: root/net/sunrpc
diff options
context:
space:
mode:
authorTrond Myklebust <Trond.Myklebust@netapp.com>2012-06-26 12:19:55 -0400
committerTrond Myklebust <Trond.Myklebust@netapp.com>2012-06-28 17:20:45 -0400
commitb760b3131d962dd35925fb65956afe621fa65ec4 (patch)
treeff02bbf734874be24a735ee216ca8f0354d23d8c /net/sunrpc
parent1aecca3e83e5da981ade916920d3d2a6b9644cc3 (diff)
SUNRPC: Remove open coded stream position calculation in xdr_read_pages
Use xdr_stream_pos() instead. Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'net/sunrpc')
-rw-r--r--net/sunrpc/xdr.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/net/sunrpc/xdr.c b/net/sunrpc/xdr.c
index 95980a5cd0a8..faf6753c593d 100644
--- a/net/sunrpc/xdr.c
+++ b/net/sunrpc/xdr.c
@@ -764,6 +764,7 @@ unsigned int xdr_read_pages(struct xdr_stream *xdr, unsigned int len)
764 struct kvec *iov; 764 struct kvec *iov;
765 ssize_t shift; 765 ssize_t shift;
766 unsigned int nwords = XDR_QUADLEN(len); 766 unsigned int nwords = XDR_QUADLEN(len);
767 unsigned int cur = xdr_stream_pos(xdr);
767 unsigned int end; 768 unsigned int end;
768 int padding; 769 int padding;
769 770
@@ -775,9 +776,8 @@ unsigned int xdr_read_pages(struct xdr_stream *xdr, unsigned int len)
775 } 776 }
776 /* Realign pages to current pointer position */ 777 /* Realign pages to current pointer position */
777 iov = buf->head; 778 iov = buf->head;
778 shift = iov->iov_len + (char *)iov->iov_base - (char *)xdr->p; 779 if (iov->iov_len > cur)
779 if (shift > 0) 780 xdr_shrink_bufhead(buf, iov->iov_len - cur);
780 xdr_shrink_bufhead(buf, shift);
781 781
782 /* Truncate page data and move it into the tail */ 782 /* Truncate page data and move it into the tail */
783 if (buf->page_len > len) 783 if (buf->page_len > len)