ctree.c (0a4eefbb745ec0e8a5b694ae3f40cc34082d8f61) ctree.c (d717aa1d31c36cb56059e97966cb76f0be021969)
1/*
2 * Copyright (C) 2007,2008 Oracle. All rights reserved.
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public
6 * License v2 as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,

--- 1026 unchanged lines hidden (view full) ---

1035 /* once for the root ptr */
1036 free_extent_buffer(mid);
1037 return ret;
1038 }
1039 if (btrfs_header_nritems(mid) >
1040 BTRFS_NODEPTRS_PER_BLOCK(root) / 4)
1041 return 0;
1042
1/*
2 * Copyright (C) 2007,2008 Oracle. All rights reserved.
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public
6 * License v2 as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,

--- 1026 unchanged lines hidden (view full) ---

1035 /* once for the root ptr */
1036 free_extent_buffer(mid);
1037 return ret;
1038 }
1039 if (btrfs_header_nritems(mid) >
1040 BTRFS_NODEPTRS_PER_BLOCK(root) / 4)
1041 return 0;
1042
1043 if (btrfs_header_nritems(mid) > 2)
1044 return 0;
1045
1046 if (btrfs_header_nritems(mid) < 2)
1047 err_on_enospc = 1;
1048
1049 left = read_node_slot(root, parent, pslot - 1);
1050 if (left) {
1051 btrfs_tree_lock(left);
1052 btrfs_set_lock_blocking(left);
1053 wret = btrfs_cow_block(trans, root, left,

--- 2737 unchanged lines hidden (view full) ---

3791 btrfs_item_key(leaf, &disk_key, 0);
3792 wret = fixup_low_keys(trans, root, path,
3793 &disk_key, 1);
3794 if (wret)
3795 ret = wret;
3796 }
3797
3798 /* delete the leaf if it is mostly empty */
1043 if (btrfs_header_nritems(mid) < 2)
1044 err_on_enospc = 1;
1045
1046 left = read_node_slot(root, parent, pslot - 1);
1047 if (left) {
1048 btrfs_tree_lock(left);
1049 btrfs_set_lock_blocking(left);
1050 wret = btrfs_cow_block(trans, root, left,

--- 2737 unchanged lines hidden (view full) ---

3788 btrfs_item_key(leaf, &disk_key, 0);
3789 wret = fixup_low_keys(trans, root, path,
3790 &disk_key, 1);
3791 if (wret)
3792 ret = wret;
3793 }
3794
3795 /* delete the leaf if it is mostly empty */
3799 if (used < BTRFS_LEAF_DATA_SIZE(root) / 2) {
3796 if (used < BTRFS_LEAF_DATA_SIZE(root) / 3) {
3800 /* push_leaf_left fixes the path.
3801 * make sure the path still points to our leaf
3802 * for possible call to del_ptr below
3803 */
3804 slot = path->slots[1];
3805 extent_buffer_get(leaf);
3806
3807 btrfs_set_path_blocking(path);

--- 501 unchanged lines hidden ---
3797 /* push_leaf_left fixes the path.
3798 * make sure the path still points to our leaf
3799 * for possible call to del_ptr below
3800 */
3801 slot = path->slots[1];
3802 extent_buffer_get(leaf);
3803
3804 btrfs_set_path_blocking(path);

--- 501 unchanged lines hidden ---