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) | |
download | lwn-00f5c795fca47d038fedd3f0c9311da3be710c9f.tar.gz lwn-00f5c795fca47d038fedd3f0c9311da3be710c9f.zip |
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, 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) |