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/file-item.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'fs/btrfs/file-item.c') diff --git a/fs/btrfs/file-item.c b/fs/btrfs/file-item.c index 7acadf3b742a..cc6e0b6de949 100644 --- a/fs/btrfs/file-item.c +++ b/fs/btrfs/file-item.c @@ -300,6 +300,10 @@ int btrfs_lookup_csums_range(struct btrfs_root *root, u64 start, u64 end, size = btrfs_item_size_nr(leaf, path->slots[0]); csum_end = key.offset + (size / csum_size) * root->sectorsize; + if (csum_end <= start) { + path->slots[0]++; + continue; + } size = min(csum_end, end + 1) - start; sums = kzalloc(btrfs_ordered_sum_size(root, size), GFP_NOFS); -- cgit v1.2.3