diff options
Diffstat (limited to 'lib/rbtree.c')
| -rw-r--r-- | lib/rbtree.c | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/lib/rbtree.c b/lib/rbtree.c index 4f56a11d67fa..c0e31fe2fabf 100644 --- a/lib/rbtree.c +++ b/lib/rbtree.c | |||
| @@ -194,8 +194,12 @@ __rb_insert(struct rb_node *node, struct rb_root *root, | |||
| 194 | } | 194 | } |
| 195 | } | 195 | } |
| 196 | 196 | ||
| 197 | __always_inline void | 197 | /* |
| 198 | __rb_erase_color(struct rb_node *parent, struct rb_root *root, | 198 | * Inline version for rb_erase() use - we want to be able to inline |
| 199 | * and eliminate the dummy_rotate callback there | ||
| 200 | */ | ||
| 201 | static __always_inline void | ||
| 202 | ____rb_erase_color(struct rb_node *parent, struct rb_root *root, | ||
| 199 | void (*augment_rotate)(struct rb_node *old, struct rb_node *new)) | 203 | void (*augment_rotate)(struct rb_node *old, struct rb_node *new)) |
| 200 | { | 204 | { |
| 201 | struct rb_node *node = NULL, *sibling, *tmp1, *tmp2; | 205 | struct rb_node *node = NULL, *sibling, *tmp1, *tmp2; |
| @@ -355,6 +359,13 @@ __rb_erase_color(struct rb_node *parent, struct rb_root *root, | |||
| 355 | } | 359 | } |
| 356 | } | 360 | } |
| 357 | } | 361 | } |
| 362 | |||
| 363 | /* Non-inline version for rb_erase_augmented() use */ | ||
| 364 | void __rb_erase_color(struct rb_node *parent, struct rb_root *root, | ||
| 365 | void (*augment_rotate)(struct rb_node *old, struct rb_node *new)) | ||
| 366 | { | ||
| 367 | ____rb_erase_color(parent, root, augment_rotate); | ||
| 368 | } | ||
| 358 | EXPORT_SYMBOL(__rb_erase_color); | 369 | EXPORT_SYMBOL(__rb_erase_color); |
| 359 | 370 | ||
| 360 | /* | 371 | /* |
| @@ -380,7 +391,10 @@ EXPORT_SYMBOL(rb_insert_color); | |||
| 380 | 391 | ||
| 381 | void rb_erase(struct rb_node *node, struct rb_root *root) | 392 | void rb_erase(struct rb_node *node, struct rb_root *root) |
| 382 | { | 393 | { |
| 383 | rb_erase_augmented(node, root, &dummy_callbacks); | 394 | struct rb_node *rebalance; |
| 395 | rebalance = __rb_erase_augmented(node, root, &dummy_callbacks); | ||
| 396 | if (rebalance) | ||
| 397 | ____rb_erase_color(rebalance, root, dummy_rotate); | ||
| 384 | } | 398 | } |
| 385 | EXPORT_SYMBOL(rb_erase); | 399 | EXPORT_SYMBOL(rb_erase); |
| 386 | 400 | ||
