Btrfs: Fix NULL block groups on reading the inode
authorChris Mason <chris.mason@oracle.com>
Fri, 21 Dec 2007 21:36:24 +0000 (16:36 -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
fs/btrfs/inode.c

index de0fb0743cf92dc8ef4dd9f7de42a4539f4cd7af..a421069e998b02ccc31ed2719cbf337868527801 100644 (file)
@@ -1630,11 +1630,11 @@ int btrfs_alloc_extent(struct btrfs_trans_handle *trans,
        struct btrfs_path *path;
 
        btrfs_set_stack_extent_refs(&extent_item, 1);
-
+#if 0
        new_hint = max(hint_byte, 16ULL * 1024 * 1024 * 1024);
        if (new_hint < btrfs_super_total_bytes(&info->super_copy))
                hint_byte = new_hint;
-
+#endif
        WARN_ON(num_bytes < root->sectorsize);
        ret = find_free_extent(trans, root, num_bytes, empty_size,
                               search_start, search_end, hint_byte, ins,
index f6a20112d9e7baf74c66a85efea46fae6b2e514d..3c7bf3bddcad41763bca7b2812ce38a889c8baeb 100644 (file)
@@ -402,6 +402,10 @@ void btrfs_read_locked_inode(struct inode *inode)
        BTRFS_I(inode)->block_group = btrfs_lookup_block_group(root->fs_info,
                                                       alloc_group_block);
 
+       if (!BTRFS_I(inode)->block_group) {
+               BTRFS_I(inode)->block_group = btrfs_find_block_group(root,
+                                                        NULL, 0, 0, 0);
+       }
        btrfs_free_path(path);
        inode_item = NULL;