]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/commit - fs/btrfs/free-space-cache.c
Btrfs: merge contigous regions when loading free space cache
authorJosef Bacik <josef@redhat.com>
Mon, 14 May 2012 14:06:40 +0000 (10:06 -0400)
committerJosef Bacik <josef@redhat.com>
Wed, 30 May 2012 14:23:36 +0000 (10:23 -0400)
commitcd023e7b17fe86c530475da210b3348421c40e5f
treeb80cf40b7ad18af59ef43602b673fe1c7d371232
parent9ba1f6e44ed7a1fa52d3f292508bf921b5054172
Btrfs: merge contigous regions when loading free space cache

When we write out the free space cache we will write out everything that is
in our in memory tree, and then we will just walk the pinned extents tree
and write anything we see there.  The problem with this is that during
normal operations the pinned extents will be merged back into the free space
tree normally, and then we can allocate space from the merged areas and
commit them to the tree log.  If we crash and replay the tree log we will
crash again because the tree log will try to free up space from what looks
like 2 seperate but contiguous entries, since one entry is from the original
free space cache and the other was a pinned extent that was merged back.  To
fix this we just need to walk the free space tree after we load it and merge
contiguous entries back together.  This will keep the tree log stuff from
breaking and it will make the allocator behave more nicely.  Thanks,

Signed-off-by: Josef Bacik <josef@redhat.com>
fs/btrfs/free-space-cache.c