Commit 888dd183 authored by Filipe Manana's avatar Filipe Manana Committed by David Sterba

btrfs: use the new bit BTRFS_FS_TREE_MOD_LOG_USERS at btrfs_free_tree_block()

Instead of exposing implementation details of the tree mod log to check
if there are active tree mod log users at btrfs_free_tree_block(), use
the new bit BTRFS_FS_TREE_MOD_LOG_USERS for fs_info->flags instead. This
way extent-tree.c does not need to known about any of the internals of
the tree mod log and avoids taking a lock unnecessarily as well.
Signed-off-by: default avatarFilipe Manana <fdmanana@suse.com>
Reviewed-by: default avatarDavid Sterba <dsterba@suse.com>
Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
parent bc03f39e
...@@ -3342,11 +3342,9 @@ void btrfs_free_tree_block(struct btrfs_trans_handle *trans, ...@@ -3342,11 +3342,9 @@ void btrfs_free_tree_block(struct btrfs_trans_handle *trans,
* find a node pointing to this leaf and record operations that * find a node pointing to this leaf and record operations that
* point to this leaf. * point to this leaf.
*/ */
if (btrfs_header_level(buf) == 0) { if (btrfs_header_level(buf) == 0 &&
read_lock(&fs_info->tree_mod_log_lock); test_bit(BTRFS_FS_TREE_MOD_LOG_USERS, &fs_info->flags))
must_pin = !list_empty(&fs_info->tree_mod_seq_list); must_pin = true;
read_unlock(&fs_info->tree_mod_log_lock);
}
if (must_pin || btrfs_is_zoned(fs_info)) { if (must_pin || btrfs_is_zoned(fs_info)) {
btrfs_redirty_list_add(trans->transaction, buf); btrfs_redirty_list_add(trans->transaction, buf);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment