mirror of
https://github.com/torvalds/linux.git
synced 2026-11-20 13:03:48 +00:00
Merge tag 'assoc-array-fixes-v2'
Clean up assoc_array library code I had already gotten rid of this tag locally, because we then decided to just remove the assoc_array library entirely since it has only one single user - the key handling code - and that user is getting rewritten to use rhashtable instead. But that removal is scheduled for 7.5, and this fixes real bugs and does clean up some of the code. So while it's all slated for removal, some of the fixes need back-porting and we might as well remove the cleaned-up version. Maybe somebody decides they want to resurrect it for another project - it really is fairly generic library code - they shouldn't get the messy end state that we decided to jettison. Background: Nils Ollrogge reported a bug in the assoc_array library and had a patch to fix it too, but that code was too obscure for me to follow, so I used some LLM tools to help make sense of it all and found more issues in the process. * tag 'assoc-array-fixes-v2': assoc_array: use assoc_array_parent_link() when splitting a shortcut assoc_array: find and collapse in deletion without gotos assoc_array: move deletion's collapse into a function of its own assoc_array: replace the labels in gc's tree walk with a loop assoc_array: move gc's folding into a function of its own assoc_array: keep gc's cleanup out of the live tree on allocation failure assoc_array: don't chain a new shortcut onto an existing one assoc_array: choose between splitting a node and a shortcut without gotos assoc_array: move shortcut creation into a function of its own assoc_array: move node splitting into a function of its own assoc_array: fill the segment cache in one place assoc_array: move in-place insertion into a function of its own assoc_array: don't lose objects when a root shortcut is split at level 4 assoc_array: don't lose objects when a shortcut is split on a word boundary assoc_array: correct the documentation of get_key_chunk()'s level argument
This commit is contained in:
@@ -123,10 +123,12 @@ This points to a number of methods, all of which need to be provided:
|
||||
|
||||
unsigned long (*get_key_chunk)(const void *index_key, int level);
|
||||
|
||||
This should return a chunk of caller-supplied index key starting at the
|
||||
*bit* position given by the level argument. The level argument will be a
|
||||
multiple of ``ASSOC_ARRAY_KEY_CHUNK_SIZE`` and the function should return
|
||||
``ASSOC_ARRAY_KEY_CHUNK_SIZE bits``. No error is possible.
|
||||
This should return the ``ASSOC_ARRAY_KEY_CHUNK_SIZE`` bits of
|
||||
caller-supplied index key that contain the *bit* position given by the
|
||||
level argument, starting at level rounded down to a multiple of
|
||||
``ASSOC_ARRAY_KEY_CHUNK_SIZE``. The level is often that of a node, which
|
||||
is a multiple of ``ASSOC_ARRAY_LEVEL_STEP``, so the function has to do the
|
||||
rounding. No error is possible.
|
||||
|
||||
|
||||
2. Get a chunk of an object's index key::
|
||||
|
||||
@@ -80,7 +80,7 @@ struct assoc_array_edit {
|
||||
struct assoc_array_ptr **leaf_p;
|
||||
struct assoc_array_ptr *dead_leaf;
|
||||
struct assoc_array_ptr *new_meta[3];
|
||||
struct assoc_array_ptr *excised_meta[1];
|
||||
struct assoc_array_ptr *excised_meta[2];
|
||||
struct assoc_array_ptr *excised_subtree;
|
||||
struct assoc_array_ptr **set_backpointers[ASSOC_ARRAY_FAN_OUT];
|
||||
struct assoc_array_ptr *set_backpointers_to;
|
||||
|
||||
+524
-363
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user