Commit 2697b615 authored by Filipe Manana's avatar Filipe Manana Committed by David Sterba
Browse files

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: default avatarBoris Burkov <boris@bur.io>
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 71c086b3
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -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;
	}