[PATCH RFC 6/8] NFSD: NFSv3 support for automated padding of xdr_buf::pages

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Chuck Lever <chuck.lever@xxxxxxxxxx>
---
 fs/nfsd/nfs3xdr.c |   19 +++----------------
 1 file changed, 3 insertions(+), 16 deletions(-)

diff --git a/fs/nfsd/nfs3xdr.c b/fs/nfsd/nfs3xdr.c
index 195ab7a0fc89..91d96a329033 100644
--- a/fs/nfsd/nfs3xdr.c
+++ b/fs/nfsd/nfs3xdr.c
@@ -709,13 +709,7 @@ void fill_post_wcc(struct svc_fh *fhp)
 	if (resp->status == 0) {
 		*p++ = htonl(resp->len);
 		xdr_ressize_check(rqstp, p);
-		rqstp->rq_res.page_len = resp->len;
-		if (resp->len & 3) {
-			/* need to pad the tail */
-			rqstp->rq_res.tail[0].iov_base = p;
-			*p = 0;
-			rqstp->rq_res.tail[0].iov_len = 4 - (resp->len&3);
-		}
+		xdr_buf_set_pagelen(&rqstp->rq_res, resp->len);
 		return 1;
 	} else
 		return xdr_ressize_check(rqstp, p);
@@ -733,14 +727,7 @@ void fill_post_wcc(struct svc_fh *fhp)
 		*p++ = htonl(resp->eof);
 		*p++ = htonl(resp->count);	/* xdr opaque count */
 		xdr_ressize_check(rqstp, p);
-		/* now update rqstp->rq_res to reflect data as well */
-		rqstp->rq_res.page_len = resp->count;
-		if (resp->count & 3) {
-			/* need to pad the tail */
-			rqstp->rq_res.tail[0].iov_base = p;
-			*p = 0;
-			rqstp->rq_res.tail[0].iov_len = 4 - (resp->count & 3);
-		}
+		xdr_buf_set_pagelen(&rqstp->rq_res, resp->count);
 		return 1;
 	} else
 		return xdr_ressize_check(rqstp, p);
@@ -817,7 +804,7 @@ void fill_post_wcc(struct svc_fh *fhp)
 		xdr_ressize_check(rqstp, p);
 		if (rqstp->rq_res.head[0].iov_len + (2<<2) > PAGE_SIZE)
 			return 1; /*No room for trailer */
-		rqstp->rq_res.page_len = (resp->count) << 2;
+		xdr_buf_set_pagelen(&rqstp->rq_res, resp->count << 2);
 
 		/* add the 'tail' to the end of the 'head' page - page 0. */
 		rqstp->rq_res.tail[0].iov_base = p;




[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux