]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commit - fs/btrfs/free-space-cache.c
Btrfs: cleanup how we setup free space clusters
authorJosef Bacik <josef@redhat.com>
Mon, 21 Mar 2011 14:11:24 +0000 (10:11 -0400)
committerChris Mason <chris.mason@oracle.com>
Fri, 25 Mar 2011 23:08:08 +0000 (19:08 -0400)
commit4e69b598f6cfb0940b75abf7e179d6020e94ad1e
treeae14c7078bd7540200ffe32726e33dd8ff64f5d5
parent32cb0840ce8e13901fe71a9a8e834a531802ffc4
Btrfs: cleanup how we setup free space clusters

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 <josef@redhat.com>
fs/btrfs/ctree.h
fs/btrfs/free-space-cache.c