• Josef Bacik's avatar
    Btrfs: use a percpu to keep track of possibly pinned bytes · b150a4f1
    Josef Bacik authored
    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: default avatarJosef Bacik <jbacik@fusionio.com>
    b150a4f1
ctree.h 125 KB