OSDN Git Service

btrfs: update may_commit_transaction to use the delayed refs rsv
authorJosef Bacik <josef@toxicpanda.com>
Mon, 3 Dec 2018 15:20:34 +0000 (10:20 -0500)
committerDavid Sterba <dsterba@suse.com>
Mon, 17 Dec 2018 13:51:47 +0000 (14:51 +0100)
commit4c8edbc75cb9ff846066cd9781ede4f27caf3cf4
tree456ab9cccbb1dd3c76ebf4f3b00d62c27d1bf08e
parentba2c4d4e3bda7d6de2bc616ae6715e0a0725b294
btrfs: update may_commit_transaction to use the delayed refs rsv

Any space used in the delayed_refs_rsv will be freed up by a transaction
commit, so instead of just counting the pinned space we also need to
account for any space in the delayed_refs_rsv when deciding if it will
make a different to commit the transaction to satisfy our space
reservation.  If we have enough bytes to satisfy our reservation ticket
then we are good to go, otherwise subtract out what space we would gain
back by committing the transaction and compare that against the pinned
space to make our decision.

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