Commit 06216ecb authored by Anna Schumaker's avatar Anna Schumaker

SUNRPC: Split out xdr_realign_pages() from xdr_align_pages()

I don't need the entire align pages code for READ_PLUS, so split out the
part I do need so I don't need to reimplement anything.
Signed-off-by: default avatarAnna Schumaker <Anna.Schumaker@Netapp.com>
parent c5675526
...@@ -997,26 +997,33 @@ __be32 * xdr_inline_decode(struct xdr_stream *xdr, size_t nbytes) ...@@ -997,26 +997,33 @@ __be32 * xdr_inline_decode(struct xdr_stream *xdr, size_t nbytes)
} }
EXPORT_SYMBOL_GPL(xdr_inline_decode); EXPORT_SYMBOL_GPL(xdr_inline_decode);
static unsigned int xdr_align_pages(struct xdr_stream *xdr, unsigned int len) static void xdr_realign_pages(struct xdr_stream *xdr)
{ {
struct xdr_buf *buf = xdr->buf; struct xdr_buf *buf = xdr->buf;
struct kvec *iov; struct kvec *iov = buf->head;
unsigned int nwords = XDR_QUADLEN(len);
unsigned int cur = xdr_stream_pos(xdr); unsigned int cur = xdr_stream_pos(xdr);
unsigned int copied, offset; unsigned int copied, offset;
if (xdr->nwords == 0)
return 0;
/* Realign pages to current pointer position */ /* Realign pages to current pointer position */
iov = buf->head;
if (iov->iov_len > cur) { if (iov->iov_len > cur) {
offset = iov->iov_len - cur; offset = iov->iov_len - cur;
copied = xdr_shrink_bufhead(buf, offset); copied = xdr_shrink_bufhead(buf, offset);
trace_rpc_xdr_alignment(xdr, offset, copied); trace_rpc_xdr_alignment(xdr, offset, copied);
xdr->nwords = XDR_QUADLEN(buf->len - cur); xdr->nwords = XDR_QUADLEN(buf->len - cur);
} }
}
static unsigned int xdr_align_pages(struct xdr_stream *xdr, unsigned int len)
{
struct xdr_buf *buf = xdr->buf;
unsigned int nwords = XDR_QUADLEN(len);
unsigned int cur = xdr_stream_pos(xdr);
unsigned int copied, offset;
if (xdr->nwords == 0)
return 0;
xdr_realign_pages(xdr);
if (nwords > xdr->nwords) { if (nwords > xdr->nwords) {
nwords = xdr->nwords; nwords = xdr->nwords;
len = nwords << 2; len = nwords << 2;
......
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