btrfs: remove the refcount warning/check at free_extent_map()
authorFilipe Manana <fdmanana@suse.com>
Mon, 19 Sep 2022 14:06:34 +0000 (15:06 +0100)
committerDavid Sterba <dsterba@suse.com>
Thu, 29 Sep 2022 15:08:30 +0000 (17:08 +0200)
At free_extent_map(), it's pointless to have a WARN_ON() to check if the
refcount of the extent map is zero. Such check is already done by the
refcount_t module and refcount_dec_and_test(), which loudly complains if
we try to decrement a reference count that is currently 0.

The WARN_ON() dates back to the time when used a regular atomic_t type
for the reference counter, before we switched to the refcount_t type.
The main goal of the refcount_t type/module is precisely to catch such
types of bugs and loudly complain if they happen.

Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/extent_map.c

index bef9cc8..2e6dc5a 100644 (file)
@@ -74,7 +74,6 @@ void free_extent_map(struct extent_map *em)
 {
        if (!em)
                return;
-       WARN_ON(refcount_read(&em->refs) == 0);
        if (refcount_dec_and_test(&em->refs)) {
                WARN_ON(extent_map_in_tree(em));
                WARN_ON(!list_empty(&em->list));