]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
btrfs: remove redundant refcount check in btrfs_put_transaction()
authorXuanqiang Luo <luoxuanqiang@kylinos.cn>
Wed, 15 Oct 2025 07:05:21 +0000 (15:05 +0800)
committerDavid Sterba <dsterba@suse.com>
Mon, 24 Nov 2025 21:03:02 +0000 (22:03 +0100)
Eric Dumazet removed the redundant refcount check for sk_refcnt, I
noticed a similar issue in btrfs_put_transaction().
refcount_dec_and_test() already checks for a zero refcount and
complains, making the preceding WARN_ON redundant. This is a leftover
from the atomic_t times.

Signed-off-by: Xuanqiang Luo <luoxuanqiang@kylinos.cn>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/transaction.c

index 6607e354eae532a151a0bf615805fd4a84bb1250..907f2d047b448a7ea7460dd34d281f940259b02f 100644 (file)
@@ -138,7 +138,6 @@ static const unsigned int btrfs_blocked_trans_types[TRANS_STATE_MAX] = {
 
 void btrfs_put_transaction(struct btrfs_transaction *transaction)
 {
-       WARN_ON(refcount_read(&transaction->use_count) == 0);
        if (refcount_dec_and_test(&transaction->use_count)) {
                BUG_ON(!list_empty(&transaction->list));
                WARN_ON(!xa_empty(&transaction->delayed_refs.head_refs));