Skip to contentSkip to conversation

Documentation: Update augmented rbtree documentation

PATCH Superseded Sasha Levin 4 participants 5 messages May 16, 2011 Documentation

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Documentation: Update augmented rbtree documentation

Current documentation referred to the old method of handling augmented trees. Update documentation to correspond with the changes done in commit b945d6b2554d550fe95caadc61e521c0ad71fb9c.

Cc Ingo Molnar <[email protected]>
Cc Pekka Enberg <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Linus Torvalds <[email protected]>
Cc David Woodhouse <[email protected]>
Cc Andrew Morton <[email protected]>
---
 Documentation/rbtree.txt |   23 ++++++++++++++---------
 1 files changed, 14 insertions(+), 9 deletions(-)
Documentation/rbtree.txt +14 -9
index 19f8278..b847598 100644
@@ -196,15 +196,20 @@ Support for Augmented rbtrees
 Augmented rbtree is an rbtree with "some" additional data stored in each node.
 This data can be used to augment some new functionality to rbtree.
 Augmented rbtree is an optional feature built on top of basic rbtree
-infrastructure. rbtree user who wants this feature will have an augment
-callback function in rb_root initialized.
-
-This callback function will be called from rbtree core routines whenever
-a node has a change in one or both of its children. It is the responsibility
-of the callback function to recalculate the additional data that is in the
-rb node using new children information. Note that if this new additional
-data affects the parent node's additional data, then callback function has
-to handle it and do the recursive updates.
+infrastructure. rbtree user who wants this feature will have to call the
+augmentation functions with the user provided augmentation callback
+when inserting and erasing nodes.
+
+On insertion, The user must call rb_augment_insert() once the new node is in
+place. This will cause the augmentation function callback to be called for
+each node between the new node and the root which have been affected by the
+insertion.
+
+When erasing a node, The user must call rb_augment_erase_begin() first to
+retrieve the deepest node on the rebalance path. Then, After erasing the
+original node, the user must call rb_augment_erase_end() with the deepest
+node found earlier. This will cause the augmentation function to be called
+for each affected node between the deepest node and the root.
 
 
 Interval tree is an example of augmented rb tree. Reference -
Signature · 1 line
1.7.5.rc3
Acked-by on v1 1/1
#1 lore raw
Quoted 7 lines · Sasha Levin

Current documentation referred to the old method of handling augmented trees. Update documentation to correspond with the changes done in commit b945d6b2554d550fe95caadc61e521c0ad71fb9c.

Cc Ingo Molnar <[email protected]>
Cc Pekka Enberg <[email protected]>
Quoted 42 lines
Cc Linus Torvalds <[email protected]>
Cc David Woodhouse <[email protected]>
Cc Andrew Morton <[email protected]>
---
 Documentation/rbtree.txt |   23 ++++++++++++++---------
 1 files changed, 14 insertions(+), 9 deletions(-)
Documentation/rbtree.txt +14 -9
index 19f8278..b847598 100644
@@ -196,15 +196,20 @@ Support for Augmented rbtrees
 Augmented rbtree is an rbtree with "some" additional data stored in each node.
 This data can be used to augment some new functionality to rbtree.
 Augmented rbtree is an optional feature built on top of basic rbtree
-infrastructure. rbtree user who wants this feature will have an augment
-callback function in rb_root initialized.
-
-This callback function will be called from rbtree core routines whenever
-a node has a change in one or both of its children. It is the responsibility
-of the callback function to recalculate the additional data that is in the
-rb node using new children information. Note that if this new additional
-data affects the parent node's additional data, then callback function has
-to handle it and do the recursive updates.
+infrastructure. rbtree user who wants this feature will have to call the
+augmentation functions with the user provided augmentation callback
+when inserting and erasing nodes.
+
+On insertion, The user must call rb_augment_insert() once the new node is in
+place. This will cause the augmentation function callback to be called for
+each node between the new node and the root which have been affected by the
+insertion.
+
+When erasing a node, The user must call rb_augment_erase_begin() first to
+retrieve the deepest node on the rebalance path. Then, After erasing the
+original node, the user must call rb_augment_erase_end() with the deepest
+node found earlier. This will cause the augmentation function to be called
+for each affected node between the deepest node and the root.
 
 
 Interval tree is an example of augmented rb tree. Reference -
Acked-by on v1 1/1
#2 lore raw
In reply to Sasha Levin
Quoted 9 lines · Sasha Levin

Current documentation referred to the old method
of handling augmented trees. Update documentation
to correspond with the changes done in commit
b945d6b2554d550fe95caadc61e521c0ad71fb9c.

Augmented rbtree is an rbtree with "some" additional data stored in each node. This data can be used to augment some new functionality to rbtree. Augmented rbtree is an optional feature built on top of basic rbtree
+infrastructure. rbtree user who wants this feature will have to call the

s/rbtree user/An rbtree user

Documentation/rbtree.txt Support for Augmented rbtrees · line 212

Quoted 13 lines
Documentation/rbtree.txt +13 -0
+augmentation functions with the user provided augmentation callback
+when inserting and erasing nodes.
+
+On insertion, The user must call rb_augment_insert() once the new node is in
+place. This will cause the augmentation function callback to be called for
+each node between the new node and the root which have been affected by the
+insertion.
+
+When erasing a node, The user must call rb_augment_erase_begin() first to
+retrieve the deepest node on the rebalance path. Then, After erasing the
+original node, the user must call rb_augment_erase_end() with the deepest
+node found earlier. This will cause the augmentation function to be called
+for each affected node between the deepest node and the root.

Thanks,

Ingo

#3 lore raw
In reply to Sasha Levin
Quoted 28 lines · On Mon, 16 May 2011 12:56:42 +0300 Sasha Levin wrote:

Current documentation referred to the old method of handling augmented trees. Update documentation to correspond with the changes done in commit b945d6b2554d550fe95caadc61e521c0ad71fb9c.

Cc Ingo Molnar <[email protected]>
Cc Pekka Enberg <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Linus Torvalds <[email protected]>
Cc David Woodhouse <[email protected]>
Cc Andrew Morton <[email protected]>
---
 Documentation/rbtree.txt |   23 ++++++++++++++---------
 1 files changed, 14 insertions(+), 9 deletions(-)
Documentation/rbtree.txt +0 -4
index 19f8278..b847598 100644
@@ -196,15 +196,20 @@ Support for Augmented rbtrees
 Augmented rbtree is an rbtree with "some" additional data stored in each node.
 This data can be used to augment some new functionality to rbtree.
 Augmented rbtree is an optional feature built on top of basic rbtree
-infrastructure. rbtree user who wants this feature will have an augment
-callback function in rb_root initialized.
-
-This callback function will be called from rbtree core routines whenever

Documentation/rbtree.txt Support for Augmented rbtrees · line 203

Quoted 10 lines
Documentation/rbtree.txt +5 -5
-a node has a change in one or both of its children. It is the responsibility
-of the callback function to recalculate the additional data that is in the
-rb node using new children information. Note that if this new additional
-data affects the parent node's additional data, then callback function has
-to handle it and do the recursive updates.
+infrastructure. rbtree user who wants this feature will have to call the
+augmentation functions with the user provided augmentation callback
+when inserting and erasing nodes.
+
+On insertion, The user must call rb_augment_insert() once the new node is in

the user

Documentation/rbtree.txt Support for Augmented rbtrees · line 205

Quoted 2 lines
Documentation/rbtree.txt +2 -0
+place. This will cause the augmentation function callback to be called for
+each node between the new node and the root which have been affected by the

which has been

Documentation/rbtree.txt Support for Augmented rbtrees · line 208

Quoted 3 lines
Documentation/rbtree.txt +3 -0
+insertion.
+
+When erasing a node, The user must call rb_augment_erase_begin() first to

the user

Documentation/rbtree.txt Support for Augmented rbtrees · line 209

Quoted 1 line
Documentation/rbtree.txt +1 -0
+retrieve the deepest node on the rebalance path. Then, After erasing the

after

Documentation/rbtree.txt Support for Augmented rbtrees · line 215

Quoted 7 lines
Documentation/rbtree.txt +3 -0
+original node, the user must call rb_augment_erase_end() with the deepest
+node found earlier. This will cause the augmentation function to be called
+for each affected node between the deepest node and the root.
 
 
 Interval tree is an example of augmented rb tree. Reference -

---
~Randy
*** Remember to use Documentation/SubmitChecklist when testing your code ***

#4 lore raw
Quoted 54 lines · Randy Dunlap
Quoted 28 lines · On Mon, 16 May 2011 12:56:42 +0300 Sasha Levin wrote:

Current documentation referred to the old method of handling augmented trees. Update documentation to correspond with the changes done in commit b945d6b2554d550fe95caadc61e521c0ad71fb9c.

Cc Ingo Molnar <[email protected]>
Cc Pekka Enberg <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Linus Torvalds <[email protected]>
Cc David Woodhouse <[email protected]>
Cc Andrew Morton <[email protected]>
---
 Documentation/rbtree.txt |   23 ++++++++++++++---------
 1 files changed, 14 insertions(+), 9 deletions(-)
Documentation/rbtree.txt +0 -4
index 19f8278..b847598 100644
@@ -196,15 +196,20 @@ Support for Augmented rbtrees
 Augmented rbtree is an rbtree with "some" additional data stored in each node.
 This data can be used to augment some new functionality to rbtree.
 Augmented rbtree is an optional feature built on top of basic rbtree
-infrastructure. rbtree user who wants this feature will have an augment
-callback function in rb_root initialized.
-
-This callback function will be called from rbtree core routines whenever

Documentation/rbtree.txt Support for Augmented rbtrees · line 203

Quoted 10 lines
Documentation/rbtree.txt +5 -5
-a node has a change in one or both of its children. It is the responsibility
-of the callback function to recalculate the additional data that is in the
-rb node using new children information. Note that if this new additional
-data affects the parent node's additional data, then callback function has
-to handle it and do the recursive updates.
+infrastructure. rbtree user who wants this feature will have to call the
+augmentation functions with the user provided augmentation callback
+when inserting and erasing nodes.
+
+On insertion, The user must call rb_augment_insert() once the new node is in

the user

Documentation/rbtree.txt Support for Augmented rbtrees · line 205

Quoted 2 lines
Documentation/rbtree.txt +2 -0
+place. This will cause the augmentation function callback to be called for
+each node between the new node and the root which have been affected by the

which has been

Documentation/rbtree.txt Support for Augmented rbtrees · line 208

Quoted 3 lines
Documentation/rbtree.txt +3 -0
+insertion.
+
+When erasing a node, The user must call rb_augment_erase_begin() first to

the user

Quoted 7 lines

Documentation/rbtree.txt Support for Augmented rbtrees · line 209

Quoted 1 line
Documentation/rbtree.txt +1 -0
+retrieve the deepest node on the rebalance path. Then, After erasing the

after

Documentation/rbtree.txt Support for Augmented rbtrees · line 212

Quoted 3 lines
Documentation/rbtree.txt +3 -0
+original node, the user must call rb_augment_erase_end() with the deepest
+node found earlier. This will cause the augmentation function to be called
+for each affected node between the deepest node and the root.

Heh, you really rock at reviewing documentation!

I went through the text and could have sworn that beyond the small detail i pointed out it's otherwise perfect ;-)

Thanks,

Ingo