btrfs: check if there are free block groups for commit
authorJosef Bacik <josef@toxicpanda.com>
Wed, 21 Nov 2018 19:03:06 +0000 (14:03 -0500)
committerDavid Sterba <dsterba@suse.com>
Mon, 25 Feb 2019 13:13:33 +0000 (14:13 +0100)
commitd89dbefb8c5f7289ad404676869135501437c04e
treed7003145fdfbea1a17b38340e18d0f254371f738
parent3f93aef535c8ea03e40cd8acf0753b3e6ed33e96
btrfs: check if there are free block groups for commit

may_commit_transaction will skip committing the transaction if we don't
have enough pinned space or if we're trying to find space for a SYSTEM
chunk.  However, if we have pending free block groups in this transaction
we still want to commit as we may be able to allocate a chunk to make
our reservation.  So instead of just returning ENOSPC, check if we have
free block groups pending, and if so commit the transaction to allow us
to use that free space.

Reviewed-by: Omar Sandoval <osandov@fb.com>
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