nfsd4: simplify server xdr->next_page use
authorJ. Bruce Fields <bfields@redhat.com>
Mon, 2 Jun 2014 16:05:47 +0000 (12:05 -0400)
committerJ. Bruce Fields <bfields@redhat.com>
Fri, 6 Jun 2014 23:22:46 +0000 (19:22 -0400)
commit05638dc73af2586517468b1159d4b76e90607359
treea3d8f7009fd818bb0bd263d74697cf9d2f1b5e6a
parent3fb87d13ce29637e0ae005fa66a4f917cce6fede
nfsd4: simplify server xdr->next_page use

The rpc code makes available to the NFS server an array of pages to
encod into.  The server represents its reply as an xdr buf, with the
head pointing into the first page in that array, the pages ** array
starting just after that, and the tail (if any) sharing any leftover
space in the page used by the head.

While encoding, we use xdr_stream->page_ptr to keep track of which page
we're currently using.

Currently we set xdr_stream->page_ptr to buf->pages, which makes the
head a weird exception to the rule that page_ptr always points to the
page we're currently encoding into.  So, instead set it to buf->pages -
1 (the page actually containing the head), and remove the need for a
little unintuitive logic in xdr_get_next_encode_buffer() and
xdr_truncate_encode.

Signed-off-by: J. Bruce Fields <bfields@redhat.com>
fs/nfsd/nfs4proc.c
net/sunrpc/xdr.c