]> git.baikalelectronics.ru Git - kernel.git/commit
Btrfs: use a percpu to keep track of possibly pinned bytes
authorJosef Bacik <jbacik@fusionio.com>
Wed, 19 Jun 2013 19:00:04 +0000 (15:00 -0400)
committerJosef Bacik <jbacik@fusionio.com>
Tue, 2 Jul 2013 15:50:42 +0000 (11:50 -0400)
commitec8c0910b2126159ad3008393e827b3898a01138
tree3d1d6d471e8dafecb765435b87d24f22482acda5
parent91bfb0a2585821175a83769caae524043141d904
Btrfs: use a percpu to keep track of possibly pinned bytes

There are all of these checks in the ENOSPC code to see if committing the
transaction would free up enough space to make the allocation.  This is because
early on we just committed the transaction and hoped and prayed, which resulted
in cases where it took _forever_ to get an ENOSPC when we really were out of
space.  So we check space_info->bytes_pinned, except this isn't completely true
because it doesn't account for space we may free but are stuck in delayed refs.
So tests like xfstests 226 would fail because we wouldn't commit the transaction
to free up the data space.  So instead add a percpu counter that will be a
little fuzzier, it will add bytes as soon as we try to free up the space, and
remove any space it doesn't actually free up when we get around to doing the
actual free.  We then 0 out this counter every transaction period so we have a
better idea of how much space we will actually free up by committing this
transaction.  With this patch we now pass xfstests 226.  Thanks,

Signed-off-by: Josef Bacik <jbacik@fusionio.com>
fs/btrfs/ctree.h
fs/btrfs/extent-tree.c