aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfsd
diff options
context:
space:
mode:
authorJ. Bruce Fields <bfields@redhat.com>2014-05-13 17:27:03 -0400
committerJ. Bruce Fields <bfields@redhat.com>2014-05-30 17:32:11 -0400
commitfec25fa4ad728dd9b063313f2a61ff65eae0d571 (patch)
tree120c2f2ac802f273557bdc79f9c0fc86abf36576 /fs/nfsd
parent34a78b488f144e011493fa51f10c01d034d47c8e (diff)
nfsd4: more read encoding cleanup
More cleanup, no change in functionality. Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Diffstat (limited to 'fs/nfsd')
-rw-r--r--fs/nfsd/nfs4xdr.c22
1 files changed, 10 insertions, 12 deletions
diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c
index addb93bf03b7..92f071b44f75 100644
--- a/fs/nfsd/nfs4xdr.c
+++ b/fs/nfsd/nfs4xdr.c
@@ -3077,11 +3077,9 @@ static __be32 nfsd4_encode_splice_read(
3077 struct xdr_stream *xdr = &resp->xdr; 3077 struct xdr_stream *xdr = &resp->xdr;
3078 struct xdr_buf *buf = xdr->buf; 3078 struct xdr_buf *buf = xdr->buf;
3079 u32 eof; 3079 u32 eof;
3080 int starting_len = xdr->buf->len - 8;
3081 int space_left; 3080 int space_left;
3082 __be32 nfserr; 3081 __be32 nfserr;
3083 __be32 tmp; 3082 __be32 *p = xdr->p - 2;
3084 __be32 *p;
3085 3083
3086 /* 3084 /*
3087 * Don't inline pages unless we know there's room for eof, 3085 * Don't inline pages unless we know there's room for eof,
@@ -3105,25 +3103,25 @@ static __be32 nfsd4_encode_splice_read(
3105 eof = (read->rd_offset + maxcount >= 3103 eof = (read->rd_offset + maxcount >=
3106 read->rd_fhp->fh_dentry->d_inode->i_size); 3104 read->rd_fhp->fh_dentry->d_inode->i_size);
3107 3105
3108 tmp = htonl(eof); 3106 *(p++) = htonl(eof);
3109 write_bytes_to_xdr_buf(buf, starting_len , &tmp, 4); 3107 *(p++) = htonl(maxcount);
3110 tmp = htonl(maxcount);
3111 write_bytes_to_xdr_buf(buf, starting_len + 4, &tmp, 4);
3112 3108
3113 buf->page_len = maxcount; 3109 buf->page_len = maxcount;
3114 buf->len += maxcount; 3110 buf->len += maxcount;
3115 xdr->page_ptr += (maxcount + PAGE_SIZE - 1) / PAGE_SIZE; 3111 xdr->page_ptr += (maxcount + PAGE_SIZE - 1) / PAGE_SIZE;
3116 xdr->iov = buf->tail;
3117 3112
3118 /* Use rest of head for padding and remaining ops: */ 3113 /* Use rest of head for padding and remaining ops: */
3119 buf->tail[0].iov_base = xdr->p; 3114 buf->tail[0].iov_base = xdr->p;
3120 buf->tail[0].iov_len = 0; 3115 buf->tail[0].iov_len = 0;
3116 xdr->iov = buf->tail;
3121 if (maxcount&3) { 3117 if (maxcount&3) {
3122 p = xdr_reserve_space(xdr, 4); 3118 int pad = 4 - (maxcount&3);
3123 WRITE32(0); 3119
3120 *(xdr->p++) = 0;
3121
3124 buf->tail[0].iov_base += maxcount&3; 3122 buf->tail[0].iov_base += maxcount&3;
3125 buf->tail[0].iov_len = 4 - (maxcount&3); 3123 buf->tail[0].iov_len = pad;
3126 buf->len -= (maxcount&3); 3124 buf->len += pad;
3127 } 3125 }
3128 3126
3129 space_left = min_t(int, (void *)xdr->end - (void *)xdr->p, 3127 space_left = min_t(int, (void *)xdr->end - (void *)xdr->p,