diff options
author | Chris Mason <chris.mason@oracle.com> | 2007-11-30 10:09:33 -0500 |
---|---|---|
committer | Chris Mason <chris.mason@oracle.com> | 2008-09-25 11:03:58 -0400 |
commit | 00f5c795fca47d038fedd3f0c9311da3be710c9f (patch) | |
tree | 98e6a349ddfa115b4f0577f3c6e1e24fca2fac59 /fs/btrfs/extent-tree.c | |
parent | ca6646264b7dab662d84435441164bb2a8e8885a (diff) |
btrfs_drop_extents: make sure the item is getting smaller before truncate
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/extent-tree.c')
-rw-r--r-- | fs/btrfs/extent-tree.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index 3c00f967eccb..55abdf997ca5 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c | |||
@@ -45,6 +45,9 @@ static int cache_block_group(struct btrfs_root *root, | |||
45 | u64 first_free; | 45 | u64 first_free; |
46 | int found = 0; | 46 | int found = 0; |
47 | 47 | ||
48 | if (!block_group) | ||
49 | return 0; | ||
50 | |||
48 | root = root->fs_info->extent_root; | 51 | root = root->fs_info->extent_root; |
49 | free_space_cache = &root->fs_info->free_space_cache; | 52 | free_space_cache = &root->fs_info->free_space_cache; |
50 | 53 | ||
@@ -168,6 +171,11 @@ static u64 find_search_start(struct btrfs_root *root, | |||
168 | u64 cache_miss = 0; | 171 | u64 cache_miss = 0; |
169 | int wrapped = 0; | 172 | int wrapped = 0; |
170 | 173 | ||
174 | if (!cache) { | ||
175 | cache = btrfs_lookup_block_group(root->fs_info, search_start); | ||
176 | if (!cache) | ||
177 | return search_start; | ||
178 | } | ||
171 | again: | 179 | again: |
172 | ret = cache_block_group(root, cache); | 180 | ret = cache_block_group(root, cache); |
173 | if (ret) | 181 | if (ret) |