]> git.baikalelectronics.ru Git - kernel.git/commit
Btrfs: fix the allocator loop logic
authorJosef Bacik <josef@redhat.com>
Fri, 27 May 2011 20:11:38 +0000 (16:11 -0400)
committerJosef Bacik <josef@redhat.com>
Wed, 8 Jun 2011 20:37:29 +0000 (16:37 -0400)
commitb14ea0a475efbe10711da71614e8e5390099bcda
tree55ee1276c7e5e1dc95a6204cc138d69983bb0ffb
parent9a3fb68a7ffcc6cf9815cfa00b5187b4c94e56e3
Btrfs: fix the allocator loop logic

I was testing with empty_cluster = 0 to try and reproduce a problem and kept
hitting early enospc panics.  This was because our loop logic was a little
confused.  So this is what I did

1) Make the loop variable the ultimate decider on wether we should loop again
isntead of checking to see if we had an uncached bg, empty size or empty
cluster.

2) Increment loop before checking to see what we are on to make the loop
definitions make more sense.

3) If we are on the chunk alloc loop don't set empty_size/empty_cluster to 0
unless we didn't actually allocate a chunk.  If we did allocate a chunk we
should be able to easily setup a new cluster so clearing
empty_size/empty_cluster makes us less efficient.

This kept me from hitting panics while trying to reproduce the other problem.
Thanks,

Signed-off-by: Josef Bacik <josef@redhat.com>
fs/btrfs/extent-tree.c