btrfs: check tickets after waiting on ordered extents
authorJosef Bacik <josef@toxicpanda.com>
Tue, 21 Jul 2020 14:22:22 +0000 (10:22 -0400)
committerDavid Sterba <dsterba@suse.com>
Wed, 7 Oct 2020 10:06:52 +0000 (12:06 +0200)
commit448b966b49be55af8f4aa79b24d7896809fd8e67
treec4014950b5f1a50d83173fe65afcf8c4b8f5ae9c
parent38d715f494f2f1dddbf3d0c6e50aefff49519232
btrfs: check tickets after waiting on ordered extents

Right now if the space is freed up after the ordered extents complete
(which is likely since the reservations are held until they complete),
we would do extra delalloc flushing before we'd notice that we didn't
have any more tickets.  Fix this by moving the tickets check after our
wait_ordered_extents check.

Tested-by: Nikolay Borisov <nborisov@suse.com>
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/space-info.c