diff options
author | Trond Myklebust <Trond.Myklebust@netapp.com> | 2012-06-26 18:19:55 +0200 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2012-06-28 23:20:45 +0200 |
commit | b760b3131d962dd35925fb65956afe621fa65ec4 (patch) | |
tree | ff02bbf734874be24a735ee216ca8f0354d23d8c /net/sunrpc/xdr.c | |
parent | NFSv3: Don't open code stream position calculation in decode_getacl3resok (diff) | |
download | linux-b760b3131d962dd35925fb65956afe621fa65ec4.tar.xz linux-b760b3131d962dd35925fb65956afe621fa65ec4.zip |
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/xdr.c')
-rw-r--r-- | net/sunrpc/xdr.c | 6 |
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) struct kvec *iov; ssize_t shift; unsigned int nwords = XDR_QUADLEN(len); + unsigned int cur = xdr_stream_pos(xdr); unsigned int end; int padding; @@ -775,9 +776,8 @@ unsigned int xdr_read_pages(struct xdr_stream *xdr, unsigned int len) } /* Realign pages to current pointer position */ iov = buf->head; - shift = iov->iov_len + (char *)iov->iov_base - (char *)xdr->p; - if (shift > 0) - xdr_shrink_bufhead(buf, shift); + if (iov->iov_len > cur) + xdr_shrink_bufhead(buf, iov->iov_len - cur); /* Truncate page data and move it into the tail */ if (buf->page_len > len) |