On Mon, 06 Jun 2022, Chuck Lever wrote:
> The value of @p is not used until the "location of the next item" is
> computed. Help human readers by moving its initial assignment to the
> paragraph where that value is used and by clarifying the antecedents
> in the documenting comment.
>
> Signed-off-by: Chuck Lever <[email protected]>
Reviewed-by: NeilBrown <[email protected]>
> ---
> net/sunrpc/xdr.c | 8 +++++---
> 1 file changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/net/sunrpc/xdr.c b/net/sunrpc/xdr.c
> index de8f71468637..89cb48931a1f 100644
> --- a/net/sunrpc/xdr.c
> +++ b/net/sunrpc/xdr.c
> @@ -971,6 +971,7 @@ static noinline __be32 *xdr_get_next_encode_buffer(struct xdr_stream *xdr,
> xdr->buf->page_len += frag1bytes;
> xdr->page_ptr++;
> xdr->iov = NULL;
> +
> /*
> * If the last encode didn't end exactly on a page boundary, the
> * next one will straddle boundaries. Encode into the next
> @@ -979,11 +980,12 @@ static noinline __be32 *xdr_get_next_encode_buffer(struct xdr_stream *xdr,
> * space at the end of the previous buffer:
> */
> xdr_set_scratch_buffer(xdr, xdr->p, frag1bytes);
> - p = page_address(*xdr->page_ptr);
> +
> /*
> - * Note this is where the next encode will start after we've
> - * shifted this one back:
> + * xdr->p is where the next encode will start after
> + * xdr_commit_encode() has shifted this one back:
> */
> + p = page_address(*xdr->page_ptr);
> xdr->p = (void *)p + frag2bytes;
> space_left = xdr->buf->buflen - xdr->buf->len;
> if (space_left - nbytes >= PAGE_SIZE)
>
>
>