mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-05-14 12:21:15 -04:00
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:
committed by
David Sterba
parent
71c086b30d
commit
2697b61597
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user