Function report |
Source Code:lib\assoc_array.c |
Create Date:2022-07-28 06:54:22 |
| Last Modify:2020-03-12 14:18:49 | Copyright©Brick |
| home page | Tree |
| Annotation kernel can get tool activity | Download SCCT | Chinese |
Name:Handle insertion into a terminal node.
Proto:static bool assoc_array_insert_into_terminal_node(struct assoc_array_edit *edit, const struct assoc_array_ops *ops, const void *index_key, struct assoc_array_walk_result *result)
Type:bool
Parameter:
| Type | Parameter | Name |
|---|---|---|
| struct assoc_array_edit * | edit | |
| const struct assoc_array_ops * | ops | |
| const void * | index_key | |
| struct assoc_array_walk_result * | result |
| 499 | free_slot = -1 |
| 504 | When i < Number of slots per node cycle |
| 506 | If Not ptr Then |
| 510 | If assoc_array_ptr_is_leaf(ptr) && compare_object(assoc_array_ptr_to_leaf(ptr), index_key) Then |
| 524 | If free_slot >= 0 Then |
| 527 | adjust_count_on = node |
| 529 | Return true |
| 539 | new_n0 = kzalloc - allocate memory. The memory is set to zero.*@size: how many bytes of memory are required.*@flags: the type of memory to allocate (see kmalloc). |
| 540 | If Not new_n0 Then Return false |
| 542 | new_meta[0] = assoc_array_node_to_ptr(new_n0) |
| 543 | new_n1 = kzalloc - allocate memory. The memory is set to zero.*@size: how many bytes of memory are required.*@flags: the type of memory to allocate (see kmalloc). |
| 544 | If Not new_n1 Then Return false |
| 546 | new_meta[1] = assoc_array_node_to_ptr(new_n1) |
| 549 | pr_devel("no spare slots\n") |
| 550 | have_meta = false |
| 551 | When i < Number of slots per node cycle |
| 553 | If assoc_array_ptr_is_meta(ptr) Then |
| 560 | base_seg >>= level & ASSOC_ARRAY_KEY_CHUNK_MASK |
| 561 | segment_cache[i] = base_seg & ASSOC_ARRAY_FAN_MASK |
| 564 | If have_meta Then |
| 565 | pr_devel("have meta\n") |
| 566 | Go to split_node |
| 570 | dissimilarity = 0 |
| 571 | base_seg = segment_cache[0] |
| 572 | When i < Number of slots per node cycle dissimilarity |= segment_cache[i] ^ base_seg |
| 575 | pr_devel("only leaves; dissimilarity=%lx\n", dissimilarity) |
| 577 | If (dissimilarity & ASSOC_ARRAY_FAN_MASK) == 0 Then |
| 581 | If (segment_cache[Number of slots per node ] ^ base_seg) == 0 Then Go to all_leaves_cluster_together |
| 592 | pr_devel("present leaves cluster but not new leaf\n") |
| 595 | split_node : |
| 596 | pr_devel("split node\n") |
| 613 | to = assoc_array_node_to_ptr(new_n0) |
| 614 | back_pointer = back_pointer |
| 615 | parent_slot = parent_slot |
| 617 | parent_slot = -1 |
| 619 | do_split_node : |
| 620 | pr_devel("do_split_node\n") |
| 623 | nr_leaves_on_branch = 0 |
| 631 | When i < Number of slots per node cycle |
| 632 | slot = segment_cache[i] |
| 633 | If slot != 0xff Then When j < Number of slots per node + 1 cycle |
| 635 | If segment_cache[j] == slot Then Go to found_slot_for_multiple_occupancy |
| 640 | BUG_ON(i >= Number of slots per node ) |
| 641 | BUG_ON(j >= Number of slots per node + 1) |
| 642 | BUG_ON(slot >= Number of slots per node ) |
| 644 | parent_slot = slot |
| 647 | When i < Number of slots per node cycle If assoc_array_ptr_is_meta(slots[i]) Then |
| 653 | slots[slot] = assoc_array_node_to_ptr(new_n1) |
| 656 | free_slot = -1 |
| 657 | next_slot = 0 |
| 658 | When i < Number of slots per node cycle |
| 659 | If assoc_array_ptr_is_meta(slots[i]) Then Continue |
| 661 | If segment_cache[i] == slot Then |
| 663 | nr_leaves_on_branch++ |
| 664 | Else |
| 674 | If segment_cache[Number of slots per node ] != slot Then |
| 680 | Else |
| 682 | adjust_count_on = new_n1 |
| 688 | When i < Number of slots per node cycle |
| 689 | If segment_cache[i] == 0xff Then |
| 691 | BUG_ON(assoc_array_ptr_is_leaf(ptr)) |
| 692 | If assoc_array_ptr_is_node(ptr) Then |
| 693 | side = assoc_array_ptr_to_node(ptr) |
| 694 | set_backpointers[i] = back_pointer |
| 695 | Else |
| 697 | set_backpointers[i] = back_pointer |
| 702 | ptr = back_pointer |
| 703 | If Not ptr Then ptr = The node at the root of the tree |
| 705 | Else if assoc_array_ptr_is_node(ptr) Then ptr = slots[parent_slot] |
| 709 | excised_meta[0] = assoc_array_node_to_ptr(node) |
| 711 | Return true |
| 728 | pr_devel("all leaves cluster together\n") |
| 730 | When i < Number of slots per node cycle |
| 731 | x = diff_objects(assoc_array_ptr_to_leaf(slots[i]), index_key) |
| 739 | BUG_ON(diff < level + ASSOC_ARRAY_LEVEL_STEP) |
| 742 | keylen >>= ASSOC_ARRAY_KEY_CHUNK_SHIFT |
| 744 | new_s0 = kzalloc - allocate memory. The memory is set to zero.*@size: how many bytes of memory are required.*@flags: the type of memory to allocate (see kmalloc). |
| 746 | If Not new_s0 Then Return false |
| 748 | new_meta[2] = assoc_array_shortcut_to_ptr(new_s0) |
| 750 | to = assoc_array_shortcut_to_ptr(new_s0) |
| 751 | back_pointer = back_pointer |
| 752 | parent_slot = parent_slot |
| 755 | parent_slot = 0 |
| 757 | parent_slot = -1 |
| 759 | skip_to_level = level = diff & ~ASSOC_ARRAY_LEVEL_STEP_MASK |
| 763 | When i < keylen cycle index_key[i] = get_key_chunk(index_key, i * Key data retrieved in chunks of this size ) |
| 767 | If level & ASSOC_ARRAY_KEY_CHUNK_MASK Then |
| 768 | blank = ULONG_MAX << (level & ASSOC_ARRAY_KEY_CHUNK_MASK) |
| 776 | When i < Number of slots per node cycle |
| 780 | base_seg >>= level & ASSOC_ARRAY_KEY_CHUNK_MASK |
| 781 | segment_cache[i] = base_seg & ASSOC_ARRAY_FAN_MASK |
| 784 | base_seg = get_key_chunk(index_key, level) |
| 785 | base_seg >>= level & ASSOC_ARRAY_KEY_CHUNK_MASK |
| 787 | Go to do_split_node |
| Name | Describe |
|---|---|
| assoc_array_insert | assoc_array_insert - Script insertion of an object into an associative array*@array: The array to insert into |
| Source code conversion tool public plug-in interface | X |
|---|---|
| Support c/c++/esqlc/java Oracle/Informix/Mysql Plug-in can realize: logical Report Code generation and batch code conversion |