]> git.ipfire.org Git - thirdparty/linux.git/commit
btrfs: avoid unnecessary ref initialization when freeing log tree block
authorFilipe Manana <fdmanana@suse.com>
Mon, 19 Feb 2024 12:51:25 +0000 (12:51 +0000)
committerDavid Sterba <dsterba@suse.com>
Mon, 4 Mar 2024 15:24:52 +0000 (16:24 +0100)
commit74cd8cac0b12b3d6f181491aca6af23f5d5a65f1
treeda4a4dfbf681d59911748085d8e0d3e4faa1e654
parent0e9e135e7c4bf90e9e5c14fe9fdedbb789df1604
btrfs: avoid unnecessary ref initialization when freeing log tree block

At btrfs_free_tree_block(), we are always initializing a delayed reference
to drop the given extent buffer but we only use if it does not belong to a
log root tree. So we are doing unnecessary work here and increasing the
duration of a critical section as this is normally called while holding a
lock on the parent tree block (if any) and while holding a log transaction
open.

So initialize the delayed reference only if the extent buffer is not from
a log tree, avoiding unnecessary work and making the code also a bit
easier to follow.

Reviewed-by: Naohiro Aota <naohiro.aota@wdc.com>
Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/extent-tree.c