From 87b29b208c6c38f3446d2de6ece946e2459052cf Mon Sep 17 00:00:00 2001 From: Yan Zheng Date: Wed, 17 Dec 2008 10:21:48 -0500 Subject: 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 --- fs/btrfs/tree-log.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) (limited to 'fs/btrfs/tree-log.c') diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c index 6ac1b7f72e2a..33eee256ee81 100644 --- a/fs/btrfs/tree-log.c +++ b/fs/btrfs/tree-log.c @@ -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) { -- cgit v1.2.3