Btrfs: Extra NULL block group checks in find_free_extent
authorChris Mason <chris.mason@oracle.com>
Thu, 13 Dec 2007 14:02:46 +0000 (09:02 -0500)
committerChris Mason <chris.mason@oracle.com>
Thu, 25 Sep 2008 15:03:58 +0000 (11:03 -0400)
Signed-off-by: Chris Mason <chris.mason@oracle.com>
fs/btrfs/extent-tree.c

index 187be40124749f53ba7b89afa896a957d0f650eb..7c953b2ecf153bbd0a101b9d6a30767acba75381 100644 (file)
@@ -1319,6 +1319,12 @@ static int find_free_extent(struct btrfs_trans_handle *trans, struct btrfs_root
        total_needed += empty_size;
        path = btrfs_alloc_path();
 check_failed:
+       if (!block_group) {
+               block_group = btrfs_lookup_block_group(info, search_start);
+               if (!block_group)
+                       block_group = btrfs_lookup_block_group(info,
+                                                      orig_search_start);
+       }
        search_start = find_search_start(root, &block_group, search_start,
                                         total_needed, data, full_scan);
        search_start = stripe_align(root, search_start);