Lines Matching refs:left
1048 struct extent_buffer *left = NULL;
1126 left = btrfs_read_node_slot(parent, pslot - 1);
1127 if (IS_ERR(left)) {
1128 ret = PTR_ERR(left);
1129 left = NULL;
1133 __btrfs_tree_lock(left, BTRFS_NESTING_LEFT);
1134 wret = btrfs_cow_block(trans, root, left,
1135 parent, pslot - 1, &left,
1162 if (left) {
1163 orig_slot += btrfs_header_nritems(left);
1164 wret = push_node_left(trans, left, mid, 1);
1208 * So, pull some keys from the left.
1209 * There has to be a left pointer at this point because
1213 if (unlikely(!left)) {
1215 "missing left child when middle child only has 1 item, parent bytenr %llu level %d mid bytenr %llu root %llu",
1222 wret = balance_node_right(trans, mid, left);
1228 wret = push_node_left(trans, left, mid, 1);
1262 if (left) {
1263 if (btrfs_header_nritems(left) > orig_slot) {
1264 atomic_inc(&left->refs);
1265 /* left was locked after cow */
1266 path->nodes[level] = left;
1274 orig_slot -= btrfs_header_nritems(left);
1287 if (left) {
1288 if (path->nodes[level] != left)
1289 btrfs_tree_unlock(left);
1290 free_extent_buffer(left);
1306 struct extent_buffer *left = NULL;
1331 left = btrfs_read_node_slot(parent, pslot - 1);
1332 if (IS_ERR(left))
1333 return PTR_ERR(left);
1335 __btrfs_tree_lock(left, BTRFS_NESTING_LEFT);
1337 left_nr = btrfs_header_nritems(left);
1341 ret = btrfs_cow_block(trans, root, left, parent,
1342 pslot - 1, &left,
1347 wret = push_node_left(trans, left, mid, 0);
1359 btrfs_tree_unlock(left);
1360 free_extent_buffer(left);
1366 if (btrfs_header_nritems(left) > orig_slot) {
1367 path->nodes[level] = left;
1374 btrfs_header_nritems(left);
1376 btrfs_tree_unlock(left);
1377 free_extent_buffer(left);
1381 btrfs_tree_unlock(left);
1382 free_extent_buffer(left);
2676 * This is used after shifting pointers to the left, so it stops
2767 * Leaf @left | Leaf @right
2771 * Key f6 in leaf @left itself is valid, but not valid when the next
2775 * is correct, we only need to bother the last key of @left and the first
2778 static bool check_sibling_keys(struct extent_buffer *left,
2783 int level = btrfs_header_level(left);
2784 int nr_left = btrfs_header_nritems(left);
2792 btrfs_node_key_to_cpu(left, &left_last, nr_left - 1);
2795 btrfs_item_key_to_cpu(left, &left_last, nr_left - 1);
2800 btrfs_crit(left->fs_info, "left extent buffer:");
2801 btrfs_print_tree(left, false);
2802 btrfs_crit(left->fs_info, "right extent buffer:");
2804 btrfs_crit(left->fs_info,
2805 "bad key order, sibling blocks, left last (%llu %u %llu) right first (%llu %u %llu)",
2815 * try to push data from one node into the next node left in the
2818 * returns 0 if some ptrs were pushed left, < 0 if there was some horrible
2819 * error, and > 0 if there was no room in the left hand block.
2858 /* dst is the left eb, src is the middle eb */
2899 * this will only push up to 1/2 the contents of the left node over
3094 * left and right, if either one works, it returns right away.
3210 * the leaf has left for both items and data
3241 struct extent_buffer *left = path->nodes[0];
3269 int space = btrfs_leaf_free_space(left);
3279 this_item_size = btrfs_item_size(left, i);
3296 /* push left to right */
3299 push_space = btrfs_item_data_end(left, left_nritems - push_items);
3300 push_space -= leaf_data_end(left);
3307 /* copy from the left data area */
3308 copy_leaf_data(right, left, BTRFS_LEAF_DATA_SIZE(fs_info) - push_space,
3309 leaf_data_end(left), push_space);
3313 /* copy the items from left to right */
3314 copy_leaf_items(right, left, 0, left_nritems - push_items, push_items);
3327 btrfs_set_header_nritems(left, left_nritems);
3330 btrfs_mark_buffer_dirty(trans, left);
3332 btrfs_clear_buffer_dirty(trans, left);
3376 struct extent_buffer *left = path->nodes[0];
3409 left_nritems = btrfs_header_nritems(left);
3413 if (check_sibling_keys(left, right)) {
3424 * no need to touch/dirty our left leaf. */
3425 btrfs_tree_unlock(left);
3426 free_extent_buffer(left);
3442 * push some data in the path leaf to the left, trying to free up at
3451 int empty, struct extent_buffer *left,
3455 struct btrfs_fs_info *fs_info = left->fs_info;
3503 /* push data from right to left */
3504 copy_leaf_items(left, right, btrfs_header_nritems(left), 0, push_items);
3509 copy_leaf_data(left, right, leaf_data_end(left) - push_space,
3511 old_left_nritems = btrfs_header_nritems(left);
3514 btrfs_init_map_token(&token, left);
3515 old_left_item_size = btrfs_item_offset(left, old_left_nritems - 1);
3523 btrfs_set_header_nritems(left, old_left_nritems + push_items);
3550 btrfs_mark_buffer_dirty(trans, left);
3564 path->nodes[0] = left;
3567 btrfs_tree_unlock(left);
3568 free_extent_buffer(left);
3574 btrfs_tree_unlock(left);
3575 free_extent_buffer(left);
3580 * push some data in the path leaf to the left, trying to free up at
3592 struct extent_buffer *left;
3610 left = btrfs_read_node_slot(path->nodes[1], slot - 1);
3611 if (IS_ERR(left))
3612 return PTR_ERR(left);
3614 __btrfs_tree_lock(left, BTRFS_NESTING_LEFT);
3616 free_space = btrfs_leaf_free_space(left);
3622 ret = btrfs_cow_block(trans, root, left,
3623 path->nodes[1], slot - 1, &left,
3632 if (check_sibling_keys(left, right)) {
3637 return __push_leaf_left(trans, path, min_data_size, empty, left,
3640 btrfs_tree_unlock(left);
3641 free_extent_buffer(left);
3803 /* first try to make some room by pushing left and right */
4649 * trying to move all its items into its left and right neighbours.
4666 * left neighbour leaf, and that's the first item.
4679 * leaf to its left neighbour, then attempt to