Btrfs: properly check free space for tree balancing

btrfs_insert_empty_items takes the space needed by the btrfs_item
structure into account when calculating the required free space.

So the tree balancing code shouldn't add sizeof(struct btrfs_item)
to the size when checking the free space. This patch removes these
superfluous additions.

Signed-off-by: Yan Zheng <zheng.yan@oracle.com>
This commit is contained in:
Yan Zheng
2008-12-17 10:21:48 -05:00
committed by Chris Mason
parent d7f735d0bc
commit 87b29b208c
3 changed files with 32 additions and 33 deletions

View File

@ -374,13 +374,8 @@ insert:
if (found_size > item_size) {
btrfs_truncate_item(trans, root, path, item_size, 1);
} else if (found_size < item_size) {
ret = btrfs_del_item(trans, root,
path);
BUG_ON(ret);
btrfs_release_path(root, path);
ret = btrfs_insert_empty_item(trans,
root, path, key, item_size);
ret = btrfs_extend_item(trans, root, path,
item_size - found_size);
BUG_ON(ret);
}
} else if (ret) {