Files
linux/Documentation
Linus Torvalds 743a116a19 assoc_array: correct the documentation of get_key_chunk()'s level argument
assoc_array.rst says the level passed to get_key_chunk() will be a
multiple of ASSOC_ARRAY_KEY_CHUNK_SIZE, and asks for the chunk starting
at that bit.  assoc_array_walk() after a shortcut, and both insertion
paths, pass the level of a node, which is any multiple of 4.  Each then
shifts the chunk it gets back right by level & ASSOC_ARRAY_KEY_CHUNK_MASK,
so what it wants is the chunk that contains that bit.

The keyring code copes, because keyring_get_key_chunk() divides the
level by ASSOC_ARRAY_KEY_CHUNK_SIZE before using it.  An implementation
written to the documentation does not: one that returns a one-word key
for level 0 and nothing for any other level files leaves under the
wrong slot the first time a node is split, and a later insertion hits
the BUG_ON() after found_slot_for_multiple_occupancy in
assoc_array_insert_into_terminal_node().

Say what the code expects.  get_object_key_chunk() is documented as
"the previous function", so this covers it too.

Assisted-by: LLM
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2026-10-11 12:42:26 -07:00
..
2026-09-10 16:55:47 -07:00
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
2026-08-11 10:45:54 -06:00
…
…