Re: [PATCH 20/50] nfsd4: keep xdr buf length updated

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

 



> diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c
> index fae7d02..a3dce3c 100644
> --- a/fs/nfsd/nfs4xdr.c
> +++ b/fs/nfsd/nfs4xdr.c
> @@ -3051,9 +3051,10 @@ nfsd4_encode_read(struct nfsd4_compoundres *resp, __be32 nfserr,
>  	WRITE32(eof);
>  	WRITE32(maxcount);
>  	ADJUST_ARGS();
> -	resp->xdr.buf->head[0].iov_len = (char*)p
> -				- (char*)resp->xdr.buf->head[0].iov_base;
> +	WARN_ON_ONCE(resp->xdr.buf->head[0].iov_len != (char*)p
> +				- (char*)resp->xdr.buf->head[0].iov_base);

There should be spaces between the typename and the *.

>  	resp->xdr.buf->page_len = maxcount;
> +	xdr->buf->len += maxcount;
>  	xdr->iov = xdr->buf->tail;
>  
>  	/* Use rest of head for padding and remaining ops: */
> @@ -3064,6 +3065,7 @@ nfsd4_encode_read(struct nfsd4_compoundres *resp, __be32 nfserr,
>  		WRITE32(0);
>  		resp->xdr.buf->tail[0].iov_base += maxcount&3;
>  		resp->xdr.buf->tail[0].iov_len = 4 - (maxcount&3);
> +		xdr->buf->len -= (maxcount&3);
>  		ADJUST_ARGS();
>  	}
>  	return 0;
> @@ -3109,6 +3111,7 @@ nfsd4_encode_readlink(struct nfsd4_compoundres *resp, __be32 nfserr, struct nfsd
>  	resp->xdr.buf->head[0].iov_len = (char*)p
>  				- (char*)resp->xdr.buf->head[0].iov_base;
>  	resp->xdr.buf->page_len = maxcount;
> +	xdr->buf->len += maxcount;
>  	xdr->iov = xdr->buf->tail;

To me it seems all these manpiluations sream for being split into
well-documented little helpers.

--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[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