btrfs_drop_extents: make sure the item is getting smaller before truncate

Signed-off-by: Chris Mason <chris.mason@oracle.com>
This commit is contained in:
Chris Mason
2007-11-30 10:09:33 -05:00
parent ca6646264b
commit 00f5c795fc
3 changed files with 25 additions and 17 deletions

View File

@ -45,6 +45,9 @@ static int cache_block_group(struct btrfs_root *root,
u64 first_free;
int found = 0;
if (!block_group)
return 0;
root = root->fs_info->extent_root;
free_space_cache = &root->fs_info->free_space_cache;
@ -168,6 +171,11 @@ static u64 find_search_start(struct btrfs_root *root,
u64 cache_miss = 0;
int wrapped = 0;
if (!cache) {
cache = btrfs_lookup_block_group(root->fs_info, search_start);
if (!cache)
return search_start;
}
again:
ret = cache_block_group(root, cache);
if (ret)