Skip to content

Commit

Permalink
Btrfs: cleanup how we setup free space clusters
Browse files Browse the repository at this point in the history
This patch makes the free space cluster refilling code a little easier to
understand, and fixes some things with the bitmap part of it.  Currently we
either want to refill a cluster with

1) All normal extent entries (those without bitmaps)
2) A bitmap entry with enough space

The current code has this ugly jump around logic that will first try and fill up
the cluster with extent entries and then if it can't do that it will try and
find a bitmap to use.  So instead split this out into two functions, one that
tries to find only normal entries, and one that tries to find bitmaps.

This also fixes a suboptimal thing we would do with bitmaps.  If we used a
bitmap we would just tell the cluster that we were pointing at a bitmap and it
would do the tree search in the block group for that entry every time we tried
to make an allocation.  Instead of doing that now we just add it to the clusters
group.

I tested this with my ENOSPC tests and xfstests and it survived.

Signed-off-by: Josef Bacik <[email protected]>
  • Loading branch information
Josef Bacik authored and chrismason-xx committed Mar 25, 2011
1 parent 32cb084 commit 4e69b59
Show file tree
Hide file tree
Showing 2 changed files with 182 additions and 185 deletions.
3 changes: 0 additions & 3 deletions fs/btrfs/ctree.h
Original file line number Diff line number Diff line change
Expand Up @@ -783,9 +783,6 @@ struct btrfs_free_cluster {
/* first extent starting offset */
u64 window_start;

/* if this cluster simply points at a bitmap in the block group */
bool points_to_bitmap;

struct btrfs_block_group_cache *block_group;
/*
* when a cluster is allocated from a block group, we put the
Expand Down
Loading

0 comments on commit 4e69b59

Please sign in to comment.