Btrfs: don't keep trying to build clusters if we are fragmented

If we are extremely fragmented then we won't be able to create a free_cluster.
So if this happens set last_ptr->fragmented so that all future allcations will
give up trying to create a cluster.  When we unpin extents we will unset
->fragmented if we free up a sufficient amount of space in a block group.
Thanks,

Signed-off-by: Josef Bacik <jbacik@fb.com>
Signed-off-by: Chris Mason <clm@fb.com>
This commit is contained in:
Josef Bacik
2015-10-02 15:25:10 -04:00
committed by Chris Mason
parent a5e681d9bd
commit c759c4e161
3 changed files with 82 additions and 24 deletions

View File

@@ -1232,6 +1232,9 @@ struct btrfs_free_cluster {
/* first extent starting offset */
u64 window_start;
/* We did a full search and couldn't create a cluster */
bool fragmented;
struct btrfs_block_group_cache *block_group;
/*
* when a cluster is allocated from a block group, we put the