Skip to content

Commit

Permalink
SUNRPC: Remove open coded stream position calculation in xdr_read_pages
Browse files Browse the repository at this point in the history
Use xdr_stream_pos() instead.

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
  • Loading branch information
Trond Myklebust authored and Trond Myklebust committed Jun 28, 2012
1 parent 1aecca3 commit b760b31
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions net/sunrpc/xdr.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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)
Expand Down

0 comments on commit b760b31

Please sign in to comment.