Lines Matching full:left

28  * Each node may have a left or right sibling.  When decending the spine,
35 * [B] No left sibling
39 * ==> rebalance(left sibling, node)
41 * [D] Both siblings, total_entries(left, node, right) <= DEL_THRESHOLD
42 * ==> delete node adding it's contents to left and right
44 * [E] Both siblings, total_entries(left, node, right) > DEL_THRESHOLD
45 * ==> rebalance(left, node, right)
85 static int node_copy(struct btree_node *left, struct btree_node *right, int shift) in node_copy() argument
87 uint32_t nr_left = le32_to_cpu(left->header.nr_entries); in node_copy()
88 uint32_t value_size = le32_to_cpu(left->header.value_size); in node_copy()
97 if (nr_left + shift > le32_to_cpu(left->header.max_entries)) { in node_copy()
102 memcpy(key_ptr(left, nr_left), in node_copy()
105 memcpy(value_ptr(left, nr_left), in node_copy()
115 key_ptr(left, nr_left - shift), in node_copy()
118 value_ptr(left, nr_left - shift), in node_copy()
189 static int shift(struct btree_node *left, struct btree_node *right, int count) in shift() argument
192 uint32_t nr_left = le32_to_cpu(left->header.nr_entries); in shift()
194 uint32_t max_entries = le32_to_cpu(left->header.max_entries); in shift()
217 r = node_copy(left, right, count); in shift()
221 r = node_copy(left, right, count); in shift()
227 left->header.nr_entries = cpu_to_le32(nr_left - count); in shift()
237 struct btree_node *left = l->n; in __rebalance2() local
239 uint32_t nr_left = le32_to_cpu(left->header.nr_entries); in __rebalance2()
247 unsigned int threshold = 2 * (merge_threshold(left) + 1); in __rebalance2()
253 node_copy(left, right, -nr_right); in __rebalance2()
254 left->header.nr_entries = cpu_to_le32(nr_left + nr_right); in __rebalance2()
259 * children, since they're still referenced by left. in __rebalance2()
267 ret = shift(left, right, nr_left - target_left); in __rebalance2()
280 struct child left, right; in rebalance2() local
284 r = init_child(info, vt, parent, left_index, &left); in rebalance2()
290 exit_child(info, &left); in rebalance2()
294 r = __rebalance2(info, parent, &left, &right); in rebalance2()
296 exit_child(info, &left); in rebalance2()
303 * We dump as many entries from center as possible into left, then the rest
309 struct btree_node *left, struct btree_node *center, struct btree_node *right, in delete_center_node() argument
312 uint32_t max_entries = le32_to_cpu(left->header.max_entries); in delete_center_node()
320 node_copy(left, center, -shift); in delete_center_node()
321 left->header.nr_entries = cpu_to_le32(nr_left + shift); in delete_center_node()
349 struct btree_node *left, struct btree_node *center, struct btree_node *right, in redistribute3() argument
353 uint32_t max_entries = le32_to_cpu(left->header.max_entries); in redistribute3()
367 ret = shift(left, center, -nr_center); in redistribute3()
372 ret = shift(left, right, s); in redistribute3()
378 ret = shift(left, center, s); in redistribute3()
394 ret = shift(left, right, s); in redistribute3()
404 ret = shift(left, center, nr_left - target_left); in redistribute3()
417 struct btree_node *left = l->n; in __rebalance3() local
421 uint32_t nr_left = le32_to_cpu(left->header.nr_entries); in __rebalance3()
425 unsigned threshold = merge_threshold(left) * 4 + 1; in __rebalance3()
427 if ((left->header.max_entries != center->header.max_entries) || in __rebalance3()
434 return delete_center_node(info, parent, l, c, r, left, center, right, in __rebalance3()
438 return redistribute3(info, parent, l, c, r, left, center, right, in __rebalance3()
447 struct child left, center, right; in rebalance3() local
452 r = init_child(info, vt, parent, left_index, &left); in rebalance3()
458 exit_child(info, &left); in rebalance3()
464 exit_child(info, &left); in rebalance3()
469 r = __rebalance3(info, parent, &left, &center, &right); in rebalance3()
471 exit_child(info, &left); in rebalance3()