Commit 7dcf4ab9 authored by Chuck Lever's avatar Chuck Lever

NFSD: Clean up nfsd4_encode_readv

Address some minor nits I noticed while working on this function.
Signed-off-by: default avatarChuck Lever <chuck.lever@oracle.com>
parent 41205539
...@@ -3591,7 +3591,6 @@ static __be32 nfsd4_encode_readv(struct nfsd4_compoundres *resp, ...@@ -3591,7 +3591,6 @@ static __be32 nfsd4_encode_readv(struct nfsd4_compoundres *resp,
__be32 nfserr; __be32 nfserr;
__be32 tmp; __be32 tmp;
__be32 *p; __be32 *p;
u32 zzz = 0;
int pad; int pad;
/* /*
...@@ -3607,7 +3606,7 @@ static __be32 nfsd4_encode_readv(struct nfsd4_compoundres *resp, ...@@ -3607,7 +3606,7 @@ static __be32 nfsd4_encode_readv(struct nfsd4_compoundres *resp,
v = 0; v = 0;
while (len) { while (len) {
thislen = min_t(long, len, PAGE_SIZE); thislen = min_t(long, len, PAGE_SIZE);
p = xdr_reserve_space(xdr, (thislen+3)&~3); p = xdr_reserve_space(xdr, thislen);
WARN_ON_ONCE(!p); WARN_ON_ONCE(!p);
resp->rqstp->rq_vec[v].iov_base = p; resp->rqstp->rq_vec[v].iov_base = p;
resp->rqstp->rq_vec[v].iov_len = thislen; resp->rqstp->rq_vec[v].iov_len = thislen;
...@@ -3616,7 +3615,6 @@ static __be32 nfsd4_encode_readv(struct nfsd4_compoundres *resp, ...@@ -3616,7 +3615,6 @@ static __be32 nfsd4_encode_readv(struct nfsd4_compoundres *resp,
} }
read->rd_vlen = v; read->rd_vlen = v;
len = maxcount;
nfserr = nfsd_readv(resp->rqstp, read->rd_fhp, file, read->rd_offset, nfserr = nfsd_readv(resp->rqstp, read->rd_fhp, file, read->rd_offset,
resp->rqstp->rq_vec, read->rd_vlen, &maxcount, resp->rqstp->rq_vec, read->rd_vlen, &maxcount,
&eof); &eof);
...@@ -3625,16 +3623,17 @@ static __be32 nfsd4_encode_readv(struct nfsd4_compoundres *resp, ...@@ -3625,16 +3623,17 @@ static __be32 nfsd4_encode_readv(struct nfsd4_compoundres *resp,
return nfserr; return nfserr;
if (svc_encode_read_payload(resp->rqstp, starting_len + 8, maxcount)) if (svc_encode_read_payload(resp->rqstp, starting_len + 8, maxcount))
return nfserr_io; return nfserr_io;
xdr_truncate_encode(xdr, starting_len + 8 + ((maxcount+3)&~3)); xdr_truncate_encode(xdr, starting_len + 8 + xdr_align_size(maxcount));
tmp = htonl(eof); tmp = htonl(eof);
write_bytes_to_xdr_buf(xdr->buf, starting_len , &tmp, 4); write_bytes_to_xdr_buf(xdr->buf, starting_len , &tmp, 4);
tmp = htonl(maxcount); tmp = htonl(maxcount);
write_bytes_to_xdr_buf(xdr->buf, starting_len + 4, &tmp, 4); write_bytes_to_xdr_buf(xdr->buf, starting_len + 4, &tmp, 4);
tmp = xdr_zero;
pad = (maxcount&3) ? 4 - (maxcount&3) : 0; pad = (maxcount&3) ? 4 - (maxcount&3) : 0;
write_bytes_to_xdr_buf(xdr->buf, starting_len + 8 + maxcount, write_bytes_to_xdr_buf(xdr->buf, starting_len + 8 + maxcount,
&zzz, pad); &tmp, pad);
return 0; return 0;
} }
......
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