Skip to content

Commit 302167c

Browse files
josefbacikkdave
authored andcommitted
btrfs: don't end the transaction for delayed refs in throttle
Previously callers to btrfs_end_transaction_throttle() would commit the transaction if there wasn't enough delayed refs space. This happens in relocation, and if the fs is relatively empty we'll run out of delayed refs space basically immediately, so we'll just be stuck in this loop of committing the transaction over and over again. This code existed because we didn't have a good feedback mechanism for running delayed refs, but with the delayed refs rsv we do now. Delete this throttling code and let the btrfs_start_transaction() in relocation deal with putting pressure on the delayed refs infrastructure. With this patch we no longer take 5 minutes to balance a metadata only fs. Qu has submitted a fstest to catch slow balance or excessive transaction commits. Steps to reproduce: * create subvolume * create many (eg. 16000) inlined files, of size 2KiB * iteratively snapshot and touch several files to trigger metadata updates * start balance -m Reported-by: Qu Wenruo <wqu@suse.com> Fixes: 6440361 ("btrfs: rework btrfs_check_space_for_delayed_refs") Signed-off-by: Josef Bacik <josef@toxicpanda.com> [ add tags and steps to reproduce ] Signed-off-by: David Sterba <dsterba@suse.com>
1 parent a627947 commit 302167c

File tree

1 file changed

+0
-8
lines changed

1 file changed

+0
-8
lines changed

fs/btrfs/transaction.c

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -850,14 +850,6 @@ static int __btrfs_end_transaction(struct btrfs_trans_handle *trans,
850850

851851
btrfs_trans_release_chunk_metadata(trans);
852852

853-
if (lock && should_end_transaction(trans) &&
854-
READ_ONCE(cur_trans->state) == TRANS_STATE_RUNNING) {
855-
spin_lock(&info->trans_lock);
856-
if (cur_trans->state == TRANS_STATE_RUNNING)
857-
cur_trans->state = TRANS_STATE_BLOCKED;
858-
spin_unlock(&info->trans_lock);
859-
}
860-
861853
if (lock && READ_ONCE(cur_trans->state) == TRANS_STATE_BLOCKED) {
862854
if (throttle)
863855
return btrfs_commit_transaction(trans);

0 commit comments

Comments
 (0)