btrfs: don't enospc all tickets on flush failure
authorJosef Bacik <josef@toxicpanda.com>
Wed, 21 Nov 2018 19:03:10 +0000 (14:03 -0500)
committerDavid Sterba <dsterba@suse.com>
Mon, 25 Feb 2019 13:13:34 +0000 (14:13 +0100)
commitf91587e4151e84f798f37839dddd3e4152fb4c76
tree44414b75d9dbfdb4887f97ffa85a22f8b1cf54de
parent450114fc0db0cd5c2e7324b917e5de52cff991d7
btrfs: don't enospc all tickets on flush failure

With the introduction of the per-inode block_rsv it became possible to
have really really large reservation requests made because of data
fragmentation.  Since the ticket stuff assumed that we'd always have
relatively small reservation requests it just killed all tickets if we
were unable to satisfy the current request.

However, this is generally not the case anymore.  So fix this logic to
instead see if we had a ticket that we were able to give some
reservation to, and if we were continue the flushing loop again.

Likewise we make the tickets use the space_info_add_old_bytes() method
of returning what reservation they did receive in hopes that it could
satisfy reservations down the line.

Reviewed-by: Nikolay Borisov <nborisov@suse.com>
Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/extent-tree.c