Btrfs: be smarter about committing the transaction in reserve_metadata_bytes
authorJosef Bacik <josef@redhat.com>
Fri, 4 Nov 2011 02:54:25 +0000 (22:54 -0400)
committerChris Mason <chris.mason@oracle.com>
Sun, 6 Nov 2011 08:04:19 +0000 (03:04 -0500)
commit663350ac38c67ca388acea6e876dc6d668c232b0
treed111c306c5dfd622c04a0568efde089bdc4577b3
parent6d668dda0caec537fbf28c4d91e6d18181af3cff
Btrfs: be smarter about committing the transaction in reserve_metadata_bytes

Because of the overcommit stuff I had to make it so that we committed the
transaction all the time in reserve_metadata_bytes in case we had overcommitted
because of delayed items.  This was because previously we had no way of knowing
how much space was reserved for delayed items.  Now that we have the
delayed_block_rsv we can check it to see if committing the transaction would get
us anywhere.  This patch breaks out the committing logic into a helper function
that will check to see if committing the transaction would free enough space for
us to get anything done.  With this patch xfstests 83 goes from taking 445
seconds to taking 28 seconds on my box.  Thanks,

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