mirror of
https://github.com/torvalds/linux.git
synced 2026-11-07 06:17:02 +01:00
btrfs: clear BTRFS_ROOT_IN_TRANS_SETUP on early exit from record_root_in_trans()
If we exit early because the transaction that last used the root already matches the current transaction, we leave the BTRFS_ROOT_IN_TRANS_SETUP bit set in the root (which we just set right before the exit). While this does not cause any functional issue, it makes callers of btrfs_record_root_in_trans() lock fs_info->reloc_mutex and call record_root_in_trans() for nothing, causing unnecessary lock contention, until one of them clears the bit in record_root_in_trans(). One caller of btrfs_record_root_in_trans() is start_transaction(), used to start new transaction or joining an existing one, which is a hot path. So clear BTRFS_ROOT_IN_TRANS_SETUP on early exit. Assisted-by: LLM Reviewed-by: Boris Burkov <boris@bur.io> Reviewed-by: Qu Wenruo <wqu@suse.com> Signed-off-by: Filipe Manana <fdmanana@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
72de4807ba
commit
3e6ff34afc
|
|
@ -432,6 +432,7 @@ static int record_root_in_trans(struct btrfs_trans_handle *trans,
|
|||
spin_lock(&fs_info->fs_roots_radix_lock);
|
||||
if (btrfs_get_root_last_trans(root) == trans->transid && !force) {
|
||||
spin_unlock(&fs_info->fs_roots_radix_lock);
|
||||
clear_bit(BTRFS_ROOT_IN_TRANS_SETUP, &root->state);
|
||||
return 0;
|
||||
}
|
||||
radix_tree_tag_set(&fs_info->fs_roots_radix,
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user