All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH RFC 0/4] Encode NFSv4 attributes via a branch table
@ 2023-06-30  1:34 Chuck Lever
  2023-06-30  1:34 ` [PATCH RFC 1/4] NFSD: Add struct nfsd4_fattr_args Chuck Lever
                   ` (4 more replies)
  0 siblings, 5 replies; 9+ messages in thread
From: Chuck Lever @ 2023-06-30  1:34 UTC (permalink / raw)
  To: linux-nfs; +Cc: Chuck Lever

Here's something just for fun. I've converted nfsd4_encode_fattr4()
to use a bitmask loop, calling an encode helper for each attribute
to be encoded. Rotten tomatoes and gold stars are both acceptible.

I was hoping for a bit of a performance gain because encode_fattr4
is called so very often, but there was not much difference at all.

The main benefit here is the hard scope boundary for each of the
separate attribute encoders -- that makes for safer code that is
easier to reason about, and might even be more straightforward to
convert to machine-generated code, if we ever want to do that.

And notably it will automatically encode the attributes in bitmask
order.

There are a few readability improvements that could be done, like
defining meaningfully-named macros for the bit positions. The ones
we have now are not directly usable for table indices. It might get
us another step closer to the XDR specification if we could find a
way to encode the whole bitmask in a single loop.

---

Chuck Lever (4):
      NFSD: Add struct nfsd4_fattr_args
      NFSD: Encode attributes in WORD0 using a bitmask loop
      NFSD: Encode attributes in WORD1 using a bitmask loop
      NFSD: Encode attributes in WORD2 using a bitmask loop


 fs/nfsd/nfs4xdr.c | 1089 +++++++++++++++++++++++++++------------------
 1 file changed, 657 insertions(+), 432 deletions(-)

--
Chuck Lever


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2023-07-03 23:05 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-30  1:34 [PATCH RFC 0/4] Encode NFSv4 attributes via a branch table Chuck Lever
2023-06-30  1:34 ` [PATCH RFC 1/4] NFSD: Add struct nfsd4_fattr_args Chuck Lever
2023-06-30  1:34 ` [PATCH RFC 2/4] NFSD: Encode attributes in WORD0 using a bitmask loop Chuck Lever
2023-06-30  1:34 ` [PATCH RFC 3/4] NFSD: Encode attributes in WORD1 " Chuck Lever
2023-06-30  1:35 ` [PATCH RFC 4/4] NFSD: Encode attributes in WORD2 " Chuck Lever
2023-07-03  4:48 ` [PATCH RFC 0/4] Encode NFSv4 attributes via a branch table NeilBrown
2023-07-03 13:56   ` Chuck Lever III
2023-07-03 21:33     ` NeilBrown
2023-07-03 23:05       ` Chuck Lever III

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.