diff options
| author | Filipe Manana <fdmanana@suse.com> | 2025-06-02 13:56:48 +0100 |
|---|---|---|
| committer | David Sterba <dsterba@suse.com> | 2025-07-21 23:53:30 +0200 |
| commit | b769777d927af168b1389388392bfd7dc4e38399 (patch) | |
| tree | 3b44d2dcccec6081a33f308203444a5db0488c22 /tools/perf/scripts/python/exported-sql-viewer.py | |
| parent | 2697b6159744e5afae0f7715da9f830ba6f9e45a (diff) | |
btrfs: use refcount_t type for the extent buffer reference counter
Instead of using a bare atomic, use the refcount_t type, which despite
being a structure that contains only an atomic, has an API that checks
for underflows and other hazards. This doesn't change the size of the
extent_buffer structure.
This removes the need to do things like this:
WARN_ON(atomic_read(&eb->refs) == 0);
if (atomic_dec_and_test(&eb->refs)) {
(...)
}
And do just:
if (refcount_dec_and_test(&eb->refs)) {
(...)
}
Since refcount_dec_and_test() already triggers a warning when we decrement
a ref count that has a value of 0 (or below zero).
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>
Diffstat (limited to 'tools/perf/scripts/python/exported-sql-viewer.py')
0 files changed, 0 insertions, 0 deletions
