Skip to content

Commit

Permalink
Btrfs: skip allocation attempt from empty cluster
Browse files Browse the repository at this point in the history
If we don't have a cluster, don't bother trying to allocate from it,
jumping right away to the attempt to allocate a new cluster.

Signed-off-by: Alexandre Oliva <oliva@lsd.ic.unicamp.br>
Signed-off-by: Chris Mason <chris.mason@oracle.com>
  • Loading branch information
Alexandre Oliva authored and Chris Mason committed Nov 30, 2011
1 parent 425d831 commit be064d1
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions fs/btrfs/extent-tree.c
Original file line number Diff line number Diff line change
Expand Up @@ -5299,9 +5299,9 @@ static noinline int find_free_extent(struct btrfs_trans_handle *trans,
* people trying to start a new cluster
*/
spin_lock(&last_ptr->refill_lock);
if (last_ptr->block_group &&
(last_ptr->block_group->ro ||
!block_group_bits(last_ptr->block_group, data)))
if (!last_ptr->block_group ||
last_ptr->block_group->ro ||
!block_group_bits(last_ptr->block_group, data))
goto refill_cluster;

offset = btrfs_alloc_from_cluster(block_group, last_ptr,
Expand Down

0 comments on commit be064d1

Please sign in to comment.