Lines Matching refs:right

864 	struct extent_buffer *right = NULL;  in balance_level()  local
954 right = btrfs_read_node_slot(parent, pslot + 1); in balance_level()
955 if (IS_ERR(right)) in balance_level()
956 right = NULL; in balance_level()
958 if (right) { in balance_level()
959 __btrfs_tree_lock(right, BTRFS_NESTING_RIGHT); in balance_level()
960 wret = btrfs_cow_block(trans, root, right, in balance_level()
961 parent, pslot + 1, &right, in balance_level()
980 if (right) { in balance_level()
981 wret = push_node_left(trans, mid, right, 1); in balance_level()
984 if (btrfs_header_nritems(right) == 0) { in balance_level()
985 btrfs_clean_tree_block(right); in balance_level()
986 btrfs_tree_unlock(right); in balance_level()
988 root_sub_used(root, right->len); in balance_level()
989 btrfs_free_tree_block(trans, btrfs_root_id(root), right, in balance_level()
991 free_extent_buffer_stale(right); in balance_level()
992 right = NULL; in balance_level()
995 btrfs_node_key(right, &right_key, 0); in balance_level()
1071 if (right) { in balance_level()
1072 btrfs_tree_unlock(right); in balance_level()
1073 free_extent_buffer(right); in balance_level()
1092 struct extent_buffer *right = NULL; in push_nodes_for_insert() local
1167 right = btrfs_read_node_slot(parent, pslot + 1); in push_nodes_for_insert()
1168 if (IS_ERR(right)) in push_nodes_for_insert()
1169 right = NULL; in push_nodes_for_insert()
1174 if (right) { in push_nodes_for_insert()
1177 __btrfs_tree_lock(right, BTRFS_NESTING_RIGHT); in push_nodes_for_insert()
1179 right_nr = btrfs_header_nritems(right); in push_nodes_for_insert()
1183 ret = btrfs_cow_block(trans, root, right, in push_nodes_for_insert()
1185 &right, BTRFS_NESTING_RIGHT_COW); in push_nodes_for_insert()
1189 wret = balance_node_right(trans, right, mid); in push_nodes_for_insert()
1197 btrfs_node_key(right, &disk_key, 0); in push_nodes_for_insert()
1205 path->nodes[level] = right; in push_nodes_for_insert()
1212 btrfs_tree_unlock(right); in push_nodes_for_insert()
1213 free_extent_buffer(right); in push_nodes_for_insert()
1217 btrfs_tree_unlock(right); in push_nodes_for_insert()
1218 free_extent_buffer(right); in push_nodes_for_insert()
2231 struct extent_buffer *right) in check_sibling_keys() argument
2237 int nr_right = btrfs_header_nritems(right); in check_sibling_keys()
2245 btrfs_node_key_to_cpu(right, &right_first, 0); in check_sibling_keys()
2248 btrfs_item_key_to_cpu(right, &right_first, 0); in check_sibling_keys()
2665 struct extent_buffer *right, in __push_leaf_right() argument
2669 struct btrfs_fs_info *fs_info = right->fs_info; in __push_leaf_right()
2728 right_nritems = btrfs_header_nritems(right); in __push_leaf_right()
2734 data_end = leaf_data_end(right); in __push_leaf_right()
2735 memmove_extent_buffer(right, in __push_leaf_right()
2741 copy_extent_buffer(right, left, BTRFS_LEAF_DATA_OFFSET + in __push_leaf_right()
2746 memmove_extent_buffer(right, btrfs_item_nr_offset(push_items), in __push_leaf_right()
2751 copy_extent_buffer(right, left, btrfs_item_nr_offset(0), in __push_leaf_right()
2756 btrfs_init_map_token(&token, right); in __push_leaf_right()
2758 btrfs_set_header_nritems(right, right_nritems); in __push_leaf_right()
2774 btrfs_mark_buffer_dirty(right); in __push_leaf_right()
2776 btrfs_item_key(right, &disk_key, 0); in __push_leaf_right()
2787 path->nodes[0] = right; in __push_leaf_right()
2790 btrfs_tree_unlock(right); in __push_leaf_right()
2791 free_extent_buffer(right); in __push_leaf_right()
2796 btrfs_tree_unlock(right); in __push_leaf_right()
2797 free_extent_buffer(right); in __push_leaf_right()
2817 struct extent_buffer *right; in push_leaf_right() local
2834 right = btrfs_read_node_slot(upper, slot + 1); in push_leaf_right()
2839 if (IS_ERR(right)) in push_leaf_right()
2842 __btrfs_tree_lock(right, BTRFS_NESTING_RIGHT); in push_leaf_right()
2844 free_space = btrfs_leaf_free_space(right); in push_leaf_right()
2849 ret = btrfs_cow_block(trans, root, right, upper, in push_leaf_right()
2850 slot + 1, &right, BTRFS_NESTING_RIGHT_COW); in push_leaf_right()
2854 free_space = btrfs_leaf_free_space(right); in push_leaf_right()
2862 if (check_sibling_keys(left, right)) { in push_leaf_right()
2864 btrfs_tree_unlock(right); in push_leaf_right()
2865 free_extent_buffer(right); in push_leaf_right()
2875 path->nodes[0] = right; in push_leaf_right()
2882 right, free_space, left_nritems, min_slot); in push_leaf_right()
2884 btrfs_tree_unlock(right); in push_leaf_right()
2885 free_extent_buffer(right); in push_leaf_right()
2904 struct extent_buffer *right = path->nodes[0]; in __push_leaf_left() local
2928 int space = btrfs_leaf_free_space(right); in __push_leaf_left()
2938 this_item_size = btrfs_item_size(right, item); in __push_leaf_left()
2950 WARN_ON(!empty && push_items == btrfs_header_nritems(right)); in __push_leaf_left()
2953 copy_extent_buffer(left, right, in __push_leaf_left()
2959 btrfs_item_offset_nr(right, push_items - 1); in __push_leaf_left()
2961 copy_extent_buffer(left, right, BTRFS_LEAF_DATA_OFFSET + in __push_leaf_left()
2964 btrfs_item_offset_nr(right, push_items - 1), in __push_leaf_left()
2988 push_space = btrfs_item_offset_nr(right, push_items - 1) - in __push_leaf_left()
2989 leaf_data_end(right); in __push_leaf_left()
2990 memmove_extent_buffer(right, BTRFS_LEAF_DATA_OFFSET + in __push_leaf_left()
2993 leaf_data_end(right), push_space); in __push_leaf_left()
2995 memmove_extent_buffer(right, btrfs_item_nr_offset(0), in __push_leaf_left()
2997 (btrfs_header_nritems(right) - push_items) * in __push_leaf_left()
3001 btrfs_init_map_token(&token, right); in __push_leaf_left()
3003 btrfs_set_header_nritems(right, right_nritems); in __push_leaf_left()
3014 btrfs_mark_buffer_dirty(right); in __push_leaf_left()
3016 btrfs_clean_tree_block(right); in __push_leaf_left()
3018 btrfs_item_key(right, &disk_key, 0); in __push_leaf_left()
3053 struct extent_buffer *right = path->nodes[0]; in push_leaf_left() local
3066 right_nritems = btrfs_header_nritems(right); in push_leaf_left()
3105 if (check_sibling_keys(left, right)) { in push_leaf_left()
3125 struct extent_buffer *right, in copy_for_split() argument
3136 btrfs_set_header_nritems(right, nritems); in copy_for_split()
3139 copy_extent_buffer(right, l, btrfs_item_nr_offset(0), in copy_for_split()
3143 copy_extent_buffer(right, l, in copy_for_split()
3150 btrfs_init_map_token(&token, right); in copy_for_split()
3160 btrfs_item_key(right, &disk_key, 0); in copy_for_split()
3161 insert_ptr(trans, path, &disk_key, right->start, path->slots[1] + 1, 1); in copy_for_split()
3163 btrfs_mark_buffer_dirty(right); in copy_for_split()
3170 path->nodes[0] = right; in copy_for_split()
3174 btrfs_tree_unlock(right); in copy_for_split()
3175 free_extent_buffer(right); in copy_for_split()
3262 struct extent_buffer *right; in split_leaf() local
3365 right = btrfs_alloc_tree_block(trans, root, 0, root->root_key.objectid, in split_leaf()
3369 if (IS_ERR(right)) in split_leaf()
3370 return PTR_ERR(right); in split_leaf()
3376 btrfs_set_header_nritems(right, 0); in split_leaf()
3378 right->start, path->slots[1] + 1, 1); in split_leaf()
3381 path->nodes[0] = right; in split_leaf()
3385 btrfs_set_header_nritems(right, 0); in split_leaf()
3387 right->start, path->slots[1], 1); in split_leaf()
3390 path->nodes[0] = right; in split_leaf()
3403 copy_for_split(trans, path, l, right, slot, mid, nritems); in split_leaf()