Lines Matching full:right

29  * Each node may have a left or right sibling.  When decending the spine,
37 * ==> rebalance(node, right sibling)
39 * [C] No right sibling
42 * [D] Both siblings, total_entries(left, node, right) <= DEL_THRESHOLD
43 * ==> delete node adding it's contents to left and right
45 * [E] Both siblings, total_entries(left, node, right) > DEL_THRESHOLD
46 * ==> rebalance(left, node, right)
86 static int node_copy(struct btree_node *left, struct btree_node *right, int shift) in node_copy() argument
91 if (value_size != le32_to_cpu(right->header.value_size)) { in node_copy()
105 key_ptr(right, 0), in node_copy()
108 value_ptr(right, 0), in node_copy()
111 if (shift > le32_to_cpu(right->header.max_entries)) { in node_copy()
116 memcpy(key_ptr(right, 0), in node_copy()
119 memcpy(value_ptr(right, 0), in node_copy()
192 static int shift(struct btree_node *left, struct btree_node *right, int count) in shift() argument
196 uint32_t nr_right = le32_to_cpu(right->header.nr_entries); in shift()
198 uint32_t r_max_entries = le32_to_cpu(right->header.max_entries); in shift()
219 node_shift(right, count); in shift()
220 r = node_copy(left, right, count); in shift()
224 r = node_copy(left, right, count); in shift()
227 node_shift(right, count); in shift()
231 right->header.nr_entries = cpu_to_le32(nr_right + count); in shift()
241 struct btree_node *right = r->n; in __rebalance2() local
243 uint32_t nr_right = le32_to_cpu(right->header.nr_entries); in __rebalance2()
256 node_copy(left, right, -nr_right); in __rebalance2()
261 * We need to decrement the right block, but not it's in __rebalance2()
271 ret = shift(left, right, nr_left - target_left); in __rebalance2()
274 *key_ptr(parent, r->index) = right->keys[0]; in __rebalance2()
284 struct child left, right; in rebalance2() local
292 r = init_child(info, vt, parent, left_index + 1, &right); in rebalance2()
298 r = __rebalance2(info, parent, &left, &right); in rebalance2()
301 exit_child(info, &right); in rebalance2()
308 * in right, then rebalance2. This wastes some cpu, but I want something
313 struct btree_node *left, struct btree_node *center, struct btree_node *right, in delete_center_node() argument
335 node_shift(right, shift); in delete_center_node()
336 node_copy(center, right, shift); in delete_center_node()
337 right->header.nr_entries = cpu_to_le32(nr_right + shift); in delete_center_node()
339 *key_ptr(parent, r->index) = right->keys[0]; in delete_center_node()
353 struct btree_node *left, struct btree_node *center, struct btree_node *right, in redistribute3() argument
376 ret = shift(left, right, s); in redistribute3()
387 ret = shift(center, right, target_right - nr_right); in redistribute3()
394 ret = shift(center, right, nr_center); in redistribute3()
398 ret = shift(left, right, s); in redistribute3()
403 ret = shift(center, right, s); in redistribute3()
414 *key_ptr(parent, r->index) = right->keys[0]; in redistribute3()
423 struct btree_node *right = r->n; in __rebalance3() local
427 uint32_t nr_right = le32_to_cpu(right->header.nr_entries); in __rebalance3()
432 (center->header.max_entries != right->header.max_entries)) { in __rebalance3()
438 return delete_center_node(info, parent, l, c, r, left, center, right, in __rebalance3()
442 return redistribute3(info, parent, l, c, r, left, center, right, in __rebalance3()
451 struct child left, center, right; in rebalance3() local
466 r = init_child(info, vt, parent, left_index + 2, &right); in rebalance3()
473 r = __rebalance3(info, parent, &left, &center, &right); in rebalance3()
477 exit_child(info, &right); in rebalance3()