Skip to content

Commit 71f50f3

Browse files
fdmananagregkh
authored andcommitted
btrfs: add comment for optimization in free_extent_buffer()
[ Upstream commit 2697b61 ] 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> Stable-dep-of: ad580df ("btrfs: fix subpage deadlock in try_release_subpage_extent_buffer()") Signed-off-by: Sasha Levin <sashal@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 99f62a4 commit 71f50f3

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
@@ -3493,6 +3493,7 @@ void free_extent_buffer(struct extent_buffer *eb)
34933493
break;
34943494
}
34953495

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

0 commit comments

Comments
 (0)