From: Lai Jiangshan Date: Mon, 13 Oct 2014 22:53:48 +0000 (-0700) Subject: rbtree: add comment to rb_insert_augmented() X-Git-Tag: v3.18-rc1~50^2~55 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a841b65921a959c759da6b5c8d5dc21966b4cf86;p=profile%2Fwearable%2Fplatform%2Fkernel%2Flinux-4.9-exynos9110.git rbtree: add comment to rb_insert_augmented() The comment is copied from Documentation/rbtree.txt, but this comment is so important that it should also be in the code. Signed-off-by: Lai Jiangshan Acked-by: Michel Lespinasse Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/include/linux/rbtree_augmented.h b/include/linux/rbtree_augmented.h index fea49b5..378c5ee 100644 --- a/include/linux/rbtree_augmented.h +++ b/include/linux/rbtree_augmented.h @@ -43,6 +43,16 @@ struct rb_augment_callbacks { extern void __rb_insert_augmented(struct rb_node *node, struct rb_root *root, void (*augment_rotate)(struct rb_node *old, struct rb_node *new)); +/* + * Fixup the rbtree and update the augmented information when rebalancing. + * + * On insertion, the user must update the augmented information on the path + * leading to the inserted node, then call rb_link_node() as usual and + * rb_augment_inserted() instead of the usual rb_insert_color() call. + * If rb_augment_inserted() rebalances the rbtree, it will callback into + * a user provided function to update the augmented information on the + * affected subtrees. + */ static inline void rb_insert_augmented(struct rb_node *node, struct rb_root *root, const struct rb_augment_callbacks *augment)