From: Chuck Lever III <chuck.lever@oracle.com>
To: Jeff Layton <jlayton@kernel.org>
Cc: Linux NFS Mailing List <linux-nfs@vger.kernel.org>
Subject: Re: [PATCH v1 1/8] NFSD: Optimize nfsd4_encode_operation()
Date: Mon, 25 Jul 2022 20:18:17 +0000 [thread overview]
Message-ID: <7B967688-54B3-489A-87B9-3971DDFFFE87@oracle.com> (raw)
In-Reply-To: <59534604ed620c0b7e9ec565a4f1505ca0910420.camel@kernel.org>
> On Jul 25, 2022, at 11:36 AM, Jeff Layton <jlayton@kernel.org> wrote:
>
> On Fri, 2022-07-22 at 20:12 +0000, Chuck Lever III wrote:
>>
>>> On Jul 22, 2022, at 4:08 PM, Chuck Lever <chuck.lever@oracle.com> wrote:
>>>
>>> write_bytes_to_xdr_buf() is a generic way to place a variable-length
>>> data item in an already-reserved spot in the encoding buffer.
>>> However, it is costly, and here, it is unnecessary because the
>>> data item is fixed in size, the buffer destination address is
>>> always word-aligned, and the destination location is already in
>>> @p.
>>>
>>> Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
>>> ---
>>> fs/nfsd/nfs4xdr.c | 3 +--
>>> 1 file changed, 1 insertion(+), 2 deletions(-)
>>>
>>> diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c
>>> index 2acea7792bb2..b52ea7d8313a 100644
>>> --- a/fs/nfsd/nfs4xdr.c
>>> +++ b/fs/nfsd/nfs4xdr.c
>>> @@ -5373,8 +5373,7 @@ nfsd4_encode_operation(struct nfsd4_compoundres *resp, struct nfsd4_op *op)
>>> so->so_replay.rp_buf, len);
>>> }
>>> status:
>>> - /* Note that op->status is already in network byte order: */
>>> - write_bytes_to_xdr_buf(xdr->buf, post_err_offset - 4, &op->status, 4);
>>> + *p = op->status;
>>> }
>>>
>>> /*
>>
>> I hit "Send" too soon. Here's the cover letter for this series.
>>
>> write_bytes_to_xdr_buf() is a generic mechanism by which to push
>> an arbitrary set of bytes to an arbitrary alignment within an
>> xdr_buf. It's expensive to use, though.
>>
>> I found several hot paths in the server's NFSv4 reply encoders
>> that write a 4-byte XDR data item on a 4-byte alignment, and
>> thus can use the classic "*p = cpu_to_be32(yada)" form instead
>> of write_bytes_to_xdr_buf().
>>
>> This series replaces some write_bytes_to_xdr_buf() call sites.
>>
>>
>> --
>> Chuck Lever
>>
>>
>>
>
> Nice cleanup. This series looks good to me (and it's a net-negative LoC
> too).
>
> Reviewed-by: Jeff Layton <jlayton@kernel.org>
Thanks, Jeff!
--
Chuck Lever
prev parent reply other threads:[~2022-07-25 20:18 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-22 20:08 [PATCH v1 1/8] NFSD: Optimize nfsd4_encode_operation() Chuck Lever
2022-07-22 20:08 ` [PATCH v1 2/8] NFSD: Optimize nfsd4_encode_fattr() Chuck Lever
2022-07-22 20:08 ` [PATCH v1 3/8] NFSD: Clean up SPLICE_OK in nfsd4_encode_read() Chuck Lever
2022-07-22 20:08 ` [PATCH v1 4/8] NFSD: Add an nfsd4_read::rd_eof field Chuck Lever
2022-07-22 20:09 ` [PATCH v1 5/8] NFSD: Optimize nfsd4_encode_readv() Chuck Lever
2022-07-22 20:09 ` [PATCH v1 6/8] NFSD: Simplify starting_len Chuck Lever
2022-07-22 20:09 ` [PATCH v1 7/8] NFSD: Use xdr_pad_size() Chuck Lever
2022-07-22 20:09 ` [PATCH v1 8/8] NFSD: Clean up nfsd_encode_readlink() Chuck Lever
2022-07-22 20:12 ` [PATCH v1 1/8] NFSD: Optimize nfsd4_encode_operation() Chuck Lever III
2022-07-25 15:36 ` Jeff Layton
2022-07-25 20:18 ` Chuck Lever III [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=7B967688-54B3-489A-87B9-3971DDFFFE87@oracle.com \
--to=chuck.lever@oracle.com \
--cc=jlayton@kernel.org \
--cc=linux-nfs@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox