btrfs: always wait on ordered extents at fsync time

There's a priority inversion that exists currently with btrfs fsync.  In
some cases we will collect outstanding ordered extents onto a list and
only wait on them at the very last second.  However this "very last
second" falls inside of a transaction handle, so if we are in a lower
priority cgroup we can end up holding the transaction open for longer
than needed, so if a high priority cgroup is also trying to fsync()
it'll see latency.

Fix this by getting rid of all of the logged extents magic and simply
wait on ordered extent before we star the tree log stuff.  This code has
changed a lot since I first wrote it and really isn't the performance
win it was originally because of the things we had to do around getting
the right checksums.  Killing all of this makes our lives easier and
gets rid of the priority inversion.

Signed-off-by: Josef Bacik <jbacik@fb.com>
5 files changed