btrfs: add comment for optimization in free_extent_buffer()

There's this special atomic compare and exchange logic which serves to
avoid locking the extent buffers refs_lock spinlock and therefore reduce
lock contention, so add a comment to make it more obvious.

Reviewed-by: Boris Burkov <boris@bur.io>
Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
Filipe Manana
2025-06-02 13:46:23 +01:00
committed by David Sterba
parent 71c086b30d
commit 2697b61597

View File

@@ -3493,6 +3493,7 @@ void free_extent_buffer(struct extent_buffer *eb)
break;
}
/* Optimization to avoid locking eb->refs_lock. */
if (atomic_try_cmpxchg(&eb->refs, &refs, refs - 1))
return;
}