aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfsd
diff options
context:
space:
mode:
authorJ. Bruce Fields <bfields@redhat.com>2014-05-13 16:32:04 -0400
committerJ. Bruce Fields <bfields@redhat.com>2014-05-30 17:32:10 -0400
commit34a78b488f144e011493fa51f10c01d034d47c8e (patch)
tree301662ead05252fce0c993af8a69cc55fcf2130d /fs/nfsd
parentdc97618ddda9a23e5211e800f0614e9612178200 (diff)
nfsd4: read encoding cleanup
Trivial 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.c27
1 files changed, 14 insertions, 13 deletions
diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c
index bad762b6cf10..addb93bf03b7 100644
--- a/fs/nfsd/nfs4xdr.c
+++ b/fs/nfsd/nfs4xdr.c
@@ -3075,6 +3075,7 @@ static __be32 nfsd4_encode_splice_read(
3075 struct file *file, unsigned long maxcount) 3075 struct file *file, unsigned long maxcount)
3076{ 3076{
3077 struct xdr_stream *xdr = &resp->xdr; 3077 struct xdr_stream *xdr = &resp->xdr;
3078 struct xdr_buf *buf = xdr->buf;
3078 u32 eof; 3079 u32 eof;
3079 int starting_len = xdr->buf->len - 8; 3080 int starting_len = xdr->buf->len - 8;
3080 int space_left; 3081 int space_left;
@@ -3097,7 +3098,7 @@ static __be32 nfsd4_encode_splice_read(
3097 * page length; reset it so as not to confuse 3098 * page length; reset it so as not to confuse
3098 * xdr_truncate_encode: 3099 * xdr_truncate_encode:
3099 */ 3100 */
3100 xdr->buf->page_len = 0; 3101 buf->page_len = 0;
3101 return nfserr; 3102 return nfserr;
3102 } 3103 }
3103 3104
@@ -3105,29 +3106,29 @@ static __be32 nfsd4_encode_splice_read(
3105 read->rd_fhp->fh_dentry->d_inode->i_size); 3106 read->rd_fhp->fh_dentry->d_inode->i_size);
3106 3107
3107 tmp = htonl(eof); 3108 tmp = htonl(eof);
3108 write_bytes_to_xdr_buf(xdr->buf, starting_len , &tmp, 4); 3109 write_bytes_to_xdr_buf(buf, starting_len , &tmp, 4);
3109 tmp = htonl(maxcount); 3110 tmp = htonl(maxcount);
3110 write_bytes_to_xdr_buf(xdr->buf, starting_len + 4, &tmp, 4); 3111 write_bytes_to_xdr_buf(buf, starting_len + 4, &tmp, 4);
3111 3112
3112 resp->xdr.buf->page_len = maxcount; 3113 buf->page_len = maxcount;
3113 xdr->buf->len += maxcount; 3114 buf->len += maxcount;
3114 xdr->page_ptr += (maxcount + PAGE_SIZE - 1) / PAGE_SIZE; 3115 xdr->page_ptr += (maxcount + PAGE_SIZE - 1) / PAGE_SIZE;
3115 xdr->iov = xdr->buf->tail; 3116 xdr->iov = buf->tail;
3116 3117
3117 /* Use rest of head for padding and remaining ops: */ 3118 /* Use rest of head for padding and remaining ops: */
3118 resp->xdr.buf->tail[0].iov_base = xdr->p; 3119 buf->tail[0].iov_base = xdr->p;
3119 resp->xdr.buf->tail[0].iov_len = 0; 3120 buf->tail[0].iov_len = 0;
3120 if (maxcount&3) { 3121 if (maxcount&3) {
3121 p = xdr_reserve_space(xdr, 4); 3122 p = xdr_reserve_space(xdr, 4);
3122 WRITE32(0); 3123 WRITE32(0);
3123 resp->xdr.buf->tail[0].iov_base += maxcount&3; 3124 buf->tail[0].iov_base += maxcount&3;
3124 resp->xdr.buf->tail[0].iov_len = 4 - (maxcount&3); 3125 buf->tail[0].iov_len = 4 - (maxcount&3);
3125 xdr->buf->len -= (maxcount&3); 3126 buf->len -= (maxcount&3);
3126 } 3127 }
3127 3128
3128 space_left = min_t(int, (void *)xdr->end - (void *)xdr->p, 3129 space_left = min_t(int, (void *)xdr->end - (void *)xdr->p,
3129 xdr->buf->buflen - xdr->buf->len); 3130 buf->buflen - buf->len);
3130 xdr->buf->buflen = xdr->buf->len + space_left; 3131 buf->buflen = buf->len + space_left;
3131 xdr->end = (__be32 *)((void *)xdr->end + space_left); 3132 xdr->end = (__be32 *)((void *)xdr->end + space_left);
3132 3133
3133 return 0; 3134 return 0;