Lines Matching full:right

25  * Each node may have a left or right sibling.  When decending the spine,
33 * ==> rebalance(node, right sibling)
35 * [C] No right sibling
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
86 BUG_ON(value_size != le32_to_cpu(right->header.value_size)); in node_copy()
92 key_ptr(right, 0), in node_copy()
95 value_ptr(right, 0), in node_copy()
98 BUG_ON(shift > le32_to_cpu(right->header.max_entries)); in node_copy()
99 memcpy(key_ptr(right, 0), in node_copy()
102 memcpy(value_ptr(right, 0), in node_copy()
173 static void shift(struct btree_node *left, struct btree_node *right, int count) in shift() argument
176 uint32_t nr_right = le32_to_cpu(right->header.nr_entries); in shift()
178 uint32_t r_max_entries = le32_to_cpu(right->header.max_entries); in shift()
188 node_shift(right, count); in shift()
189 node_copy(left, right, count); in shift()
191 node_copy(left, right, count); in shift()
192 node_shift(right, count); in shift()
196 right->header.nr_entries = cpu_to_le32(nr_right + count); in shift()
203 struct btree_node *right = r->n; in __rebalance2() local
205 uint32_t nr_right = le32_to_cpu(right->header.nr_entries); in __rebalance2()
212 node_copy(left, right, -nr_right); in __rebalance2()
217 * We need to decrement the right block, but not it's in __rebalance2()
226 shift(left, right, nr_left - target_left); in __rebalance2()
227 *key_ptr(parent, r->index) = right->keys[0]; in __rebalance2()
236 struct child left, right; in rebalance2() local
244 r = init_child(info, vt, parent, left_index + 1, &right); in rebalance2()
250 __rebalance2(info, parent, &left, &right); in rebalance2()
253 exit_child(info, &right); in rebalance2()
260 * in right, then rebalance2. This wastes some cpu, but I want something
265 struct btree_node *left, struct btree_node *center, struct btree_node *right, in delete_center_node() argument
278 node_shift(right, shift); in delete_center_node()
279 node_copy(center, right, shift); in delete_center_node()
280 right->header.nr_entries = cpu_to_le32(nr_right + shift); in delete_center_node()
282 *key_ptr(parent, r->index) = right->keys[0]; in delete_center_node()
296 struct btree_node *left, struct btree_node *center, struct btree_node *right, in redistribute3() argument
316 shift(left, right, s); in redistribute3()
321 shift(center, right, target_right - nr_right); in redistribute3()
327 shift(center, right, nr_center); in redistribute3()
329 shift(left, right, s); in redistribute3()
332 shift(center, right, s); in redistribute3()
338 *key_ptr(parent, r->index) = right->keys[0]; in redistribute3()
346 struct btree_node *right = r->n; in __rebalance3() local
350 uint32_t nr_right = le32_to_cpu(right->header.nr_entries); in __rebalance3()
355 BUG_ON(center->header.max_entries != right->header.max_entries); in __rebalance3()
358 delete_center_node(info, parent, l, c, r, left, center, right, in __rebalance3()
361 redistribute3(info, parent, l, c, r, left, center, right, in __rebalance3()
370 struct child left, center, right; in rebalance3() local
385 r = init_child(info, vt, parent, left_index + 2, &right); in rebalance3()
392 __rebalance3(info, parent, &left, &center, &right); in rebalance3()
396 exit_child(info, &right); in rebalance3()