six locks: Simplify dispatch
authorKent Overstreet <kent.overstreet@linux.dev>
Sun, 21 May 2023 01:44:30 +0000 (21:44 -0400)
committerKent Overstreet <kent.overstreet@linux.dev>
Sun, 22 Oct 2023 21:10:02 +0000 (17:10 -0400)
commitc4bd3491b1c0b335f63599ec96d1d4ab0d37a3c1
tree4be0daffa01be52e7629c131bb43cbec38c943a3
parentd2c86b77de5894bbe26ecbf5214227f61855aed7
six locks: Simplify dispatch

Originally, we used inlining/flattening to cause the compiler to
generate different versions of lock/trylock/relock/unlock for each lock
type - read, intent, and write. This made the individual functions
smaller and let the compiler eliminate table lookups: however, as the
code has gotten more complicated these optimizations have gotten less
worthwhile, and all the tricky inlining and dispatching made the code
less readable.

Text size: 11015 bytes -> 7467 bytes, and benchmarks show no loss of
performance.

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
fs/bcachefs/six.c
fs/bcachefs/six.h