forked from Minki/linux
SUNRPC: Remove xdr_align_data() and xdr_expand_hole()
These functions are no longer needed now that the NFS client places data and hole segments directly. Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com> Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
This commit is contained in:
parent
d3b00a802c
commit
29946fbcb2
@ -259,8 +259,6 @@ extern unsigned int xdr_read_pages(struct xdr_stream *xdr, unsigned int len);
|
||||
extern void xdr_enter_page(struct xdr_stream *xdr, unsigned int len);
|
||||
extern int xdr_process_buf(const struct xdr_buf *buf, unsigned int offset, unsigned int len, int (*actor)(struct scatterlist *, void *), void *data);
|
||||
extern void xdr_set_pagelen(struct xdr_stream *, unsigned int len);
|
||||
extern unsigned int xdr_align_data(struct xdr_stream *, unsigned int offset, unsigned int length);
|
||||
extern unsigned int xdr_expand_hole(struct xdr_stream *, unsigned int offset, unsigned int length);
|
||||
extern bool xdr_stream_subsegment(struct xdr_stream *xdr, struct xdr_buf *subbuf,
|
||||
unsigned int len);
|
||||
extern unsigned int xdr_stream_move_subsegment(struct xdr_stream *xdr, unsigned int offset,
|
||||
|
@ -1530,72 +1530,6 @@ void xdr_set_pagelen(struct xdr_stream *xdr, unsigned int len)
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(xdr_set_pagelen);
|
||||
|
||||
unsigned int xdr_align_data(struct xdr_stream *xdr, unsigned int offset,
|
||||
unsigned int length)
|
||||
{
|
||||
struct xdr_buf *buf = xdr->buf;
|
||||
unsigned int from, bytes, len;
|
||||
unsigned int shift;
|
||||
|
||||
xdr_realign_pages(xdr);
|
||||
from = xdr_page_pos(xdr);
|
||||
|
||||
if (from >= buf->page_len + buf->tail->iov_len)
|
||||
return 0;
|
||||
if (from + buf->head->iov_len >= buf->len)
|
||||
return 0;
|
||||
|
||||
len = buf->len - buf->head->iov_len;
|
||||
|
||||
/* We only shift data left! */
|
||||
if (WARN_ONCE(from < offset, "SUNRPC: misaligned data src=%u dst=%u\n",
|
||||
from, offset))
|
||||
return 0;
|
||||
if (WARN_ONCE(offset > buf->page_len,
|
||||
"SUNRPC: buffer overflow. offset=%u, page_len=%u\n",
|
||||
offset, buf->page_len))
|
||||
return 0;
|
||||
|
||||
/* Move page data to the left */
|
||||
shift = from - offset;
|
||||
xdr_buf_pages_shift_left(buf, from, len, shift);
|
||||
|
||||
bytes = xdr_stream_remaining(xdr);
|
||||
if (length > bytes)
|
||||
length = bytes;
|
||||
bytes -= length;
|
||||
|
||||
xdr->buf->len -= shift;
|
||||
xdr_set_page(xdr, offset + length, bytes);
|
||||
return length;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(xdr_align_data);
|
||||
|
||||
unsigned int xdr_expand_hole(struct xdr_stream *xdr, unsigned int offset,
|
||||
unsigned int length)
|
||||
{
|
||||
struct xdr_buf *buf = xdr->buf;
|
||||
unsigned int from, to, shift;
|
||||
|
||||
xdr_realign_pages(xdr);
|
||||
from = xdr_page_pos(xdr);
|
||||
to = xdr_align_size(offset + length);
|
||||
|
||||
/* Could the hole be behind us? */
|
||||
if (to > from) {
|
||||
unsigned int buflen = buf->len - buf->head->iov_len;
|
||||
shift = to - from;
|
||||
xdr_buf_try_expand(buf, shift);
|
||||
xdr_buf_pages_shift_right(buf, from, buflen, shift);
|
||||
xdr_set_page(xdr, to, xdr_stream_remaining(xdr));
|
||||
} else if (to != from)
|
||||
xdr_align_data(xdr, to, 0);
|
||||
xdr_buf_pages_zero(buf, offset, length);
|
||||
|
||||
return length;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(xdr_expand_hole);
|
||||
|
||||
/**
|
||||
* xdr_enter_page - decode data from the XDR page
|
||||
* @xdr: pointer to xdr_stream struct
|
||||
|
Loading…
Reference in New Issue
Block a user