Lines Matching full:left
25 * Each node may have a left or right sibling. When decending the spine,
32 * [B] No left sibling
36 * ==> rebalance(left sibling, node)
38 * [D] Both siblings, total_entries(left, node, right) <= DEL_THRESHOLD
39 * ==> delete node adding it's contents to left and right
41 * [E] Both siblings, total_entries(left, node, right) > DEL_THRESHOLD
42 * ==> rebalance(left, node, right)
82 static void node_copy(struct btree_node *left, struct btree_node *right, int shift) in node_copy() argument
84 uint32_t nr_left = le32_to_cpu(left->header.nr_entries); in node_copy()
85 uint32_t value_size = le32_to_cpu(left->header.value_size); in node_copy()
90 BUG_ON(nr_left + shift > le32_to_cpu(left->header.max_entries)); in node_copy()
91 memcpy(key_ptr(left, nr_left), in node_copy()
94 memcpy(value_ptr(left, nr_left), in node_copy()
100 key_ptr(left, nr_left - shift), in node_copy()
103 value_ptr(left, nr_left - shift), in node_copy()
173 static void shift(struct btree_node *left, struct btree_node *right, int count) in shift() argument
175 uint32_t nr_left = le32_to_cpu(left->header.nr_entries); in shift()
177 uint32_t max_entries = le32_to_cpu(left->header.max_entries); in shift()
189 node_copy(left, right, count); in shift()
191 node_copy(left, right, count); in shift()
195 left->header.nr_entries = cpu_to_le32(nr_left - count); in shift()
202 struct btree_node *left = l->n; in __rebalance2() local
204 uint32_t nr_left = le32_to_cpu(left->header.nr_entries); in __rebalance2()
212 unsigned int threshold = 2 * (merge_threshold(left) + 1); in __rebalance2()
218 node_copy(left, right, -nr_right); in __rebalance2()
219 left->header.nr_entries = cpu_to_le32(nr_left + nr_right); in __rebalance2()
224 * children, since they're still referenced by left. in __rebalance2()
232 shift(left, right, nr_left - target_left); in __rebalance2()
242 struct child left, right; in rebalance2() local
246 r = init_child(info, vt, parent, left_index, &left); in rebalance2()
252 exit_child(info, &left); in rebalance2()
256 __rebalance2(info, parent, &left, &right); in rebalance2()
258 exit_child(info, &left); in rebalance2()
265 * We dump as many entries from center as possible into left, then the rest
271 struct btree_node *left, struct btree_node *center, struct btree_node *right, in delete_center_node() argument
274 uint32_t max_entries = le32_to_cpu(left->header.max_entries); in delete_center_node()
278 node_copy(left, center, -shift); in delete_center_node()
279 left->header.nr_entries = cpu_to_le32(nr_left + shift); in delete_center_node()
302 struct btree_node *left, struct btree_node *center, struct btree_node *right, in redistribute3() argument
306 uint32_t max_entries = le32_to_cpu(left->header.max_entries); in redistribute3()
320 shift(left, center, -nr_center); in redistribute3()
322 shift(left, right, s); in redistribute3()
325 shift(left, center, s); in redistribute3()
335 shift(left, right, s); in redistribute3()
340 shift(left, center, nr_left - target_left); in redistribute3()
350 struct btree_node *left = l->n; in __rebalance3() local
354 uint32_t nr_left = le32_to_cpu(left->header.nr_entries); in __rebalance3()
358 unsigned threshold = merge_threshold(left) * 4 + 1; in __rebalance3()
360 BUG_ON(left->header.max_entries != center->header.max_entries); in __rebalance3()
364 delete_center_node(info, parent, l, c, r, left, center, right, in __rebalance3()
367 redistribute3(info, parent, l, c, r, left, center, right, in __rebalance3()
376 struct child left, center, right; in rebalance3() local
381 r = init_child(info, vt, parent, left_index, &left); in rebalance3()
387 exit_child(info, &left); in rebalance3()
393 exit_child(info, &left); in rebalance3()
398 __rebalance3(info, parent, &left, ¢er, &right); in rebalance3()
400 exit_child(info, &left); in rebalance3()