]> git.baikalelectronics.ru Git - kernel.git/commit
Btrfs: fix enospc problems with delalloc
authorJosef Bacik <josef@redhat.com>
Fri, 15 Jul 2011 15:16:44 +0000 (15:16 +0000)
committerChris Mason <chris.mason@oracle.com>
Wed, 27 Jul 2011 16:46:44 +0000 (12:46 -0400)
commit95f37890642afb3729415e1e2715eec17b455d8d
tree0fb899e1fa78b599d22389ca3befc8ab51ff5049
parent6caf1c4468ed4ffe51bb026762e46302590f7c0f
Btrfs: fix enospc problems with delalloc

So I had this brilliant idea to use atomic counters for outstanding and reserved
extents, but this turned out to be a bad idea.  Consider this where we have 1
outstanding extent and 1 reserved extent

Reserver Releaser
atomic_dec(outstanding) now 0
atomic_read(outstanding)+1 get 1
atomic_read(reserved) get 1
don't actually reserve anything because
they are the same
atomic_cmpxchg(reserved, 1, 0)
atomic_inc(outstanding)
atomic_add(0, reserved)
free reserved space for 1 extent

Then the reserver now has no actual space reserved for it, and when it goes to
finish the ordered IO it won't have enough space to do it's allocation and you
get those lovely warnings.

Signed-off-by: Josef Bacik <josef@redhat.com>
Signed-off-by: Chris Mason <chris.mason@oracle.com>
fs/btrfs/btrfs_inode.h
fs/btrfs/ctree.h
fs/btrfs/extent-tree.c
fs/btrfs/file.c
fs/btrfs/inode.c
fs/btrfs/ioctl.c