From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753869Ab1EQJos (ORCPT ); Tue, 17 May 2011 05:44:48 -0400 Received: from mail-fx0-f46.google.com ([209.85.161.46]:44216 "EHLO mail-fx0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753294Ab1EQJor (ORCPT ); Tue, 17 May 2011 05:44:47 -0400 DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer; b=eHcOPf51XqiYMhB/nebeEhsNwdkDMlUV3LAovI2+pqInWJcRnc9u4mevYlCf3fajOa UE/XEzRN+J0aYXziaeKbTuh+ZbXK3MvYSV02aSZo9jd5m3vHTPvqXTxLlX0iaQnIzZGP 0aJXA5OTAkjZbZHPFiuEirasRafq1/nOeShYg= From: Sasha Levin To: linux-kernel@vger.kernel.org Cc: mingo@elte.hu, a.p.zijlstra@chello.nl, Sasha Levin , Pekka Enberg , Linus Torvalds , David Woodhouse , Andrew Morton Subject: [PATCH V2] Documentation: Update augmented rbtree documentation Date: Tue, 17 May 2011 12:43:43 +0300 Message-Id: <1305625423-17908-1-git-send-email-levinsasha928@gmail.com> X-Mailer: git-send-email 1.7.5.rc3 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Current documentation referred to the old method of handling augmented trees. Update documentation to correspond with the changes done in commit b945d6b2554d550fe95caadc61e521c0ad71fb9c. Cc: Pekka Enberg Cc: Linus Torvalds Cc: David Woodhouse Cc: Andrew Morton Acked-by: Ingo Molnar Acked-by: Peter Zijlstra Signed-off-by: Sasha Levin --- Documentation/rbtree.txt | 23 ++++++++++++++--------- 1 files changed, 14 insertions(+), 9 deletions(-) diff --git a/Documentation/rbtree.txt b/Documentation/rbtree.txt index 19f8278..8d32d85 100644 --- a/Documentation/rbtree.txt +++ b/Documentation/rbtree.txt @@ -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. An 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 has 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 - -- 1.7.5.rc3