MCPcopy Create free account
hub / github.com/bobranten/Ext4Fsd / rb_insert

Function rb_insert

Ext4Fsd/rbtree.c:392–414  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

390EXPORT_SYMBOL(rb_replace_node);
391
392void rb_insert(struct rb_root *root, struct rb_node *node,
393 int (*cmp)(struct rb_node *, struct rb_node *))
394{
395 struct rb_node **new = &(root->rb_node), *parent = NULL;
396
397 /* Figure out where to put new node */
398 while (*new) {
399 int result = cmp(node, *new);
400
401 parent = *new;
402 if (result < 0)
403 new = &((*new)->rb_left);
404 else if (result > 0)
405 new = &((*new)->rb_right);
406 else
407 return;
408
409 }
410
411 /* Add new node and rebalance tree. */
412 rb_link_node(node, parent, new);
413 rb_insert_color(node, root);
414}
415EXPORT_SYMBOL(rb_insert);

Callers 2

buffer_head_insertFunction · 0.85
ext4_xattr_item_insertFunction · 0.85

Calls 2

rb_link_nodeFunction · 0.85
rb_insert_colorFunction · 0.85

Tested by

no test coverage detected