Skip to content

Commit 03a4713

Browse files
fdmananakdave
authored andcommitted
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>
1 parent cd660d0 commit 03a4713

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

fs/btrfs/extent_io.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3494,6 +3494,7 @@ void free_extent_buffer(struct extent_buffer *eb)
34943494
break;
34953495
}
34963496

3497+
/* Optimization to avoid locking eb->refs_lock. */
34973498
if (atomic_try_cmpxchg(&eb->refs, &refs, refs - 1))
34983499
return;
34993500
}

0 commit comments

Comments
 (0)