Skip to contentSkip to conversation

docs: maple_tree: Replace removed bulk insertion API

PATCH Applied Karl Mehltretter 3 participants 3 messages Sep 5 – Sep 7

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 docs: maple_tree: Replace removed bulk insertion API

Commit e3852a1213ff ("maple_tree: Drop bulk insert support") removed mas_expected_entries() but left the documentation describing it. Document the current preallocation interface instead.

Fixes e3852a1213ff ("maple_tree: Drop bulk insert support")
Assisted-by LLM
---
 Documentation/core-api/maple_tree.rst | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)
Documentation/core-api/maple_tree.rst +4 -5
index 12bccfb6aac1..836342fb1eec 100644
@@ -214,11 +214,10 @@ Advanced Allocating Nodes
 -------------------------
 
 Allocations are usually handled internally to the tree, however if allocations
-need to occur before a write occurs then calling mas_expected_entries() will
-allocate the worst-case number of needed nodes to insert the provided number of
-ranges.  This also causes the tree to enter mass insertion mode.  Once
-insertions are complete calling mas_destroy() on the maple state will free the
-unused allocations.
+need to occur before a write occurs then calling mas_preallocate() will
+allocate the nodes needed to store the provided entry.  The entry is then
+stored with mas_store_prealloc().  If the store is abandoned, calling
+mas_destroy() on the maple state will free the unused allocations.
 
 .. _maple-tree-advanced-locks:
 
Signature · 1 line
2.53.0
Acked-by on v1 1/1
#1 lore raw
Quoted 33 lines · Karl Mehltretter

Commit e3852a1213ff ("maple_tree: Drop bulk insert support") removed mas_expected_entries() but left the documentation describing it. Document the current preallocation interface instead.

Fixes e3852a1213ff ("maple_tree: Drop bulk insert support")
Assisted-by LLM
---
 Documentation/core-api/maple_tree.rst | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)
Documentation/core-api/maple_tree.rst +4 -5
index 12bccfb6aac1..836342fb1eec 100644
@@ -214,11 +214,10 @@ Advanced Allocating Nodes
 -------------------------
 
 Allocations are usually handled internally to the tree, however if allocations
-need to occur before a write occurs then calling mas_expected_entries() will
-allocate the worst-case number of needed nodes to insert the provided number of
-ranges.  This also causes the tree to enter mass insertion mode.  Once
-insertions are complete calling mas_destroy() on the maple state will free the
-unused allocations.
+need to occur before a write occurs then calling mas_preallocate() will
+allocate the nodes needed to store the provided entry.  The entry is then
+stored with mas_store_prealloc().  If the store is abandoned, calling
+mas_destroy() on the maple state will free the unused allocations.
 
 .. _maple-tree-advanced-locks:
 
Signature · 1 line
2.53.0

Hi Karl

The documented behavior appears to be consistent with the existing tests in tools/testing/radix-tree/maple.c, in particular the mas_preallocate() / mas_store_prealloc() / mas_destroy() handling around lines 35173-35185:

https://elixir.bootlin.com/linux/v7.2.2/source/tools/testing/radix-tree/maple.c#L35173
https://elixir.bootlin.com/linux/v7.2.2/source/tools/testing/radix-tree/maple.c#L35185

maintainer Applied
#2 lore raw
In reply to Karl Mehltretter
Quoted 18 lines · Karl Mehltretter

Commit e3852a1213ff ("maple_tree: Drop bulk insert support") removed mas_expected_entries() but left the documentation describing it. Document the current preallocation interface instead.

Fixes e3852a1213ff ("maple_tree: Drop bulk insert support")
Assisted-by LLM
---
 Documentation/core-api/maple_tree.rst | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)
Documentation/core-api/maple_tree.rst +0 -0
index 12bccfb6aac1..836342fb1eec 100644
@@ -214,11 +214,10 @@ Advanced Allocating Nodes
 -------------------------
 

Documentation/core-api/maple_tree.rst Advanced Allocating Nodes · line 220

Quoted 10 lines
Documentation/core-api/maple_tree.rst +4 -5
 Allocations are usually handled internally to the tree, however if allocations
-need to occur before a write occurs then calling mas_expected_entries() will
-allocate the worst-case number of needed nodes to insert the provided number of
-ranges.  This also causes the tree to enter mass insertion mode.  Once
-insertions are complete calling mas_destroy() on the maple state will free the
-unused allocations.
+need to occur before a write occurs then calling mas_preallocate() will
+allocate the nodes needed to store the provided entry.  The entry is then
+stored with mas_store_prealloc().  If the store is abandoned, calling
+mas_destroy() on the maple state will free the unused allocations.

Applied, thanks.

jon