[PATCH v1 7/7] SUNRPC: Use the new xdr_buf_length() helper

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

 



Clean up.

Signed-off-by: Chuck Lever <chuck.lever@xxxxxxxxxx>
---
 fs/nfsd/nfs4xdr.c |    3 +--
 net/sunrpc/xdr.c  |    5 ++---
 2 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c
index 1e9690a061ec..26d005c5ec10 100644
--- a/fs/nfsd/nfs4xdr.c
+++ b/fs/nfsd/nfs4xdr.c
@@ -5426,8 +5426,7 @@ nfs4svc_encode_compoundres(struct svc_rqst *rqstp, struct xdr_stream *xdr)
 	struct xdr_buf *buf = xdr->buf;
 	__be32 *p;
 
-	WARN_ON_ONCE(buf->len != buf->head[0].iov_len + buf->page_len +
-				 buf->tail[0].iov_len);
+	WARN_ON_ONCE(buf->len != xdr_buf_length(buf));
 
 	/*
 	 * Send buffer space for the following items is reserved
diff --git a/net/sunrpc/xdr.c b/net/sunrpc/xdr.c
index 8ad637ca703e..f77a7d98b294 100644
--- a/net/sunrpc/xdr.c
+++ b/net/sunrpc/xdr.c
@@ -508,9 +508,8 @@ static unsigned int xdr_buf_pages_fill_sparse(const struct xdr_buf *buf,
 
 static void xdr_buf_try_expand(struct xdr_buf *buf, unsigned int len)
 {
-	struct kvec *head = buf->head;
 	struct kvec *tail = buf->tail;
-	unsigned int sum = head->iov_len + buf->page_len + tail->iov_len;
+	unsigned int sum = xdr_buf_length(buf);
 	unsigned int free_space, newlen;
 
 	if (sum > buf->len) {
@@ -2060,7 +2059,7 @@ int xdr_encode_array2(const struct xdr_buf *buf, unsigned int base,
 		      struct xdr_array2_desc *desc)
 {
 	if ((unsigned long) base + 4 + desc->array_len * desc->elem_size >
-	    buf->head->iov_len + buf->page_len + buf->tail->iov_len)
+	    xdr_buf_length(buf))
 		return -EINVAL;
 
 	return xdr_xcode_array2(buf, base, desc, 1);





[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